* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3b82f6;
    --secondary-color: #1e40af;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --dark-color: #1f2937;
    --light-color: #f3f4f6;
    --border-color: #e5e7eb;
    --text-color: #374151;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --sidebar-width: 250px;
    --sidebar-bg: #111827;
    --sidebar-text: #9ca3af;
    --sidebar-hover: #1f2937;
    --sidebar-active: #3b82f6;
    --top-header-height: 56px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ===================================
   OLD HEADER (student pages uchun saqlanadi)
   =================================== */
.header {
    background: white;
    box-shadow: var(--shadow);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.logo {
    font-size: 20px;
    font-weight: bold;
    color: var(--primary-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
}

.nav-menu {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.nav-btn {
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    transition: background 0.3s;
}

.nav-btn:hover {
    background: var(--secondary-color);
}

.logout-btn {
    background: var(--danger-color);
}

/* ===================================
   SIDEBAR LAYOUT (admin pages)
   =================================== */

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    z-index: 200;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-size: 17px;
    font-weight: 700;
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
}

.sidebar-close:hover {
    color: #fff;
}

/* Sidebar navigation */
.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.sidebar-section-title {
    padding: 16px 20px 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-link.active {
    background: rgba(59, 130, 246, 0.12);
    color: var(--sidebar-active);
    border-left-color: var(--sidebar-active);
    font-weight: 600;
}

.sidebar-link.active svg {
    stroke: var(--sidebar-active);
}

.sidebar-link svg {
    flex-shrink: 0;
}

/* Sidebar footer */
.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 12px 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: #d1d5db;
    font-size: 13px;
    font-weight: 500;
}

.sidebar-logout {
    color: #f87171 !important;
}
.sidebar-logout:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #fca5a5 !important;
}

/* Overlay (mobile uchun) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 190;
}

/* Top header (sidebar mavjud bo'lganda) */
.top-header {
    position: sticky;
    top: 0;
    height: var(--top-header-height);
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    margin-left: var(--sidebar-width);
    z-index: 100;
    box-shadow: var(--shadow);
}

.hamburger-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    color: var(--text-color);
}

.hamburger-btn:hover {
    background: var(--light-color);
}

.top-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.top-header-user {
    font-size: 14px;
    color: var(--text-color);
    font-weight: 500;
}

/* Main content — sidebar mavjud bo'lganda suriladi */
body:has(.sidebar) .container,
body.has-sidebar .container {
    margin-left: var(--sidebar-width);
    max-width: calc(1200px + var(--sidebar-width));
}

/* ===================================
   SIDEBAR — MOBILE RESPONSIVE
   =================================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-close {
        display: block;
    }
    .sidebar-overlay.active {
        display: block;
    }
    .top-header {
        margin-left: 0;
    }
    .hamburger-btn {
        display: block;
    }
    body:has(.sidebar) .container,
    body.has-sidebar .container {
        margin-left: 0;
        max-width: 100%;
    }
}

/* ===================================
   Cards
   =================================== */
.card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.card-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--dark-color);
}

.card-subtitle {
    font-size: 16px;
    font-weight: 500;
    margin: 15px 0 10px;
    color: var(--text-color);
}

/* ===================================
   Forms
   =================================== */
.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 14px;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

/* ===================================
   Buttons
   =================================== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--secondary-color);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-full {
    width: 100%;
}

/* ===================================
   Statistics Dashboard
   =================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 14px;
    opacity: 0.9;
}

/* ===================================
   Table
   =================================== */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.table th {
    background: var(--primary-color);
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: 500;
    font-size: 14px;
}

.table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.table tr:hover {
    background: var(--light-color);
}

/* ===================================
   File Upload
   =================================== */
.file-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.file-upload-area:hover {
    border-color: var(--primary-color);
    background: var(--light-color);
}

.file-upload-icon {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 10px;
}

/* ===================================
   Login Page
   =================================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.login-title {
    text-align: center;
    font-size: 28px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 30px;
}

/* ===================================
   Badges
   =================================== */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: var(--success-color);
    color: white;
}

.badge-warning {
    background: var(--warning-color);
    color: white;
}

.badge-danger {
    background: var(--danger-color);
    color: white;
}

/* ===================================
   Alert Messages
   =================================== */
.alert {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #3b82f6;
}

/* ===================================
   Filter Section
   =================================== */
.filter-section {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.filter-section .form-group {
    flex: 1;
    min-width: 150px;
    margin-bottom: 0;
}

/* ===================================
   Progress Bar
   =================================== */
.progress-bar {
    width: 100%;
    height: 20px;
    background: var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--success-color);
    transition: width 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* ===================================
   Mobile Responsive (umumiy)
   =================================== */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav-menu {
        width: 100%;
        justify-content: center;
    }
    
    .card {
        padding: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .table {
        font-size: 12px;
    }
    
    .table th, .table td {
        padding: 8px;
    }
    
    .filter-section {
        flex-direction: column;
    }
    
    .filter-section .form-group {
        width: 100%;
    }
    
    .login-card {
        padding: 30px 20px;
    }
}

/* ===================================
   Print styles
   =================================== */
@media print {
    .sidebar, .top-header, .sidebar-overlay {
        display: none !important;
    }
    body:has(.sidebar) .container,
    body.has-sidebar .container {
        margin-left: 0;
    }
}

/* ===================================
   Utility Classes
   =================================== */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }

.flex {
    display: flex;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gap-1 {
    gap: 10px;
}

.gap-2 {
    gap: 20px;
}
