/* ============================================ */
/* DISCOVERY.CSS - TEMA BLANCO BRAND KIT CRY     */
/* Sistema tipográfico: RBNo3.1 + Montserrat     */
/* Paleta: Greenery Los Agaves (#8fb949)         */
/* ============================================ */

/* CSS Variables - Brand Kit CRY + Tema Blanco Luminoso */
:root {
    /* Colores del brand kit - Los Agaves (Greenery) */
    --color-accent: #8fb949;          /* Greenery - color principal zona Cd. Obregón */
    --color-accent-light: #a8d662;     /* Greenery claro */
    --color-accent-dark: #5a8246;      /* Greenery oscuro */
    --color-accent-deep: #2d4a2e;      /* Verde profundo agave */
    --color-accent-glow: rgba(143, 185, 73, 0.5);
    --color-accent-soft: rgba(143, 185, 73, 0.15);

    /* Paleta neutra - TEMA BLANCO (regla 60/25/10/5) */
    --color-warm-white: #FFFFFF;       /* Fondos principales - más brillante */
    --color-cream: #FAFBF7;            /* Fondos secundarios con tinte cálido */
    --color-mist-gray: #E2E8F0;        /* Bordes, divisores */
    --color-text: #1E293B;             /* Dark Slate - texto principal */
    --color-text-muted: #64748B;       /* Texto secundario */
    --color-text-dim: #94A3B8;         /* Texto terciario */
    --color-text-inverse: #ffffff;      /* Texto sobre fondos oscuros */

    /* Backgrounds premium */
    --color-bg-page: #F5F7F2;          /* Fondo principal de página (verde muy claro) */
    --color-bg-card: #FFFFFF;          /* Fondo de cards */
    --color-bg-elevated: #FFFFFF;      /* Cards elevados */
    --color-bg-glass: rgba(255, 255, 255, 0.85);

    /* Categorías de POIs */
    --cat-compras: #f59e0b;
    --cat-educacion: #3b82f6;
    --cat-salud: #ef4444;
    --cat-gasolinera: #10b981;
    --cat-banco: #1e40af;
    --cat-restaurante: #f97316;
    --cat-recreacion: #22c55e;

    /* Tipografía oficial brand kit CRY */
    --font-display: 'RBNo3.1', Georgia, serif;
    --font-body: 'Montserrat', -apple-system, sans-serif;

    /* Sombras cinematográficas */
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-elevated: 0 8px 32px rgba(0, 0, 0, 0.12);
    --shadow-dramatic: 0 20px 60px rgba(0, 0, 0, 0.18);
    --shadow-glow: 0 0 30px var(--color-accent-glow);

    /* Transiciones */
    --ease-cinematic: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-body);
    background: #FFFFFF;
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}

button {
    font-family: var(--font-body);
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
    -webkit-tap-highlight-color: transparent;
}

input {
    font-family: var(--font-body);
    border: none;
    outline: none;
    background: none;
    color: inherit;
}

h1, h2, h3, h4, h5, h6, .display-font {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--color-text);
}

/* ============================================ */
/* CINEMATIC LOADER - TEMA BLANCO                */
/* ============================================ */
#cinematic-loader {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #FFFFFF 0%, #F0F7E8 50%, #E0F0D0 100%);
    transition: opacity 0.8s var(--ease-cinematic), visibility 0.8s;
}

#cinematic-loader.loader-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-backdrop {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 30% 30%, rgba(143, 185, 73, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 70% 70%, rgba(168, 214, 98, 0.15) 0%, transparent 50%);
    animation: loader-pulse 4s ease-in-out infinite;
}

@keyframes loader-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.loader-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
}

.loader-logo {
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    height: auto;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.loader-isotipo {
    height: 110px;
    width: auto;
    filter: drop-shadow(0 8px 24px rgba(143, 185, 73, 0.4));
    animation: logo-float 3s ease-in-out infinite;
}

@keyframes logo-float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-8px) rotate(-2deg); }
}

.loader-fallback {
    width: 160px;
    height: 160px;
}

.logo-circle-1, .logo-circle-2 {
    stroke: #8fb949;
    fill: none;
    stroke-width: 2;
}

.logo-circle-1 {
    stroke-dasharray: 502;
    stroke-dashoffset: 502;
    animation: draw-circle-1 2.5s ease-out forwards;
}

.logo-circle-2 {
    stroke-dasharray: 377;
    stroke-dashoffset: 377;
    animation: draw-circle-2 2.5s ease-out 0.3s forwards;
}

.logo-letter {
    fill: #5a8246 !important;
    font-family: 'RBNo3.1', sans-serif !important;
    animation: fade-letter 0.8s ease-out 1.5s backwards;
}

@keyframes draw-circle-1 { to { stroke-dashoffset: 0; } }
@keyframes draw-circle-2 { to { stroke-dashoffset: 0; } }
@keyframes fade-letter { from { opacity: 0; } to { opacity: 1; } }

.loader-title {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    margin: 0.75rem 0;
    line-height: 1.2;
    color: var(--color-text);
    text-align: center;
}

.title-line {
    display: inline-block;
    background: linear-gradient(135deg, #5a8246 0%, #8fb949 50%, #2d4a2e 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: #5a8246;
    opacity: 0;
    transform: translateY(20px);
    animation: title-reveal 0.8s var(--ease-cinematic) forwards;
}

.title-1 { animation-delay: 1.8s; }
.title-2 { animation-delay: 2.0s; font-size: 1.3em; }

@keyframes title-reveal {
    to { opacity: 1; transform: translateY(0); }
}

.loader-subtitle {
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--color-text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    opacity: 0;
    animation: fade-in 0.6s ease-out 2.4s forwards;
    font-weight: 500;
}

.loader-brand {
    font-family: var(--font-display);
    font-size: 0.78rem;
    color: var(--color-accent-dark);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-top: 1.5rem;
    opacity: 0;
    animation: fade-in 0.6s ease-out 2.8s forwards;
    font-weight: 700;
}

.loader-logo-cry {
    height: 36px;
    width: auto;
    margin-top: 1.2rem;
    opacity: 0;
    animation: fade-in 0.6s ease-out 3.0s forwards;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.08));
}

/* Logotipo CRY original en brand bar */
.brand-logo-cry {
    height: 38px;
    width: auto;
    margin-left: 1rem;
    padding-left: 1rem;
    border-left: 1px solid var(--color-mist-gray);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.06));
    transition: transform 0.3s var(--ease-smooth);
}
.brand-logo-cry:hover { transform: scale(1.04); }

@keyframes fade-in { to { opacity: 1; } }

.loader-progress {
    width: 280px;
    height: 3px;
    background: rgba(143, 185, 73, 0.2);
    border-radius: 3px;
    margin: 0 auto 1rem;
    overflow: hidden;
    opacity: 0;
    animation: fade-in 0.6s ease-out 2.6s forwards;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #a8d662 0%, #8fb949 50%, #5a8246 100%);
    border-radius: 3px;
    box-shadow: 0 0 12px var(--color-accent-glow);
    transition: width 0.3s var(--ease-smooth);
}

.loader-percentage {
    font-family: 'Montserrat', monospace;
    font-size: 0.85rem;
    color: var(--color-accent-dark);
    letter-spacing: 0.2em;
    opacity: 0;
    animation: fade-in 0.6s ease-out 2.6s forwards;
    font-weight: 600;
}

/* ============================================ */
/* APP CONTAINER                                  */
/* ============================================ */
#app {
    position: relative;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: 1fr 400px;
    grid-template-rows: 76px 1fr;
    grid-template-areas:
        "header header"
        "map sidebar";
    opacity: 1;
    transition: opacity 0.6s var(--ease-cinematic);
    background: var(--color-bg-page);
}

#app.app-hidden {
    opacity: 0;
}

/* ============================================ */
/* BRAND BAR (HEADER) - TEMA BLANCO               */
/* ============================================ */
.brand-bar {
    grid-area: header;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(143, 185, 73, 0.15);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(143, 185, 73, 0.06);
    z-index: 100;
    position: relative;
}

.brand-bar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, #8fb949 50%, transparent 100%);
}

.brand-left {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex: 0 0 auto;
}

.brand-logo-mini {
    width: auto;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Texto "LOS AGAVES" en loader cinematográfico — CRY oficial */
.loader-name-los-agaves {
    font-family: 'RBNo3.1', Georgia, serif;
    font-weight: 900;
    font-size: 56px;
    color: #1E293B;
    letter-spacing: 4px;
    text-align: center;
    text-transform: uppercase;
    margin: 1rem 0 0.5rem;
    line-height: 1;
    text-shadow: 0 2px 8px rgba(143, 185, 73, 0.15);
}

/* Texto "LOS AGAVES" en header (RBNo3.1) — CRY oficial */
.brand-name-los-agaves {
    font-family: 'RBNo3.1', Georgia, serif;
    font-weight: 900;
    font-size: 22px;
    color: #1E293B;
    letter-spacing: 2px;
    text-transform: uppercase;
    white-space: nowrap;
}

/* Texto "LOS AGAVES" en modal Street View */
#modal-isotipo-container .brand-name-los-agaves {
    font-size: 22px;
    letter-spacing: 2px;
}

.brand-bar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, #8fb949 50%, transparent 100%);
}

.brand-left {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex: 0 0 auto;
}

.brand-logo-mini {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 4px 12px rgba(143, 185, 73, 0.3));
    flex-shrink: 0;
    transition: transform 0.3s var(--ease-bounce);
}

.brand-logo-mini:hover {
    transform: scale(1.08) rotate(-3deg);
}

.brand-isotipo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-letter {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 900;
    color: var(--color-accent-dark);
    letter-spacing: 0.05em;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand-name {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    color: var(--color-accent-dark);
    white-space: nowrap;
}

.brand-tagline {
    font-family: var(--font-body);
    font-size: 0.68rem;
    color: var(--color-text-muted);
    letter-spacing: 0.05em;
    font-weight: 500;
    white-space: nowrap;
    margin-top: 2px;
}

.brand-center {
    text-align: center;
    flex: 1;
    min-width: 0;
    padding: 0 1.5rem;
}

.page-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--color-text);
    letter-spacing: 0.01em;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: linear-gradient(135deg, #1E293B 0%, #5a8246 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.page-subtitle {
    font-family: 'Montserrat', monospace;
    font-size: 0.7rem;
    color: var(--color-accent-dark);
    margin: 3px 0 0;
    letter-spacing: 0.05em;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-right {
    display: flex;
    gap: 0.5rem;
    flex: 0 0 auto;
}

.header-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    color: var(--color-text-muted);
    background: var(--color-cream);
    border: 1px solid var(--color-mist-gray);
    transition: all 0.2s var(--ease-smooth);
    flex-shrink: 0;
}

.header-btn:hover {
    color: var(--color-accent-dark);
    background: var(--color-accent-soft);
    border-color: var(--color-accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(143, 185, 73, 0.25);
}

/* ============================================ */
/* MAP WRAPPER                                    */
/* ============================================ */
.map-wrapper {
    grid-area: map;
    position: relative;
    overflow: hidden;
    background: #E8F0DC;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

#map {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: #E8F0DC;
}

.leaflet-control-attribution {
    background: rgba(255, 255, 255, 0.92) !important;
    color: var(--color-text-muted) !important;
    backdrop-filter: blur(10px);
    border: 1px solid var(--color-mist-gray) !important;
    border-radius: 8px !important;
    padding: 4px 10px !important;
    font-size: 10px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
}

.leaflet-control-attribution a {
    color: var(--color-accent-dark) !important;
    font-weight: 600;
}

.leaflet-control-zoom {
    display: none !important;
}

/* ============================================ */
/* FLOATING CONTROLS - TEMA BLANCO                */
/* ============================================ */
.floating-controls {
    position: absolute;
    bottom: 24px;
    left: 24px;
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.control-btn {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: var(--color-warm-white);
    border: 1px solid var(--color-mist-gray);
    color: var(--color-text);
    transition: all 0.25s var(--ease-smooth);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}

.control-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--color-accent-soft) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.25s;
}

.control-btn:hover {
    transform: translateY(-3px);
    border-color: var(--color-accent);
    box-shadow: 0 8px 24px rgba(143, 185, 73, 0.25), 0 0 0 3px rgba(143, 185, 73, 0.1);
}

.control-btn:hover::before {
    opacity: 1;
}

.control-btn:active {
    transform: translateY(0);
}

.control-primary {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #8fb949 0%, #5a8246 100%);
    color: white;
    border: none;
    box-shadow: 0 8px 24px rgba(143, 185, 73, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
    flex-direction: column;
    gap: 2px;
    font-family: var(--font-display);
}

.control-primary:hover {
    background: linear-gradient(135deg, #a8d662 0%, #8fb949 100%);
    box-shadow: 0 12px 32px rgba(143, 185, 73, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.3) inset;
    transform: translateY(-3px) scale(1.05);
}

.control-primary.tour-active {
    background: linear-gradient(135deg, #ef4444 0%, #991b1b 100%);
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4);
    animation: pulse-tour 2s ease-in-out infinite;
}

@keyframes pulse-tour {
    0%, 100% { box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 8px 24px rgba(239, 68, 68, 0.7), 0 0 0 8px rgba(239, 68, 68, 0.2); }
}

.control-label {
    font-family: var(--font-display);
    font-size: 0.65rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.control-group {
    position: relative;
}

.layers-menu {
    position: absolute;
    bottom: 60px;
    left: 0;
    background: var(--color-warm-white);
    border: 1px solid var(--color-mist-gray);
    border-radius: 12px;
    padding: 0.4rem;
    min-width: 150px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 51;
}

.layer-option {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text);
    transition: all 0.2s;
    text-align: left;
}

.layer-option:hover {
    background: var(--color-cream);
}

.layer-option.active {
    background: var(--color-accent-soft);
    color: var(--color-accent-dark);
    font-weight: 600;
}

.layer-swatch {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid var(--color-mist-gray);
}

.layer-swatch.dark { background: #1a2420; }
.layer-swatch.light { background: #E2E8F0; }
.layer-swatch.satellite { background: linear-gradient(135deg, #2d4a2b 0%, #1a3a1a 100%); }

/* ============================================ */
/* TOUR PROGRESS BAR                              */
/* ============================================ */
.tour-progress {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: min(520px, calc(100% - 32px));
    background: var(--color-warm-white);
    border: 1px solid var(--color-accent);
    border-radius: 100px;
    padding: 10px 18px;
    z-index: 50;
    box-shadow: 0 8px 24px rgba(143, 185, 73, 0.25);
    overflow: hidden;
}

.tour-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--color-accent-soft) 0%, var(--color-accent-soft) 100%);
    transition: width 0.5s var(--ease-smooth);
    z-index: 0;
}

.tour-progress-text {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    gap: 1rem;
}

.tour-step-name {
    font-family: var(--font-body);
    color: var(--color-text);
    font-weight: 600;
    letter-spacing: 0.02em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.tour-step-counter {
    color: var(--color-accent-dark);
    font-family: 'Montserrat', monospace;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
    background: var(--color-accent-soft);
    padding: 2px 10px;
    border-radius: 100px;
}

/* ============================================ */
/* MAP COMPASS - TEMA BLANCO                      */
/* ============================================ */
.map-compass {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 40;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
    animation: compass-float 6s ease-in-out infinite;
}

@keyframes compass-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* ============================================ */
/* LEAFLET POPUP STYLES                           */
/* ============================================ */
.leaflet-popup-content-wrapper {
    background: var(--color-warm-white) !important;
    border: 1px solid var(--color-accent) !important;
    border-radius: 16px !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18) !important;
    color: var(--color-text) !important;
    padding: 0 !important;
    font-family: var(--font-body);
}

.leaflet-popup-content {
    margin: 0 !important;
    padding: 0 !important;
    min-width: 250px;
}

.leaflet-popup-tip {
    background: var(--color-warm-white) !important;
    border: 1px solid var(--color-accent) !important;
}

.leaflet-popup-close-button {
    color: var(--color-text-muted) !important;
    font-size: 22px !important;
    padding: 8px 10px 0 0 !important;
}

.leaflet-popup-close-button:hover {
    color: var(--color-accent-dark) !important;
}

.popup-body { padding: 1.1rem 1.2rem; }

.popup-header {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 0.85rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--color-mist-gray);
}

.popup-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.popup-title-group { flex: 1; min-width: 0; }

.popup-name {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
    line-height: 1.2;
}

.popup-category {
    font-family: var(--font-body);
    font-size: 0.7rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
    font-weight: 500;
}

.popup-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
}

.popup-stat {
    background: var(--color-cream);
    border: 1px solid var(--color-mist-gray);
    border-radius: 8px;
    padding: 0.55rem 0.65rem;
}

.popup-stat-label {
    font-family: var(--font-body);
    font-size: 0.65rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.popup-stat-value {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-accent-dark);
    font-family: 'Montserrat', monospace;
}

.popup-actions {
    display: flex;
    gap: 0.4rem;
}

.popup-btn {
    flex: 1;
    padding: 0.55rem;
    background: var(--color-accent-soft);
    color: var(--color-accent-dark);
    border: 1px solid var(--color-accent);
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s;
}

.popup-btn:hover {
    background: var(--color-accent);
    color: white;
    transform: translateY(-1px);
}

/* Marker Cluster Custom */
.marker-cluster-custom {
    background: var(--color-warm-white) !important;
    border: 3px solid var(--color-accent) !important;
    color: var(--color-accent-dark) !important;
    font-family: 'Montserrat', sans-serif !important;
    font-weight: 700 !important;
    box-shadow: 0 0 0 4px rgba(143, 185, 73, 0.2), 0 8px 24px rgba(143, 185, 73, 0.3) !important;
}

.marker-cluster-custom div {
    background: linear-gradient(135deg, #8fb949 0%, #5a8246 100%) !important;
    color: white !important;
    font-weight: 800 !important;
}

/* ============================================ */
/* MODAL OVERLAY                                  */
/* ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: fade-in 0.3s var(--ease-cinematic);
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 18, 0.65);
    backdrop-filter: blur(12px);
}

.modal-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1100px;
    height: 100%;
    max-height: 80vh;
    background: var(--color-warm-white);
    border: 1px solid var(--color-mist-gray);
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
    animation: modal-zoom-in 0.4s var(--ease-cinematic);
}

@keyframes modal-zoom-in {
    from { opacity: 0; transform: scale(0.95) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--color-cream);
    border-bottom: 1px solid var(--color-mist-gray);
}

.modal-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-logo {
    height: 32px;
    width: auto;
    filter: drop-shadow(0 2px 6px rgba(143, 185, 73, 0.3));
}

.modal-header h3 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: var(--color-text-muted);
    background: var(--color-warm-white);
    border: 1px solid var(--color-mist-gray);
    transition: all 0.2s;
}

.modal-close:hover {
    color: var(--color-text);
    background: var(--color-cream);
    transform: rotate(90deg);
}

.modal-body {
    flex: 1;
    position: relative;
    background: #000;
}

.modal-body iframe {
    width: 100%;
    height: 100%;
}

.streetview-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    color: var(--color-text-muted);
    font-family: var(--font-body);
    background: var(--color-cream);
}

.streetview-fallback svg {
    color: var(--color-accent);
    opacity: 0.6;
    margin-bottom: 1.5rem;
}

.streetview-fallback h4 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--color-text);
    margin-bottom: 1rem;
    font-weight: 700;
}

.streetview-fallback p {
    max-width: 480px;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.streetview-fallback ol {
    text-align: left;
    max-width: 500px;
    line-height: 1.8;
}

.streetview-fallback code {
    background: var(--color-accent-soft);
    color: var(--color-accent-dark);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Montserrat', monospace;
    font-size: 0.85rem;
}

.streetview-fallback a {
    color: var(--color-accent-dark);
    text-decoration: none;
    font-weight: 600;
}

.streetview-fallback a:hover {
    text-decoration: underline;
}

/* ============================================ */
/* TOAST NOTIFICATIONS                            */
/* ============================================ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    top: auto;
    z-index: 8000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
    max-width: calc(100vw - 48px);
}

.toast {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(143, 185, 73, 0.3);
    border-left: 4px solid var(--color-accent);
    color: var(--color-text);
    padding: 0.85rem 1.1rem;
    border-radius: 14px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    min-width: 280px;
    max-width: 360px;
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.08),
        0 12px 32px rgba(0, 0, 0, 0.12),
        0 0 0 0.5px rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    pointer-events: auto;
    transform-origin: right center;
    animation: toast-slide-3d 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.toast-exit {
    animation: toast-slide-3d-out 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toast-slide-3d {
    from { transform: perspective(600px) rotateX(-30deg) translateX(80%); opacity: 0; }
    to { transform: perspective(600px) rotateX(0deg) translateX(0); opacity: 1; }
}

@keyframes toast-slide-3d-out {
    to { transform: perspective(600px) rotateX(-20deg) translateX(120%); opacity: 0; }
}

.toast-icon {
    width: 22px;
    height: 22px;
    color: var(--color-accent-dark);
    flex-shrink: 0;
}

/* ============================================ */
/* RESPONSIVE - TABLET                            */
/* ============================================ */
/* RESPONSIVE - TABLET PORTRAIT                   */
/* ============================================ */
@media (max-width: 1024px) {
    #app {
        grid-template-columns: 1fr 340px;
    }

    .page-title {
        font-size: 1.25rem;
    }

    .brand-bar {
        padding: 0 1rem;
        gap: 0.5rem;
    }

    .brand-logo-cry {
        height: 32px;
        margin-left: 0.5rem;
        padding-left: 0.5rem;
    }

    .brand-name {
        font-size: 1rem;
    }
}

/* Story panel responsive - tablet */
@media (max-width: 1024px) and (min-width: 769px) {
    .story-panel {
        right: 16px;
        width: 340px;
        max-height: 72vh;
        padding: 1.5rem 1.5rem 1.25rem 1.5rem;
        border-radius: 20px;
    }

    .story-chapter-title {
        font-size: 1.65rem;
    }

    .story-poi-logo,
    .story-poi-logo-fallback {
        width: 64px;
        height: 64px;
    }
}

/* POI detail - tablet */
@media (max-width: 1024px) and (min-width: 769px) {
    .poi-detail {
        width: 360px;
        max-width: calc(100vw - 32px);
    }

    .detail-content {
        padding: 1.5rem;
    }

    .detail-hero {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .detail-hero-icon {
        width: 80px;
        height: 80px;
    }
}

/* ============================================ */
/* RESPONSIVE - MÓVIL                             */
/* ============================================ */
@media (max-width: 768px) {
    #app {
        grid-template-columns: 1fr;
        grid-template-rows: 64px 1fr;
        grid-template-areas:
            "header"
            "map";
    }

    .brand-bar {
        padding: 0 0.85rem;
        gap: 0.5rem;
    }

    .brand-text {
        display: none;
    }

    .brand-center {
        text-align: left;
        flex: 1;
        min-width: 0;
    }

    .page-title {
        font-size: 0.95rem;
    }

    .page-subtitle {
        font-size: 0.62rem;
        margin-top: 1px;
    }

    .header-btn {
        width: 36px;
        height: 36px;
    }

    .sidebar {
        position: fixed !important;
        top: 64px !important;
        right: 0 !important;
        bottom: 0 !important;
        left: auto !important;
        width: 100% !important;
        max-width: 360px !important;
        height: calc(100vh - 64px) !important;
        height: calc(100dvh - 64px) !important;
        z-index: 200 !important;
        transform: translateX(100%) !important;
        transition: transform 0.4s var(--ease-cinematic) !important;
        box-shadow: -10px 0 40px rgba(0, 0, 0, 0.2);
    }

    .sidebar.open {
        transform: translateX(0) !important;
    }

    .sidebar-floating-toggle {
        display: flex !important;
        position: fixed !important;
        top: 50% !important;
        right: 0 !important;
        transform: translateY(-50%) !important;
        background: linear-gradient(135deg, #8fb949 0%, #5a8246 100%) !important;
        color: white !important;
        padding: 0.85rem 0.6rem !important;
        border-radius: 12px 0 0 12px !important;
        font-family: var(--font-display);
        font-size: 0.7rem !important;
        font-weight: 700 !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 0.4rem !important;
        z-index: 150 !important;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.2) !important;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }

    .sidebar-floating-toggle:hover {
        padding-right: 0.85rem !important;
    }

    .sidebar-floating-toggle svg {
        width: 18px !important;
        height: 18px !important;
    }

    .floating-controls {
        bottom: 16px;
        left: 16px;
    }

    .control-btn {
        width: 44px;
        height: 44px;
    }

    .control-primary {
        width: 52px;
        height: 52px;
    }

    .tour-progress {
        top: 12px;
        width: calc(100% - 24px);
        padding: 6px 12px;
    }

    .map-compass {
        top: 12px;
        right: 12px;
    }

    .toast-container {
        bottom: 84px;
        right: 12px;
        left: 12px;
        top: auto;
        align-items: center;
    }

    .toast {
        max-width: 100%;
        min-width: 0;
    }

    .poi-detail {
        max-width: 100% !important;
        width: 100% !important;
    }

    .modal-overlay {
        padding: 0;
    }

    .modal-container {
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
    }

    /* Loader escala mobile */
    .loader-isotipo {
        height: 80px;
    }

    .loader-name-los-agaves {
        font-size: 36px;
    }

    .loader-title {
        font-size: 1.5rem;
    }

    .loader-subtitle {
        font-size: 0.78rem;
        letter-spacing: 0.05em;
    }
}

/* ============================================ */
/* RESPONSIVE - MÓVIL PEQUEÑO (≤480px)            */
/* ============================================ */
@media (max-width: 480px) {
    .brand-logo-cry { display: none; }

    .page-title {
        font-size: 0.85rem;
    }

    .page-subtitle {
        font-size: 0.58rem;
    }

    .header-btn {
        width: 32px;
        height: 32px;
    }

    .sidebar {
        max-width: 100vw !important;
        width: 100vw !important;
    }

    .control-btn {
        width: 40px;
        height: 40px;
    }

    .control-primary {
        width: 48px;
        height: 48px;
    }

    .control-label {
        display: none;
    }

    .floating-controls {
        bottom: 12px;
        left: 12px;
        gap: 0.4rem;
    }

    .tour-progress {
        padding: 5px 10px;
    }

    .tour-step-name {
        font-size: 0.7rem;
    }

    .tour-step-counter {
        font-size: 0.65rem;
        padding: 1px 8px;
    }

    .loader-name-los-agaves {
        font-size: 28px;
        letter-spacing: 2px;
    }

    .loader-title {
        font-size: 1.25rem;
    }

    .loader-subtitle {
        font-size: 0.7rem;
    }

    .loader-logo-cry {
        height: 28px;
    }

    /* Story panel en mobile pequeño */
    .story-panel {
        right: 8px;
        left: 8px;
        bottom: 8px;
        padding: 1rem;
        border-radius: 16px;
        max-height: 55vh;
    }

    .story-chapter-tag {
        font-size: 0.6rem;
        padding: 3px 8px;
    }

    .story-chapter-title {
        font-size: 1.25rem;
        margin-bottom: 0.5rem;
    }

    .story-chapter-intro {
        font-size: 0.9rem;
    }

    .story-poi-name {
        font-size: 1rem;
    }

    .story-poi-distance {
        font-size: 0.75rem;
        padding: 3px 8px;
    }

    .story-poi-narrative {
        font-size: 0.9rem;
    }

    .story-cta-phone {
        font-size: 1.15rem;
    }

    .story-progress-meta {
        font-size: 0.7rem;
        flex-wrap: wrap;
    }

    /* Modal en mobile pequeño */
    .modal-header {
        padding: 0.75rem 1rem;
    }

    .modal-close {
        width: 44px;
        height: 44px;
    }
}

/* ============================================ */
/* RESPONSIVE - MÓVIL LANDSCAPE                    */
/* ============================================ */
@media (max-height: 500px) and (orientation: landscape) {
    .brand-bar {
        padding: 0 0.85rem;
    }

    .page-subtitle {
        display: none;
    }

    .page-title {
        font-size: 0.85rem;
    }

    .floating-controls {
        bottom: 8px;
        left: 8px;
    }

    .tour-progress {
        top: 8px;
        padding: 4px 10px;
    }

    /* Story panel en landscape = bottom sheet compacto */
    .story-panel {
        top: auto;
        bottom: 8px;
        right: 8px;
        left: 8px;
        transform: none;
        width: auto;
        max-height: 45vh;
        padding: 1rem;
        border-radius: 16px;
    }

    @keyframes story-panel-in {
        from { opacity: 0; transform: translateY(40px); }
        to { opacity: 1; transform: translateY(0); }
    }

    .story-chapter-title {
        font-size: 1.3rem;
    }

    .map-compass {
        top: 8px;
        right: 8px;
        transform: scale(0.7);
    }
}

/* ============================================ */
/* TABLET LANDSCAPE - ajustar story panel          */
/* ============================================ */
@media (min-width: 1024px) and (max-height: 700px) and (orientation: landscape) {
    .story-panel {
        max-height: 65vh;
    }
}

/* ============================================ */
/* SCROLLBAR CUSTOM                               */
/* ============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-cream);
}

::-webkit-scrollbar-thumb {
    background: var(--color-accent);
    border-radius: 4px;
    border: 2px solid var(--color-cream);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-accent-dark);
}

/* ============================================ */
/* FEATURED BADGE - FIX "Cargando..." FLASH       */
/* ============================================ */
.featured-badge-empty {
    opacity: 0;
    transition: opacity 0.25s var(--ease-smooth);
}
.featured-badge:not(.featured-badge-empty) {
    opacity: 1;
}

/* ============================================ */
/* STORY PANEL - TOUR STORYTELLING                */
/* Panel lateral derecho semi-transparente       */
/* Capítulos narrativos para compradores         */
/* ============================================ */
.story-panel {
    position: absolute;
    top: 50%;
    right: 24px;
    transform: translateY(-50%);
    width: 400px;
    max-width: calc(100vw - 48px);
    max-height: 80vh;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(143, 185, 73, 0.35);
    border-radius: 24px;
    padding: 2rem 2rem 1.5rem 2rem;
    box-shadow:
        0 20px 60px rgba(30, 41, 59, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    z-index: 60;
    font-family: var(--font-body);
    overflow-y: auto;
    animation: story-panel-in 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes story-panel-in {
    from { opacity: 0; transform: translateY(-50%) translateX(40px); }
    to { opacity: 1; transform: translateY(-50%) translateX(0); }
}

.story-chapter-tag {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--color-accent-dark);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin: 0 0 0.5rem 0;
    display: inline-block;
    background: rgba(143, 185, 73, 0.15);
    padding: 4px 10px;
    border-radius: 100px;
}

.story-chapter-title {
    font-family: 'RBNo3.1', 'Montserrat', serif;
    font-size: 2rem;
    font-weight: 900;
    color: var(--color-text);
    line-height: 1.1;
    margin: 0 0 0.75rem 0;
    letter-spacing: -0.01em;
}

.story-chapter-intro {
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    color: var(--color-text);
    line-height: 1.5;
    margin: 0 0 1rem 0;
    opacity: 0.85;
}

.story-divider {
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(143, 185, 73, 0.4) 50%,
        transparent 100%);
    margin: 1rem 0;
}

/* POI Card dentro del Story Panel */
.story-poi-card {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(143, 185, 73, 0.25);
    border-left: 4px solid var(--poi-color, #8fb949);
    border-radius: 16px;
    padding: 1.25rem;
    margin: 1rem 0 1rem 0;
}

.story-poi-logo {
    width: 72px;
    height: 72px;
    border-radius: 14px;
    background: white;
    margin: 0 0 0.85rem 0;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--color-mist-gray);
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-poi-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.story-poi-logo-fallback {
    width: 72px;
    height: 72px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--poi-color, #8fb949), var(--color-accent-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-family: 'RBNo3.1', serif;
    font-size: 2rem;
    font-weight: 900;
    margin: 0 0 0.85rem 0;
    box-shadow: 0 4px 14px rgba(143, 185, 73, 0.4);
}

.story-poi-name {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 0.4rem 0;
    line-height: 1.2;
}

.story-poi-distance {
    display: inline-block;
    font-size: 0.85rem;
    color: var(--color-accent-dark);
    font-weight: 600;
    background: rgba(143, 185, 73, 0.15);
    padding: 4px 10px;
    border-radius: 100px;
    margin: 0 0 1rem 0;
}

.story-poi-narrative {
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.55;
    color: var(--color-text);
    margin: 0;
}

/* Progress dots del capítulo */
.story-progress-dots {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    margin: 0.5rem 0 1rem 0;
}

.story-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--dot-color, rgba(143, 185, 73, 0.25));
    transition: all 0.3s var(--ease-smooth);
}

.story-dot.active {
    background: var(--dot-color, var(--color-accent));
    transform: scale(1.4);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--dot-color, #8fb949) 25%, transparent);
}

.story-progress-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(143, 185, 73, 0.2);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    gap: 0.5rem;
}

.story-counter {
    background: rgba(143, 185, 73, 0.12);
    color: var(--color-accent-dark);
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 700;
}

.story-chapter-counter {
    color: var(--color-text-secondary);
    font-size: 0.75rem;
    text-align: right;
}

/* CTA del cierre */
.story-cta {
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
    color: white;
    border-radius: 18px;
    padding: 1.5rem;
    margin: 1rem 0;
    text-align: center;
    box-shadow: 0 12px 30px rgba(143, 185, 73, 0.35);
}

.story-cta-label {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0 0 0.5rem 0;
    opacity: 0.9;
}

.story-cta-phone {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'RBNo3.1', serif;
    font-size: 1.6rem;
    font-weight: 900;
    color: white;
    text-decoration: none;
    margin: 0.5rem 0;
    transition: transform 0.2s var(--ease-smooth);
}

.story-cta-phone:hover {
    transform: scale(1.05);
}

.story-cta-phone svg {
    flex-shrink: 0;
}

.story-cta-meta {
    font-size: 0.78rem;
    margin: 0.5rem 0 0 0;
    opacity: 0.85;
    line-height: 1.4;
}

.story-cta-signature {
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    margin: 0.85rem 0 0 0;
    opacity: 0.7;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.25);
}
