/* =========================================================
   VV-UI · piezas compartidas (se carga en TODAS las páginas desde header.php)
   ---------------------------------------------------------
   Referencia de estilo: el Atlas (/guias-indomitas/). Un solo lenguaje
   para Atlas, Buscador, Cuaderno y las fichas de los mapas:
   - .vv-hero / .vv-kicker / .vv-title   cabecera de página
   - .vv-btn                             cápsula (principal, fantasma, icono)
   - .vv-card                            tarjeta de misión (foto, etiqueta, meta, título, briefing, acciones)
   - .vv-pin / .vv-rpin                  pines de mapa (círculo con número / punto de ruta)
   - .vv-map-card                        ficha que sale en los mapas (popup o panel lateral)
   - .vv-panel                           panel/hoja sobre el mapa (lateral en PC, inferior en móvil)
   ========================================================= */

/* --- BARRAS DE SCROLL (todo el sitio): naranja venaviajera, no gris --- */
html { scrollbar-color: var(--color-primary) var(--color-surface); scrollbar-width: thin; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: var(--color-surface); }
*::-webkit-scrollbar-thumb { background: var(--color-primary); border-radius: 999px; border: 2px solid var(--color-surface); }
*::-webkit-scrollbar-thumb:hover { background: var(--color-primary-hover); }

/* --- Cabecera de página --- */
.vv-kicker { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-tactical); font-size: 0.72rem; letter-spacing: 3px; text-transform: uppercase; color: var(--color-primary); margin-bottom: 12px; }
.vv-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-primary); box-shadow: 0 0 0 4px rgba(255,94,20,0.2); animation: vv-blink 2s infinite; }
@keyframes vv-blink { 50% { box-shadow: 0 0 0 8px rgba(255,94,20,0); } }
.vv-title { font-family: var(--font-heading); font-size: clamp(2.8rem, 7vw, 5rem); line-height: 0.95; color: var(--color-text-primary); margin-bottom: 16px; text-shadow: 4px 4px 0 rgba(0,0,0,0.15); }
.vv-title span { color: var(--color-primary); }
.vv-sub { max-width: 640px; color: var(--color-text-secondary); font-size: 1.1rem; line-height: 1.65; }

/* --- Botón cápsula (el .ap-btn del Atlas) --- */
.vv-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    padding: 12px 18px; border-radius: 999px; border: 1px solid var(--color-primary);
    background: var(--color-primary); color: var(--color-text-inverted);
    font-family: var(--font-subheading); font-weight: 800; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 1px; line-height: 1;
    text-decoration: none; cursor: pointer; white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.vv-btn:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); }
.vv-btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 3px; }
.vv-btn--ghost { background: transparent; border-color: var(--color-border); color: var(--color-text-primary); }
.vv-btn--ghost:hover { background: transparent; border-color: var(--color-primary); color: var(--color-primary); }
.vv-btn--icon { width: 46px; height: 46px; padding: 0; flex: none; border-radius: 50%; font-size: 1rem; background: var(--color-background); border-color: var(--color-border); color: var(--color-text-primary); }
.vv-btn--icon:hover, .vv-btn--icon:focus-visible { background: var(--color-background); border-color: var(--color-primary); color: var(--color-primary); outline: none; }
.vv-btn--icon.added-active { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-text-inverted); }
.vv-btn--sm { padding: 9px 12px; font-size: 0.7rem; letter-spacing: 0.5px; gap: 6px; }
.vv-btn--block { width: 100%; }
.leaflet-container a.vv-btn { color: var(--color-text-inverted); }
.leaflet-container a.vv-btn--ghost { color: var(--color-text-primary); }

/* --- Etiqueta naranja recortada (sobre fotos) --- */
.vv-tag {
    display: inline-block; background-color: var(--color-primary); color: var(--color-text-inverted);
    font-family: var(--font-subheading); font-weight: 800; font-size: 0.7rem; letter-spacing: 1.5px; text-transform: uppercase;
    padding: 6px 10px; clip-path: var(--clip-tag-right); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* --- Tarjeta de misión (misma familia que las tarjetas del Atlas y del Cuaderno) --- */
.vv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 22px; }
.vv-card {
    position: relative; display: flex; flex-direction: column;
    background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); overflow: hidden;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.vv-card:hover, .vv-card.is-hot { transform: translateY(-4px); border-color: var(--color-primary); box-shadow: var(--shadow-lg); }
.vv-card__media { position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--color-border); }
.vv-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.5s ease; }
.vv-card:hover .vv-card__media img { transform: scale(1.05); }
.vv-card__media::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.6), transparent 55%); pointer-events: none; }
.vv-card__tag { position: absolute; left: 12px; bottom: 12px; z-index: 1; }
.vv-card__tag i { margin-right: 4px; }
.vv-card__save {
    position: absolute; top: 10px; right: 10px; z-index: 2; width: 40px; height: 40px; border-radius: 50%;
    background: rgba(20,24,28,0.7); border: 1px solid rgba(255,255,255,0.25); color: #fff; cursor: pointer; font-size: 0.95rem;
    display: inline-flex; align-items: center; justify-content: center; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.vv-card__save:hover, .vv-card__save:focus-visible { border-color: var(--color-primary); color: var(--color-primary); outline: none; }
.vv-card__save.added-active { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-text-inverted); }
.vv-card__body { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px 18px; flex: 1; }
.vv-card__meta { margin: 0; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-family: var(--font-tactical); font-size: 0.62rem; letter-spacing: 1px; text-transform: uppercase; color: var(--color-text-secondary); }
.vv-card__meta i { color: var(--color-primary); margin-right: 2px; }
.vv-card__cat { color: var(--color-primary); font-weight: 700; }
.vv-card__title { margin: 0; font-family: var(--font-subheading); font-weight: 800; font-size: 1.2rem; line-height: 1.2; text-transform: none; }
.vv-card__title a { color: var(--color-text-primary); text-decoration: none; }
.vv-card__title a:hover { color: var(--color-primary); }
.vv-card__title a:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; border-radius: 4px; }
.vv-card__desc { margin: 0; color: var(--color-text-secondary); font-size: 0.9rem; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.vv-card__foot { display: flex; align-items: center; gap: 10px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--color-border); }
.vv-card__foot .vv-btn { flex: 1 1 auto; min-width: 0; }
.vv-card__foot .vv-btn--ghost { flex: 0 0 auto; }
@media (max-width: 1023px) {
    .vv-grid { grid-template-columns: 1fr; gap: 14px; }
    .vv-card { border-radius: 16px; }
    .vv-card__desc { -webkit-line-clamp: 2; }
    .vv-card__save { width: 44px; height: 44px; }
}

/* --- Pines de mapa (los del Atlas) --- */
.vv-pin-wrap, .vv-rpin-wrap { background: transparent; border: none; }
.vv-pin {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--color-primary); color: #fff; border: 3px solid #fff;
    box-shadow: 0 6px 16px rgba(0,0,0,0.35), 0 0 0 6px rgba(255,94,20,0.18);
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    font-family: var(--font-subheading); font-weight: 800; font-size: 0.95rem; line-height: 1;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
.vv-pin-wrap:hover .vv-pin, .vv-pin-wrap.is-active .vv-pin { transform: translate(-50%, -50%) scale(1.15); box-shadow: 0 8px 20px rgba(0,0,0,0.4), 0 0 0 10px rgba(255,94,20,0.25); }
.vv-pin-wrap.is-active .vv-pin { background: var(--color-primary-hover); border-color: #FFC300; }
.vv-pin--sm { width: 28px; height: 28px; border-width: 2px; font-size: 0.75rem; box-shadow: 0 4px 12px rgba(0,0,0,0.4), 0 0 0 5px rgba(255,94,20,0.2); }
.vv-rpin {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--color-primary); border: 2px solid #fff;
    box-shadow: 0 3px 8px rgba(0,0,0,0.4), 0 0 0 4px rgba(255,94,20,0.2);
    cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.vv-rpin-wrap:hover .vv-rpin { transform: translate(-50%, -50%) scale(1.3); box-shadow: 0 4px 10px rgba(0,0,0,0.45), 0 0 0 7px rgba(255,94,20,0.25); }
.vv-pin__label, .vv-rpin__label {
    position: absolute; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; pointer-events: none;
    font-family: var(--font-subheading); font-weight: 700; font-size: 0.7rem;
    color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.9), 0 0 8px rgba(0,0,0,0.7);
    opacity: 0; transition: opacity 0.2s ease;
}
.vv-pin__label { left: 50%; top: calc(50% + 24px); transform: translateX(-50%); letter-spacing: 0.5px; text-transform: uppercase; }
.vv-pin-wrap .vv-pin--sm ~ .vv-pin__label { top: calc(50% + 18px); text-transform: none; }
.vv-rpin__label { left: calc(50% + 12px); top: 50%; transform: translateY(-50%); }
body.light-theme .vv-pin__label, body.light-theme .vv-rpin__label { color: #1c2024; text-shadow: 0 1px 3px rgba(255,255,255,0.95), 0 0 8px rgba(255,255,255,0.9); }
.vv-pin-wrap:hover .vv-pin__label, .vv-pin-wrap.is-active .vv-pin__label, .show-labels .vv-pin__label,
.vv-rpin-wrap:hover .vv-rpin__label, .show-rlabels .vv-rpin__label { opacity: 1; }

/* --- Controles de Leaflet con la piel del sitio (todos los mapas) --- */
.leaflet-container .leaflet-control-zoom { border: 1px solid var(--color-border); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow-md); }
.leaflet-container .leaflet-control-zoom a { background: var(--color-background); color: var(--color-text-primary); border-bottom-color: var(--color-border); width: 36px; height: 36px; line-height: 36px; }
.leaflet-container .leaflet-control-zoom a:hover { color: var(--color-primary); }
.leaflet-container .leaflet-control-attribution { background: rgba(0,0,0,0.35); color: #cbd2d9; font-size: 10px; }
.leaflet-container .leaflet-control-attribution a { color: #fff; }
body.light-theme .leaflet-container .leaflet-control-attribution { background: rgba(255,255,255,0.7); color: #444; }
body.light-theme .leaflet-container .leaflet-control-attribution a { color: #222; }

/* --- Ficha de mapa (la tarjeta de ruta del Atlas, compacta para popups) --- */
.vv-map-card { display: flex; flex-direction: column; background: var(--color-background); color: var(--color-text-primary); text-align: left; }
.vv-map-card__cover { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; background: var(--color-surface); }
.vv-map-card__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vv-map-card__cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, var(--color-background), transparent 60%); pointer-events: none; }
.vv-map-card__tag { position: absolute; left: 12px; bottom: 10px; z-index: 1; font-size: 0.62rem; padding: 5px 8px; }
.vv-map-card__body { padding: 8px 14px 14px; }
.vv-map-card__title { margin: 0; font-family: var(--font-subheading); font-weight: 800; font-size: 0.98rem; line-height: 1.25; text-transform: none; color: var(--color-text-primary); }
.vv-map-card__meta { margin: 4px 0 0; font-size: 0.74rem; color: var(--color-text-secondary); }
.vv-map-card__desc { margin: 8px 0 0; font-size: 0.8rem; color: var(--color-text-primary); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.vv-map-card__actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.vv-map-card__actions .vv-btn { flex: 1; padding: 10px 14px; font-size: 0.72rem; }
.vv-map-card__actions .vv-btn--icon { flex: none; width: 40px; height: 40px; }
.vv-popup .leaflet-popup-content-wrapper { padding: 0 !important; background: var(--color-background) !important; color: var(--color-text-primary); border: 1px solid var(--color-border); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-lg); }
.vv-popup .leaflet-popup-content { margin: 0 !important; padding: 0 !important; width: 260px !important; line-height: inherit; }
.vv-popup .leaflet-popup-tip { background: var(--color-background); }
.vv-popup .leaflet-popup-close-button { z-index: 3; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.8); font-size: 18px; padding: 8px 10px 0 0; }

/* --- Panel sobre el mapa (lateral en PC, hoja inferior con asa en móvil) --- */
.vv-panel {
    position: absolute; z-index: 6; display: flex; flex-direction: column;
    background: var(--color-background); border: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg); overflow: hidden;
    opacity: 0; transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}
.vv-panel[hidden] { display: none; }
.vv-panel.is-open { opacity: 1; transform: none; }
@media (min-width: 768px) { .vv-panel { top: 14px; bottom: 14px; width: 380px; border-radius: 14px; } .vv-panel--left { left: 14px; transform: translateX(-24px); } .vv-panel--right { right: 66px; transform: translateX(24px); } }
@media (max-width: 767px) {
    .vv-panel { left: 0; right: 0; bottom: 0; max-height: 64%; border-radius: 18px 18px 0 0; border-bottom: none; transform: translateY(30px); box-shadow: 0 -12px 40px rgba(0,0,0,0.4); }
    .vv-panel::before { content: ''; position: absolute; top: 8px; left: 50%; width: 40px; height: 4px; border-radius: 999px; background: rgba(255,255,255,0.6); transform: translateX(-50%); z-index: 3; }
}
