/* Energie Dashboard — Frontend Styles */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@700;800&family=DM+Mono:wght@400;500&display=swap');

.ed-dashboard {
    --ed-bg:      #0a0c0a;
    --ed-surface: #111611;
    --ed-border:  #1e2e1e;
    --ed-yellow:  #f0c030;
    --ed-green:   #3ddc64;
    --ed-red:     #e05c5c;
    --ed-blue:    #50b4e0;
    --ed-orange:  #f0a030;
    --ed-text:    #e8f5ec;
    --ed-muted:   #8db898;
    --ed-radius:  12px;

    background: var(--ed-bg);
    border-radius: 16px;
    padding: 28px;
    font-family: 'DM Mono', monospace;
    color: var(--ed-text);
    position: relative; overflow: hidden;
}

/* Grid background */
.ed-dashboard::before {
    content: '';
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(240,192,48,.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(240,192,48,.03) 1px, transparent 1px);
    background-size: 32px 32px;
    pointer-events: none;
}

/* ─── Header ─────────────────────────────────── */
.ed-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px; padding-bottom: 16px;
    border-bottom: 1px solid var(--ed-border);
    flex-wrap: wrap; gap: 10px; position: relative;
}
.ed-header-left { display: flex; align-items: center; gap: 10px; }
.ed-logo-icon { width: 28px; height: 28px; color: var(--ed-yellow); flex-shrink: 0; }
.ed-title {
    font-family: 'Syne', sans-serif !important;
    font-size: 1.3rem !important; font-weight: 800 !important;
    color: var(--ed-yellow) !important;
    letter-spacing: 0.06em; margin: 0 !important; padding: 0 !important; border: none !important;
}
.ed-meta { font-size: 0.7rem; color: var(--ed-muted); text-align: right; line-height: 1.8; }

/* ─── Period tabs ────────────────────────────── */
.ed-period-tabs { display: flex; gap: 6px; margin-bottom: 20px; }
.ed-tab {
    background: var(--ed-surface); border: 1px solid var(--ed-border);
    border-radius: 6px; color: var(--ed-muted);
    font-family: 'DM Mono', monospace; font-size: 0.75rem;
    padding: 5px 14px; text-decoration: none !important; transition: all .15s;
}
.ed-tab:hover { border-color: var(--ed-yellow); color: var(--ed-yellow); }
.ed-tab--active {
    background: var(--ed-yellow) !important;
    color: var(--ed-bg) !important;
    border-color: var(--ed-yellow) !important;
    font-weight: 500;
}

/* ─── Live meting ────────────────────────────── */
.ed-live {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px; margin-bottom: 20px;
    background: var(--ed-surface);
    border: 1px solid var(--ed-border);
    border-radius: var(--ed-radius);
    padding: 20px;
}
.ed-live__label { font-size: 0.7rem; color: var(--ed-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.08em; }
.ed-live__value {
    font-family: 'Syne', sans-serif;
    font-size: 2rem; font-weight: 800; line-height: 1;
    color: var(--ed-text);
}
.ed-live__value span { font-size: 0.8rem; color: var(--ed-muted); margin-left: 4px; font-family: 'DM Mono', monospace; font-weight: 400; }
.ed-live__item--import .ed-live__value { color: var(--ed-orange); }
.ed-live__item--export .ed-live__value { color: var(--ed-green); }
.ed-live__item--cost   .ed-live__value { color: var(--ed-red); }
.ed-live__item--profit .ed-live__value { color: var(--ed-green); }

/* ─── Stat kaartjes ──────────────────────────── */
.ed-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px; margin-bottom: 20px;
}
.ed-stat {
    background: var(--ed-surface); border: 1px solid var(--ed-border);
    border-radius: var(--ed-radius); padding: 16px 18px;
    position: relative; overflow: hidden;
}
.ed-stat::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; }
.ed-stat--import::before { background: var(--ed-orange); }
.ed-stat--export::before { background: var(--ed-green); }
.ed-stat--gas::before    { background: var(--ed-red); }
.ed-stat--cost::before   { background: var(--ed-red); }
.ed-stat--profit::before { background: var(--ed-green); }

.ed-stat__label { font-size: 0.68rem; color: var(--ed-muted); letter-spacing: 0.09em; text-transform: uppercase; margin-bottom: 6px; }
.ed-stat__value {
    font-family: 'Syne', sans-serif; font-size: 1.8rem; font-weight: 800; line-height: 1; margin-bottom: 4px;
}
.ed-stat--import .ed-stat__value { color: var(--ed-orange); }
.ed-stat--export .ed-stat__value { color: var(--ed-green); }
.ed-stat--gas    .ed-stat__value { color: var(--ed-red); }
.ed-stat--cost   .ed-stat__value { color: var(--ed-red); }
.ed-stat--profit .ed-stat__value { color: var(--ed-green); }
.ed-stat__unit { font-size: 0.68rem; color: var(--ed-muted); }

/* ─── Charts ─────────────────────────────────── */
.ed-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px; margin-top: 12px;
}
.ed-chart-card {
    background: var(--ed-surface); border: 1px solid var(--ed-border);
    border-radius: var(--ed-radius); padding: 16px 18px; margin-bottom: 12px;
}
.ed-chart-card--wide { grid-column: 1 / -1; }
.ed-chart-title { font-size: 0.72rem; color: var(--ed-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 12px; }
.ed-chart-wrap { position: relative; height: 160px; }

@media (max-width: 600px) {
    .ed-dashboard { padding: 16px; }
    .ed-stats { grid-template-columns: 1fr 1fr; }
    .ed-live  { grid-template-columns: 1fr 1fr; }
}

/* ─── Alert banner ───────────────────────────── */
.ed-alert {
    border-radius: var(--ed-radius); padding: 12px 18px;
    margin-bottom: 16px; font-size: 0.82rem; font-weight: 500;
}
.ed-alert--high { background: rgba(224,92,92,.15); border: 1px solid rgba(224,92,92,.4); color: #e05c5c; }
.ed-alert--low  { background: rgba(80,180,224,.15); border: 1px solid rgba(80,180,224,.4); color: #50b4e0; }

/* ─── Netwerk statistieken ───────────────────── */
.ed-netstats {
    display: flex; flex-wrap: wrap; gap: 10px;
    margin-bottom: 16px;
}
.ed-netstat {
    background: var(--ed-surface); border: 1px solid var(--ed-border);
    border-radius: 8px; padding: 10px 16px; flex: 1; min-width: 100px;
}
.ed-netstat__label { font-size: 0.65rem; color: var(--ed-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 4px; }
.ed-netstat__value { font-family: 'Syne', sans-serif; font-size: 1.2rem; font-weight: 700; }
.ed-netstat__value.ok   { color: var(--ed-green); }
.ed-netstat__value.warn { color: var(--ed-orange); }

/* ─── Spanning waarde kleur ──────────────────── */
.ed-live__value--ok   { color: var(--ed-text) !important; }
.ed-live__value--high { color: var(--ed-red) !important; }
.ed-live__value--low  { color: var(--ed-blue) !important; }

/* ─── Klikbare netstats ──────────────────────── */
.ed-netstat--clickable {
    cursor: pointer;
    transition: border-color .15s, transform .1s;
}
.ed-netstat--clickable:hover {
    border-color: var(--ed-yellow);
    transform: translateY(-2px);
}
.ed-netstat__hint {
    font-size: 0.6rem;
    color: var(--ed-yellow);
    opacity: 0.7;
}

/* ─── Modal ──────────────────────────────────── */
.ed-modal {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.7);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
.ed-modal--open { display: flex; }
.ed-modal__box {
    background: #111d16;
    border: 1px solid #1e3326;
    border-radius: 12px;
    width: 90%; max-width: 480px;
    max-height: 70vh;
    overflow: hidden;
    display: flex; flex-direction: column;
}
.ed-modal__header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #1e3326;
}
.ed-modal__title {
    font-family: 'Syne', sans-serif;
    font-size: 1rem; font-weight: 700;
    color: var(--ed-yellow);
}
.ed-modal__close {
    background: none; border: none;
    color: #8db898; font-size: 1rem;
    cursor: pointer; padding: 4px 8px;
    border-radius: 4px;
}
.ed-modal__close:hover { color: var(--ed-yellow); }
.ed-modal__body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}
.ed-modal__loading { color: #8db898; font-size: 0.85rem; }
.ed-modal__empty   { color: #8db898; font-size: 0.85rem; }
.ed-modal__table {
    width: 100%; border-collapse: collapse;
    font-size: 0.82rem; color: #e8f5ec;
}
.ed-modal__table th {
    text-align: left; padding: 6px 8px;
    color: #8db898; font-size: 0.7rem;
    text-transform: uppercase; letter-spacing: 0.08em;
    border-bottom: 1px solid #1e3326;
}
.ed-modal__table td {
    padding: 8px 8px;
    border-bottom: 1px solid #1e3326;
}
.ed-modal__table tr:last-child td { border-bottom: none; }

/* ─── Contract sectie ────────────────────────── */
.ed-contract-section { margin-bottom: 20px; }
.ed-section-title {
    font-family: 'Syne', sans-serif !important;
    font-size: 0.85rem !important; font-weight: 700 !important;
    color: var(--ed-muted) !important;
    text-transform: uppercase; letter-spacing: 0.08em;
    margin: 0 0 12px !important; padding: 0 !important; border: none !important;
}
.ed-contract-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px; margin-bottom: 4px;
}
.ed-contract-card {
    background: var(--ed-surface); border: 1px solid var(--ed-border);
    border-radius: var(--ed-radius); padding: 16px 18px;
    position: relative; overflow: hidden;
}
.ed-contract-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--ed-yellow); }
.ed-contract-card--positive::before { background: var(--ed-green); }
.ed-contract-card--negative::before { background: var(--ed-red); }
.ed-contract-card__label { font-size: 0.68rem; color: var(--ed-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.ed-contract-card__value { font-family: 'Syne', sans-serif; font-size: 1.6rem; font-weight: 800; line-height: 1; margin-bottom: 4px; color: var(--ed-text); }
.ed-contract-card--positive .ed-contract-card__value { color: var(--ed-green); }
.ed-contract-card--negative .ed-contract-card__value { color: var(--ed-red); }
.ed-contract-card__sub { font-size: 0.68rem; color: var(--ed-muted); }
