/* ------------------------------------------------------------------ *
 * DVP shared theme — used by both the dashboard and the Manual Test   *
 * page. Tweak the CSS variables below to re-skin the whole app.       *
 * ------------------------------------------------------------------ */
:root {
    /* Darkened forest green background (base tone behind the buti pattern) */
    --bg: #081A10;
    /* Slightly raised panel surfaces, still deep green */
    --panel: #123420;
    --panel-2: #17402a;
    --line: #26543a;
    /* Body text stays white; minor text is a muted off-white/green-gray */
    --text: #ffffff;
    --muted: #a9c2b3;
    /* Flush red accent for buttons, active states, alerts, chart bars */
    --accent: #C41E3A;
    --accent-hover: #a4172f;
    --accent-soft: rgba(196, 30, 58, 0.14);
    /* Fallback note / warning styling built around the red accent */
    --warn-bg: rgba(196, 30, 58, 0.12);
    --warn-border: #C41E3A;
    --warn-text: #f2c6cd;
    --radius: 12px;
    --heading-font: "Playfair Display", Georgia, "Times New Roman", serif;
    --body-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--body-font);
    /* Base color + a faint tiled "buti" (Jamdani dot-flower) motif: a small
       diamond outline with a center dot, 42x42px tile, drawn only in muted
       line color at low opacity so it reads as texture, not decoration. */
    background-color: var(--bg);
    background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='42'%20height='42'%20viewBox='0%200%2042%2042'%3E%3Cg%20fill='none'%20stroke='%2333553C'%20stroke-width='1'%20opacity='0.45'%3E%3Cpolygon%20points='21,16.75%2025.25,21%2021,25.25%2016.75,21'/%3E%3Ccircle%20cx='21'%20cy='21'%20r='1'/%3E%3C/g%3E%3C/svg%3E");
    background-repeat: repeat;
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

/* Headings: classy serif display font, bold, white */
h1, h2, h3 {
    font-family: var(--heading-font);
    color: var(--text);
    font-weight: 700;
    margin: 0;
}

.wrap { max-width: 1040px; margin: 0 auto; padding: 24px 20px 64px; }

/* ------------------------------- Nav ----------------------------- */
.nav {
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 1040px;
    margin: 0 auto;
    padding: 16px 20px 0;
}
.nav .brand {
    font-family: var(--heading-font);
    font-weight: 700;
    font-size: 1.15rem;
    margin-right: 18px;
    color: var(--text);
}
.nav-link {
    text-decoration: none;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid transparent;
}
.nav-link:hover { color: var(--text); }
.nav-link.active {
    color: var(--text);
    background: var(--accent);
    border-color: var(--accent);
}

/* ----------------------------- Header ---------------------------- */
h1 { font-size: 2rem; margin: 0 0 4px; letter-spacing: 0.01em; }
.sub { color: var(--muted); margin: 0 0 26px; font-size: 0.98rem; }
h2 { font-size: 1.15rem; margin: 0 0 14px; }

/* ----------------------------- Panels ---------------------------- */
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px 22px;
    margin-bottom: 22px;
}

.controls { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 6px; }

select, button, input[type="number"] {
    font: inherit;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--panel-2);
    color: var(--text);
}
select:focus, input[type="number"]:focus { outline: none; border-color: var(--accent); }

button, .btn-primary {
    background: var(--accent);
    color: #ffffff;
    font-weight: 600;
    cursor: pointer;
    border: none;
}
button:hover, .btn-primary:hover { background: var(--accent-hover); }
button:disabled, .btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

/* --------------------------- Totals ------------------------------ */
.total { margin-left: auto; text-align: right; }
.total .num { font-size: 1.8rem; font-weight: 700; color: var(--accent); }
.total .lbl { font-size: 0.75rem; color: var(--muted); }

/* --------------------------- Notes ------------------------------- */
.note {
    background: var(--warn-bg);
    border: 1px solid var(--warn-border);
    color: var(--warn-text);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin: 16px 0 0;
}
.caption {
    color: var(--muted);
    font-size: 0.85rem;
    margin: 0 0 18px;
    max-width: 640px;
}

/* --------------------------- Badges ------------------------------ */
.badge {
    display: inline-block;
    font-size: 0.72rem;
    padding: 3px 9px;
    border-radius: 999px;
    font-weight: 600;
    vertical-align: middle;
    margin-left: 8px;
}
.badge.live { background: rgba(102, 214, 154, 0.18); color: #7fe0ac; }
.badge.climatology { background: var(--warn-bg); color: var(--warn-text); }

/* --------------------------- Chart ------------------------------- */
.chart { display: flex; align-items: flex-end; gap: 10px; height: 200px; margin: 20px 0 8px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bar-val { font-size: 0.78rem; color: var(--muted); margin-bottom: 4px; }
.bar {
    width: 100%;
    max-width: 54px;
    background: linear-gradient(180deg, var(--accent), var(--accent-hover));
    border-radius: 6px 6px 0 0;
    min-height: 3px;
    transition: height 0.3s ease;
}
.bar-day { font-size: 0.72rem; color: var(--muted); margin-top: 6px; text-align: center; }

/* --------------------------- Tables ------------------------------ */
table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 0.9rem; }
th, td { padding: 9px 10px; text-align: right; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
td { font-variant-numeric: tabular-nums; }
td.pred { color: var(--accent); font-weight: 700; }

/* --------------------------- Metrics ----------------------------- */
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; }
.metric { background: var(--panel-2); border-radius: 9px; padding: 14px; }
.metric .m-num { font-size: 1.3rem; font-weight: 700; }
.metric .m-lbl { font-size: 0.75rem; color: var(--muted); }

/* ---------------------- Feature importance ----------------------- */
.imp-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; font-size: 0.85rem; }
.imp-name { width: 130px; color: var(--muted); }
.imp-track { flex: 1; background: var(--panel-2); border-radius: 5px; height: 12px; overflow: hidden; }
.imp-fill { height: 100%; background: var(--accent); }
.imp-val { width: 52px; text-align: right; color: var(--muted); }

/* --------------------- Collapsible explainer --------------------- */
details.explainer {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-2);
    padding: 0 16px;
    margin-top: 4px;
}
details.explainer summary {
    cursor: pointer;
    padding: 12px 0;
    font-weight: 600;
    color: var(--text);
    list-style: none;
}
details.explainer summary::-webkit-details-marker { display: none; }
details.explainer summary::before { content: "▸ "; color: var(--accent); }
details.explainer[open] summary::before { content: "▾ "; }
details.explainer .explain-item { padding: 4px 0 14px; }
details.explainer .explain-item h3 { font-size: 0.98rem; margin-bottom: 4px; }
details.explainer .explain-item p { margin: 0; color: var(--muted); font-size: 0.88rem; }

/* --------------------------- Forms ------------------------------- */
.predict-form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; }
.form-group.full { grid-column: 1 / -1; }
.form-actions { grid-column: 1 / -1; }
.btn-primary { padding: 12px 20px; border-radius: 8px; font-size: 0.95rem; }

@media (max-width: 560px) {
    .predict-form { grid-template-columns: 1fr; }
}

/* --------------------- Manual prediction result ------------------ */
.prediction-result {
    margin-top: 22px;
    padding: 22px;
    background: var(--accent-soft);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
}
.prediction-result.hidden { display: none; }
.result-label { font-size: 0.8rem; color: var(--muted); }
.result-value { font-size: 2.6rem; font-weight: 700; color: var(--accent); margin: 4px 0; font-family: var(--heading-font); }
.result-context { font-size: 0.82rem; color: var(--muted); }

.muted { color: var(--muted); }
.loading { color: var(--muted); font-style: italic; }
