/* Design System & Global Styles */
:root {
    --primary: #2563EB; /* Royal Blue */
    --primary-hover: #1D4ED8; /* Darker Blue */
    --secondary: #7C3AED; /* Purple */
    --accent: #22C55E; /* Green */
    --background: #0F172A; /* Dark Slate Background */
    --surface: rgba(30, 41, 59, 0.7); /* Dark Glass */
    --surface-border: rgba(37, 99, 235, 0.2); /* Subtle Blue Border */
    --text-main: #F8FAFC; /* White Text */
    --text-muted: #94A3B8; /* Light Slate Gray */
    --success: #22C55E;
    --warning: #F59E0B;
    --danger: #EF4444;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --radius-lg: 1rem;
    --radius-md: 0.5rem;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.5;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Glassmorphism Classes */
.glass {
    background: var(--surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
}

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

main {
    flex: 1;
    padding: 2rem;
    max-height: 100vh;
    overflow-y: auto;
}

/* Typography */
h1, h2, h3 { font-weight: 700; letter-spacing: -0.025em; }
h1 { font-size: 2.25rem; }
p { color: var(--text-muted); }

/* Components */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    gap: 0.5rem;
    text-decoration: none;
    font-size: 0.875rem;
}

.btn-primary { background: var(--primary); color: #FFFFFF; font-weight: 700; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }

.card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: transform 0.2s;
}

.card:hover { transform: translateY(-4px); }

/* Dashboard Specifics */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.icon-box {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* Table Design */
.table-container {
    margin-top: 2rem;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    border-bottom: 1px solid var(--surface-border);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--surface-border);
}

tr:hover { background: rgba(255, 255, 255, 0.03); }

/* Sidebar */
.sidebar {
    width: 280px;
    height: 100vh;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    position: sticky;
    top: 0;
}

.sidebar-brand {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
}

.nav-link:hover, .nav-link.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

/* Mobile Hamburger Button */
.menu-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1000;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.5rem 0.75rem;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

/* Overlay behind sidebar on mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

.sidebar-overlay.active {
    display: block;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    #app {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        left: -300px;
        top: 0;
        width: 280px;
        height: 100vh;
        z-index: 999;
        transition: left 0.3s ease;
        border-radius: 0;
    }

    .sidebar.open {
        left: 0;
    }

    main {
        padding: 1rem;
        padding-top: 4rem;
        max-height: none;
    }

    h1 {
        font-size: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .stat-card {
        padding: 1rem;
    }

    table {
        font-size: 0.8rem;
    }

    th, td {
        padding: 0.5rem;
    }

    .card {
        padding: 1rem;
    }

    /* Dashboard grid collapse */
    div[style*="grid-template-columns: 1.5fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
}
