:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --sidebar: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-active: #ffffff;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

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

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

#app {
    height: 100vh;
}

.hidden {
    display: none !important;
}

.page {
    display: none;
    height: 100%;
}

.page.active {
    display: flex;
}

/* Login Page */
#login-page {
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 2.5rem;
    border-radius: 20px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    text-align: center;
}

.login-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--sidebar);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-light);
    margin-bottom: 2rem;
}

.form-group {
    text-align: left;
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: all 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    gap: 0.5rem;
}

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

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

.btn-block {
    width: 100%;
}

.error-msg {
    margin-top: 1rem;
    padding: 0.75rem;
    background-color: #fee2e2;
    color: var(--danger);
    border-radius: var(--radius);
    font-size: 0.875rem;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar);
    display: flex;
    flex-direction: column;
    color: var(--sidebar-text);
}

.sidebar-header {
    padding: 2rem 1.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
}

.logo i {
    color: var(--primary);
}

.sidebar-nav {
    flex: 1;
    padding: 0 1rem;
}

.nav-section {
    margin-bottom: 2rem;
}

.nav-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    padding-left: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius);
    font-size: 0.925rem;
    margin-bottom: 0.25rem;
    transition: all 0.2s;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--sidebar-active);
}

.nav-item.active {
    background-color: var(--primary);
    color: white;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    overflow: hidden;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background-color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-details span:first-child {
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-details span:last-child {
    font-size: 0.75rem;
}

.btn-icon {
    padding: 0.5rem;
    background: transparent;
    color: var(--sidebar-text);
}

.btn-icon:hover {
    color: white;
}

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

.content-header {
    padding: 1.5rem 2rem;
    background-color: white;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.content-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

#content-area {
    padding: 2rem;
    flex: 1;
    overflow-y: auto;
}

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

.stat-card {
    background-color: white;
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

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

.stat-icon.primary { background-color: rgba(99, 102, 241, 0.1); color: var(--primary); }
.stat-icon.success { background-color: rgba(16, 185, 129, 0.1); color: var(--success); }
.stat-icon.warning { background-color: rgba(245, 158, 11, 0.1); color: var(--warning); }
.stat-icon.danger { background-color: rgba(239, 68, 68, 0.1); color: var(--danger); }

.stat-info span {
    display: block;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Tables */
.table-container {
    background-color: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

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

th {
    background-color: #f8fafc;
    padding: 1rem 1.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    border-bottom: 1px solid var(--border);
}

td {
    padding: 1rem 1.5rem;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border);
}

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

.badge {
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-pending { background-color: #fef3c7; color: #92400e; }
.badge-success { background-color: #d1fae5; color: #065f46; }
.badge-danger { background-color: #fee2e2; color: #991b1b; }
.badge-info { background-color: #e0e7ff; color: #3730a3; }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-card {
    background-color: white;
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    overflow: hidden;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
}

.modal-body {
    padding: 1.5rem;
}

/* Utils */
.flex { display: flex; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }
.flex-col { flex-direction: column; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-8 { margin-top: 2rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-10 { padding: 2.5rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.font-bold { font-weight: 700; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.rounded-lg { border-radius: var(--radius); }
.shadow-sm { box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); }
.bg-white { background-color: white; }
.max-w-2xl { max-width: 42rem; }
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
@media (min-width: 768px) {
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.mobile-only {
    display: none !important;
}

/* Responsive Media Queries */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#mobile-toggle {
    display: none;
}

@media (max-width: 768px) {
    #mobile-toggle {
        display: flex;
        background: none;
        border: none;
        color: var(--text);
        font-size: 1.5rem;
        cursor: pointer;
        padding: 0.5rem;
    }

    .header-actions .btn-icon {
        padding: 0.4rem;
        font-size: 0.9rem;
    }

    .mobile-only {
        display: flex !important;
    }

    .page.active {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -260px; /* Hidden by default */
        bottom: 0;
        width: 260px;
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: 10px 0 30px rgba(0,0,0,0.1);
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        backdrop-filter: blur(2px);
    }

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

    .sidebar-header, .sidebar-footer {
        display: flex;
    }

    .sidebar-nav {
        display: block;
        padding: 0 1rem;
    }

    .nav-section {
        margin-bottom: 2rem;
        display: block;
    }

    .nav-label {
        display: block;
    }

    .nav-item {
        flex-direction: row;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
        font-size: 0.925rem;
        margin-bottom: 0.25rem;
        border-radius: var(--radius);
        text-align: left;
    }

    .main-content {
        height: 100vh;
        margin-bottom: 0;
    }

    .content-header {
        padding: 1rem 1.25rem;
    }

    .content-header h2 {
        font-size: 1.125rem;
    }

    #content-area {
        padding: 1.25rem;
    }

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

    .stat-card {
        padding: 1rem;
    }

    .table-container {
        overflow-x: auto;
    }

    table {
        min-width: 600px;
    }

    .modal-card {
        max-width: 90%;
        border-radius: 12px;
    }
}

.loader {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
