/* ==========================================================================
   Mapa de playas de Carboneras - Estilos
   ========================================================================== */

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

:root {
    --color-primary: #0ea5e9;
    --color-primary-dark: #0284c7;
    --color-bg: #f1f5f9;
    --color-surface: #ffffff;
    --color-text: #1e293b;
    --color-text-soft: #475569;
    --color-muted: #64748b;
    --color-border: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 6px 20px rgba(15, 23, 42, 0.10);
    --shadow-lg: 0 18px 45px rgba(15, 23, 42, 0.16);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    height: 100%;
    overflow-y: scroll;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--color-text);
    background: var(--color-surface);
}

body {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Hero, barra de marca y navegación compartidos en shared-hero-nav.css */

/* ---------- Polilínea de costa ---------- */
.leaflet-overlay-pane path {
    transition: stroke 0.5s ease;
}

/* ---------- Contenedor del mapa ---------- */
.map-wrap {
    flex: 1 1 auto;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#map {
    flex: 1 1 auto;
    width: 100%;
    min-height: 300px;
    z-index: 1;
}

/* ---------- Leyenda ---------- */
.legend {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    z-index: 500;
    background: var(--color-surface);
    border-radius: 12px;
    padding: 0.75rem 0.9rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border);
    font-size: 0.78rem;
    max-width: 200px;
}

.legend-title {
    font-weight: 700;
    margin-bottom: 0.5rem;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-muted);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.3rem;
}

.legend-item:last-child { margin-bottom: 0; }

.legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    flex-shrink: 0;
}

.legend-dot.green { background: #16a34a; }
.legend-dot.yellow { background: #facc15; }
.legend-dot.red { background: #dc2626; }
.legend-dot.gray { background: #94a3b8; }

/* ---------- Marcadores de bandera ---------- */
.flag-marker {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    transition: transform 0.2s ease;
}

.flag-marker.green { background: #16a34a; }
.flag-marker.yellow { background: #facc15; }
.flag-marker.red { background: #dc2626; }
.flag-marker.unknown { background: #94a3b8; }

.flag-marker:hover {
    transform: scale(1.25);
}

/* Marcador de playa sin bandera */
.beach-marker-no-flag {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 3px solid #fff;
    background: #64748b;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: #fff;
    font-weight: 700;
}

/* ---------- Popup ---------- */
.leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 0;
}

.leaflet-popup-content {
    margin: 0;
    padding: 0;
    width: auto !important;
}

.popup-content {
    padding: 0.8rem 1rem;
    min-width: 180px;
    max-width: 260px;
}

.popup-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.popup-flag-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.popup-flag-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    padding: 0.35rem 0.6rem;
    border-radius: 8px;
    background: var(--color-bg);
}

.popup-flag-item .pf-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.popup-flag-item .pf-dot.green { background: #16a34a; }
.popup-flag-item .pf-dot.yellow { background: #facc15; }
.popup-flag-item .pf-dot.red { background: #dc2626; }

.popup-flag-item .pf-puesto {
    font-weight: 600;
    color: var(--color-text-soft);
    font-size: 0.75rem;
}

.popup-flag-item .pf-estado {
    color: var(--color-muted);
    font-size: 0.75rem;
}

.popup-link {
    display: block;
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--color-border);
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-primary-dark);
    text-decoration: none;
    transition: var(--transition);
}

.popup-link:hover { color: var(--color-primary); }

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
    .page-nav-item { padding: 0.4rem 0.9rem; font-size: 0.8rem; }
    .legend {
        bottom: 0.5rem;
        left: 0.5rem;
        padding: 0.6rem 0.75rem;
        font-size: 0.72rem;
        max-width: 170px;
    }
    .popup-content { min-width: 150px; max-width: 220px; }
}

/* ---------- Leaflet overrides ---------- */
.leaflet-control-layers {
    border-radius: 10px !important;
    box-shadow: var(--shadow-md) !important;
    border: 1px solid var(--color-border) !important;
}

.leaflet-control-zoom a {
    border-radius: 8px !important;
}

/* ---------- Spinner ---------- */
.map-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(241, 245, 249, 0.8);
    z-index: 600;
    flex-direction: column;
    gap: 1rem;
    color: var(--color-muted);
    font-size: 0.9rem;
}

.map-loading.hidden { display: none; }

.map-loading .spinner {
    width: 38px;
    height: 38px;
    border: 4px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
