/* ============================================================
   MAPA (pruebas) — estética nueva (dark, Inter/Bricolage).
   El SISTEMA DE PUNTOS se mantiene igual: azul = FSD ID, amarillo = Tickets.
   ============================================================ */

html, body { height: 100%; overflow: hidden; }

#map {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: #0a0a0f;
    z-index: 0;
}

/* ============ BURBUJAS (colores intactos) ============ */
.burbuja {
    border-radius: 50%;
    position: absolute;
    animation: bubble-pulse 2.8s ease-in-out infinite;
}
.burbuja.id-bubble {
    background: radial-gradient(circle at 35% 35%, #4d7aff, #011EF6);
    border: 1.5px solid rgba(100, 140, 255, 0.6);
    box-shadow: 0 0 14px 3px rgba(1, 30, 246, 0.45);
}
.burbuja.ticket-bubble {
    background: radial-gradient(circle at 35% 35%, #fae97a, #f6da4a);
    border: 1.5px solid rgba(255, 240, 120, 0.6);
    box-shadow: 0 0 14px 3px rgba(246, 218, 74, 0.45);
}
.burbuja.combined-bubble {
    border: 2px solid rgba(255, 255, 255, 0.55);
    box-shadow: 0 0 14px 3px rgba(255, 255, 255, 0.2);
}
@keyframes bubble-pulse {
    0%, 100% { transform: scale(1);    opacity: 0.82; }
    50%      { transform: scale(1.10); opacity: 1;    }
}

/* ============ TOOLTIP ============ */
.leaflet-tooltip.bubble-tt {
    background: rgba(16, 16, 16, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 9px 13px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.6;
    white-space: nowrap;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}
.leaflet-tooltip.bubble-tt::before { display: none; }
.bubble-tt .city-name {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 3px;
}
.bubble-tt .id-line { color: #6b93ff; }
.bubble-tt .tk-line { color: #f6da4a; }

/* ============ FILTER BAR ============ */
.filter-bar {
    position: fixed;
    top: 92px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 900;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(16, 16, 16, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    padding: 6px 8px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}

.filter-btn {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 7px 14px;
    cursor: pointer;
    background: transparent;
    transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--fg-dim);
    white-space: nowrap;
}
.filter-btn:hover { color: var(--fg); background: rgba(255, 255, 255, 0.05); }
.filter-btn .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.filter-btn.id-btn .dot { background: #4d7aff; }
.filter-btn.ticket-btn .dot { background: #f6da4a; }

.filter-btn.all-btn.active { background: #ffffff; color: #0a0a0a; border-color: #ffffff; }
.filter-btn.id-btn.active { background: rgba(77, 122, 255, 0.22); border-color: #4d7aff; color: #fff; }
.filter-btn.ticket-btn.active { background: rgba(246, 218, 74, 0.16); border-color: #f6da4a; color: #fff; }

.filter-divider {
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, 0.12);
    flex-shrink: 0;
}

/* ---- Lite switch ---- */
.lite-switch {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    padding-left: 4px;
}
.lite-switch-label {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--fg-faint);
    transition: color 0.2s ease;
    line-height: 1;
}
.lite-switch.active .lite-switch-label { color: var(--fg); }
.lite-switch-track {
    position: relative;
    width: 32px;
    height: 18px;
    background: rgba(255, 255, 255, 0.14);
    border-radius: 9px;
    transition: background 0.25s ease;
    flex-shrink: 0;
}
.lite-switch.active .lite-switch-track { background: #4ade80; }
.lite-switch-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    transition: transform 0.25s ease;
}
.lite-switch.active .lite-switch-thumb { transform: translateX(14px); }

/* ============ CTA BAR (FSD / Tickets externos) ============ */
.map-cta-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 900;
    display: flex;
    gap: 10px;
}

.map-cta {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #fff;
    text-decoration: none;
    background: rgba(16, 16, 16, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    padding: 11px 18px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    transition: background 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.map-cta .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.map-cta-id .dot     { background: #4d7aff; box-shadow: 0 0 8px rgba(77, 122, 255, 0.6); }
.map-cta-ticket .dot { background: #f6da4a; box-shadow: 0 0 8px rgba(246, 218, 74, 0.6); }
.map-cta-arrow { transition: transform 0.25s var(--ease); opacity: 0.7; }
.map-cta:hover { transform: translateY(-2px); }
.map-cta:hover .map-cta-arrow { transform: translateX(3px); opacity: 1; }
.map-cta-id:hover     { background: rgba(77, 122, 255, 0.22); border-color: rgba(77, 122, 255, 0.55); }
.map-cta-ticket:hover { background: rgba(246, 218, 74, 0.18); border-color: rgba(246, 218, 74, 0.55); }

/* ============ STATS PANEL ============ */
.stats-panel {
    position: fixed;
    top: 92px;
    right: 18px;
    z-index: 900;
    background: rgba(16, 16, 16, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    padding: 16px 18px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    min-width: 180px;
}
.stats-panel.loaded { opacity: 1; transform: translateY(0); }

.stats-label {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--fg-faint);
}
.stats-row { display: flex; align-items: center; gap: 11px; }
.stats-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.stats-dot.blue   { background: #4d7aff; box-shadow: 0 0 6px rgba(77, 122, 255, 0.6); }
.stats-dot.yellow { background: #f6da4a; box-shadow: 0 0 6px rgba(246, 218, 74, 0.6); }
.stats-dot.white  { background: rgba(255, 255, 255, 0.55); }
.stats-info { display: flex; flex-direction: column; line-height: 1.2; }
.stats-num {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 700;
    font-size: 19px;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.stats-desc {
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--fg-faint);
}
.stats-divider { height: 1px; background: rgba(255, 255, 255, 0.08); margin: 0 -4px; }
.stats-toggle { display: none; }

/* ============ DRAWER ============ */
.drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 1999;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}
.drawer-overlay.open { opacity: 1; visibility: visible; }

.city-drawer {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    max-width: 92vw;
    height: 100%;
    z-index: 2000;
    background: rgba(12, 12, 12, 0.96);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    display: flex;
    flex-direction: column;
    transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -24px 0 60px rgba(0, 0, 0, 0.5);
}
.city-drawer.open { right: 0; }

.drawer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 26px 22px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
}
.drawer-city-name {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 700;
    font-size: 24px;
    letter-spacing: -0.02em;
    line-height: 1.05;
}
.drawer-city-meta {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--fg-faint);
    margin-top: 6px;
}
.drawer-close {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 34px;
    height: 34px;
    color: var(--fg-dim);
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s ease, color 0.2s ease;
    line-height: 1;
}
.drawer-close:hover { background: rgba(255, 255, 255, 0.1); color: var(--fg); }

.drawer-summary {
    display: flex;
    gap: 10px;
    padding: 16px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
}
.drawer-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 8px 12px;
    flex: 1;
}
.drawer-chip-num {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.drawer-chip-label {
    font-family: 'Inter', sans-serif;
    font-size: 8px;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--fg-faint);
    line-height: 1.3;
}

.drawer-tabs {
    display: flex;
    gap: 6px;
    padding: 12px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
}
.drawer-tab {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--fg-faint);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: all 0.2s ease;
}
.drawer-tab .tab-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.drawer-tab.id-tab .tab-dot { background: #4d7aff; }
.drawer-tab.tk-tab .tab-dot { background: #f6da4a; }
.drawer-tab.id-tab.active { background: rgba(77, 122, 255, 0.14); border-color: rgba(77, 122, 255, 0.35); color: #6b93ff; }
.drawer-tab.tk-tab.active { background: rgba(246, 218, 74, 0.12); border-color: rgba(246, 218, 74, 0.35); color: #f6da4a; }

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 14px 24px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}
.drawer-body::-webkit-scrollbar { width: 4px; }
.drawer-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 2px; }

.drawer-section-title {
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--fg-faint);
    padding: 14px 8px 8px;
}

.id-card-row, .ticket-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 12px;
    transition: background 0.15s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.id-card-row:last-child, .ticket-row:last-child { border-bottom: none; }
.id-card-row:hover, .ticket-row:hover { background: rgba(255, 255, 255, 0.03); }

.id-avatar, .ticket-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}
.id-avatar { background: rgba(77, 122, 255, 0.18); border: 1px solid rgba(77, 122, 255, 0.3); color: #6b93ff; }
.ticket-avatar { background: rgba(246, 218, 74, 0.12); border: 1px solid rgba(246, 218, 74, 0.3); color: #f6da4a; }

.id-info { flex: 1; min-width: 0; }
.id-name {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.id-meta {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--fg-faint);
    margin-top: 3px;
}

.ticket-bet {
    display: inline-block;
    font-family: 'Inter', sans-serif;
    font-size: 8px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 6px;
}
.ticket-bet.nsqk  { background: rgba(246, 218, 74, 0.15);  color: #f6da4a; }
.ticket-bet.mosca { background: rgba(255, 120, 120, 0.15); color: #ff9090; }
.ticket-bet.none  { color: var(--fg-faint); letter-spacing: 0.08em; }

.drawer-loading, .drawer-empty {
    text-align: center;
    padding: 40px 20px;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--fg-faint);
}
.drawer-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 0;
}
.drawer-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-top-color: #4d7aff;
    border-radius: 50%;
    animation: map-spin 0.7s linear infinite;
}
@keyframes map-spin { to { transform: rotate(360deg); } }

.load-more-btn {
    display: block;
    width: calc(100% - 16px);
    margin: 12px auto 4px;
    padding: 11px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--fg-dim);
    cursor: pointer;
    transition: all 0.2s ease;
}
.load-more-btn:hover { background: rgba(255, 255, 255, 0.08); color: var(--fg); }

/* ============ LITE MODE ============ */
body.lite-mode .burbuja {
    animation: none !important;
    box-shadow: none !important;
    border-width: 1px !important;
}
body.lite-mode .burbuja.id-bubble { background: #011EF6 !important; }
body.lite-mode .burbuja.ticket-bubble { background: #f6da4a !important; }
body.lite-mode .burbuja.combined-bubble { box-shadow: none !important; }
body.lite-mode .leaflet-tooltip.bubble-tt {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}

/* ============ LEAFLET CONTROLS ============ */
.leaflet-bottom.leaflet-right { bottom: 24px; }
.leaflet-control-zoom { border: none !important; box-shadow: 0 8px 24px rgba(0,0,0,0.4) !important; }
.leaflet-control-zoom a {
    background: rgba(16, 16, 16, 0.88) !important;
    color: #fff !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}
.leaflet-control-zoom a:hover { background: rgba(77, 122, 255, 0.3) !important; }
.leaflet-control-attribution {
    background: rgba(16, 16, 16, 0.7) !important;
    color: rgba(255, 255, 255, 0.3) !important;
    font-size: 9px !important;
}
.leaflet-control-attribution a { color: rgba(255, 255, 255, 0.45) !important; }

/* ============ RESPONSIVE ============ */
@media (max-width: 820px) {
    .map-cta-bar { bottom: 18px; gap: 8px; width: 92vw; justify-content: center; }
    .map-cta { padding: 10px 14px; font-size: 11px; gap: 7px; }
    .map-cta-arrow { display: none; }

    .filter-bar { top: 78px; padding: 5px 6px; gap: 4px; }
    .filter-btn { font-size: 11px; padding: 6px 11px; }
    .lite-switch-label { display: none; }

    .stats-panel {
        right: unset;
        left: 50%;
        top: 130px;
        transform: translateX(-50%) translateY(-6px);
        padding: 0;
        min-width: 168px;
        gap: 0;
        border-radius: 16px;
        overflow: hidden;
    }
    .stats-panel.loaded { transform: translateX(-50%) translateY(0) !important; }
    .stats-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        padding: 10px 14px;
        cursor: pointer;
        background: transparent;
        border: none;
        color: var(--fg);
        font-family: 'Inter', sans-serif;
        font-size: 10px;
        font-weight: 600;
        letter-spacing: 0.22em;
        text-transform: uppercase;
        width: 100%;
        white-space: nowrap;
    }
    .stats-toggle-dots { display: flex; gap: 4px; align-items: center; }
    .stats-toggle-arrow { font-size: 10px; color: var(--fg-faint); transition: transform 0.3s ease; line-height: 1; }
    .stats-panel.open .stats-toggle-arrow { transform: rotate(180deg); }
    .stats-body {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.35s ease, padding 0.35s ease;
        padding: 0 16px;
    }
    .stats-panel.open .stats-body { max-height: 220px; padding: 0 16px 14px; }
    .stats-label { display: none; }
    .stats-num { font-size: 16px; }
    .stats-divider { margin: 8px 0; }
}
