:root {
    /* LIGHT THEME (Default) */
    --bg-main: #f4f6f8;
    --bg-card: #ffffff;
    --bg-header: #ffffff;
    --border-color: rgba(0, 0, 0, 0.1);
    
    --text-main: #111111;
    --text-muted: #666666;
    
    /* Blue Gamut */
    --brand-blue: #007aff;
    --brand-blue-hover: #005bb5;
    --brand-blue-light: rgba(0, 122, 255, 0.1);
    
    --color-cpu: var(--brand-blue);
    --color-ram: var(--brand-blue);
    --color-cache: var(--brand-blue);
    --color-swap: var(--brand-blue);
    
    --color-success: var(--brand-blue);
    --color-danger: #ff3366;
    --color-warning: #ffcc00;
    
    --gauge-bg: #e5e7eb;
    
    --bg-sidebar: #ffffff;
    --logo-invert: 1;
    
    --font-primary: "Helvetica Neue", Helvetica, "Inter", sans-serif;
}

[data-theme="dark"] {
    /* DARK THEME */
    --bg-main: #050505;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-header: #050505;
    --border-color: rgba(255, 255, 255, 0.08);
    
    --text-main: #ffffff;
    --text-muted: #8b949e;
    
    --color-cpu: var(--brand-blue);
    --color-ram: var(--brand-blue);
    --color-cache: var(--brand-blue);
    --color-swap: var(--brand-blue);
    
    --gauge-bg: #2a2e39;
    
    --color-success: var(--brand-blue);
    --color-danger: #ff3366;
    --color-warning: #ffcc00;
    
    --bg-sidebar: #111111;
    --logo-invert: 0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-primary);
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* Utilities */
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-4 { margin-bottom: 1.5rem; }
.p-0 { padding: 0 !important; }
.p-3 { padding: 1rem !important; }
.p-4 { padding: 1.5rem !important; }
.text-muted { color: var(--text-muted); }
.text-blue { color: var(--color-cache); }
.text-red { color: var(--color-danger); }
.text-right { text-align: right; }
.float-right { float: right; }
.full-width { width: 100%; }
.flex-grow { flex-grow: 1; }
.inline-flex { display: flex; gap: 0.5rem; }

/* App Layout */
#app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    transition: width 0.3s ease;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar.collapsed {
    width: 80px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header .brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-header .brand img {
    filter: invert(var(--logo-invert));
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
}

.sidebar.collapsed .brand {
    display: none;
}

.toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    transition: color 0.3s;
}

.toggle-btn:hover {
    color: var(--text-main);
}

.sidebar-nav {
    flex-grow: 1;
    padding: 1rem 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s;
    gap: 1rem;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 1rem;
}

.nav-item i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.sidebar.collapsed .nav-text {
    display: none;
}

.nav-item:hover, .nav-item.active {
    color: var(--text-main);
    background: var(--bg-card);
    border-right: 3px solid var(--color-danger);
}

.sidebar-footer {
    padding: 1.5rem 1rem;
    border-top: 1px solid var(--border-color);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar.collapsed .user-profile {
    justify-content: center;
}

.sidebar.collapsed .details {
    display: none;
}

.avatar {
    width: 35px;
    height: 35px;
    background: var(--color-danger);
    color: #fff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 300;
    flex-shrink: 0;
}

.details {
    display: flex;
    flex-direction: column;
}

.details .name {
    font-size: 0.9rem;
    font-weight: 300;
}

.logout-link {
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: color 0.3s;
}
.logout-link:hover { color: var(--color-danger); }

/* Main Wrapper */
.main-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Important for flex children */
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 3rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-main);
}

.top-header h2 {
    font-weight: 300;
    font-size: 1.8rem;
    letter-spacing: -0.5px;
}

.uptime-badge {
    background: rgba(255,255,255,0.05);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.content-wrapper {
    padding: 2rem 3rem;
    max-width: 1600px;
    margin: 0;
    width: 100%;
}

/* Views */
.view {
    display: none;
    animation: fadeIn 0.3s ease;
}
.view.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 300;
    margin-bottom: 1rem;
}

/* Dashboard Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.5rem;
}

.metric-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Removed padding-bottom since elements are naturally stacked now */
}

.metric-card h3 {
    font-size: 0.85rem;
    font-weight: 300;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 0.2rem;
}

/* Gauge Charts (Half Circles) */
.gauge-chart {
    position: relative;
    width: 100%;
    max-width: 220px;
    aspect-ratio: 100 / 85;
    display: flex;
    justify-content: center;
    margin: 0 auto;
}

.gauge-chart svg {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0; left: 0;
}

.gauge-chart path {
    fill: none;
    stroke-width: 4;
    stroke-linecap: round;
}

.gauge-chart .gauge-bg {
    stroke: var(--gauge-bg);
}

.gauge-chart .gauge-val {
    stroke: url(#vu-gradient);
    stroke-dasharray: 188.5;
    stroke-dashoffset: calc(188.5 - (188.5 * var(--val) / 100));
    transition: stroke-dashoffset 0.5s ease-out;
}

.gauge-chart .inner {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.gauge-chart .percent {
    font-size: 2rem;
    font-weight: 300;
    letter-spacing: -1px;
}

.metric-card .sub {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 0.5rem;
}

.sub-dropdown-wrapper {
    position: relative;
    display: inline-block;
    margin-top: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.sub-dropdown-wrapper:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}
.sub-dropdown-wrapper select.premium-select {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
    text-align: center;
    padding: 0.3rem 2rem 0.3rem 1rem;
    width: 100%;
    height: 100%;
}
.sub-dropdown-wrapper select.premium-select:focus {
    color: #fff;
}
.sub-dropdown-wrapper .dropdown-icon {
    position: absolute;
    right: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    color: var(--text-muted);
    pointer-events: none;
}

/* Storage Card */
.storage-card {
    grid-column: span 1;
}

.storage-item {
    margin-bottom: 1rem;
}

.storage-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 300;
    margin-bottom: 0.4rem;
}

.storage-bar {
    height: 6px;
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
}

.storage-bar .fill {
    height: 100%;
    border-radius: 3px;
    background: var(--color-cpu);
}

/* Process Grid */
.process-grid {
    display: grid;
    grid-template-columns: 2fr 2fr 1.5fr;
    gap: 1.5rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 300;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 0.8rem 1rem;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255,255,255,0.02);
}

.data-table th:first-child, .data-table td:first-child {
    padding-left: 1rem;
    text-align: left;
}

.data-table tr:hover td {
    background: rgba(255,255,255,0.02);
}

.data-table .text-green { color: var(--color-ram); }
.data-table .text-blue { color: var(--color-cpu); }

/* Files List */
.file-list li {
    padding: 0.8rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
    font-weight: 300;
    border-bottom: 1px solid rgba(255,255,255,0.02);
}

/* Nav Grid */
.nav-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.nav-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    cursor: pointer;
    transition: transform 0.3s, background 0.3s;
}

.nav-card:hover {
    transform: translateY(-5px);
    background: rgba(255,255,255,0.05);
}

.nav-card img {
    width: 40px;
    margin-bottom: 1rem;
}

.nav-card h3 {
    font-size: 1rem;
}

/* Sub Views Generic */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.title-with-icon {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.title-with-icon img {
    width: 35px;
}

.title-with-icon h2 {
    font-size: 1.5rem;
    font-weight: 300;
}

/* Forms */
.form-group { margin-bottom: 0.8rem; }
.form-group label, .dark-form label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
    font-weight: 300;
    letter-spacing: 0.5px;
}

.dark-input, .dark-form input, .dark-form select {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
    font-family: inherit;
    font-weight: 300;
    font-size: 0.85rem;
}

.inline-form {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
}

.input-group-col {
    flex-grow: 1;
}

/* Buttons */
.btn {
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    border: none;
    outline: none;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.3s;
}

.btn:focus, input:focus, select:focus {
    outline: none !important;
    box-shadow: none !important;
}

.btn.primary { background: var(--brand-blue); color: #fff; }
.btn.success { background: var(--brand-blue); color: #fff; }
.btn.outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-main); }
.btn.ghost { background: transparent; color: var(--brand-blue); }
.btn.ghost:hover { background: var(--brand-blue-light); }
.btn.btn-sm { padding: 0.5rem 1rem; font-size: 0.85rem; }

/* Badges */
.badge {
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 300;
}
.badge.A { background: var(--color-cache); color: white; }
.badge.AAAA { background: var(--color-swap); color: white; }
.serial-badge { background: rgba(9, 132, 227, 0.2); color: var(--color-cache); }

/* Security Specific */
.stats-blocks-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.stat-block {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
}

.stat-block h2 {
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 0.5rem;
}

.stat-block p {
    font-size: 0.75rem;
    font-weight: 300;
    color: var(--text-muted);
}

.security-layout {
    display: flex;
    gap: 1.5rem;
}

.settings-sidebar {
    width: 300px;
    flex-shrink: 0;
}

.ip-list {
    max-height: 200px;
    overflow-y: auto;
}

.ip-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.02);
    font-size: 0.85rem;
    font-family: monospace;
    color: var(--color-cache);
}

/* Databases */
.db-table td:first-child {
    font-weight: 300;
    color: var(--color-cache);
}
.db-table img {
    vertical-align: middle;
    margin-right: 0.5rem;
    width: 20px;
}

/* Login */
.login-container {
    width: 400px;
    margin: 10vh auto;
    background: transparent;
    padding: 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 10;
}

/* Three Stripes Motif (Adidas inspiration) */
.stripes-container {
    display: flex;
    gap: 8px;
    margin-bottom: -1rem;
    transform: skew(-20deg);
}

.stripe {
    width: 12px;
    height: 40px;
    background: var(--text-main);
    border-radius: 2px;
    animation: slideUp 1s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.stripe:nth-child(1) { height: 25px; animation-delay: 0.1s; }
.stripe:nth-child(2) { height: 35px; animation-delay: 0.2s; }
.stripe:nth-child(3) { height: 45px; animation-delay: 0.3s; }

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* The Logo / Brand Name */
h1.brand-name {
    font-family: "Helvetica Neue", Helvetica, "Inter", sans-serif;
    font-weight: 200;
    font-size: 3rem;
    letter-spacing: 0px;
    color: var(--text-main);
    text-transform: lowercase;
    margin: 1rem 0 2rem 0;
    line-height: 1;
    position: relative;
    animation: reveal 1.2s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: 0.4s;
}

@keyframes reveal {
    from { clip-path: inset(100% 0 0 0); transform: translateY(20px); }
    to { clip-path: inset(0 0 0 0); transform: translateY(0); }
}

.login-container::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 51, 102, 0.2) 0%, transparent 60%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    filter: blur(80px);
    z-index: -1;
}

.input-group {
    position: relative;
    margin-bottom: 1rem;
}

.input-group i:first-child {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.input-group input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0.8rem 2.5rem;
    border-radius: 8px;
    color: var(--text-main);
}

.toggle-password {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-muted);
}

/* ── THEME GRID ────────────────────────────────── */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}

.theme-card {
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 0.65rem 0.8rem;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    background: var(--bg-card);
}

.theme-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.theme-card.active {
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 3px var(--brand-blue-light);
}

.theme-preview {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
}

.theme-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    flex-shrink: 0;
}

.theme-bars {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.theme-bar {
    height: 4px;
    border-radius: 4px;
    opacity: 0.65;
}

.theme-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-main);
    letter-spacing: 0.05em;
}

.theme-tag {
    display: none;
}

/* ── COLOR THEME PALETTES ──────────────────────── */

/* Blue (default — already in :root) */

/* Silver / Titanium */
[data-color-theme="silver"] {
    --brand-blue: #7b8fa1;
    --brand-blue-hover: #5a6a7a;
    --brand-blue-light: rgba(123, 143, 161, 0.12);
    --color-cpu: var(--brand-blue);
    --color-ram: var(--brand-blue);
    --color-cache: var(--brand-blue);
    --color-swap: var(--brand-blue);
    --color-success: var(--brand-blue);
}

/* Gold / Amber */
[data-color-theme="gold"] {
    --brand-blue: #c8922a;
    --brand-blue-hover: #a07018;
    --brand-blue-light: rgba(200, 146, 42, 0.12);
    --color-cpu: var(--brand-blue);
    --color-ram: var(--brand-blue);
    --color-cache: var(--brand-blue);
    --color-swap: var(--brand-blue);
    --color-success: var(--brand-blue);
}

/* Red / Carbon */
[data-color-theme="red"] {
    --brand-blue: #c0392b;
    --brand-blue-hover: #96281b;
    --brand-blue-light: rgba(192, 57, 43, 0.12);
    --color-cpu: var(--brand-blue);
    --color-ram: var(--brand-blue);
    --color-cache: var(--brand-blue);
    --color-swap: var(--brand-blue);
    --color-success: var(--brand-blue);
}

/* Green / Emerald */
[data-color-theme="green"] {
    --brand-blue: #00b894;
    --brand-blue-hover: #00796b;
    --brand-blue-light: rgba(0, 184, 148, 0.12);
    --color-cpu: var(--brand-blue);
    --color-ram: var(--brand-blue);
    --color-cache: var(--brand-blue);
    --color-swap: var(--brand-blue);
    --color-success: var(--brand-blue);
}

/* B&W / Monochrome */
[data-color-theme="bw"] {
    --brand-blue: #555555;
    --brand-blue-hover: #333333;
    --brand-blue-light: rgba(85, 85, 85, 0.12);
    --color-cpu: var(--brand-blue);
    --color-ram: #777777;
    --color-cache: #999999;
    --color-swap: #444444;
    --color-success: var(--brand-blue);
    --color-danger: #333333;
    --color-warning: #888888;
}

[data-theme="dark"][data-color-theme="bw"] {
    --brand-blue: #aaaaaa;
    --brand-blue-hover: #cccccc;
    --brand-blue-light: rgba(170, 170, 170, 0.12);
    --color-cpu: var(--brand-blue);
    --color-ram: #888888;
    --color-cache: #666666;
    --color-swap: #bbbbbb;
    --color-success: var(--brand-blue);
    --color-danger: #cccccc;
    --color-warning: #999999;
}


