/* ===================================
   Totalplay SLP — Calendario de Eventos
   css/calendario.css
   =================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700;800;900&display=swap');

:root {
    --cal-bg: #0a0a12;
    --cal-surface: #13131f;
    --cal-card: #1a1a2e;
    --cal-border: rgba(255, 255, 255, 0.07);
    --cal-text: #f0f0ff;
    --cal-dim: rgba(255, 255, 255, 0.45);
    --cal-accent: #af52de;
    --cal-radius: 20px;

    /* Colores por categoría */
    --cat-musica:      #6ee7b7;
    --cat-teatro:      #c4b5fd;
    --cat-arte:        #fdba74;
    --cat-deporte:     #93c5fd;
    --cat-gastronomia: #fde68a;
    --cat-cultura:     #67e8f9;

    --cat-musica-bg:      rgba(6, 95, 70, 0.85);
    --cat-teatro-bg:      rgba(76, 29, 149, 0.85);
    --cat-arte-bg:        rgba(146, 64, 14, 0.85);
    --cat-deporte-bg:     rgba(30, 58, 95, 0.85);
    --cat-gastronomia-bg: rgba(120, 53, 15, 0.85);
    --cat-cultura-bg:     rgba(14, 116, 144, 0.85);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--cal-bg);
    color: var(--cal-text);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ─── LAYOUT ─────────────────────────────── */
.cal-wrapper {
    width: 100%;
    max-width: 430px;
    margin: 0 auto;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    background: var(--cal-bg);
}

/* ─── HEADER ─────────────────────────────── */
.cal-header {
    position: absolute;
    top: 0; left: 0; right: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 52px 20px 16px;
    background: linear-gradient(to bottom, rgba(10,10,18,0.95) 0%, transparent 100%);
}

.cal-back-btn {
    width: 38px; height: 38px;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border: 1px solid var(--cal-border);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    color: var(--cal-text);
    text-decoration: none;
    flex-shrink: 0;
    transition: background 0.2s;
}
.cal-back-btn:active { background: rgba(255,255,255,0.18); }
.cal-back-btn svg { width: 18px; height: 18px; }

.cal-header-title {
    font-size: 1.1rem;
    font-weight: 900;
    letter-spacing: -0.03em;
    color: #fff;
}

/* ─── MAPA ────────────────────────────────── */
#cal-map {
    width: 100%;
    height: 55dvh;
    min-height: 300px;
    flex-shrink: 0;
    z-index: 1;
}

/* CartoDB Dark Matter override */
.leaflet-tile-pane { filter: brightness(0.85) saturate(0.6); }
.leaflet-control-attribution { display: none !important; }
.leaflet-control-zoom { display: none !important; }

/* Pill de ubicación */
.location-pill {
    position: absolute;
    top: 108px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 40;
    background: rgba(10, 10, 18, 0.82);
    backdrop-filter: blur(14px);
    border: 1px solid var(--cal-border);
    border-radius: 999px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    color: var(--cal-text);
}
.location-dot {
    width: 8px; height: 8px;
    background: var(--cal-accent);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--cal-accent);
}

/* Botón centrar mapa */
.recenter-btn {
    position: absolute;
    right: 16px;
    bottom: calc(45dvh + 16px);
    z-index: 40;
    width: 44px; height: 44px;
    background: var(--cal-accent);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    box-shadow: 0 4px 20px rgba(175, 82, 222, 0.4);
    cursor: pointer;
    border: none;
}
.recenter-btn svg { width: 20px; height: 20px; }

/* Pines del mapa */
.map-pin {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
    border: 2px solid rgba(255,255,255,0.25);
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    cursor: pointer;
    transition: transform 0.2s;
}
.map-pin:active { transform: scale(1.15); }
.map-pin.musica      { background: var(--cat-musica-bg);      color: var(--cat-musica);      border-color: var(--cat-musica); }
.map-pin.teatro      { background: var(--cat-teatro-bg);      color: var(--cat-teatro);      border-color: var(--cat-teatro); }
.map-pin.arte        { background: var(--cat-arte-bg);        color: var(--cat-arte);        border-color: var(--cat-arte); }
.map-pin.deporte     { background: var(--cat-deporte-bg);     color: var(--cat-deporte);     border-color: var(--cat-deporte); }
.map-pin.gastronomia { background: var(--cat-gastronomia-bg); color: var(--cat-gastronomia); border-color: var(--cat-gastronomia); }
.map-pin.cultura     { background: var(--cat-cultura-bg);     color: var(--cat-cultura);     border-color: var(--cat-cultura); }

/* ─── PANEL INFERIOR ─────────────────────── */
.cal-panel {
    flex: 1;
    background: var(--cal-surface);
    border-radius: 24px 24px 0 0;
    margin-top: -24px;
    position: relative;
    z-index: 10;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding-bottom: 20px;
}

/* ─── SELECTOR DE FECHAS ─────────────────── */
.date-scroll-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 20px 20px 14px;
}
.date-scroll-wrap::-webkit-scrollbar { display: none; }

.date-scroll {
    display: flex;
    gap: 10px;
    width: max-content;
}

.date-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    padding: 10px 8px;
    border-radius: 16px;
    background: var(--cal-card);
    border: 1.5px solid var(--cal-border);
    cursor: pointer;
    transition: all 0.2s;
    gap: 2px;
    user-select: none;
}
.date-pill:active { transform: scale(0.95); }

.date-pill .day-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--cal-dim);
    letter-spacing: 0.5px;
}
.date-pill .day-num {
    font-size: 1.4rem;
    font-weight: 900;
    line-height: 1;
    color: var(--cal-text);
}
.date-pill .month-label {
    font-size: 0.6rem;
    color: var(--cal-dim);
    font-weight: 600;
}

.date-pill.active {
    background: transparent;
    border-color: var(--cal-accent);
    box-shadow: 0 0 16px rgba(175, 82, 222, 0.2), inset 0 0 12px rgba(175, 82, 222, 0.06);
}
.date-pill.active .day-label,
.date-pill.active .month-label { color: var(--cal-accent); }
.date-pill.active .day-num { color: var(--cal-accent); }

/* ─── SECCIÓN EVENTOS ────────────────────── */
.events-section {
    padding: 0 20px;
    flex: 1;
}

.events-header {
    margin-bottom: 14px;
}
.events-header h2 {
    font-size: 1.4rem;
    font-weight: 900;
    letter-spacing: -0.5px;
}
.events-header p {
    font-size: 0.8rem;
    color: var(--cal-dim);
    margin-top: 2px;
}

/* ─── CARDS DE EVENTOS ───────────────────── */
.events-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.event-card {
    border-radius: var(--cal-radius);
    overflow: hidden;
    background: var(--cal-card);
    border: 1px solid var(--cal-border);
    cursor: pointer;
    position: relative;
    height: 120px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.event-card:active { transform: scale(0.98); }

.event-card-img {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    opacity: 0.55;
}

.event-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(10,10,18,0.7) 0%, rgba(10,10,18,0.2) 100%);
}

.event-card-content {
    position: relative;
    z-index: 2;
    padding: 14px 16px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.event-card-top {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cat-chip {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.cat-chip.musica      { background: var(--cat-musica-bg);      color: var(--cat-musica); }
.cat-chip.teatro      { background: var(--cat-teatro-bg);      color: var(--cat-teatro); }
.cat-chip.arte        { background: var(--cat-arte-bg);        color: var(--cat-arte); }
.cat-chip.deporte     { background: var(--cat-deporte-bg);     color: var(--cat-deporte); }
.cat-chip.gastronomia { background: var(--cat-gastronomia-bg); color: var(--cat-gastronomia); }
.cat-chip.cultura     { background: var(--cat-cultura-bg);     color: var(--cat-cultura); }

.event-time {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255,255,255,0.75);
}

.event-card-bottom {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
}

.event-name {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.2;
    max-width: 75%;
}

.event-lugar {
    font-size: 0.7rem;
    color: var(--cal-dim);
    margin-top: 3px;
}

.event-arrow {
    width: 32px; height: 32px;
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(8px);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    flex-shrink: 0;
}
.event-arrow svg { width: 14px; height: 14px; }

/* Estado vacío */
.no-events {
    text-align: center;
    padding: 40px 20px;
    color: var(--cal-dim);
}
.no-events svg { width: 40px; height: 40px; margin-bottom: 12px; opacity: 0.4; }
.no-events p { font-size: 0.9rem; }

/* ─── DRAWER DETALLE ─────────────────────── */
.detail-drawer {
    position: fixed;
    bottom: 0; left: 50%;
    transform: translateX(-50%) translateY(100%);
    width: 100%;
    max-width: 430px;
    background: var(--cal-surface);
    border-radius: 28px 28px 0 0;
    z-index: 200;
    transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 90dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.detail-drawer.open { transform: translateX(-50%) translateY(0); }

.drawer-handle {
    width: 40px; height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    margin: 12px auto 0;
    flex-shrink: 0;
}

.detail-close {
    position: absolute;
    top: 14px; right: 16px;
    width: 32px; height: 32px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    border: none;
    color: var(--cal-text);
    z-index: 10;
}
.detail-close svg { width: 16px; height: 16px; }

.detail-scroll {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex: 1;
}
.detail-scroll::-webkit-scrollbar { display: none; }

.detail-hero {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
}

.detail-body {
    padding: 20px 20px 32px;
}

.detail-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.detail-title {
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: -0.5px;
    margin-bottom: 14px;
    line-height: 1.2;
}

.detail-info-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
    color: var(--cal-dim);
    font-size: 0.85rem;
}
.detail-info-row svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }
.detail-info-row span { font-weight: 500; line-height: 1.4; }

.detail-desc {
    margin-top: 16px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: rgba(255,255,255,0.75);
}

/* Galería de fotos extra */
.gallery-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--cal-dim);
    margin: 28px 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gallery-title svg {
    opacity: 0.6;
}

.gallery-badge {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 99px;
    letter-spacing: 0.5px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    border-radius: 18px;
    overflow: hidden;
}

.gallery-cell {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    height: 120px;
    background: rgba(255,255,255,0.04);
}

.gallery-cell:first-child {
    grid-column: span 2;
    height: 190px;
}

.gallery-cell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    display: block;
}

.gallery-cell:hover img {
    transform: scale(1.06);
}

.gallery-cell:active img {
    transform: scale(0.97);
}

/* Overlay "+N más" en última celda visible */
.gallery-more::after {
    content: attr(data-more);
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

/* Botón Cómo llegar */
.btn-directions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 24px;
    padding: 16px;
    background: var(--cal-accent);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 800;
    border-radius: 16px;
    text-decoration: none;
    transition: opacity 0.2s;
}
.btn-directions:active { opacity: 0.8; }
.btn-directions svg { width: 18px; height: 18px; }

/* ─── BACKDROP ───────────────────────────── */
.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 190;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s;
}
.drawer-backdrop.visible {
    opacity: 1;
    pointer-events: all;
}

/* ─── LOADING ────────────────────────────── */
.cal-loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--cal-dim);
    font-size: 0.9rem;
}
.cal-spinner {
    width: 28px; height: 28px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--cal-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }
