@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --secondary: #10B981;
    --accent: #F59E0B;
    --danger: #EF4444;
    
    --bg-light: #F3F4F6;
    --surface-light: #FFFFFF;
    --text-main-light: #111827;
    --text-muted-light: #6B7280;
    --border-light: #E5E7EB;
    
    --bg-dark: #111827;
    --surface-dark: #1F2937;
    --text-main-dark: #F9FAFB;
    --text-muted-dark: #9CA3AF;
    --border-dark: #374151;

    --transition-speed: 0.3s;
    --border-radius: 12px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body.dark-mode {
    --bg-color: var(--bg-dark);
    --surface-color: var(--surface-dark);
    --text-main: var(--text-main-dark);
    --text-muted: var(--text-muted-dark);
    --border-color: var(--border-dark);
    --glass-bg: rgba(31, 41, 55, 0.7);
}

body {
    --bg-color: var(--bg-light);
    --surface-color: var(--surface-light);
    --text-main: var(--text-main-light);
    --text-muted: var(--text-muted-light);
    --border-color: var(--border-light);
    --glass-bg: rgba(255, 255, 255, 0.7);

    margin: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

/* Glassmorphism utility */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
}

.layout-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--surface-color);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: width var(--transition-speed);
}

.sidebar-header {
    padding: 20px;
    font-size: 1.25rem;
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary);
}

.sidebar-menu {
    list-style: none;
    padding: 10px 0;
    margin: 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    gap: 12px;
    transition: all var(--transition-speed);
}

.sidebar-menu li a:hover, .sidebar-menu li a.active {
    background-color: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    border-right: 3px solid var(--primary);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.top-header {
    height: 70px;
    padding: 0 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    z-index: 10;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Common Components */
.card {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-speed);
    border: none;
    gap: 8px;
    font-family: inherit;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Login Form specific */
.login-container {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
}

.login-box {
    width: 400px;
    padding: 40px;
    border-radius: 16px;
    text-align: center;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
}
.form-control {
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.form-control:focus {
    outline: none;
    border-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 forwards;
}

/* Table styles */
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
tr:hover td {
    background-color: rgba(0,0,0,0.02);
}
body.dark-mode tr:hover td {
    background-color: rgba(255,255,255,0.02);
}

/* =========================================
   RESPONSIVE SIDEBAR (Mobile)
   ========================================= */
.sidebar-toggle-btn {
    display: none;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    color: var(--text-primary);
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.sidebar-toggle-btn:hover {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
}
.sidebar-toggle-btn svg {
    width: 20px;
    height: 20px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 900;
    backdrop-filter: blur(2px);
}

@media (max-width: 768px) {
    .sidebar-toggle-btn {
        display: flex;
    }

    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100%;
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: 4px 0 20px rgba(0,0,0,0.2);
    }

    .sidebar.sidebar-open {
        left: 0;
    }

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

    .main-content {
        margin-left: 0 !important;
        width: 100%;
    }

    .layout-wrapper {
        grid-template-columns: 1fr;
    }

    .top-header {
        padding: 12px 16px;
    }

    .page-title {
        font-size: 1.1rem;
    }

    /* Fix table on small screens */
    table {
        font-size: 12px;
    }
    th, td {
        padding: 8px 10px;
    }
}
