:root {
    --primary: #059669;
    --primary-dark: #047857;
    --secondary: #64748b;
    --background: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px rgba(0,0,0,0.05);
    --sidebar-width: 250px;
    --nav-active: #2563eb;
    --badge-success: #198754;
    --badge-warning: #ffc107;
    --badge-danger: #dc3545;
    --badge-info: #0dcaf0;
    --badge-secondary: #6c757d;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    background-color: var(--background);
    color: var(--text);
    line-height: 1.6;
}

/* Layout Grid */
.dashboard {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: 60px 1fr;
    grid-template-areas:
        "sidebar header"
        "sidebar main";
    min-height: 100vh;
}

/* Header */
.header {
    grid-area: header;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: background-color 0.3s;
}

.menu-toggle:hover {
    background-color: var(--background);
}

/* Sidebar */
.sidebar {
    grid-area: sidebar;
    background: var(--card-bg);
    border-right: 1px solid var(--border);
    padding: 20px 0 0 0;
    position: fixed;
    width: var(--sidebar-width);
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 1000;
}

.sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.sidebar-menu {
    list-style: none;
    flex: 1;
    margin-bottom: 0;
}

.sidebar-version {
    padding: 0.75rem 0;
    border-top: 1px solid var(--border);
}

.sidebar-menu li {
    margin: 5px 0;
}

.sidebar-menu a {
    text-decoration: none;
    color: var(--text);
    padding: 12px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s;
    margin: 0 10px;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background-color: var(--nav-active);
    color: white;
}

.sidebar-menu i {
    width: 20px;
    text-align: center;
}

/* Main Content */
.main {
    grid-area: main;
    padding: 30px;
    overflow-y: auto;
}

.mobile-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s ease;
    position: relative;
    z-index: 1;
}

@media (hover: hover) {
    .mobile-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 12px rgba(0,0,0,0.1);
    }
}

.mobile-card:has(.dropdown-menu.show) {
    z-index: 1000;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.stat-card {
    background: var(--background);
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--border);
}

.stat-card h3 {
    font-size: 1.8rem;
    color: var(--primary);
    margin-bottom: 5px;
}

/* User Menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #2563eb;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
}

/* Mobile Overlay */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

/* Mobile */
@media (max-width: 768px) {
    .dashboard {
        grid-template-columns: 1fr;
        grid-template-areas:
            "header"
            "main";
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .overlay.active {
        display: block;
    }

    .main {
        padding: 20px;
    }

    .header {
        padding: 0 10px;
        gap: 8px;
    }

    .user-menu .me-2 {
        display: none;
    }

    .user-avatar {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.8rem;
    }

    .mobile-card {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .main {
        padding: 15px;
    }

    .mobile-card {
        padding: 12px;
        margin-bottom: 12px;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.mb-20 { margin-bottom: 20px; }
.mt-20 { margin-top: 20px; }
.text-light { color: var(--text-light); }
