/* ElectoData — hoja de estilos. Mapa protagonista, responsive. */

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: #263238;
    background: #eceff1;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ---------- Cabecera ---------- */

.topbar {
    background: #102a43;
    color: #fff;
    padding: 10px 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 18px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    z-index: 5;
}

.topbar-title h1 {
    margin: 0;
    font-size: 1.25rem;
    letter-spacing: 0.2px;
}

.topbar-title .subtitle {
    margin: 2px 0 0;
    font-size: 0.78rem;
    color: #bcccdc;
}

.controls {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
}

.controls label {
    color: #d7e3ee;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.controls select {
    padding: 5px 8px;
    border-radius: 6px;
    border: 1px solid #45637f;
    background: #fff;
    color: #102a43;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.leyenda {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
    margin-left: auto;
    max-width: 100%;
}

.leyenda-vacia {
    font-size: 0.8rem;
    color: #bcccdc;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    padding: 2px 9px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
}

.chip b {
    color: #ffd54f;
}

.dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: none;
}

/* ---------- Mapa ---------- */

.map-wrap {
    flex: 1;
    position: relative;
    min-height: 0;
}

#map {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.map-notice {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: #b71c1c;
    color: #fff;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    z-index: 10;
    max-width: 90%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.contador {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(16, 42, 67, 0.92);
    color: #fff;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    white-space: nowrap;
}

.hidden { display: none !important; }

/* ---------- Ficha (InfoWindow) ---------- */

.ficha {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 13px;
    color: #263238;
    min-width: 230px;
}

.ficha-titulo {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 6px;
}

.ficha-ganador {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 6px 8px;
    margin-bottom: 8px;
    font-size: 13px;
}

.ficha-tabla {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

.ficha-tabla th {
    text-align: left;
    font-size: 11px;
    color: #607d8b;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 2px 4px;
    border-bottom: 1px solid #cfd8dc;
}

.ficha-tabla td {
    padding: 3px 4px;
    border-bottom: 1px solid #eceff1;
    white-space: nowrap;
}

.ficha-tabla td .dot { margin-right: 5px; width: 9px; height: 9px; }

.ficha-tabla .num { text-align: right; font-variant-numeric: tabular-nums; }

.ficha-nota {
    margin-top: 6px;
    font-size: 11px;
    color: #78909c;
}

/* ---------- Pie ---------- */

.foot {
    background: #102a43;
    color: #bcccdc;
    font-size: 0.75rem;
    padding: 6px 16px;
    text-align: center;
}

.foot a { color: #ffd54f; text-decoration: none; }
.foot a:hover { text-decoration: underline; }

/* ---------- Responsive ---------- */

@media (max-width: 768px) {
    .topbar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 8px 12px;
    }

    .topbar-title h1 { font-size: 1.1rem; }

    .controls { justify-content: space-between; }

    .controls select { flex: 1; min-width: 0; }

    .leyenda {
        margin-left: 0;
        max-height: 74px;
        overflow-y: auto;
        justify-content: center;
    }

    .contador {
        bottom: 10px;
        font-size: 0.72rem;
        padding: 5px 10px;
        max-width: 92%;
        white-space: normal;
        text-align: center;
    }
}
