/* ============================================================
   Watt — Sleek dark dashboard design system
   ============================================================ */

:root {
    /* surfaces */
    --bg-0: #080d18;
    --bg-1: #0c1322;
    --surface: #111a2e;
    --surface-2: #0e1626;
    --surface-3: #16223c;
    --border: rgba(148, 163, 184, 0.12);
    --border-strong: rgba(148, 163, 184, 0.24);

    /* text */
    --text: #e8edf6;
    --text-dim: #93a1b9;
    --text-faint: #5d6b86;

    /* accents */
    --lime: #a3e635;
    --lime-soft: rgba(163, 230, 53, 0.14);
    --cyan: #22d3ee;
    --cyan-soft: rgba(34, 211, 238, 0.14);
    --green: #34d399;
    --green-soft: rgba(52, 211, 153, 0.14);
    --amber: #fbbf24;
    --violet: #a78bfa;
    --violet-soft: rgba(167, 139, 250, 0.14);
    --danger: #f87171;

    --accent-grad: linear-gradient(135deg, var(--lime), var(--cyan));
    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.8);
    --font: 'Inter', "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background:
        radial-gradient(1100px 560px at 12% -8%, rgba(34, 211, 238, 0.10), transparent 60%),
        radial-gradient(950px 520px at 100% 0%, rgba(163, 230, 53, 0.08), transparent 55%),
        var(--bg-0);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }

::selection { background: var(--lime-soft); color: #fff; }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: #243049; border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #2f3e5c; background-clip: content-box; }

.icon { width: 20px; height: 20px; display: block; flex: none; }

/* ============================================================ App shell */
.app { min-height: 100dvh; display: flex; flex-direction: column; }

.app-main { flex: 1 1 auto; }

.container { width: 100%; max-width: 1160px; margin: 0 auto; padding: 30px 26px 56px; }

/* ============================================================ Top bar */
.topbar {
    position: sticky; top: 0; z-index: 50;
    background: rgba(9, 14, 26, 0.72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    max-width: 1160px; margin: 0 auto;
    height: 66px; padding: 0 26px;
    display: flex; align-items: center; gap: 26px;
}

.brand { display: flex; align-items: center; gap: 11px; font-weight: 800; letter-spacing: 0.14em; }
.brand-mark {
    width: 38px; height: 38px; border-radius: 11px;
    display: grid; place-items: center; color: #07120a;
    background: var(--accent-grad);
    box-shadow: 0 6px 18px -4px rgba(163, 230, 53, 0.5);
}
.brand-mark .icon { width: 22px; height: 22px; }
.brand-mark svg { fill: #07120a; stroke: #07120a; }
.brand-name { font-size: 18px; }

.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-link {
    display: flex; align-items: center; gap: 9px;
    padding: 9px 15px; border-radius: 11px;
    color: var(--text-dim); font-weight: 600; font-size: 14.5px;
    transition: all .15s ease; border: 1px solid transparent;
}
.nav-link:hover { color: var(--text); background: rgba(148, 163, 184, 0.07); }
.nav-link.active {
    color: var(--text);
    background: var(--lime-soft);
    border-color: rgba(163, 230, 53, 0.28);
}
.nav-link.active .icon { color: var(--lime); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.user-chip {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 12px 6px 6px; border-radius: 99px;
    background: var(--surface); border: 1px solid var(--border);
}
.avatar {
    width: 30px; height: 30px; border-radius: 50%;
    display: grid; place-items: center;
    font-size: 12px; font-weight: 800; color: #07120a;
    background: var(--accent-grad);
}
.user-name { font-size: 13.5px; font-weight: 600; color: var(--text); }

.btn-ghost {
    display: grid; place-items: center;
    width: 40px; height: 40px; border-radius: 11px; cursor: pointer;
    color: var(--text-dim); background: var(--surface);
    border: 1px solid var(--border); transition: all .15s ease;
}
.btn-ghost:hover { color: var(--danger); border-color: rgba(248, 113, 113, 0.4); background: rgba(248, 113, 113, 0.08); }

/* ============================================================ Page head */
.page-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 18px; margin-bottom: 24px; flex-wrap: wrap;
}
.page-title { font-size: 30px; }
.page-title .grad { background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.page-sub { color: var(--text-dim); margin-top: 5px; font-size: 14.5px; }

.pill {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 14px; border-radius: 99px; font-size: 13px; font-weight: 600;
    color: var(--text-dim); background: var(--surface); border: 1px solid var(--border);
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 10px var(--lime); }
.pill .dot.live { animation: live-pulse 1.6s ease-in-out infinite; }
@keyframes live-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(163, 230, 53, 0.55); opacity: 1; }
    50%      { box-shadow: 0 0 0 5px rgba(163, 230, 53, 0); opacity: .65; }
}

/* big live counter */
.live-counter {
    display: flex; align-items: center; gap: 15px;
    padding: 13px 24px; border-radius: 18px;
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
    border: 1px solid rgba(163, 230, 53, 0.30);
    box-shadow: 0 0 0 1px rgba(163, 230, 53, 0.06), 0 18px 44px -24px rgba(163, 230, 53, 0.6);
}
.live-counter .lc-dot {
    width: 12px; height: 12px; border-radius: 50%; flex: none;
    background: var(--lime); box-shadow: 0 0 14px var(--lime);
    animation: live-pulse 1.6s ease-in-out infinite;
}
.live-counter .lc-num {
    font-size: 38px; font-weight: 800; line-height: 1; letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
    animation: lc-pop .45s ease-out;
}
.live-counter .lc-label {
    margin-top: 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.18em;
    text-transform: uppercase; color: var(--text-dim);
}
@keyframes lc-pop {
    0%   { transform: scale(1.18); filter: brightness(1.6); }
    60%  { transform: scale(0.99); }
    100% { transform: scale(1); filter: brightness(1); }
}

/* ============================================================ Stat tiles */
.stat-grid {
    display: grid; gap: 16px; margin-bottom: 22px;
    grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
}

.stat-tile {
    position: relative; overflow: hidden;
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px; transition: transform .18s ease, border-color .18s ease;
}
.stat-tile::before {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
    background: var(--tile-accent, var(--lime)); opacity: .8;
}
.stat-tile:hover { transform: translateY(-3px); border-color: var(--border-strong); }

.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.stat-ic {
    width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center;
    color: var(--tile-accent, var(--lime)); background: var(--tile-soft, var(--lime-soft));
}
.stat-trend { font-size: 12px; font-weight: 700; color: var(--green); }

.stat-label { color: var(--text-dim); font-size: 13px; font-weight: 500; }
.stat-value { font-size: 30px; font-weight: 800; line-height: 1.1; margin-top: 3px; letter-spacing: -0.02em; }
.stat-unit { font-size: 14px; font-weight: 600; color: var(--text-faint); margin-left: 5px; }

.stat-tile.t-lime   { --tile-accent: var(--lime);   --tile-soft: var(--lime-soft); }
.stat-tile.t-cyan   { --tile-accent: var(--cyan);   --tile-soft: var(--cyan-soft); }
.stat-tile.t-green  { --tile-accent: var(--green);  --tile-soft: var(--green-soft); }
.stat-tile.t-violet { --tile-accent: var(--violet); --tile-soft: var(--violet-soft); }
.stat-tile.t-amber  { --tile-accent: var(--amber);  --tile-soft: rgba(251,191,36,0.14); }

.stat-tile.highlight {
    border-color: rgba(52, 211, 153, 0.45);
    box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.15), 0 16px 40px -22px rgba(52, 211, 153, 0.6);
}

/* ============================================================ Panels & charts */
.panel-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .panel-grid.two { grid-template-columns: 1fr 1fr; } }

.panel {
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px 22px; box-shadow: var(--shadow); margin-bottom: 16px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; gap: 12px; }
.panel-title { font-size: 16px; display: flex; align-items: center; gap: 10px; }
.panel-title .icon { color: var(--lime); }
.panel-meta { color: var(--text-faint); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.chart-wrap { margin: 4px -6px -6px; }

/* legend chips */
.legend { display: flex; gap: 16px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-dim); font-weight: 600; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ============================================================ Empty state */
.empty {
    text-align: center; padding: 70px 20px;
    border: 1px dashed var(--border-strong); border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.012);
}
.empty .empty-ic {
    width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 18px;
    display: grid; place-items: center; color: var(--lime); background: var(--lime-soft);
}
.empty .empty-ic .icon { width: 30px; height: 30px; }
.empty h2 { font-size: 19px; }
.empty p { color: var(--text-dim); margin-top: 6px; }

/* ============================================================ History table */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
    text-align: left; padding: 12px 14px; color: var(--text-faint);
    font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em;
    border-bottom: 1px solid var(--border);
}
table.data th.num, table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td { padding: 14px; border-bottom: 1px solid var(--border); color: var(--text); }
table.data tbody tr { transition: background .12s ease; }
table.data tbody tr:hover { background: rgba(148, 163, 184, 0.05); }
table.data td .day { font-weight: 700; }
.chip-val { color: var(--lime); font-weight: 700; }

/* ============================================================ Footer */
.app-footer {
    border-top: 1px solid var(--border); margin-top: auto;
    padding: 18px 26px; display: flex; align-items: center; justify-content: space-between;
    gap: 12px; color: var(--text-faint); font-size: 13px; flex-wrap: wrap;
}
.app-footer a { color: var(--text-dim); }
.app-footer a:hover { color: var(--lime); }
.footer-links { display: flex; gap: 18px; }

/* ============================================================ Auth */
.auth-shell {
    min-height: 100dvh; display: grid; place-items: center; padding: 24px;
    background:
        radial-gradient(900px 480px at 20% 0%, rgba(34, 211, 238, 0.12), transparent 60%),
        radial-gradient(820px 460px at 100% 100%, rgba(163, 230, 53, 0.10), transparent 55%),
        var(--bg-0);
}
.auth-card {
    width: 100%; max-width: 410px;
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
    border: 1px solid var(--border); border-radius: 24px;
    padding: 38px 34px; box-shadow: 0 40px 90px -40px rgba(0, 0, 0, 0.9);
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.auth-brand .brand-name { font-size: 20px; letter-spacing: 0.16em; font-weight: 800; }
.auth-title { font-size: 24px; }
.auth-sub { color: var(--text-dim); margin-top: 6px; margin-bottom: 26px; }

.field-group { margin-bottom: 16px; }
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-dim); margin-bottom: 7px; }
.field {
    width: 100%; height: 46px; padding: 0 15px;
    background: var(--bg-1); color: var(--text); font-size: 15px; font-family: var(--font);
    border: 1px solid var(--border-strong); border-radius: 12px; outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.field::placeholder { color: var(--text-faint); }
.field:focus { border-color: var(--lime); box-shadow: 0 0 0 3px var(--lime-soft); }

.btn-primary {
    width: 100%; height: 48px; margin-top: 8px; cursor: pointer;
    border: none; border-radius: 12px; font-family: var(--font);
    font-size: 15px; font-weight: 700; color: #07120a;
    background: var(--accent-grad);
    box-shadow: 0 12px 28px -10px rgba(163, 230, 53, 0.6);
    transition: transform .12s ease, filter .15s ease;
}
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .6; cursor: default; }

.form-error {
    margin-top: 16px; padding: 11px 14px; border-radius: 11px; font-size: 13.5px; font-weight: 500;
    color: #fecaca; background: rgba(248, 113, 113, 0.12); border: 1px solid rgba(248, 113, 113, 0.32);
}

/* ============================================================ Boot loader */
.boot { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 18px; }
.boot-mark {
    width: 66px; height: 66px; border-radius: 18px; display: grid; place-items: center; color: #07120a;
    background: var(--accent-grad); box-shadow: 0 12px 36px -8px rgba(163, 230, 53, 0.55);
}
.boot-mark svg { width: 34px; height: 34px; fill: #07120a; stroke: #07120a; }
.boot-name { font-weight: 800; letter-spacing: 0.34em; font-size: 17px; color: var(--text); }
.boot-spinner {
    width: 30px; height: 30px; border-radius: 50%;
    border: 3px solid rgba(148, 163, 184, 0.18); border-top-color: var(--lime);
    animation: boot-spin .8s linear infinite;
}
@keyframes boot-spin { to { transform: rotate(360deg); } }

/* ============================================================ Blazor error UI */
#blazor-error-ui {
    background: #1a1430; color: #fcd34d; border-top: 1px solid rgba(251, 191, 36, 0.3);
    bottom: 0; left: 0; width: 100%; position: fixed; z-index: 1000; display: none;
    padding: 0.7rem 1.25rem; box-shadow: 0 -8px 24px -10px rgba(0, 0, 0, 0.7);
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.9rem; top: 0.6rem; }
#blazor-error-ui a { color: var(--cyan); }

.blazor-error-boundary {
    background: #b32121; color: white; padding: 1rem 1.3rem; border-radius: 12px; margin: 12px 0;
}
.blazor-error-boundary::before { content: "A apărut o eroare. "; font-weight: 700; }

/* ============================================================ Responsive */
@media (max-width: 760px) {
    .topbar-inner { gap: 12px; padding: 0 16px; }
    .container { padding: 22px 16px 44px; }
    .brand-name { display: none; }
    .user-name { display: none; }
    .nav-link span.lbl { display: none; }
    .page-title { font-size: 24px; }
}
