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

/* ===== DESIGN TOKENS ===== */
:root {
    --header-h: 48px;

    --white: #ffffff;
    --gray-50: #fafafa;
    --gray-100: #f5f5f7;
    --gray-200: #e8e8ed;
    --gray-300: #d2d2d7;
    --gray-400: #86868b;
    --gray-500: #6e6e73;
    --gray-800: #1d1d1f;
    --black: #000000;

    --accent: #0071e3;
    --accent-hover: #0077ED;

    --text: var(--gray-800);
    --text-secondary: var(--gray-500);
    --border: var(--gray-200);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-full: 980px;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.15);

    --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    font-family: var(--font);
    background: var(--white);
    color: var(--text);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ===== HEADER ===== */
#header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-h);
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 1000;
    border-bottom: 1px solid var(--gray-200);
}

.header-brand a {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
    text-decoration: none;
    letter-spacing: -0.01em;
}

.header-brand span {
    color: var(--gray-400);
    font-weight: 400;
}

.header-center {
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== PILLS ===== */
.filter-pills {
    display: flex;
    gap: 2px;
    background: var(--gray-100);
    padding: 2px;
    border-radius: var(--radius-full);
}

.pill {
    font-family: var(--font);
    font-size: 0.72rem;
    font-weight: 500;
    padding: 4px 10px;
    border: none;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    line-height: 1;
}

.pill:hover { color: var(--text); }

.pill.active {
    background: var(--white);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.pill-icon {
    background: var(--gray-100);
    width: 30px;
    height: 30px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--gray-500);
}

.pill-icon.active {
    background: var(--accent);
    color: var(--white);
    box-shadow: none;
}

/* Botón filtro móbil — oculto en desktop */
.btn-filter-mobile {
    display: none;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-500);
    cursor: pointer;
}

.btn-filter-mobile.active {
    background: var(--accent);
    color: var(--white);
}

/* ===== BOTON PRINCIPAL ===== */
.btn-primary {
    font-family: var(--font);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 6px 14px;
    background: var(--accent);
    color: var(--white);
    border: none;
    border-radius: var(--radius-full);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s;
    line-height: 1;
    white-space: nowrap;
}

.btn-primary:hover { background: var(--accent-hover); }

/* ===== PANEL FILTROS (móbil: tempo + categorías, desktop: só categorías) ===== */
.panel-filtros {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    z-index: 998;
}

.panel-filtros.hidden { display: none; }

.panel-filtros-inner {
    padding: 10px 16px 12px;
}

.panel-section + .panel-section {
    margin-top: 10px;
}

.panel-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

/* No panel, as pills non precisan fondo gris */
.filter-pills-panel {
    background: transparent;
    padding: 0;
    gap: 4px;
    flex-wrap: wrap;
}

.filter-pills-panel .pill {
    background: var(--gray-100);
}

.filter-pills-panel .pill.active {
    background: var(--accent);
    color: var(--white);
    box-shadow: none;
}

.panel-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    border: 1.5px solid var(--gray-300);
    background: var(--white);
    color: var(--text);
    transition: all 0.15s;
    user-select: none;
}

.chip.active {
    border-color: var(--accent);
    background: rgba(0, 113, 227, 0.06);
    color: var(--accent);
}

.chip:not(.active) { opacity: 0.45; }

.chip-icon {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.chip-fire.active {
    border-color: #FF3D00;
    background: rgba(255, 61, 0, 0.06);
    color: #FF3D00;
}

.chip-fire:not(.active) { opacity: 0.45; }

/* En desktop, ocultar a sección "Período" do panel (xa está no header) */
.panel-section:first-child {
    display: none;
}

/* ===== MARKER PINS ===== */
.marker-icon {
    background: none !important;
    border: none !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.marker-pin {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid white;
    background: var(--accent);
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
    transition: transform 0.15s ease, opacity 0.15s ease;
    cursor: pointer;
}

.marker-pin:hover {
    transform: scale(1.08);
    opacity: 1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.35);
    z-index: 1000 !important;
}

.marker-pin svg {
    width: 14px;
    height: 14px;
    display: block;
}

/* ===== FOOTER ===== */
:root {
    --footer-h: 32px;
}

#footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--footer-h);
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    border-top: 1px solid var(--gray-200);
}

.footer-links {
    display: flex;
    gap: 16px;
}

.footer-links a {
    font-size: 0.65rem;
    color: var(--gray-400);
    text-decoration: none;
    transition: color 0.15s;
}

.footer-links a:hover {
    color: var(--text);
}

/* ===== MAPA ===== */
#mapa {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    bottom: var(--footer-h);
}

/* ===== POPUP ===== */
.leaflet-popup-content-wrapper {
    background: var(--white) !important;
    color: var(--text) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-lg) !important;
    padding: 0 !important;
    overflow: hidden;
    border: 1px solid var(--border) !important;
}

.leaflet-popup-tip {
    background: var(--white) !important;
    box-shadow: none !important;
}

.leaflet-popup-close-button {
    top: 6px !important;
    right: 6px !important;
    width: 20px !important;
    height: 20px !important;
    font-size: 14px !important;
    line-height: 20px !important;
    text-align: center !important;
    color: var(--gray-400) !important;
    background: var(--gray-100) !important;
    border-radius: 50% !important;
    padding: 0 !important;
    z-index: 1;
    transition: background 0.15s, color 0.15s;
}

.leaflet-popup-close-button:hover {
    color: var(--gray-800) !important;
    background: var(--gray-200) !important;
}

.leaflet-popup-content {
    margin: 0 !important;
    width: 270px;
}

.leaflet-popup-content p {
    margin: 1em 0 !important;
}

.popup-inner { padding: 0; }

.popup-img-wrap {
    position: relative;
    cursor: pointer;
    line-height: 0;
    overflow: hidden;
}

.popup-img-wrap img {
    width: 100%;
    height: 240px;
    object-fit: cover;
    display: block;
    transition: filter 0.2s ease, transform 0.2s ease;
}

.popup-img-wrap:hover img {
    filter: brightness(0.85);
    transform: scale(1.02);
}

.popup-credit {
    position: absolute;
    bottom: 0;
    right: 0;
    font-size: 0.58rem;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(0, 0, 0, 0.4);
    padding: 3px 8px;
    border-radius: var(--radius-sm) 0 0 0;
    line-height: 1;
    pointer-events: none;
}

.popup-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(8px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-play::after {
    content: '';
    display: block;
    border-style: solid;
    border-width: 7px 0 7px 12px;
    border-color: transparent transparent transparent white;
    margin-left: 2px;
}

.popup-body { padding: 8px 10px 10px; }

.popup-meta {
    display: flex;
    align-items: center;
    gap: 6px;
}

.popup-badge {
    display: inline-block;
    padding: 1px 7px;
    border-radius: var(--radius-full);
    font-size: 0.6rem;
    font-weight: 600;
    color: white;
    line-height: 1.5;
}

.popup-date {
    font-size: 0.68rem;
    color: var(--gray-400);
}

.popup-desc {
    font-size: 0.78rem;
    line-height: 1.4;
    color: var(--gray-800);
    margin-top: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.popup-actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 0.5px solid var(--gray-200);
}

.popup-action {
    font-family: var(--font);
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--accent);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.popup-action:hover { text-decoration: underline; }

/* ===== LIGHTBOX ===== */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.88);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.lightbox.hidden { display: none; }

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    color: rgba(255,255,255,0.8);
    font-size: 1.6rem;
    background: none;
    border: none;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.15s;
    z-index: 10001;
}

.lightbox-close:hover { background: rgba(255,255,255,0.15); }

.lightbox-content {
    max-width: 92vw;
    max-height: 90vh;
    cursor: default;
}

.lightbox-content img,
.lightbox-content video {
    max-width: 92vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

/* ===== LEAFLET OVERRIDES ===== */
.leaflet-control-zoom {
    border: none !important;
    box-shadow: var(--shadow-md) !important;
    border-radius: var(--radius-sm) !important;
    overflow: hidden;
}

.leaflet-control-zoom a {
    background: var(--white) !important;
    color: var(--gray-800) !important;
    border-bottom: 1px solid var(--gray-200) !important;
    width: 32px !important;
    height: 32px !important;
    line-height: 32px !important;
    font-size: 16px !important;
}

.leaflet-control-zoom a:hover { background: var(--gray-50) !important; }

/* ===== STATIC PAGES (legal, info, contacto) ===== */
.page-static {
    font-family: var(--font);
    color: var(--text);
    background: var(--white);
    height: auto;
    overflow: auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.static-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(12px);
    z-index: 10;
}

.static-back {
    display: flex;
    align-items: center;
    color: var(--accent);
    text-decoration: none;
}

.static-brand {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-800);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.static-brand span { color: var(--gray-400); }

.static-content {
    max-width: 680px;
    margin: 0 auto;
    padding: 32px 20px 48px;
    flex: 1;
    line-height: 1.65;
}

.static-content h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 20px;
}

.static-content h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 28px;
    margin-bottom: 8px;
}

.static-content p {
    font-size: 0.9rem;
    margin-bottom: 12px;
    color: var(--gray-800);
}

.static-content ul {
    font-size: 0.9rem;
    margin-bottom: 12px;
    padding-left: 20px;
}

.static-content li { margin-bottom: 4px; }

.static-content a {
    color: var(--accent);
    text-decoration: none;
}

.static-content a:hover { text-decoration: underline; }

.static-content .lead {
    font-size: 1.05rem;
    color: var(--gray-800);
}

.static-content .callout {
    padding: 16px;
    margin: 20px 0;
}

.static-content .callout-warning {
    background: #FFF8E1;
    border-left: 3px solid #FF6F00;
}

.static-content .callout p { margin-bottom: 0; }

.static-content .credits {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-secondary);
}

.static-content .credits p { color: var(--text-secondary); }

.legal-nav {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.legal-nav a {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
}

.legal-nav a:hover { text-decoration: underline; }

.cookie-table {
    width: 100%;
    font-size: 0.82rem;
    border-collapse: collapse;
    margin: 12px 0;
}

.cookie-table th,
.cookie-table td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
}

.cookie-table th {
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.cookie-table code {
    font-size: 0.78rem;
    background: var(--gray-100);
    padding: 1px 5px;
}

.static-content section + section {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.static-footer {
    text-align: center;
    padding: 16px;
    border-top: 1px solid var(--border);
}

.static-footer a {
    font-size: 0.85rem;
    color: var(--accent);
    text-decoration: none;
}

.static-footer a:hover { text-decoration: underline; }

.page-dev .static-content section + section {
    border-top: none;
    padding-top: 0;
    margin-top: 48px;
}

/* ===== COOKIE BANNER ===== */
.cookie-banner {
    display: none;
    position: fixed;
    bottom: 16px;
    left: 16px;
    z-index: 9999;
    background: var(--gray-800);
    color: #fff;
    font-family: var(--font);
    font-size: 0.78rem;
    line-height: 1.4;
    padding: 14px 16px;
    max-width: 260px;
    box-shadow: var(--shadow-lg);
    flex-direction: column;
    gap: 10px;
}

.cookie-banner a { color: var(--accent); }

.cookie-banner button {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 6px 0;
    font-size: 0.78rem;
    cursor: pointer;
    width: 100%;
}

/* ===== MOBILE ===== */
@media (max-width: 640px) {
    /* Ocultar pills e icona filtro do header */
    .header-center { display: none; }

    /* Mostrar botón filtro móbil */
    .btn-filter-mobile { display: flex; }

    /* No panel, mostrar a sección "Período" (en desktop está oculta) */
    .panel-section:first-child { display: block; }

    #header { padding: 0 10px; }
    .header-brand a { font-size: 0.9rem; }
    .btn-primary { font-size: 0.72rem; padding: 8px 12px; }

    .leaflet-popup-content { width: 240px; }
    .popup-img-wrap img { height: 180px; }

    .cookie-banner {
        bottom: 10px;
        left: 10px;
        max-width: 220px;
        font-size: 0.72rem;
        padding: 10px 12px;
        gap: 8px;
    }

    .cookie-banner button { font-size: 0.72rem; padding: 5px 0; }
}
