/* Observatorio Climatológico Académico · Tecnológico Universitario EuroAmericano · © Prof. Feddor Derenzin M.
   Panel lateral: pestañas, tarjetas de lluvia, pronóstico, capas, mareas, log. */

/* ============================================================
   3. PANEL LATERAL COMPACTO Y ESTILIZADO (DERECHA - SIN SATURACIÓN)
   ============================================================ */
#panelControl {
    position: absolute;
    top: 72px;
    right: 14px;
    width: 346px;
    max-height: calc(100vh - 130px);
    z-index: 1050;
    background: rgba(10, 15, 28, 0.93);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 13px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.68);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

#panelControl.panel-hidden {
    transform: translateX(calc(100% + 24px)) !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Pestañas Compactas */
.citizen-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 6px;
    background: rgba(4, 8, 16, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
    flex-shrink: 0;
}

.citizen-tab-btn {
    background: transparent;
    border: 1px solid transparent;
    color: #94a3b8;
    padding: 5px 4px;
    border-radius: 7px;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.16s ease;
    white-space: nowrap;
}

.citizen-tab-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.citizen-tab-btn.is-active {
    background: rgba(0, 229, 255, 0.16);
    border-color: rgba(0, 229, 248, 0.42);
    color: #ffffff;
    font-weight: 700;
}

.panel-scroll-body {
    padding: 9px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.panel-module-section {
    display: none;
    flex-direction: column;
    gap: 8px;
}

.panel-module-section.is-active {
    display: flex;
}

/* Cuadrícula 4x2 de Ciudades con Semáforo de Imagen Satelital (Cero recortes) */
.sat-cities-box {
    background: rgba(15, 22, 38, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 9px;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sat-cities-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 800;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.quick-cities-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    width: 100%;
}

.city-chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
    padding: 4px 3px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    transition: all 0.15s ease;
}

.city-chip:hover {
    background: rgba(0, 229, 255, 0.15);
    border-color: var(--accent-cyan);
    color: #ffffff;
}

.city-chip.is-active {
    background: var(--accent-cyan);
    border-color: var(--accent-cyan);
    color: #060b16;
    font-weight: 800;
}

.sat-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
    flex-shrink: 0;
}
.sat-dot.is-watch {
    background: #f59e0b;
    box-shadow: 0 0 5px #f59e0b;
}
.sat-dot.is-danger {
    background: #f43f5e;
    box-shadow: 0 0 6px #f43f5e;
}

/* Tarjeta Principal Compacta: ¿VA A LLOVER EN MI SECTOR? */
.rain-answer-card {
    background: linear-gradient(155deg, rgba(16, 185, 129, 0.14), rgba(13, 20, 36, 0.95));
    border: 1px solid rgba(16, 185, 129, 0.42);
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    transition: all 0.25s ease;
}

.rain-answer-card.status-watch {
    background: linear-gradient(155deg, rgba(245, 158, 11, 0.18), rgba(13, 20, 36, 0.95));
    border-color: rgba(245, 158, 11, 0.52);
}

.rain-answer-card.status-danger {
    background: linear-gradient(155deg, rgba(244, 63, 94, 0.22), rgba(13, 20, 36, 0.96));
    border-color: rgba(244, 63, 94, 0.62);
}

.rain-question-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 800;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.rain-hero-row {
    display: flex;
    align-items: center;
    gap: 9px;
}

.rain-hero-icon {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
}

.rain-hero-headline {
    font-family: 'Outfit', sans-serif;
    font-size: 14.5px;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.18;
}

.rain-hero-sub {
    font-size: 11px;
    color: #cbd5e1;
    line-height: 1.35;
    margin-top: 2px;
}

/* 3 Métricas Clave Compactas */
.citizen-kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
}

.citizen-kpi-box {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 7px;
    padding: 6px 7px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.kpi-lbl {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
}

.kpi-val {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 800;
    color: #ffffff;
    white-space: nowrap;
}

.kpi-sub {
    font-size: 11px;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Tarjetas Secundarias Compactas */
.sat-pass-card {
    background: rgba(15, 22, 38, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sat-pass-card { min-width: 0; overflow: hidden; }
.sat-pass-card .section-label { flex-wrap: wrap; row-gap: 4px; }
.sat-pass-card .section-label-title { min-width: 0; white-space: normal; overflow: visible; text-overflow: clip; }

/* Fila etiqueta / valor: si no cabe en una línea, el valor baja a la siguiente (antes se recortaba la etiqueta) */
.sat-pass-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    column-gap: 8px;
    row-gap: 2px;
    font-size: 11px;
    min-width: 0;
}

.sat-pass-row span {
    color: #94a3b8;
    flex: 1 1 auto;
    min-width: 0;
}

.sat-pass-row b {
    color: #ffffff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    margin-left: auto;
    text-align: right;
    overflow-wrap: anywhere;
}

/* ============================================================
   4. LOG DE DESCARGAS SATELITALES EN TIEMPO REAL
   ============================================================ */
.log-card {
    background: rgba(7, 11, 20, 0.94);
    border: 1px solid rgba(0, 229, 255, 0.25);
    border-radius: 10px;
    padding: 9px 10px;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.log-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 5px;
}

.log-title {
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-cyan);
    display: flex;
    align-items: center;
    gap: 5px;
}

.log-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height: 290px;
    overflow-y: auto;
    padding-right: 2px;
}

.log-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 3px solid var(--accent-emerald);
    border-radius: 7px;
    padding: 7px 9px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.log-item:hover {
    background: rgba(0, 229, 255, 0.08);
    border-color: rgba(0, 229, 255, 0.3);
}

.log-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #ffffff;
    font-weight: 700;
    font-size: 11px;
}

.log-badge-ok {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
}

.log-item-file {
    color: #94a3b8;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.log-item-metrics {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #cbd5e1;
    font-size: 11px;
    margin-top: 1px;
}

/* ============================================================
   5. PRONÓSTICO 7 DÍAS Y CONTROLES COMPACTOS (SIN RECORTES)
   ============================================================ */
.section-label {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.section-label-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.section-label-badge {
    flex-shrink: 0;
    white-space: nowrap;
    background: rgba(0, 229, 255, 0.12);
    border: 1px solid rgba(0, 229, 255, 0.3);
    color: var(--accent-cyan);
    padding: 1.5px 6px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.section-label-badge:hover {
    background: rgba(0, 229, 255, 0.24);
    color: #ffffff;
}

/* Cuadrícula de 7 días 100% alineada y compacta */
.forecast-strip-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    width: 100%;
    gap: 3px;
    text-align: center;
}

.forecast-mini-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 6px;
    padding: 5px 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 2px;
    cursor: pointer;
    min-width: 0;
    transition: all 0.15s ease;
}

.forecast-mini-card:hover {
    background: rgba(0, 229, 255, 0.12);
    border-color: rgba(0, 229, 255, 0.4);
}

.forecast-day-name {
    font-size: 11px;
    font-weight: 700;
    color: #cbd5e1;
    white-space: nowrap;
    line-height: 1.1;
}

.forecast-icon {
    font-size: 14px;
    line-height: 1.1;
}

.forecast-temp-val {
    font-size: 11px;
    font-weight: 800;
    color: #ffffff;
    white-space: nowrap;
    line-height: 1.1;
    letter-spacing: -0.3px;
}

.forecast-temp-min {
    color: #94a3b8;
    font-weight: 600;
}

.forecast-precip-val {
    width: 100%;
    font-size: 11px;
    color: var(--accent-cyan);
    background: rgba(0, 229, 255, 0.12);
    border-radius: 3px;
    padding: 1px 0;
    font-weight: 700;
    white-space: nowrap;
    line-height: 1.1;
}

.weather-submetrics-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
}

.weather-submetric-pill {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 5px;
    padding: 3.5px 4px;
    font-size: 11px;
    color: #94a3b8;
    text-align: center;
    white-space: nowrap;
}

.weather-submetric-pill b {
    color: #ffffff;
    font-weight: 700;
}

.layer-box {
    background: rgba(15, 22, 38, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 9px;
    padding: 9px 10px;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.layer-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
}

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

.switch {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 18px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: rgba(255, 255, 255, 0.16);
    transition: .25s;
    border-radius: 20px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .25s;
    border-radius: 50%;
}
input:checked + .slider { background-color: var(--accent-cyan); }
input:checked + .slider:before { transform: translateX(14px); }

.legend-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 9px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gradient-bar {
    height: 7px;
    border-radius: 4px;
    background: linear-gradient(to right,
        #ffffff 0%, #be00d2 12%, #820000 24%, #dc1400 38%,
        #ff8c00 50%, #ffe600 62%, #00d23c 75%, #0096ff 88%, #1e46b4 100%
    );
}

.gradient-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #cbd5e1;
    font-family: 'JetBrains Mono', monospace;
}

.tides-region-tabs {
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.45);
    padding: 4px;
    border-radius: 8px;
    overflow-x: auto;
    scrollbar-width: none;
}

.tides-tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: #cbd5e1;
    padding: 6px 8px;
    font-size: 11.5px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
}

.tides-tab-btn.is-active {
    background: var(--accent-cyan);
    color: #060b18;
    font-weight: 800;
}

.tides-national-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.tides-national-mini-box {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 7px 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    cursor: pointer;
}

.compound-risk-box {
    background: rgba(0, 0, 0, 0.38);
    border-radius: 9px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.risk-pill-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.risk-badge {
    font-family: 'Outfit', sans-serif;
    font-size: 11px;
    font-weight: 800;
    padding: 2.5px 9px;
    border-radius: 999px;
    text-transform: uppercase;
}

.risk-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 3px;
    overflow: hidden;
}

.risk-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

.risk-desc-text {
    font-size: 12px;
    color: #e2e8f0;
    line-height: 1.42;
}
