/* ============================================================
   MAPA DE TOURS — puntos donde NSQK ha hecho shows.
   Inspirado en css/map.css pero con identidad propia:
   marcadores cálidos (no azul/amarillo) y card-carrusel
   reutilizando la .show-card de tours.css.
   ============================================================ */

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

:root {
    --tmap-marker-main: #3b82f6;
    --tmap-marker-light: #60a5fa;
    --tmap-marker-border: rgba(147, 197, 253, 0.72);
    --tmap-marker-glow-soft: rgba(59, 130, 246, 0.35);
    --tmap-marker-glow-strong: rgba(59, 130, 246, 0.55);
}

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

/* ============ MARCADORES (burbujas de shows) ============ */
.show-bubble {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 700;
    color: #fff;
    background: radial-gradient(circle at 35% 30%, var(--tmap-marker-light), var(--tmap-marker-main));
    border: 1.5px solid var(--tmap-marker-border);
    box-shadow: 0 0 14px 3px var(--tmap-marker-glow-soft);
    cursor: pointer;
    animation: show-bubble-pulse 2.8s ease-in-out infinite;
    transition: transform 0.18s var(--ease);
}
.show-bubble:hover { transform: scale(1.12); }
.show-bubble.has-soldout {
    background: radial-gradient(circle at 35% 30%, var(--tmap-marker-light), var(--tmap-marker-main));
    border-color: var(--tmap-marker-border);
    box-shadow: 0 0 14px 3px var(--tmap-marker-glow-soft);
}
.show-bubble-count {
    font-size: 12px;
    line-height: 1;
    letter-spacing: -0.02em;
    pointer-events: none;
}

@keyframes show-bubble-pulse {
    0%, 100% { box-shadow: 0 0 14px 3px var(--tmap-marker-glow-soft); }
    50%      { box-shadow: 0 0 20px 6px var(--tmap-marker-glow-strong); }
}

/* ============ TOOLTIP ============ */
.leaflet-tooltip.show-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.5;
    white-space: nowrap;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}
.leaflet-tooltip.show-tt::before { display: none; }
.show-tt .tt-city {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 2px;
}
.show-tt .tt-count { color: #ff9b7a; font-size: 11px; }

/* ============ FILTER (por tour, plegable) ============ */
.tmap-filter {
    position: fixed;
    top: 92px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 900;
    width: max-content;
    max-width: min(92vw, 320px);
}

/* Botón compacto que abre/cierra el menú */
.tmap-filter-toggle {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--fg);
    background: rgba(16, 16, 16, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    padding: 9px 14px;
    cursor: pointer;
    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);
}
.tmap-filter-toggle:hover { background: rgba(28, 28, 28, 0.9); border-color: rgba(255, 255, 255, 0.22); }
.tmap-filter-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, var(--tmap-marker-light), var(--tmap-marker-main));
    box-shadow: 0 0 8px var(--tmap-marker-glow-strong);
    flex-shrink: 0;
}
.tmap-filter-label {
    flex: 1;
    min-width: 0;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tmap-filter-caret {
    flex-shrink: 0;
    font-size: 10px;
    color: var(--fg-faint);
    transition: transform 0.25s var(--ease);
}
.tmap-filter.open .tmap-filter-caret { transform: rotate(180deg); }

/* Menú desplegable */
.tmap-filter-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 0;
    overflow: hidden;
    background: rgba(16, 16, 16, 0.92);
    border: 1px solid transparent;
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: max-height 0.28s var(--ease), opacity 0.2s ease, transform 0.25s var(--ease), visibility 0.28s;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.tmap-filter.open .tmap-filter-menu {
    max-height: min(56vh, 420px);
    overflow-y: auto;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    border-color: rgba(255, 255, 255, 0.1);
    padding: 6px;
}
.tmap-filter-menu::-webkit-scrollbar { width: 4px; }
.tmap-filter-menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.tmap-filter-opt {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-align: left;
    border: none;
    border-radius: 10px;
    padding: 9px 12px;
    cursor: pointer;
    background: transparent;
    color: var(--fg-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.tmap-filter-opt:hover { color: var(--fg); background: rgba(255, 255, 255, 0.06); }
.tmap-filter-opt.active { background: rgba(255, 255, 255, 0.12); color: var(--fg); font-weight: 600; }

/* ============ STATS PILL ============ */
.tmap-stats {
    position: fixed;
    bottom: 24px;
    left: 18px;
    z-index: 900;
    display: flex;
    gap: 18px;
    background: rgba(16, 16, 16, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 12px 18px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.tmap-stats.loaded { opacity: 1; transform: translateY(0); }
.tmap-stat-num {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 700;
    font-size: 19px;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}
.tmap-stat-desc {
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--fg-faint);
}

/* ============ CARD OVERLAY (carrusel) ============ */
.tmap-overlay {
    position: fixed;
    inset: 0;
    z-index: 1999;
    background: rgba(0, 0, 0, 0.6);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.tmap-overlay.open { opacity: 1; visibility: visible; }

.tmap-card-wrap {
    position: relative;
    width: 100%;
    max-width: 360px;
    transform: translateY(12px) scale(0.98);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.tmap-overlay.open .tmap-card-wrap { transform: translateY(0) scale(1); }

/* La .show-card viene de tours.css; aquí solo ajustes de contexto */
.tmap-card-wrap .show-card { width: 100%; }

/* Etiqueta del tour dentro de la card */
.show-tour-tag {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #fff;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    padding: 6px 11px;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    max-width: calc(100% - 32px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Cerrar */
.tmap-close {
    position: absolute;
    top: -14px;
    right: -14px;
    z-index: 6;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(16, 16, 16, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    transition: background 0.2s ease, transform 0.2s ease;
}
.tmap-close:hover { background: rgba(224, 47, 47, 0.85); transform: scale(1.06); }

/* Navegación carrusel */
.tmap-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 18px;
}
.tmap-nav-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}
.tmap-nav-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}
.tmap-nav-btn:disabled { opacity: 0.3; cursor: default; transform: none; }
.tmap-nav-count {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--fg-dim);
    font-variant-numeric: tabular-nums;
    min-width: 52px;
    text-align: center;
}
.tmap-nav.single { display: none; }

/* ============ BOTÓN VOLVER A TOURS (flotante) ============ */
.tmap-back-tours {
    position: fixed;
    bottom: 24px;
    right: 18px;
    z-index: 900;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--fg);
    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 ease, border-color 0.2s ease, transform 0.2s ease;
}
.tmap-back-tours:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* ============ LEAFLET CONTROLS ============ */
.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(224, 47, 47, 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; }

/* ============ STATE / LOADING ============ */
.tmap-loading {
    position: fixed;
    inset: 0;
    z-index: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 14px;
    color: var(--fg-faint);
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.tmap-loading.hidden { opacity: 0; }
.tmap-spinner {
    width: 22px;
    height: 22px;
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-top-color: #e02f2f;
    border-radius: 50%;
    animation: tmap-spin 0.7s linear infinite;
}
@keyframes tmap-spin { to { transform: rotate(360deg); } }

/* ============ RESPONSIVE ============ */
@media (max-width: 820px) {
    .tmap-filter { top: 78px; }
    .tmap-back-tours { padding: 10px 14px; font-size: 10px; }
    .tmap-stats { padding: 10px 14px; gap: 14px; }
    .tmap-stat-num { font-size: 16px; }
}

/* Pantallas bajas: que la card + navegación quepan sin recortarse */
@media (max-height: 720px) {
    .tmap-card-wrap { max-width: min(360px, 56vh); }
}
