/* ==========================================================================
   The QNAP (NAS) monitor — QNAP-specifieke stijlen
   Header/navbar: via @import monitor-shared.css
   ========================================================================== */

@import 'monitor-shared.css';

:root, [data-theme="dark"] {
    --bg: #0f172a;
    --card-bg: #1e293b;
    --card-border: #334155;
    --card-header-bg: rgba(255, 255, 255, 0.02);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #38bdf8;
    --green: #00ff00;
    --green-bg: #064e3b;
    --yellow: #ffff00;
    --yellow-bg: #713f12;
    --orange: #ffa500;
    --orange-bg: #7c2d12;
    --red: #ff0000;
    --red-bg: #7f1d1d;
    --table-header-bg: #0f172a;
    --table-hover: rgba(255, 255, 255, 0.02);
    --code-bg: #0f172a;
    --bar-bg: #334155;
    --toggle-bg: #0f172a;
    --toggle-active: #334155;
    --toggle-active-text: #f8fafc;
    --badge-ok-text: #86efac;
    --badge-warn-text: #fde047;
    --badge-orange-text: #fed7aa;
    --badge-danger-text: #fca5a5;
    --badge-neutral-bg: #334155;
    --badge-neutral-text: #cbd5e1;
    --banner-ok-bg: rgba(34, 197, 94, 0.15);
    --banner-ok-text: #86efac;
    --banner-alert-bg: rgba(239, 68, 68, 0.15);
    --banner-alert-text: #fca5a5;
}

[data-theme="white"] {
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --card-border: #cbd5e1;
    --card-header-bg: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --accent: #0284c7;
    --green: #00ff00;
    --green-bg: #dcfce7;
    --yellow: #ffff00;
    --yellow-bg: #fef9c3;
    --orange: #ffa500;
    --orange-bg: #ffedd5;
    --red: #ff0000;
    --red-bg: #fee2e2;
    --table-header-bg: #f1f5f9;
    --table-hover: rgba(0, 0, 0, 0.02);
    --code-bg: #f1f5f9;
    --bar-bg: #e2e8f0;
    --toggle-bg: #e2e8f0;
    --toggle-active: #0284c7;
    --toggle-active-text: #ffffff;
    --badge-ok-text: #15803d;
    --badge-warn-text: #a16207;
    --badge-orange-text: #c2410c;
    --badge-danger-text: #b91c1c;
    --badge-neutral-bg: #e2e8f0;
    --badge-neutral-text: #475569;
    --banner-ok-bg: #dcfce7;
    --banner-ok-text: #15803d;
    --banner-alert-bg: #fee2e2;
    --banner-alert-text: #b91c1c;
}

[data-theme="white"] .badge-rebuild,
[data-theme="white"] .pill-rebuild {
    background: rgba(234, 179, 8, 0.15) !important;
    color: #a16207 !important;
    border: 1px solid #eab308 !important;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text-primary);
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

/* QNAP subbar: blauw gradient */
:root, [data-theme="dark"] {
    --subbar-bg: linear-gradient(90deg, #081e59 0%, #0c2e82 50%, #1545b5 100%);
    --subbar-text: #ffffff;
    --subbar-meta-text: rgba(255, 255, 255, 0.85);
}

[data-theme="white"] {
    --subbar-bg: linear-gradient(90deg, #081e59 0%, #0c2e82 50%, #1545b5 100%);
    --subbar-text: #ffffff;
    --subbar-meta-text: rgba(255, 255, 255, 0.85);
}



.banner {
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 14px;
}

.banner-ok {
    background: var(--banner-ok-bg);
    border: 1px solid var(--green);
    color: var(--banner-ok-text);
}

.banner-alert {
    background: var(--banner-alert-bg);
    border: 1px solid var(--red);
    color: var(--banner-alert-text);
}

.alert-list {
    margin: 8px 0 0 18px;
    padding: 0;
}

.alert-item { margin-bottom: 4px; }

.cluster-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.stat-box {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 12px 16px;
}

.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    overflow: hidden;
}

.card-header {
    background: var(--card-header-bg);
    border-bottom: 1px solid var(--card-border);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--accent);
}

.card-body {
    padding: 16px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    margin-bottom: 6px;
}

.bar-container {
    background: var(--bar-bg);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 14px;
}

.bar {
    height: 100%;
    border-radius: 4px;
}

.bar-cpu { background: #38bdf8; }
.bar-mem { background: #22c55e; }
.bar-warn { background: #eab308; }
.bar-green { background: var(--green); }
.bar-yellow { background: var(--yellow); }
.bar-orange { background: var(--orange); }
.bar-red { background: var(--red); }

.pct-green { color: var(--green); }
.pct-yellow { color: var(--yellow); }
.pct-orange { color: var(--orange); }
.pct-red { color: var(--red); font-weight: 700; }

.section-title {
    font-size: 18px;
    margin: 30px 0 12px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-wrap {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 24px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

th {
    background: var(--table-header-bg);
    color: var(--text-secondary);
    font-weight: 600;
    padding: 10px 14px;
    border-bottom: 1px solid var(--card-border);
}

td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--card-border);
    vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--table-hover); }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.badge-ok { background: var(--green-bg); color: var(--badge-ok-text); border: 1px solid var(--green); }
.badge-warn { background: var(--yellow-bg); color: var(--badge-warn-text); border: 1px solid var(--yellow); }
.badge-rebuild { background: rgba(255, 255, 0, 0.2); color: #ffff00; border: 1px solid #ffff00; font-weight: 700; }
.badge-danger { background: var(--red-bg); color: var(--badge-danger-text); border: 1px solid var(--red); }
.badge-neutral { background: var(--badge-neutral-bg); color: var(--badge-neutral-text); border: 1px solid var(--card-border); }

code {
    background: var(--code-bg);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
}

footer {
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 30px;
    padding-top: 15px;
    border-top: 1px solid var(--card-border);
}


/* ---- THEME WARN COLORS (GEEL) ---- */
:root, [data-theme="dark"] {
    --qnap-warn-yellow: var(--yellow);
    --qnap-warn-bg: rgba(255, 255, 0, 0.18);
}
[data-theme="white"] {
    --qnap-warn-yellow: var(--yellow);
    --qnap-warn-bg: rgba(255, 255, 0, 0.18);
}

.status-callout-yellow {
    color: var(--yellow) !important;
    font-weight: 800;
    font-size: 19px;
    margin-top: 4px;
    letter-spacing: 0.4px;
}
.raid-status-line {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.35;
    color: var(--yellow) !important;
}
.raid-status-prefix, .raid-status-action {
    color: var(--yellow) !important;
    font-weight: 700;
}

/* Header Compact */
.qnap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0 0.6rem 0;
    margin-bottom: 0.6rem;
    border-bottom: 1px solid var(--card-border);
}
.header-left h1 {
    font-size: 20px;
    margin: 0;
}
.header-sub {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}
.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}
.header-update {
    font-size: 12px;
    color: var(--text-secondary);
}
.header-actions {
    display: flex;
    gap: 6px;
}

/* Footer */
.qnap-footer {
    margin-top: 1.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--card-border);
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
}
.footer-meta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
}

/* Container */
.container {
    max-width: 1680px;
    margin: 0 auto;
    padding: 0.5rem 1.25rem 1rem 1.25rem;
}

/* ---- DESKTOP (BREED & COMPACT) ---- */
@media (min-width: 1100px) {
    .widget-grid-top {
        display: grid;
        grid-template-columns: 1.15fr 1fr 1.25fr;
        gap: 0.75rem;
        margin-bottom: 0.75rem;
    }
    .widget-grid-bottom {
        display: grid;
        grid-template-columns: 1fr 1.35fr;
        gap: 0.75rem;
        margin-bottom: 0.75rem;
    }
    .desktop-tables-split {
        display: grid;
        grid-template-columns: 1.25fr 1fr;
        gap: 0.75rem;
        align-items: start;
    }
    .shares-scroll-wrap {
        max-height: 230px;
        overflow-y: auto;
    }
    .table-wrap table th,
    .table-wrap table td {
        padding: 5px 8px;
        font-size: 12px;
    }
    .section-title {
        margin: 0.4rem 0 0.35rem 0;
        font-size: 13px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: var(--text-secondary);
    }
}

/* ---- MOBIEL (LANG & GESTAPELD) ---- */
@media (max-width: 1099px) {
    .container {
        padding: 0.5rem;
    }
    .qnap-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .header-right {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }
    .widget-grid-top {
        display: flex;
        flex-direction: column;
        gap: 0.65rem;
        margin-bottom: 0.65rem;
    }
    .widget-grid-bottom {
        display: flex;
        flex-direction: column;
        gap: 0.65rem;
        margin-bottom: 0.65rem;
    }
    .desktop-tables-split {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }
}

/* Card Styling Compact */
.widget-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.widget-header {
    background: var(--card-header-bg);
    border-bottom: 1px solid var(--card-border);
    padding: 0.45rem 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.widget-title {
    font-weight: 700;
    font-size: 13px;
    color: var(--text-primary);
}
.widget-body {
    padding: 0.65rem 0.75rem;
    flex: 1;
}

/* Systeemstatus Box */
.status-body {
    display: flex;
    align-items: center;
}
.nas-icon-wrap {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
}
.nas-tower-box {
    width: 56px;
    height: 64px;
    background: #334155;
    border: 2px solid #64748b;
    border-radius: 6px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3px;
    flex-shrink: 0;
}
.nas-leds {
    display: flex;
    gap: 3px;
    position: absolute;
    top: 4px;
    left: 5px;
}
.led-green { width: 4px; height: 4px; border-radius: 50%; background: #22c55e; }
.led-blue { width: 4px; height: 4px; border-radius: 50%; background: #38bdf8; }
.nas-bays {
    width: 40px;
    height: 40px;
    display: flex;
    gap: 2px;
    margin-top: 8px;
}
.bay {
    flex: 1;
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 2px;
    transition: background 0.3s, border-color 0.3s;
}
.bay.bay-ok {
    background: #22c55e;
    border-color: #16a34a;
    box-shadow: 0 0 4px rgba(34, 197, 94, 0.4);
}
.bay.bay-rebuild {
    background: #ffff00 !important;
    border-color: #fef08a !important;
    box-shadow: 0 0 8px rgba(255, 255, 0, 0.8) !important;
}
.bay.bay-danger {
    background: #ef4444;
    border-color: #dc2626;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.7);
}
.bay.bay-empty {
    background: #1e293b;
    border-color: #475569;
}
.nas-warn-badge {
    position: absolute;
    bottom: -5px;
    right: -5px;
    background: var(--qnap-warn-yellow);
    color: #000;
    font-weight: 900;
    font-size: 12px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--card-bg);
}
.nas-ok-badge {
    position: absolute;
    bottom: -5px;
    right: -5px;
    background: #22c55e;
    color: #fff;
    font-size: 11px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--card-bg);
}
.nas-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
}

/* Hardware Info */
.hw-item {
    display: flex;
    align-items: center;
    font-size: 12px;
}
.hw-label {
    width: 100px;
    color: var(--text-secondary);
}
.hw-val {
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}
.check-icon {
    color: #22c55e;
    font-weight: 900;
}
.hw-meta-box {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px dashed var(--card-border);
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Bronnenmonitor */
.gauges-row {
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 4px;
}
.gauge-wrap {
    position: relative;
    width: 76px;
    height: 76px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.gauge-svg {
    transform: rotate(-90deg);
}
.gauge-bg {
    fill: none;
    stroke: var(--bar-bg);
    stroke-width: 7;
}
.gauge-bar {
    fill: none;
    stroke-width: 7;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.4s ease;
}
.gauge-inner {
    position: absolute;
    text-align: center;
}
.gauge-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
}
.gauge-val {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}
.gauge-green .gauge-bar { stroke: var(--green); }
.gauge-green .gauge-val { color: var(--green); }

.gauge-yellow .gauge-bar { stroke: var(--yellow); }
.gauge-yellow .gauge-val { color: var(--yellow); }

.gauge-orange .gauge-bar { stroke: var(--orange); }
.gauge-orange .gauge-val { color: var(--orange); }

.gauge-red .gauge-bar { stroke: var(--red); }
.gauge-red .gauge-val { color: var(--red); }
.net-widget {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding-left: 4px;
}
.net-title {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 2px;
}
.net-rates {
    display: flex;
    flex-direction: column;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.35;
}
.net-down { color: #22c55e; }
.net-up { color: #38bdf8; }

/* Schijfgezondheid */
.disk-health-body {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
}
.disk-left-box {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.disk-graphic {
    width: 50px;
    height: 42px;
    background: #334155;
    border: 2px solid #64748b;
    border-radius: 5px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.disk-led {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #22c55e;
}
.disk-badge-ok {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #22c55e;
    color: #fff;
    font-size: 9px;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--card-bg);
}
.status-callout {
    font-weight: 700;
    font-size: 18px;
    margin-top: 2px;
}
.callout-ok { color: #22c55e; }
.disk-count {
    font-size: 12px;
    color: var(--text-secondary);
}
.disk-pills-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    border-left: 1px dashed var(--card-border);
    padding-left: 14px;
    flex: 1;
    justify-content: flex-start;
}
.disk-pill {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
}
.pill-ok {
    background: rgba(34, 197, 94, 0.15);
    color: var(--green);
    border: 1px solid rgba(34, 197, 94, 0.3);
}
.pill-warn {
    background: var(--qnap-warn-bg);
    color: var(--qnap-warn-yellow);
    border: 1px solid var(--qnap-warn-yellow);
}
.pill-rebuild {
    background: rgba(255, 255, 0, 0.2);
    color: #ffff00;
    border: 1px solid #ffff00;
    font-weight: 700;
}

/* Opslag Widget */
.storage-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.vol-label {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 700;
    display: inline-block;
}
.legend-item {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.legend-sq {
    width: 9px;
    height: 9px;
    display: inline-block;
    border-radius: 2px;
}
.sq-gray { background: #71717a; }
.sq-cyan { background: #00d2ff; }
.storage-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-left: 1px dashed var(--card-border);
    padding-left: 10px;
}
.folder-row {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-secondary);
}
.folder-name { color: var(--text-primary); }
.folder-size { font-weight: 600; }
