/* EnergieSpotter — Dark Dashboard Theme */

:root {
    --bg:           #0a0e17;
    --bg-secondary: #0f1521;
    --surface:      #141c2e;
    --surface-2:    #1a2540;
    --border:       #1f2d48;
    --border-hover: #2a3f66;

    --text-primary:  #e8eef7;
    --text-secondary: #8fa3c8;
    --text-muted:    #4d6080;

    --accent:        #f59e0b;
    --accent-hover:  #d97706;
    --accent-subtle: rgba(245, 158, 11, 0.12);

    --success:       #22c55e;
    --success-bg:    rgba(34, 197, 94, 0.1);
    --danger:        #ef4444;
    --danger-bg:     rgba(239, 68, 68, 0.1);
    --warning:       #eab308;
    --warning-bg:    rgba(234, 179, 8, 0.1);

    --radius:        8px;
    --radius-lg:     12px;
    --font:          'Inter', 'Segoe UI', system-ui, sans-serif;
    --font-mono:     'JetBrains Mono', 'Fira Code', monospace;

    --navbar-h:      56px;
    --transition:    0.18s ease;
}

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

html { font-size: 15px; }

body {
    background: var(--bg);
    color: var(--text-primary);
    font-family: var(--font);
    line-height: 1.55;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

/* ── Navbar ── */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--navbar-h);
    background: rgba(10, 14, 23, 0.92);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
}
.navbar-inner {
    max-width: 1440px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 0 1.5rem;
}
.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
    flex-shrink: 0;
}
.brand-icon { font-size: 1.25rem; }
.navbar-menu { display: flex; gap: 0.25rem; flex: 1; }
.navbar-actions { display: flex; gap: 0.5rem; align-items: center; }

.nav-link {
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition);
    text-decoration: none;
}
.nav-link:hover { background: var(--surface-2); color: var(--text-primary); }
.nav-link.active { background: var(--accent-subtle); color: var(--accent); }

/* ── Container & layout ── */
.container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 1.75rem;
    gap: 1rem;
}
.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}
.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.2rem;
}

/* ── KPI grid ── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.75rem;
}
@media (max-width: 900px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }

.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    transition: border-color var(--transition);
}
.kpi-card:hover { border-color: var(--border-hover); }
.kpi-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.5rem;
}
.kpi-value {
    font-size: 1.6rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}
.kpi-sub {
    font-size: 0.8rem;
    margin-top: 0.3rem;
}

/* ── Dashboard grid ── */
.dashboard-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.5rem;
    align-items: start;
}
@media (max-width: 1100px) { .dashboard-grid { grid-template-columns: 1fr; } }

/* ── Cards ── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.card-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.card-link {
    font-size: 0.8rem;
    color: var(--accent);
}

/* ── Performers list ── */
.performer-list { list-style: none; }
.performer-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
}
.performer-item:last-child { border-bottom: none; }
.performer-ticker {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}
.performer-name {
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.performer-stats {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
.performer-change { font-weight: 600; }

/* ── Status list ── */
.status-list { list-style: none; }
.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.625rem 1.25rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}
.status-item:last-child { border-bottom: none; }
.status-label { color: var(--text-secondary); }
.status-value { font-variant-numeric: tabular-nums; }

/* ── Sentiment cards ── */
.sentiment-cards {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.sentiment-card {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}
.sentiment-card:last-child { border-bottom: none; }
.sentiment-card:hover { background: var(--surface-2); }

.sentiment-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.5rem;
}
.sc-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.sc-prices {
    display: flex;
    flex-direction: column;
}
.sc-price {
    font-size: 0.95rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.sc-change {
    font-size: 0.8rem;
    font-weight: 600;
}
.sc-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.4rem;
}
.sc-badges {
    display: flex;
    gap: 0.4rem;
}
.sc-toelichting {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0.4rem 0;
}
.sc-pnl {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.4rem;
}

/* ── Temperatuurmeter ── */
.temp-gauge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.temp-gauge-bar {
    width: 80px;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}
.temp-gauge-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}
.temp-score {
    font-size: 0.8rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Temperatuurbadge in tabel */
.temp-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
}
.temp-badge.temp-1,  .temp-badge.temp-2  { background: #ef4444; }
.temp-badge.temp-3,  .temp-badge.temp-4  { background: #f97316; }
.temp-badge.temp-5,  .temp-badge.temp-6  { background: #eab308; }
.temp-badge.temp-7,  .temp-badge.temp-8  { background: #84cc16; }
.temp-badge.temp-9,  .temp-badge.temp-10 { background: #22c55e; }

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2em 0.55em;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.badge-kopen    { background: var(--success-bg); color: var(--success); }
.badge-vasthouden { background: var(--warning-bg); color: var(--warning); }
.badge-verkopen { background: var(--danger-bg);  color: var(--danger); }

.badge-sentiment-positief { background: var(--success-bg); color: var(--success); }
.badge-sentiment-neutraal { background: rgba(139,148,158,0.15); color: #8b949e; }
.badge-sentiment-negatief { background: var(--danger-bg);  color: var(--danger); }

/* ── Ticker badge ── */
.ticker-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2em 0.6em;
    background: var(--accent-subtle);
    color: var(--accent);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 5px;
    font-size: 0.8rem;
    font-weight: 700;
    font-family: var(--font-mono);
    letter-spacing: 0.03em;
    flex-shrink: 0;
}

/* ── Watchlist grid ── */
.watchlist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 1rem;
}
.watchlist-card { padding: 1.25rem; }
.watchlist-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
}
.watchlist-ticker-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.company-name { font-size: 0.85rem; }
.watchlist-price-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.current-price {
    font-size: 1rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.watchlist-sentiment { margin-bottom: 0.75rem; }
.sentiment-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}
.sentiment-toelichting {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
}
.watchlist-reason {
    font-size: 0.82rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    margin-bottom: 0.75rem;
    display: flex;
    gap: 0.4rem;
}
.watchlist-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}
.label-small {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    white-space: nowrap;
    margin-top: 0.1rem;
}

/* ── Table ── */
.table-responsive { overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--surface-2); }
.table .text-right { text-align: right; }
.table .text-center { text-align: center; }
.table-actions {
    text-align: right;
    white-space: nowrap;
    vertical-align: middle;
}
.table-actions .btn { margin-left: 0.3rem; }

/* ── Chart period selector ── */
.period-btn {
    padding: 0.2rem 0.65rem;
    font-size: 0.72rem;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.period-btn:hover { background: var(--surface-2); color: var(--text); }
.period-btn.period-active {
    background: #f59e0b;
    color: #fff;
    border-color: #f59e0b;
    box-shadow: 0 1px 4px rgba(59,130,246,0.4);
}

/* ── Formulieren ── */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    padding: 1.25rem;
}
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.form-group-full { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.required { color: var(--danger); }

.form-control {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    padding: 0.6rem 0.875rem;
    font-size: 0.9rem;
    font-family: var(--font);
    width: 100%;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
textarea.form-control { resize: vertical; min-height: 72px; }

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text-primary); border-color: var(--border-hover); }

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.25);
}
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }

/* ── Alerts ── */
.alert {
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    border: 1px solid transparent;
}
.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border-color: rgba(34, 197, 94, 0.2);
}
.alert-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.2);
}

/* ── Modal ── */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}
.modal-content {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 32px 80px rgba(0,0,0,0.6);
}
.modal-content h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}
.modal-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
    line-height: 1.6;
}

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ── Utility ── */
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted   { color: var(--text-muted); }
.text-right   { text-align: right; }
.text-center  { text-align: center; }
[hidden] { display: none !important; }

/* ── Smalle schermen: navigatie mag niet breder zijn dan het scherm ── */
@media (max-width: 640px) {
    .navbar { height: auto; }
    .navbar-inner { flex-wrap: wrap; gap: 0.25rem 1rem; padding: 0.5rem 1rem; }
    .navbar-menu { order: 3; flex-basis: 100%; overflow-x: auto; }
    .navbar-actions { margin-left: auto; }
    .container { padding: 1.25rem 1rem; }
}

/* ── Verbruikspagina ── */
.usage-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
    margin-bottom: 1rem;
}
.segmented {
    display: inline-flex;
    flex-wrap: wrap;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2px;
    gap: 2px;
}
.segmented-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: var(--font);
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}
.segmented-btn:hover { background: var(--surface-2); color: var(--text-primary); }
.segmented-btn.is-active { background: var(--accent-subtle); color: var(--accent); }

.usage-nav { display: flex; align-items: center; gap: 0.4rem; }
.usage-date { width: auto; padding: 0.35rem 0.6rem; font-size: 0.85rem; color-scheme: dark; }
.usage-mode { display: flex; align-items: center; gap: 0.4rem; }

.info-btn {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
}
.info-btn:hover, .info-btn[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); }
.info-text {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    max-width: 60rem;
}
.info-icon { cursor: help; color: var(--text-secondary); text-transform: none; }

.usage-chart-card { margin-bottom: 1.5rem; padding: 1rem; transition: opacity var(--transition); }
.usage-chart-card.is-loading { opacity: 0.55; }
.chart-box { position: relative; width: 100%; height: 380px; }

.usage-totals-note { font-size: 0.8rem; }
.totals-table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.totals-table .pct { display: block; font-size: 0.72rem; color: var(--text-muted); }
.totals-table tr.is-current td:first-child { color: var(--accent); font-weight: 600; }

@media (max-width: 640px) {
    .chart-box { height: 300px; }
    .usage-chart-card { padding: 0.5rem; }
    .usage-controls { gap: 0.5rem; }
    .usage-nav { width: 100%; }
    .usage-date { flex: 1; min-width: 0; }
    .segmented-btn { padding: 0.4rem 0.6rem; }
    .card-header { flex-wrap: wrap; gap: 0.25rem; }
}

/* ── Syncstatus en overzicht ── */
.alert-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border-color: rgba(234, 179, 8, 0.25);
}
.sync-bar { background: var(--bg-secondary); border-bottom: 1px solid var(--border); font-size: 0.8rem; }
.sync-bar-inner { max-width: 1440px; margin: 0 auto; padding: 0.4rem 1.5rem; display: flex; gap: 1rem; flex-wrap: wrap; }
.sync-bar-inner .alert { margin: 0.2rem 0; width: 100%; }
.sync-status { color: var(--text-secondary); }
.sync-status.is-stale { color: var(--warning); }
.sync-feedback.is-ok { color: var(--success); }
.sync-feedback.is-error { color: var(--danger); }

.overview-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
@media (max-width: 900px) { .overview-tiles { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .overview-tiles { grid-template-columns: 1fr; } }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.1rem 1.25rem; }
.tile-title { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary); font-weight: 600; }
.tile-period { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.6rem; }
.tile-metric { display: block; padding: 0.45rem 0; border-top: 1px solid var(--border); color: var(--text-primary); }
.tile-metric:hover { color: var(--text-primary); background: var(--surface-2); }
.tile-metric-label { display: block; font-size: 0.75rem; color: var(--text-secondary); }
.tile-metric-value { font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile-metric-unit { font-size: 0.8rem; font-weight: 400; color: var(--text-secondary); }
.tile-pct { float: right; font-size: 0.85rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.tile-pct.good { color: var(--success); }
.tile-pct.bad { color: var(--danger); }
.tile-pct.na, .tile-pct.flat { color: var(--text-muted); }
.tile-note { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.4rem; }

/* ── Isolatie-effect ── */
.insulation .info-text { margin-bottom: 1rem; }
.insulation .card { margin-bottom: 1.5rem; }
.chart-box-short { height: 260px; }
.insulation-bar-note { font-size: 0.8rem; margin: 0.75rem 0 0; }
@media (max-width: 640px) {
    .chart-box-short { height: 220px; }
}
