@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Sans:wght@300;400;500;700&family=JetBrains+Mono:wght@400;700&display=swap');

/* ─── TOKENS ─────────────────────────────────────────────────── */
:root {
    --bg:          #0a1520;
    --bg2:         #0f1d2b;
    --surface:     #142333;
    --surface2:    #1a2d3e;
    --border:      rgba(230, 126, 34, 0.18);
    --border-hi:   rgba(230, 126, 34, 0.5);
    --accent:      #e67e22;
    --accent2:     #f39c12;
    --accent-dim:  rgba(230, 126, 34, 0.12);
    --hot:         #e74c3c;
    --cold:        #3498db;
    --green:       #27ae60;
    --warn:        #f1c40f;
    --text:        #ecf0f1;
    --muted:       #7f8c8d;
    --dim:         #95a5a6;
    --radius:      16px;
    --radius-lg:   22px;
    --radius-xl:   28px;
    --font-display:'Bebas Neue', sans-serif;
    --font-body:   'DM Sans', system-ui, sans-serif;
    --font-mono:   'JetBrains Mono', 'Consolas', monospace;
    --glow-accent: 0 0 28px rgba(230, 126, 34, 0.25);
    --glow-hot:    0 0 28px rgba(231, 76, 60, 0.2);
    --glow-green:  0 0 28px rgba(39, 174, 96, 0.2);
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
}

/* ─── TEMA CLARO ─────────────────────────────────────────────── */
[data-theme="light"] {
    --bg:          #f0f4f8;
    --bg2:         #e8eef5;
    --surface:     #ffffff;
    --surface2:    #f5f8fb;
    --border:      rgba(230, 126, 34, 0.22);
    --border-hi:   rgba(230, 126, 34, 0.55);
    --text:        #1a2535;
    --muted:       #6b7a8d;
    --dim:         #8e9faf;
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.08);
    --glow-accent: 0 0 20px rgba(230, 126, 34, 0.15);
}
[data-theme="light"] body::before {
    background-image:
        linear-gradient(rgba(0,0,0,.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,.035) 1px, transparent 1px);
}
[data-theme="light"] .clock-box { background: rgba(0,0,0,.04); }
[data-theme="light"] .header-title h1 {
    background: linear-gradient(135deg, var(--text) 40%, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

/* ─── BODY ───────────────────────────────────────────────────── */
body {
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    display: flex;
    flex-direction: column;
    padding: clamp(10px, 1.2vw, 20px);
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(230,126,34,.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(230,126,34,.025) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

body > * { position: relative; z-index: 1; }

/* ─── HEADER ─────────────────────────────────────────────────── */
header {
    display: flex;
    align-items: center;
    gap: clamp(8px, 1vw, 18px);
    margin-bottom: clamp(8px, 1vw, 14px);
    padding-bottom: clamp(7px, .8vw, 12px);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

#logo-l {
    height: clamp(34px, 4.5vw, 60px);
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(230,126,34,.3));
    flex-shrink: 0;
}

.header-title { flex: 1; min-width: 0; }

.header-title h1 {
    font-family: var(--font-display);
    font-size: clamp(18px, 3vw, 46px);
    letter-spacing: .08em;
    line-height: 1;
    background: linear-gradient(135deg, var(--text) 40%, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-title p {
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .2em;
    font-size: clamp(7px, .7vw, 10px);
    font-weight: 500;
    margin-top: 2px;
}

/* ─── NAV ────────────────────────────────────────────────────── */
.header-nav {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.header-nav a, .nav-btn {
    color: var(--muted);
    text-decoration: none;
    font-size: clamp(7px, .62vw, 10px);
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    padding: 5px 9px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: none;
    cursor: pointer;
    transition: color .2s, border-color .2s, background .2s;
    white-space: nowrap;
    font-family: var(--font-body);
}

.header-nav a:hover, .nav-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-dim);
}

.nav-btn-lightning { color: var(--warn) !important; border-color: rgba(241,196,15,.35) !important; }
.nav-btn-lightning:hover { background: rgba(241,196,15,.1) !important; border-color: var(--warn) !important; }

/* ─── BARRA SOLAR ────────────────────────────────────────────── */
.sun-bar {
    display: flex;
    align-items: center;
    gap: clamp(8px, 1vw, 16px);
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: clamp(4px, .5vw, 8px) clamp(10px, 1.2vw, 20px);
    margin-bottom: clamp(4px, .5vw, 8px);
    flex-shrink: 0;
}

.sb-col { display: flex; flex-direction: column; align-items: center; gap: 1px; flex-shrink: 0; }

.sb-lbl {
    font-size: clamp(6px, .55vw, 9px);
    font-weight: 700;
    color: var(--muted);
    letter-spacing: .2em;
    text-transform: uppercase;
}

.sb-val {
    font-family: var(--font-display);
    font-size: clamp(13px, 1.4vw, 22px);
    color: var(--accent);
    letter-spacing: .06em;
    line-height: 1;
}

.sb-track-wrap { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 80px; }

.sun-track { width: 100%; height: 5px; background: rgba(230,126,34,.14); border-radius: 3px; overflow: hidden; }

.sun-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--warn)); border-radius: 3px; transition: width 2s ease; }

.sb-sub {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: clamp(6px, .6vw, 9px);
    color: var(--muted);
}

/* ─── INFO ROW ───────────────────────────────────────────────── */
.info-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: clamp(4px, .5vw, 8px);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.alerts-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(231,76,60,.12);
    border: 1px solid rgba(231,76,60,.35);
    border-radius: 12px;
    padding: 5px 14px 5px 12px;
    flex-shrink: 0;
    animation: fadeUp .3s ease;
    position: relative;
}

.alerts-icon { font-size: 14px; flex-shrink: 0; }

.alerts-content { flex: 1; display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; justify-content: center; }

.alert-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(0,0,0,.25);
    border: 1px solid var(--c, #e67e22);
    border-radius: 50px;
    padding: 2px 9px;
    font-size: clamp(8px, .75vw, 11px);
    color: var(--text);
}
.alert-chip strong { color: var(--c, #e67e22); }
.alert-chip em { font-style: normal; opacity: .8; }
.alert-until { font-family: var(--font-mono); font-size: .85em; opacity: .65; white-space: nowrap; }

.alerts-close {
    background: none; border: none; color: var(--muted); cursor: pointer;
    font-size: 16px; line-height: 1; padding: 0 3px; flex-shrink: 0;
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    transition: color .2s;
}
.alerts-close:hover { color: var(--text); }

.moon-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(52,152,219,.1);
    border: 1px solid rgba(52,152,219,.28);
    border-radius: 12px;
    padding: 5px 16px;
    flex-shrink: 0;
}

.moon-bar-icon { font-size: clamp(14px, 1.5vw, 20px); line-height: 1; }

.moon-bar-name {
    font-family: var(--font-display);
    font-size: clamp(11px, 1.1vw, 17px);
    color: var(--dim);
    letter-spacing: .08em;
    white-space: nowrap;
}

/* ─── RISCO INCÊNDIO ─────────────────────────────────────────── */
.fire-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(231,76,60,.1);
    border: 1px solid rgba(231,76,60,.35);
    border-radius: 12px;
    padding: 5px 14px;
    flex-shrink: 0;
    transition: background .3s, border-color .3s;
}

.fire-pill-icon { font-size: clamp(13px, 1.3vw, 18px); line-height: 1; }

.fire-pill-lbl {
    font-size: clamp(7px, .65vw, 10px);
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .15em;
}

.fire-pill-nivel {
    font-family: var(--font-display);
    font-size: clamp(12px, 1.2vw, 18px);
    letter-spacing: .08em;
    transition: color .3s;
}

/* ─── DASHBOARD GRID ─────────────────────────────────────────── */
.dashboard {
    display: grid;
    grid-template-columns: 1.35fr 1.4fr 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: clamp(7px, .9vw, 14px);
    flex-grow: 1;
    min-height: 0;
}

/* ─── CARDS ──────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: clamp(12px, 1.5vw, 26px);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: border-color .3s;
    animation: fadeUp .45s ease both;
}

.card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(circle at 100% 0%, rgba(230,126,34,.06) 0%, transparent 55%);
    pointer-events: none;
}

.card:hover { border-color: var(--border-hi); }

.card-temp      { grid-row: span 2; justify-content: space-between; padding: clamp(16px, 1.8vw, 34px); }
.card-webcam    { padding: clamp(10px, 1.2vw, 18px); }
.card-forecast  { grid-column: span 3; }

.card:nth-child(1) { animation-delay: .04s; }
.card:nth-child(2) { animation-delay: .08s; }
.card:nth-child(3) { animation-delay: .12s; }
.card:nth-child(4) { animation-delay: .16s; }
.card:nth-child(5) { animation-delay: .20s; }

/* ─── CARD LABEL ─────────────────────────────────────────────── */
.card-label {
    font-size: clamp(7px, .72vw, 11px);
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .2em;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.card-dot {
    width: 5px; height: 5px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 6px var(--accent);
    flex-shrink: 0;
    display: inline-block;
}

/* ─── VALORES ────────────────────────────────────────────────── */
.value-xl {
    font-family: var(--font-display);
    font-size: clamp(44px, 8vw, 120px);
    line-height: .85;
    color: var(--accent);
    text-shadow: var(--glow-accent);
    letter-spacing: .02em;
}

.value-lg {
    font-family: var(--font-display);
    font-size: clamp(30px, 4.5vw, 66px);
    line-height: .9;
    letter-spacing: .02em;
}

.value-md {
    font-family: var(--font-display);
    font-size: clamp(22px, 3.2vw, 48px);
    line-height: .9;
    letter-spacing: .02em;
}

.mono { font-family: var(--font-mono); font-size: clamp(9px, .95vw, 13px); }

.feels-row {
    display: flex;
    align-items: baseline;
    gap: clamp(6px, .8vw, 12px);
    margin-top: 5px;
    color: var(--muted);
    font-size: clamp(10px, 1.1vw, 16px);
    font-weight: 500;
}

.feels-badge {
    display: inline-flex;
    align-items: center;
    background: var(--accent-dim);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: clamp(4px, .5vw, 8px) clamp(8px, 1vw, 16px);
    font-size: clamp(9px, 1.1vw, 15px);
    color: var(--accent2);
    margin: clamp(5px, .7vw, 10px) 0;
    font-weight: 500;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: clamp(10px, 1.3vw, 19px);
    font-weight: 700;
    padding: clamp(4px, .5vw, 8px) 0;
    border-top: 1px solid var(--border);
}

.time-small { font-family: var(--font-mono); font-size: clamp(6px, .65vw, 10px); color: var(--muted); font-weight: 400; margin-left: 4px; }

.trend-up   { color: var(--hot);   font-size: clamp(11px, 1.2vw, 18px); }
.trend-down { color: var(--cold);  font-size: clamp(11px, 1.2vw, 18px); }
.trend-flat { color: var(--muted); font-size: clamp(11px, 1.2vw, 18px); }

/* ─── RELÓGIO ────────────────────────────────────────────────── */
.clock-box {
    background: rgba(0,0,0,.3);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: clamp(8px, 1vw, 16px);
    text-align: center;
    flex-shrink: 0;
}

#v_time_big {
    font-family: var(--font-display);
    font-size: clamp(34px, 5.5vw, 88px);
    letter-spacing: .08em;
    line-height: 1;
    color: var(--accent);
}

#v_date_big {
    font-family: var(--font-mono);
    font-size: clamp(10px, 1vw, 15px);
    color: var(--muted);
    margin-top: 4px;
    letter-spacing: .12em;
}

/* ─── INTERIOR ───────────────────────────────────────────────── */
.interior-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,.2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: clamp(4px, .5vw, 8px) clamp(7px, .9vw, 12px);
    flex-shrink: 0;
}

.interior-label { font-size: clamp(7px, .65vw, 10px); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .18em; flex-shrink: 0; }
.interior-vals  { font-family: var(--font-mono); font-size: clamp(9px, .9vw, 13px); color: var(--dim); flex: 1; }
.interior-delta { font-family: var(--font-display); font-size: clamp(11px, 1.2vw, 19px); font-weight: 700; flex-shrink: 0; }

/* ─── CONFORTO / UV / BEAUFORT ───────────────────────────────── */
.comfort-badge {
    font-family: var(--font-mono);
    font-size: clamp(8px, .78vw, 11px);
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    margin: clamp(3px, .3vw, 5px) 0;
    flex-shrink: 0;
    transition: color .4s;
}

.uv-badge {
    font-family: var(--font-mono);
    font-size: clamp(8px, .78vw, 11px);
    font-weight: 700;
    letter-spacing: .06em;
    color: var(--muted);
    margin: clamp(3px, .3vw, 5px) 0;
    flex-shrink: 0;
    transition: color .4s;
}

.beaufort-label {
    font-family: var(--font-mono);
    font-size: clamp(7px, .7vw, 10px);
    color: var(--muted);
    letter-spacing: .05em;
    margin: clamp(2px, .2vw, 4px) 0;
    flex-shrink: 0;
}

.wdir-text {
    font-family: var(--font-display);
    font-size: clamp(11px, 1.2vw, 18px);
    color: var(--dim);
    letter-spacing: .1em;
    margin-top: 2px;
}

/* ─── CARD DIVIDIDO ──────────────────────────────────────────── */
.card-split { flex-direction: row; align-items: stretch; gap: 0; }

.split-item { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; padding: 0 clamp(5px, .8vw, 12px); }
.split-item:first-child { padding-left: 0; }
.split-item:last-child  { padding-right: 0; }

.divider-v { width: 1px; background: var(--border); align-self: stretch; flex-shrink: 0; }

.split-item .value-lg { font-size: clamp(24px, 3.4vw, 55px); line-height: .9; }
.split-item .value-md { font-size: clamp(18px, 2.5vw, 40px); line-height: .9; }
.split-item .stat-row  { font-size: clamp(9px, 1vw, 14px); padding: clamp(3px, .3vw, 5px) 0; }
.split-item .mono      { font-size: clamp(8px, .8vw, 11px); }

/* ─── SPARKLINES ─────────────────────────────────────────────── */
.sparkline-canvas {
    display: block;
    width: 100%;
    height: 20px;
    margin-top: 5px;
    opacity: 0.75;
    flex-shrink: 0;
    margin-top: auto;
}

/* ─── ROSA DOS VENTOS ────────────────────────────────────────── */
.wind-rose-svg {
    width: 100%;
    max-width: 80px;
    height: 80px;
    margin: 4px auto 0;
    display: block;
    flex-shrink: 0;
    overflow: visible;
}

/* ─── WEBCAM CARD ────────────────────────────────────────────── */
.card-webcam { gap: 6px; }

.webcam-frame {
    flex: 1;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    cursor: pointer;
    min-height: 0;
}

.webcam-frame:hover .webcam-overlay { opacity: 1; }

.webcam-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.webcam-offline {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--muted);
    font-size: clamp(10px, 1vw, 14px);
}

.wc-icon { font-size: clamp(28px, 3vw, 44px); opacity: .4; }

.webcam-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,.6) 0%, transparent 50%);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 8px 10px;
    opacity: 0;
    transition: opacity .25s;
}

.webcam-frame:hover .webcam-overlay { opacity: 1; }

.webcam-label-text {
    font-family: var(--font-mono);
    font-size: clamp(8px, .75vw, 11px);
    color: rgba(255,255,255,.8);
    letter-spacing: .1em;
}

.webcam-fs-hint {
    font-size: clamp(7px, .68vw, 10px);
    color: rgba(255,255,255,.6);
    letter-spacing: .08em;
}

/* ─── PREVISÃO ───────────────────────────────────────────────── */
.forecast-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 5px;
    flex-shrink: 0;
}

.forecast-tabs { display: flex; gap: 4px; }

.f-tab {
    background: var(--accent-dim);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--muted);
    cursor: pointer;
    font-size: clamp(7px, .62vw, 10px);
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: 3px 9px;
    transition: all .2s;
    white-space: nowrap;
    font-family: var(--font-body);
}

.f-tab:hover  { color: var(--accent); border-color: var(--border-hi); }
.f-tab.active { background: var(--accent); color: #fff; border-color: transparent; }

.forecast-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    overflow: hidden;
    gap: clamp(5px, .6vw, 10px);
    flex-grow: 1;
    align-content: start;
}

.forecast-day {
    background: var(--accent-dim);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: clamp(8px, .9vw, 16px) clamp(5px, .6vw, 12px);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    transition: background .2s, border-color .2s, transform .15s;
}

.forecast-day:hover { background: rgba(230,126,34,.18); border-color: var(--border-hi); transform: translateY(-2px); }

.f-dia { font-family: var(--font-display); font-size: clamp(13px, 1.3vw, 20px); letter-spacing: .1em; color: var(--accent2); }
.f-date { font-family: var(--font-mono); font-size: clamp(7px, .65vw, 10px); color: var(--muted); }

.f-icon-wrap { line-height: 1; }
.f-icon-img  { width: clamp(32px, 3.5vw, 56px); height: auto; display: block; margin: 0 auto; }
.f-icon-emoji { font-size: clamp(26px, 3vw, 48px); line-height: 1; display: block; }

.f-desc { font-size: clamp(7px, .7vw, 11px); color: var(--muted); line-height: 1.3; }

.f-temps { font-family: var(--font-display); font-size: clamp(13px, 1.3vw, 20px); display: flex; gap: clamp(3px, .4vw, 8px); }
.f-max { color: var(--hot); }
.f-min { color: var(--cold); }

.f-prob { font-family: var(--font-mono); font-size: clamp(8px, .8vw, 12px); color: var(--cold); opacity: .85; }

.f-wind-info { font-family: var(--font-mono); font-size: clamp(7px, .65vw, 10px); color: var(--muted); white-space: nowrap; }

.f-loading { color: var(--muted); font-size: clamp(9px, .85vw, 12px); padding: 8px; }
.f-error   { color: var(--muted); font-size: clamp(9px, .85vw, 12px); }

/* ─── PREVISÃO HORÁRIA ───────────────────────────────────────── */
.hourly-scroll {
    display: flex;
    gap: clamp(4px, .55vw, 8px);
    overflow-x: auto;
    padding-bottom: 4px;
    flex-grow: 1;
    align-items: flex-start;
    scrollbar-width: thin;
    scrollbar-color: var(--border-hi) transparent;
}

.hourly-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    background: var(--accent-dim);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: clamp(5px, .6vw, 10px) clamp(5px, .6vw, 9px);
    flex-shrink: 0;
    min-width: clamp(40px, 4.5vw, 60px);
    transition: border-color .2s;
}

.hourly-slot:hover { border-color: var(--border-hi); }
.h-time { font-family: var(--font-mono); font-size: clamp(7px, .68vw, 10px); color: var(--muted); white-space: nowrap; }
.h-icon { font-size: clamp(14px, 1.6vw, 24px); line-height: 1; }
.h-temp { font-family: var(--font-display); font-size: clamp(11px, 1.2vw, 18px); color: var(--accent2); }
.h-prob { font-family: var(--font-mono); font-size: clamp(6px, .6vw, 9px); color: var(--cold); opacity: .85; }

/* ─── LIVE DOT ───────────────────────────────────────────────── */
.live-dot {
    display: inline-block;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 7px var(--green);
    animation: pulse 2s infinite;
    flex-shrink: 0;
}

@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .5; transform: scale(.6); } }

/* ─── RODAPÉ ─────────────────────────────────────────────────── */
.site-footer {
    text-align: center;
    font-family: var(--font-mono);
    font-size: clamp(8px, .7vw, 11px);
    color: var(--muted);
    letter-spacing: .12em;
    padding: clamp(4px, .5vw, 8px) 0 2px;
    flex-shrink: 0;
    opacity: .55;
}

/* ─── STATUS PILL ────────────────────────────────────────────── */
.status-pill {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 4px 14px;
    font-size: clamp(7px, .65vw, 10px);
    font-family: var(--font-mono);
    color: var(--muted);
    z-index: 50;
    opacity: 0;
    transition: opacity .3s;
    pointer-events: none;
    white-space: nowrap;
}

.status-pill.show { opacity: 1; }
.status-pill.ok   { color: var(--green); border-color: rgba(39,174,96,.3); }
.status-pill.err  { color: var(--hot);   border-color: rgba(231,76,60,.3); }

/* ─── MODAIS ─────────────────────────────────────────────────── */
.modal-bg {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.9);
    backdrop-filter: blur(10px);
    z-index: 999;
    justify-content: center;
    align-items: center;
}

.modal-bg.open { display: flex; animation: fadeIn .2s ease; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.fechar-btn {
    position: absolute;
    top: 16px;
    right: 22px;
    color: var(--dim);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    transition: color .2s, transform .2s;
    font-weight: 300;
    background: none;
    border: none;
}

.fechar-btn:hover { color: var(--hot); transform: scale(1.15); }

/* Webcam modal */
.webcam-modal-img {
    max-width: 94vw;
    max-height: 90vh;
    border-radius: 16px;
    border: 2px solid var(--border-hi);
    box-shadow: 0 0 60px rgba(230,126,34,.2);
    display: block;
}

/* Charts panel */
.charts-panel {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xl);
    padding: clamp(20px, 2.5vw, 38px);
    width: min(860px, 92vw);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
    animation: fadeUp .25s ease;
    box-shadow: 0 8px 48px rgba(0,0,0,.6);
}

.charts-title { font-family: var(--font-display); font-size: clamp(16px, 2vw, 28px); letter-spacing: .1em; color: var(--accent); }

.charts-fechar { position: absolute; top: 14px; right: 18px; font-size: 20px; background: none; border: none; color: var(--muted); cursor: pointer; transition: color .2s; }
.charts-fechar:hover { color: var(--text); }

.charts-tabs { display: flex; gap: 6px; flex-wrap: wrap; }

.chart-tab {
    background: var(--accent-dim);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--muted);
    cursor: pointer;
    font-size: clamp(8px, .78vw, 12px);
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: 5px 12px;
    transition: all .2s;
    font-family: var(--font-body);
}

.chart-tab:hover  { color: var(--accent); border-color: var(--border-hi); }
.chart-tab.active { background: var(--accent); color: #fff; border-color: transparent; }

.chart-container { flex: 1; min-height: 260px; position: relative; }

.chart-note { font-family: var(--font-mono); font-size: clamp(7px, .7vw, 10px); color: var(--muted); text-align: right; }

/* Modal trovoada */
.lightning-panel {
    width: 100vw; height: 100vh;
    display: flex; flex-direction: column; overflow: hidden;
    background: var(--surface);
    animation: fadeUp .25s ease;
}

.lightning-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 18px;
    border-bottom: 1px solid rgba(241,196,15,.2);
    background: rgba(241,196,15,.05);
    flex-shrink: 0;
}

.lightning-title { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-size: clamp(14px, 1.6vw, 22px); letter-spacing: .08em; color: var(--warn); }
.lightning-bolt { font-size: 1.4em; animation: boltPulse 2s ease-in-out infinite; }
.lightning-sub { font-family: var(--font-mono); font-size: clamp(7px, .68vw, 10px); color: var(--muted); letter-spacing: .12em; font-weight: 400; }

@keyframes boltPulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

.lightning-map-wrap { flex: 1; position: relative; background: #0a1520; min-height: 0; }
.lightning-iframe { width: 100%; height: 100%; border: none; display: block; }

.lightning-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 7px 18px;
    border-top: 1px solid rgba(241,196,15,.15);
    background: rgba(0,0,0,.2);
    font-size: clamp(7px, .68vw, 10px);
    color: var(--muted);
    flex-shrink: 0; gap: 10px; flex-wrap: wrap;
}

.lightning-ext { color: var(--warn); text-decoration: none; font-family: var(--font-mono); font-size: clamp(7px, .65vw, 10px); letter-spacing: .1em; white-space: nowrap; transition: opacity .2s; }
.lightning-ext:hover { opacity: .7; }

/* Modal ambiente */
.ambiente-panel {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xl);
    padding: clamp(22px, 2.8vw, 42px);
    width: min(600px, 92vw);
    display: flex; flex-direction: column; gap: 18px;
    position: relative;
    animation: fadeUp .25s ease;
    box-shadow: 0 8px 48px rgba(0,0,0,.6);
}

.ambiente-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.aq-card { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: clamp(12px, 1.6vw, 22px); text-align: center; display: flex; flex-direction: column; gap: 5px; }
.aq-label { font-size: clamp(8px, .75vw, 11px); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .18em; }
.aq-value { font-family: var(--font-display); font-size: clamp(32px, 4.5vw, 60px); line-height: .9; color: var(--accent); transition: color .4s; }
.aq-risk  { font-family: var(--font-mono); font-size: clamp(8px, .78vw, 12px); color: var(--dim); letter-spacing: .06em; }
.aq-source { font-family: var(--font-mono); font-size: clamp(7px, .67vw, 10px); color: var(--muted); text-align: center; opacity: .7; }

/* ─── SCROLLBAR ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 2px; }

/* ─── RESPONSIVO ─────────────────────────────────────────────── */
@media (max-width: 1100px) {
    body { overflow-y: auto; height: auto; min-height: 100vh; }
    .dashboard {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto;
    }
    .card-temp     { grid-row: auto; }
    .card-forecast { grid-column: span 2; }
}

@media (max-width: 640px) {
    .dashboard         { grid-template-columns: 1fr; }
    .card-forecast     { grid-column: span 1; }
    .forecast-grid     { grid-template-columns: repeat(3, 1fr); }
    .side-panel        { width: 100vw; }
}

/* ═══════════════════════════════════════════════════════════════
   BACKOFFICE / ADMIN
═══════════════════════════════════════════════════════════════ */

body.admin-body { overflow-y: auto; height: auto; min-height: 100vh; padding: 0; display: block; }

.admin-topbar {
    position: sticky; top: 0; z-index: 200;
    background: var(--bg2); border-bottom: 2px solid var(--border);
    padding: 0 clamp(16px,3vw,40px);
    display: flex; align-items: center; gap: 16px; height: 60px;
    backdrop-filter: blur(12px);
}

.admin-topbar .brand { font-family: var(--font-display); font-size: 1.5rem; letter-spacing: .1em; color: var(--accent); flex: 1; display: flex; align-items: center; gap: 10px; }
.admin-topbar .brand span { color: var(--muted); font-size: .85rem; letter-spacing: .05em; }

.admin-wrap { max-width: 1100px; margin: 0 auto; padding: clamp(20px,3vw,40px) clamp(16px,3vw,40px); }

.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }

.section-title {
    font-family: var(--font-display); font-size: clamp(18px,2.5vw,28px);
    letter-spacing: .08em; color: var(--text);
    display: flex; align-items: center; gap: 10px;
}

.section-title::before { content: ''; width: 4px; height: 1.2em; background: var(--accent); border-radius: 2px; display: inline-block; }

.station-list { display: flex; flex-direction: column; gap: 14px; }

.station-card {
    background: var(--surface); border: 1.5px solid var(--border);
    border-radius: var(--radius-lg); padding: 20px 24px;
    display: flex; align-items: flex-start; gap: 16px;
    transition: border-color .2s, box-shadow .2s; position: relative;
}

.station-card:hover { border-color: var(--border-hi); box-shadow: var(--shadow-card); }
.station-card.is-active { border-color: var(--accent); }
.station-card.is-active::before { content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%; background: var(--accent); border-radius: var(--radius-lg) 0 0 var(--radius-lg); }

.station-status { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex-shrink: 0; margin-top: 5px; }
.station-status.online { background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse 2s infinite; }
.station-status.active { background: var(--accent); box-shadow: 0 0 8px var(--accent); }

.station-info { flex: 1; min-width: 0; }
.station-info h3 { font-family: var(--font-display); font-size: clamp(16px,2vw,22px); letter-spacing: .05em; color: var(--text); display: flex; align-items: center; gap: 10px; }
.badge-ativa { font-family: var(--font-body); font-size: .65rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; background: var(--accent-dim); color: var(--accent); border: 1px solid var(--border-hi); padding: 2px 8px; border-radius: 50px; }
.station-info .localidade { color: var(--muted); font-size: .85rem; margin-top: 3px; }
.station-info .url { font-family: var(--font-mono); font-size: .72rem; color: var(--dim); margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.station-actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }

.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; border-radius: 9px; border: 1.5px solid transparent;
    font-family: var(--font-body); font-size: .8rem; font-weight: 600;
    cursor: pointer; transition: background .2s, border-color .2s, transform .15s;
    text-decoration: none; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: #cf6d17; border-color: #cf6d17; }
.btn-outline { background: transparent; color: var(--dim); border-color: var(--border); }
.btn-outline:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }
.btn-danger  { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-danger:hover { color: var(--hot); border-color: rgba(231,76,60,.4); background: rgba(231,76,60,.08); }
.btn-sm { padding: 5px 10px; font-size: .75rem; }

.side-panel {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: clamp(340px,45vw,580px);
    background: var(--bg2); border-left: 2px solid var(--border);
    z-index: 300; display: flex; flex-direction: column;
    transform: translateX(100%); transition: transform .35s cubic-bezier(.4,0,.2,1);
    box-shadow: -10px 0 40px rgba(0,0,0,.5);
}
.side-panel.open { transform: translateX(0); }

.side-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 290; opacity: 0; pointer-events: none; transition: opacity .3s; }
.side-overlay.open { opacity: 1; pointer-events: all; }

.side-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.side-header h2 { font-family: var(--font-display); font-size: 1.4rem; letter-spacing: .07em; color: var(--accent); }
.side-body { flex: 1; overflow-y: auto; padding: 24px; }
.side-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; flex-shrink: 0; }

.form-section { font-size: .65rem; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; color: var(--accent); margin: 20px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row.full { grid-template-columns: 1fr; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .15em; color: var(--muted); }
.form-group input, .form-group select { padding: 10px 12px; border-radius: 9px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); font-family: var(--font-body); font-size: .88rem; outline: none; transition: border-color .2s, box-shadow .2s; }
.form-group input:focus, .form-group select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(230,126,34,.15); }

.webcam-entry { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px; display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: end; margin-bottom: 8px; }
.webcam-entry .form-group { margin: 0; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--surface2); border: 1px solid var(--border); border-radius: 50px; padding: 10px 22px; font-size: .85rem; font-weight: 600; color: var(--text); z-index: 400; opacity: 0; transition: opacity .3s, transform .3s; pointer-events: none; white-space: nowrap; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok  { color: var(--green); border-color: rgba(39,174,96,.35); }
.toast.err { color: var(--hot);   border-color: rgba(231,76,60,.35); }

.confirm-modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.8); z-index: 500; justify-content: center; align-items: center; }
.confirm-modal.open { display: flex; animation: fadeIn .2s ease; }
.confirm-box { background: var(--surface2); border: 1.5px solid var(--border-hi); border-radius: var(--radius-lg); padding: 32px; max-width: 400px; width: 90vw; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.confirm-box h3 { font-family: var(--font-display); font-size: 1.4rem; letter-spacing: .08em; margin-bottom: 10px; color: var(--hot); }
.confirm-box p  { color: var(--muted); font-size: .9rem; margin-bottom: 24px; }
.confirm-box .actions { display: flex; gap: 10px; justify-content: center; }

/* ─── MINI PAINEL ────────────────────────────────────────────── */
body.mini-body { overflow-y: auto; height: auto; min-height: 100vh; padding: clamp(12px,3vw,22px); display: block; }

.mini-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: clamp(12px,2vw,18px); border-bottom: 1px solid var(--border); margin-bottom: clamp(14px,2vw,20px); }
.mini-header h1 { font-family: var(--font-display); font-size: clamp(22px,5vw,38px); letter-spacing: .08em; background: linear-gradient(135deg, var(--text) 40%, var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.mini-time { font-family: var(--font-display); font-size: clamp(28px,6vw,50px); letter-spacing: .06em; color: var(--accent); }
.mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(10px,2vw,16px); }
.mini-card { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius); padding: clamp(14px,3vw,22px); }
.mini-label { font-size: clamp(9px,1.5vw,12px); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .18em; margin-bottom: 8px; }
.mini-val { font-family: var(--font-display); font-size: clamp(34px,7.5vw,60px); line-height: .9; }
.mini-sub { font-family: var(--font-mono); font-size: clamp(10px,1.7vw,13px); color: var(--muted); margin-top: 6px; }
