/* ==========================================================================
   Light Theme Design System - Vanilla CSS
   Optimized for Ubuntu 24.04 / Modern Browsers
   No Glassmorphism - Clean, Crisp & High-Contrast Light Layout
   ========================================================================== */

:root {
    --bg-page: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f1f5f9;
    --bg-muted: #e2e8f0;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-inverse: #ffffff;

    --brand-primary: #2563eb;
    --brand-primary-hover: #1d4ed8;
    --brand-light: #eff6ff;

    --color-success: #16a34a;
    --color-success-bg: #f0fdf4;
    --color-error: #dc2626;
    --color-error-bg: #fef2f2;
    --color-warning: #d97706;
    --color-warning-bg: #fffbeb;
    --color-info: #0284c7;
    --color-info-bg: #f0f9ff;

    --border-color: #e2e8f0;
    --border-color-darker: #cbd5e1;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);

    --sidebar-width: 270px;
    --topbar-height: 60px;
    --transition: all 0.2s ease-in-out;
}

/* Reset & Box Sizing */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-page);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--brand-primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--brand-primary-hover);
}

/* Layout Architecture */
.app-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* Left Sidebar Menu */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    background: var(--brand-primary);
    color: var(--text-inverse);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    box-shadow: var(--shadow-sm);
}

.sidebar-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.sidebar-nav {
    padding: 16px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-section-title {
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 12px 12px 6px 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition);
}

.nav-item:hover {
    background-color: var(--bg-surface-hover);
    color: var(--brand-primary);
}

.nav-item.active {
    background-color: var(--brand-light);
    color: var(--brand-primary);
    font-weight: 600;
}

.nav-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: currentColor;
}

.icon {
    width: 18px;
    height: 18px;
    display: inline-block;
    vertical-align: middle;
    stroke: currentColor;
    fill: none;
    flex-shrink: 0;
}

.icon-sm {
    width: 15px;
    height: 15px;
}

.icon-lg {
    width: 22px;
    height: 22px;
}

/* Sidebar Footer & Auth Button */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-surface);
}

.disk-tile {
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background-color: var(--bg-surface-hover);
    border: 1px solid var(--border-color);
    margin-bottom: 12px;
}

.disk-tile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 12px;
}

.disk-tile-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: var(--text-primary);
}

.disk-progress-bar {
    width: 100%;
    height: 6px;
    border-radius: var(--radius-full);
    background-color: var(--border-color);
    overflow: hidden;
    margin-bottom: 4px;
}

.disk-progress-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

.disk-tile-footer {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
}

.user-badge-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    background-color: var(--bg-surface-hover);
    margin-bottom: 12px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--brand-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
}

.user-meta {
    overflow: hidden;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.user-role {
    font-size: 11px;
    color: var(--text-muted);
}

/* Main Content Area */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Topbar for Mobile Toggle & Quick Actions */
.topbar {
    height: var(--topbar-height);
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.mobile-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 18px;
    color: var(--text-primary);
}

.page-container {
    padding: 30px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    flex: 1;
}

/* Typography & Headings */
h1, h2, h3, h4, h5 {
    color: var(--text-primary);
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.3;
}

h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }

p {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

/* Cards & Surface Containers */
.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

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

.card-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

/* Grid & Flex Utilities */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.btn-primary {
    background-color: var(--brand-primary);
    color: var(--text-inverse);
}
.btn-primary:hover {
    background-color: var(--brand-primary-hover);
    color: var(--text-inverse);
}

.btn-secondary {
    background-color: var(--bg-surface);
    border-color: var(--border-color-darker);
    color: var(--text-primary);
}
.btn-secondary:hover {
    background-color: var(--bg-surface-hover);
}

.btn-danger {
    background-color: var(--color-error);
    color: #fff;
}
.btn-danger:hover {
    background-color: #b91c1c;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--text-primary);
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

textarea.form-control {
    min-height: 90px;
    resize: vertical;
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-surface);
}

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

.table th {
    background-color: var(--bg-surface-hover);
    padding: 12px 16px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.05em;
}

.table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td {
    background-color: #fafbfc;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}

.badge-success {
    background-color: var(--color-success-bg);
    color: var(--color-success);
    border: 1px solid rgba(22, 163, 74, 0.2);
}

.badge-danger {
    background-color: var(--color-error-bg);
    color: var(--color-error);
    border: 1px solid rgba(220, 38, 38, 0.2);
}

.badge-info {
    background-color: var(--color-info-bg);
    color: var(--color-info);
    border: 1px solid rgba(2, 132, 199, 0.2);
}

.badge-muted {
    background-color: var(--bg-muted);
    color: var(--text-muted);
}

/* Stats Metric Cards */
.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.stat-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
}

/* Toast Notifications Container & Items */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 380px;
    width: calc(100% - 48px);
}

.toast {
    pointer-events: auto;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast-fading {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(-16px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.toast-icon {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.toast-success { border-left: 4px solid var(--color-success); }
.toast-success .toast-icon { background-color: var(--color-success-bg); color: var(--color-success); }

.toast-error { border-left: 4px solid var(--color-error); }
.toast-error .toast-icon { background-color: var(--color-error-bg); color: var(--color-error); }

.toast-warning { border-left: 4px solid var(--color-warning); }
.toast-warning .toast-icon { background-color: var(--color-warning-bg); color: var(--color-warning); }

.toast-info { border-left: 4px solid var(--color-info); }
.toast-info .toast-icon { background-color: var(--color-info-bg); color: var(--color-info); }

.toast-message {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
    word-break: break-word;
}

.toast-close {
    background: none;
    border: none;
    font-size: 18px;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}
.toast-close:hover {
    color: var(--text-primary);
}

/* Sidebar Backdrop on Mobile */
.sidebar-backdrop {
    display: none;
}

/* Responsive Breakpoints (Mobile Optimization) */
@media (max-width: 768px) {
    .mobile-toggle {
        display: inline-flex;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: var(--shadow-lg);
        z-index: 1000;
    }

    .sidebar.sidebar-open {
        transform: translateX(0);
    }

    .sidebar-backdrop.active {
        display: block;
        position: fixed;
        inset: 0;
        background-color: rgba(15, 23, 42, 0.4);
        z-index: 999;
    }

    .page-container {
        padding: 20px 16px;
    }

    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 18px;
    }
}
