:root {
    --primary: #6C63FF;
    --primary-hover: #5a52d5;
    --bg-color: #F5F6FA;
    --card-bg: #FFFFFF;
    --text-color: #2F2F2F;
    --text-muted: #6c757d;
    --border-radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --transition: all 0.3s ease;
}

[data-theme="dark"] {
    --bg-color: #1A1C1E;
    --card-bg: #212429;
    --text-color: #E2E2E2;
    --text-muted: #9BA1A6;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: var(--transition);
}

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    background: var(--card-bg);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}

.btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

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

.alert {
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
}

.alert-error {
    background-color: #FEE2E2;
    color: #DC2626;
    border: 1px solid #FECACA;
}

@media (max-width: 768px) {
    .auth-card {
        padding: 30px 20px;
    }
}

/* Layout */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    background: var(--card-bg);
    box-shadow: var(--shadow);
    padding: 24px;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-header h2 {
    color: var(--primary);
    font-size: 22px;
    margin-bottom: 40px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-color);
    padding: 12px 16px;
    border-radius: 10px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.nav-item .nav-icon {
    font-size: 18px;
    transition: transform 0.3s ease;
}

.nav-item:hover {
    background: rgba(108, 99, 255, 0.05);
    color: var(--primary);
    border-color: rgba(108, 99, 255, 0.1);
    transform: translateX(4px);
}

.nav-item:hover .nav-icon {
    transform: scale(1.15);
}

.nav-item.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(108, 99, 255, 0.25);
    border-color: var(--primary);
}

.nav-item.active .nav-icon {
    color: white;
}

.nav-item.logout {
    margin-top: 10px;
    color: #DC2626;
    background: rgba(220, 38, 38, 0.02);
}

.nav-item.logout:hover {
    background: rgba(220, 38, 38, 0.08);
    border-color: rgba(220, 38, 38, 0.15);
    color: #B91C1C;
}

[data-theme="dark"] .nav-item:hover {
    background: rgba(108, 99, 255, 0.15);
}

.topbar {
    position: fixed;
    top: 0;
    left: 260px;
    right: 0;
    height: 70px;
    background: var(--card-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    z-index: 90;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.has-sidebar {
    margin-left: 260px;
    margin-top: 70px;
    padding: 30px;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

#drawer-toggle {
    display: none;
}

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.active {
        transform: translateX(0);
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.5);
        backdrop-filter: blur(2px);
        z-index: 95;
    }
    .sidebar-overlay.active {
        display: block;
    }
    .topbar {
        left: 0;
    }
    .has-sidebar {
        margin-left: 0;
    }
    #drawer-toggle {
        display: block;
    }
}

/* ─── Content Header ─── */
.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 28px;
}
.content-header h1 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

/* ─── Stats Bar ─── */
.stats-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}
.stat-card {
    flex: 1;
    min-width: 160px;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px 24px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(108, 99, 255, 0.08);
    transition: var(--transition);
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(108, 99, 255, 0.12);
}
.stat-card .stat-icon {
    font-size: 28px;
    margin-bottom: 8px;
}
.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}
.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ─── Search & Filter Bar ─── */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.search-wrapper {
    position: relative;
    flex: 1;
    min-width: 220px;
}
.search-wrapper .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 16px;
    pointer-events: none;
}
.search-wrapper input {
    width: 100%;
    padding: 11px 16px 11px 42px;
    border: 1px solid rgba(108, 99, 255, 0.15);
    border-radius: 10px;
    font-size: 14px;
    background: var(--card-bg);
    color: var(--text-color);
    outline: none;
    transition: var(--transition);
}
.search-wrapper input::placeholder {
    color: var(--text-muted);
}
.search-wrapper input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}

/* ─── Enhanced Table ─── */
.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(108, 99, 255, 0.06);
    overflow: hidden;
}
.table-responsive {
    overflow-x: auto;
}
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.table thead th {
    padding: 14px 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    background: rgba(108, 99, 255, 0.03);
    border-bottom: 1px solid rgba(108, 99, 255, 0.08);
    white-space: nowrap;
}
.table tbody td {
    padding: 16px 20px;
    vertical-align: middle;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    font-size: 14px;
    transition: var(--transition);
}
.table tbody tr {
    transition: var(--transition);
}
.table tbody tr:hover {
    background: rgba(108, 99, 255, 0.03);
}
.table tbody tr:last-child td {
    border-bottom: none;
}

/* ─── Avatar ─── */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), #a78bfa);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(108, 99, 255, 0.25);
}
.user-info {
    display: flex;
    align-items: center;
    gap: 14px;
}
.user-info .user-name {
    font-weight: 600;
    font-size: 14px;
}

/* ─── Action Buttons ─── */
.actions-cell {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}
.btn-action {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-size: 15px;
    background: rgba(108, 99, 255, 0.08);
    color: var(--primary);
}
.btn-action:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.08);
}
.btn-action.danger {
    background: rgba(220, 38, 38, 0.08);
    color: #DC2626;
}
.btn-action.danger:hover {
    background: #DC2626;
    color: white;
}

/* ─── Enhanced Buttons ─── */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), #a78bfa);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(108, 99, 255, 0.3);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover), #9061f9);
    box-shadow: 0 6px 20px rgba(108, 99, 255, 0.4);
    transform: translateY(-1px);
}
.btn-sm {
    padding: 7px 14px;
    font-size: 13px;
    border-radius: 8px;
}
.btn-ghost {
    background: transparent;
    border: 1px solid rgba(108, 99, 255, 0.2);
    color: var(--text-color);
    border-radius: 10px;
    padding: 10px 18px;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}
.btn-ghost:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(108, 99, 255, 0.04);
}

/* ─── Badge ─── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(108, 99, 255, 0.1);
    color: var(--primary);
}

/* ─── Toast Notification ─── */
.toast {
    position: fixed;
    top: 90px;
    right: 30px;
    padding: 14px 24px;
    border-radius: 12px;
    background: var(--card-bg);
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    border-left: 4px solid var(--primary);
    color: var(--text-color);
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}
.toast.show {
    transform: translateX(0);
}

/* ─── Empty State ─── */
.empty-state {
    text-align: center;
    padding: 60px 30px;
}
.empty-state .empty-icon {
    font-size: 56px;
    margin-bottom: 16px;
    opacity: 0.6;
}
.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}
.empty-state p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 24px;
}

/* ─── Animations ─── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slideIn {
    from { opacity: 0; transform: scale(0.95) translateY(-10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.animate-in {
    animation: fadeInUp 0.4s ease both;
}
.animate-in:nth-child(1) { animation-delay: 0.03s; }
.animate-in:nth-child(2) { animation-delay: 0.06s; }
.animate-in:nth-child(3) { animation-delay: 0.09s; }
.animate-in:nth-child(4) { animation-delay: 0.12s; }
.animate-in:nth-child(5) { animation-delay: 0.15s; }
.animate-in:nth-child(6) { animation-delay: 0.18s; }
.animate-in:nth-child(7) { animation-delay: 0.21s; }
.animate-in:nth-child(8) { animation-delay: 0.24s; }
.animate-in:nth-child(9) { animation-delay: 0.27s; }
.animate-in:nth-child(10) { animation-delay: 0.30s; }

/* ─── Text Helpers ─── */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.w-100 { width: 100%; }

/* ─── Dark mode refinements ─── */
[data-theme="dark"] .table thead th {
    background: rgba(108, 99, 255, 0.06);
    border-bottom-color: rgba(255,255,255,0.06);
}
[data-theme="dark"] .table tbody td {
    border-bottom-color: rgba(255,255,255,0.04);
}
[data-theme="dark"] .table tbody tr:hover {
    background: rgba(108, 99, 255, 0.06);
}
[data-theme="dark"] .card {
    border-color: rgba(255,255,255,0.06);
}
[data-theme="dark"] .search-wrapper input {
    border-color: rgba(255,255,255,0.1);
}
[data-theme="dark"] .search-wrapper input:focus {
    border-color: var(--primary);
}
[data-theme="dark"] .stat-card {
    border-color: rgba(255,255,255,0.06);
}
[data-theme="dark"] .btn-ghost {
    border-color: rgba(255,255,255,0.12);
}
[data-theme="dark"] .btn-ghost:hover {
    background: rgba(108, 99, 255, 0.08);
}
[data-theme="dark"] .form-control {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
    color: var(--text-color);
}
[data-theme="dark"] .mode-btn {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.12);
    color: var(--text-color);
}
[data-theme="dark"] .mode-btn:hover {
    background: rgba(255,255,255,0.14);
}
[data-theme="dark"] .btn-outline-secondary {
    border-color: rgba(255,255,255,0.12);
    color: var(--text-color);
}

/* ─── Responsive helpers ─── */
@media (max-width: 768px) {
    .has-sidebar { padding: 16px !important; }
    .content-header { flex-direction: row; justify-content: space-between; align-items: center; }
    .stats-bar { 
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }
    .stat-card {
        padding: 10px 12px !important;
    }
    .stat-icon {
        font-size: 16px !important;
        margin-bottom: 2px !important;
    }
    .stat-value {
        font-size: 18px !important;
    }
    .stat-label {
        font-size: 10px !important;
    }
    .filter-bar { flex-direction: row !important; gap: 8px !important; }
    .hide-mobile { display: none !important; }
    .actions-cell {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 4px;
        justify-items: center;
    }
    .table th, .table td {
        padding: 8px 10px !important;
        font-size: 12px !important;
    }
    .card {
        border-radius: 10px !important;
    }
}
/* ─── Modal System ─── */
.c-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    overflow: hidden;
    padding-top: 3vh;
}

.c-modal-content {
    background-color: var(--card-bg);
    margin: 0 auto;
    padding: 0;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 95%;
    max-width: 500px;
    max-height: 94vh;
    position: relative;
    animation: slideIn 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

.c-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(108, 99, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.c-modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--primary);
    font-weight: 600;
}

.c-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}


.c-close-btn {
    background: rgba(108, 99, 255, 0.05);
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: var(--transition);
}

.c-close-btn:hover {
    background: #ff4757;
    color: white;
}

.form-actions-row {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.form-actions-row button {
    flex: 1;
}
