/* Páginas de cada albufeira (/albufeira/<nome>, geradas por scripts/gerar_paginas_albufeiras.py): os estilos da
   albufeiras.html que estas páginas usam. */
.grafico-box, .kpi-card, .cta-simulador { box-sizing: border-box; }

.painel-header { text-align: center; margin-bottom: 16px; }
.painel-header h1 { margin: 0 0 8px 0; font-size: 1.4em; color: #2c3e50; }
.painel-header p { margin: 4px 0 0; font-size: 0.9em; color: #666; }
.badge-global { text-align: center; font-size: 0.82em; color: #555; margin: 0 0 14px 0; }
.badge-global strong { color: #2c3e50; }

.bloco { width: 95%; max-width: 1200px; margin: 0 auto 14px auto; }
.resumo-topo { font-size: 0.98em; color: #333; line-height: 1.6; margin: 6px 0 12px 0; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 10px 0 12px 0; }
.kpis.kpis-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1000px) { .kpis, .kpis.kpis-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .kpis, .kpis.kpis-3 { grid-template-columns: 1fr; } }
.kpi-card { background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 8px; padding: 12px 14px; text-align: center; }
.kpi-label { font-size: 0.78em; color: #5c636a; font-weight: 600; margin-bottom: 6px; }
.kpi-value { font-size: 1.25em; font-weight: 700; color: #212529; line-height: 1.2; }
.kpi-sub { font-size: 0.76em; color: #5c636a; margin-top: 5px; }

.grafico-box { width: 95%; max-width: 1200px; margin: 0 auto 14px auto; }
.grafico-box h2 { font-size: 1.15em; color: #2c3e50; margin: 30px 0 6px 0; }
.grafico-intro { font-size: 0.88em; color: #666; margin: 0 0 12px 0; line-height: 1.5; }
.grafico { width: 100%; height: 440px; }
.resumo-bloco { width: 100%; margin: 12px 0 0; font-size: 0.9em; color: #444; line-height: 1.6; }
.nota-bloco { font-size: 0.8em; color: #666; margin: 6px 0 0; }

.bloco-controls { display: flex; justify-content: flex-start; flex-wrap: wrap; gap: 10px 14px; margin-bottom: 12px; align-items: center; }
.ctrl-label { font-size: 0.75em; color: #6c757d; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; align-self: center; }
.btn-toggle { display: inline-flex; border: 1px solid #cbd5e1; border-radius: 5px; overflow: hidden; flex-wrap: wrap; }
.btn-toggle button { background: #fff; border: none; border-right: 1px solid #cbd5e1; padding: 6px 13px; font-size: 0.85em; cursor: pointer; color: #475569; transition: background 0.15s, color 0.15s; white-space: nowrap; }
.btn-toggle button:last-child { border-right: none; }
.btn-toggle button:hover:not(.active) { background: #f1f5f9; }
.btn-toggle button.active { background: #2563eb; color: #fff; font-weight: 600; }

.tabela-box { width: 100%; margin: 6px 0 0; overflow-x: auto; }
.tabela-alb { border-collapse: collapse; width: 100%; font-size: 0.86em; background: #fff; }
.tabela-alb th, .tabela-alb td { border: 1px solid #dee2e6; padding: 6px 10px; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabela-alb th[scope="col"], .tabela-alb th[scope="row"] { background: #f1f3f5; font-weight: 600; }
.tabela-alb td.esq, .tabela-alb th.esq { text-align: left; }
.tabela-alb .mini { display: block; font-size: 0.78em; color: #64748b; font-weight: normal; }
.tabela-alb .sobe { color: #15803d; }
.tabela-alb .desce { color: #b91c1c; }
.tabela-ficha { max-width: 720px; }
.tabela-ficha td { white-space: normal; }

.lista-bacia { list-style: none; padding: 0; margin: 0 0 8px 0; display: flex; flex-wrap: wrap; gap: 8px 18px; }
.lista-bacia li { font-size: 0.92em; }
.lista-bacia .mini { color: #64748b; font-size: 0.85em; margin-left: 4px; }

#mapa-alb { width: 100%; height: 360px; border-radius: 8px; border: 1px solid #ddd; background: #dce9f2; }

.cta-simulador { width: 95%; max-width: min(1200px, 100%); margin: 30px auto; background: #eef6ff; border: 1px solid #b8daff; border-radius: 8px; padding: 18px 20px; text-align: center; }
.cta-simulador h2 { margin: 0 0 8px 0; font-size: 1.12em; color: #2c3e50; }
.cta-simulador p { margin: 0 0 14px 0; font-size: 0.92em; color: #555; }
.faq-titulo { width: 95%; max-width: 1200px; margin: 30px auto 12px auto; font-size: 1.15em; }
.faq-lista { width: 95%; max-width: 1200px; margin: 0 auto 30px auto; }

@media (max-width: 700px) {
    .grafico { height: 360px; }
    .tabela-alb th, .tabela-alb td { padding: 5px 6px; }
}
/* No telemóvel, as tabelas cabem na largura sem as colunas de menos interesse */
@media (max-width: 600px) {
    .tabela-alb .col-opc { display: none; }
    .tabela-alb th[scope="col"], .tabela-alb td.esq { white-space: normal; }
    .tabela-alb td.esq { overflow-wrap: anywhere; }
    .tabela-alb { font-size: 0.8em; }
    .tabela-alb th, .tabela-alb td { padding: 4px 5px; }
}

/* --- Modo escuro --- */
[data-theme="dark"] .painel-header h1, [data-theme="dark"] .badge-global strong, [data-theme="dark"] .grafico-box h2,
[data-theme="dark"] .kpi-value, [data-theme="dark"] .cta-simulador h2 { color: #e2e8f0; }
[data-theme="dark"] .painel-header p, [data-theme="dark"] .badge-global, [data-theme="dark"] .grafico-intro,
[data-theme="dark"] .kpi-label, [data-theme="dark"] .kpi-sub, [data-theme="dark"] .ctrl-label,
[data-theme="dark"] .nota-bloco, [data-theme="dark"] .lista-bacia .mini { color: #94a3b8; }
[data-theme="dark"] .resumo-topo, [data-theme="dark"] .resumo-bloco, [data-theme="dark"] .cta-simulador p { color: #cbd5e1; }
[data-theme="dark"] .kpi-card { background: #1e293b; border-color: #475569; }
[data-theme="dark"] .btn-toggle { border-color: #475569; }
[data-theme="dark"] .btn-toggle button { background: #1e293b; color: #cbd5e1; border-right-color: #475569; }
[data-theme="dark"] .btn-toggle button:hover:not(.active) { background: #334155; }
[data-theme="dark"] .btn-toggle button.active { background: #2563eb; color: #fff; }
[data-theme="dark"] .tabela-alb { background: #1e293b; }
[data-theme="dark"] .tabela-alb th, [data-theme="dark"] .tabela-alb td { border-color: #475569; color: #e2e8f0; }
[data-theme="dark"] .tabela-alb th[scope="col"], [data-theme="dark"] .tabela-alb th[scope="row"] { background: #0f172a; }
[data-theme="dark"] .tabela-alb .mini { color: #94a3b8; }
[data-theme="dark"] .tabela-alb .sobe { color: #4ade80; }
[data-theme="dark"] .tabela-alb .desce { color: #f87171; }
[data-theme="dark"] #mapa-alb { background: #0f2238; border-color: #475569; }
[data-theme="dark"] .leaflet-control-zoom a { background: #1e293b !important; color: #e2e8f0 !important; border-color: #475569 !important; }
[data-theme="dark"] .leaflet-control-attribution { background: rgba(30,41,59,0.8) !important; color: #94a3b8 !important; }
[data-theme="dark"] .leaflet-control-attribution a { color: #60a5fa !important; }
[data-theme="dark"] .cta-simulador { background: #1e3a5f; border-color: #3b82f6; }
[data-theme="dark"] main a:not(.button-link) { color: #93c5fd; }
