/* ============================================
   SmartSchool - Complete CSS
   Modern, Responsive, RTL Kurdish
   ============================================ */

/* CSS Variables */
:root {
    --primary: #4F46E5;
    --primary-dark: #4338CA;
    --primary-light: #818CF8;
    --secondary: #64748B;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;

    --bg-primary: #F8FAFC;
    --bg-secondary: #F1F5F9;
    --bg-card: #FFFFFF;
    --bg-sidebar: #FFFFFF;
    --bg-overlay: rgba(0,0,0,0.5);

    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;
    --text-inverse: #FFFFFF;

    --border-color: #E2E8F0;
    --border-light: #F1F5F9;

    --shadow-sm: 0 1px 2px 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);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --font-family: 'Noto Sans Arabic', system-ui, -apple-system, sans-serif;
    --font-size-base: 16px;
    --font-size-sm: 14px;
    --font-size-xs: 12px;
    --font-size-lg: 18px;
    --font-size-xl: 24px;
    --font-size-2xl: 32px;

    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;

    --sidebar-width: 280px;
    --top-bar-height: 64px;
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* Dark Mode */
[data-theme="dark"] {
    --bg-primary: #0F172A;
    --bg-secondary: #1E293B;
    --bg-card: #1E293B;
    --bg-sidebar: #1E293B;
    --bg-overlay: rgba(0,0,0,0.7);

    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;

    --border-color: #334155;
    --border-light: #1E293B;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.5);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: var(--font-size-base);
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb {
    background: var(--secondary);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Selection */
::selection {
    background: var(--primary-light);
    color: var(--text-inverse);
}

/* ============================================
   SPLASH SCREEN
   ============================================ */
.splash-screen {
    position: fixed;
    inset: 0;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.splash-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.splash-content {
    text-align: center;
    color: white;
    animation: splashFadeIn 0.8s ease;
}

@keyframes splashFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.splash-logo {
    width: 120px;
    height: 120px;
    margin: 0 auto 24px;
}

.splash-logo-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 10px 30px rgba(0,0,0,0.3));
    animation: splashPulse 2s ease infinite;
}

@keyframes splashPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.splash-title {
    font-size: var(--font-size-2xl);
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -1px;
}

.splash-subtitle {
    font-size: var(--font-size-lg);
    opacity: 0.9;
    margin-bottom: 32px;
}

.splash-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
}

.splash-spinner {
    width: 24px;
    height: 24px;
    border: 3px 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); }
}

.splash-loading-text {
    font-size: var(--font-size-sm);
    opacity: 0.8;
}

.splash-version {
    font-size: var(--font-size-xs);
    opacity: 0.6;
}

/* ============================================
   AUTH SCREEN
   ============================================ */
.auth-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg-primary);
}

.auth-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 16px;
}

.auth-logo-svg {
    width: 100%;
    height: 100%;
    color: var(--primary);
}

.auth-title {
    font-size: var(--font-size-2xl);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.auth-subtitle {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.auth-tabs {
    display: flex;
    gap: 8px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
}

.auth-tab {
    padding: 10px 24px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: var(--font-size-sm);
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.auth-tab.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.auth-form {
    width: 100%;
    max-width: 400px;
    animation: formSlideIn 0.4s ease;
}

@keyframes formSlideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-form.hidden {
    display: none;
}

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

.form-label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    right: 14px;
    font-size: 18px;
    z-index: 1;
    pointer-events: none;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px 44px 12px 14px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--font-size-base);
    transition: all var(--transition-fast);
    outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-textarea {
    padding: 12px 14px;
    resize: vertical;
    min-height: 80px;
}

.toggle-password {
    position: absolute;
    left: 12px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}

.toggle-password:hover {
    opacity: 1;
}

/* Role Selector */
.role-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.role-option {
    cursor: pointer;
}

.role-option input {
    display: none;
}

.role-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 8px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    transition: all var(--transition-fast);
}

.role-option input:checked + .role-card {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.role-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.role-name {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    outline: none;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0);
    transition: background var(--transition-fast);
}

.btn:active::after {
    background: rgba(255,255,255,0.2);
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.5);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

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

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

.btn-full {
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: var(--font-size-sm);
}

.btn-icon {
    padding: 8px 12px;
    font-size: var(--font-size-sm);
}

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

.btn-loader.hidden {
    display: none;
}

.auth-hint {
    text-align: center;
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: 12px;
}

/* ============================================
   MAIN APP LAYOUT
   ============================================ */
#main-app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform var(--transition-base);
    overflow-y: auto;
    overflow-x: hidden;
}

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

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

.sidebar-logo-svg {
    width: 100%;
    height: 100%;
    color: var(--primary);
}

.sidebar-brand {
    flex: 1;
    min-width: 0;
}

.sidebar-brand-title {
    display: block;
    font-size: var(--font-size-lg);
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.sidebar-brand-subtitle {
    display: block;
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    margin: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
}

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

.user-info {
    min-width: 0;
}

.user-name {
    display: block;
    font-weight: 700;
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    display: block;
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.sidebar-nav {
    flex: 1;
    padding: 8px 12px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--font-size-sm);
    font-weight: 600;
    transition: all var(--transition-fast);
    margin-bottom: 4px;
}

.nav-item:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.nav-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sync-btn,
.logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    width: 100%;
}

.sync-btn {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

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

.sync-status {
    margin-right: auto;
    color: var(--success);
    font-size: var(--font-size-xs);
}

.logout-btn {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-right: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Top Bar */
.top-bar {
    position: sticky;
    top: 0;
    height: var(--top-bar-height);
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 4px;
}

.top-bar-title {
    flex: 1;
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-primary);
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.top-btn {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: none;
    border-radius: var(--radius-md);
    font-size: 18px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.notif-badge {
    position: absolute;
    top: -2px;
    left: -2px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Page Container */
.page-container {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.page {
    display: none;
    animation: pageFadeIn 0.3s ease;
}

.page.active {
    display: block;
}

@keyframes pageFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   DASHBOARD
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.stat-primary .stat-icon { background: rgba(79, 70, 229, 0.1); }
.stat-success .stat-icon { background: rgba(16, 185, 129, 0.1); }
.stat-warning .stat-icon { background: rgba(245, 158, 11, 0.1); }
.stat-info .stat-icon { background: rgba(59, 130, 246, 0.1); }

.stat-info {
    flex: 1;
    min-width: 0;
}

.stat-value {
    display: block;
    font-size: var(--font-size-2xl);
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    display: block;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-top: 2px;
}

.stat-trend {
    font-size: var(--font-size-sm);
    font-weight: 700;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}

.trend-up {
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.trend-down {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.trend-stable {
    color: var(--secondary);
    background: var(--bg-secondary);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.dashboard-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.dashboard-card.full-width {
    grid-column: 1 / -1;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: var(--font-size-base);
    font-weight: 700;
    color: var(--text-primary);
}

.card-action {
    font-size: var(--font-size-sm);
    color: var(--primary);
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
}

.card-action:hover {
    text-decoration: underline;
}

.card-body {
    padding: 20px;
}

.chart-canvas {
    width: 100%;
    height: 250px;
}

/* Top Students */
.top-students {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.top-student-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    transition: all var(--transition-fast);
}

.top-student-item:hover {
    background: var(--border-color);
}

.top-student-rank {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: var(--font-size-sm);
    flex-shrink: 0;
}

.top-student-rank.gold {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: white;
}

.top-student-rank.silver {
    background: linear-gradient(135deg, #C0C0C0, #A0A0A0);
    color: white;
}

.top-student-rank.bronze {
    background: linear-gradient(135deg, #CD7F32, #B87333);
    color: white;
}

.top-student-rank.normal {
    background: var(--bg-primary);
    color: var(--text-secondary);
}

.top-student-info {
    flex: 1;
    min-width: 0;
}

.top-student-name {
    font-weight: 700;
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-student-class {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.top-student-score {
    font-weight: 800;
    color: var(--primary);
    font-size: var(--font-size-lg);
}

/* Today Schedule */
.today-schedule {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.schedule-slot {
    min-width: 180px;
    padding: 16px;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.schedule-slot:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.schedule-slot-time {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-bottom: 8px;
}

.schedule-slot-subject {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.schedule-slot-class {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.schedule-slot-teacher {
    font-size: var(--font-size-xs);
    color: var(--primary);
    margin-top: 8px;
}

/* ============================================
   PAGE TOOLBAR
   ============================================ */
.page-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 400px;
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    opacity: 0.5;
}

.search-box input {
    width: 100%;
    padding: 10px 40px 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--font-size-sm);
    outline: none;
    transition: all var(--transition-fast);
}

.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.filter-group {
    display: flex;
    gap: 8px;
}

.week-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.week-label {
    font-weight: 700;
    color: var(--text-primary);
}

/* ============================================
   STUDENTS PAGE
   ============================================ */
.students-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.student-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.student-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.student-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.student-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    flex-shrink: 0;
}

.student-info {
    flex: 1;
    min-width: 0;
}

.student-name {
    font-weight: 700;
    color: var(--text-primary);
    font-size: var(--font-size-base);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.student-class {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.student-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.student-stat {
    text-align: center;
    padding: 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.student-stat-value {
    display: block;
    font-weight: 800;
    color: var(--primary);
    font-size: var(--font-size-lg);
}

.student-stat-label {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.student-actions {
    display: flex;
    gap: 8px;
}

.student-actions .btn {
    flex: 1;
    padding: 8px;
    font-size: var(--font-size-xs);
}

/* ============================================
   ASSESSMENT PAGE
   ============================================ */
.assessment-table-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

.data-table th {
    background: var(--bg-secondary);
    padding: 14px 16px;
    text-align: right;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    white-space: nowrap;
}

.data-table tr:hover td {
    background: var(--bg-secondary);
}

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

.score-input {
    width: 70px;
    padding: 6px 10px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--font-size-sm);
    text-align: center;
    outline: none;
    transition: all var(--transition-fast);
}

.score-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.score-total {
    font-weight: 800;
    color: var(--primary);
    font-size: var(--font-size-lg);
}

.score-pass {
    color: var(--success);
}

.score-fail {
    color: var(--danger);
}

/* ============================================
   EXAMS PAGE
   ============================================ */
.exams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.exam-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    transition: all var(--transition-fast);
}

.exam-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.exam-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}

.exam-title {
    font-weight: 700;
    color: var(--text-primary);
    font-size: var(--font-size-base);
}

.exam-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: var(--font-size-xs);
    font-weight: 600;
}

.exam-badge.math { background: rgba(79, 70, 229, 0.1); color: var(--primary); }
.exam-badge.science { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.exam-badge.kurdish { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.exam-badge.english { background: rgba(59, 130, 246, 0.1); color: var(--info); }
.exam-badge.arabic { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

.exam-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.exam-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.exam-preview {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 16px;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    max-height: 80px;
    overflow: hidden;
}

.exam-actions {
    display: flex;
    gap: 8px;
}

.exam-actions .btn {
    flex: 1;
    padding: 8px;
    font-size: var(--font-size-xs);
}

/* Rich Editor */
.rich-editor {
    min-height: 200px;
    padding: 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--font-size-base);
    line-height: 1.8;
    outline: none;
    transition: all var(--transition-fast);
}

.rich-editor:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.rich-editor p {
    margin-bottom: 12px;
}

/* ============================================
   SCHEDULE PAGE
   ============================================ */
.schedule-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.schedule-header {
    display: grid;
    grid-template-columns: 80px repeat(6, 1fr);
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-color);
}

.schedule-time-col,
.schedule-day {
    padding: 14px 8px;
    text-align: center;
    font-weight: 700;
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    border-left: 1px solid var(--border-color);
}

.schedule-time-col {
    border-left: none;
    font-size: var(--font-size-xs);
}

.schedule-body {
    display: flex;
    flex-direction: column;
}

.schedule-row {
    display: grid;
    grid-template-columns: 80px repeat(6, 1fr);
    border-bottom: 1px solid var(--border-light);
    min-height: 80px;
}

.schedule-row:last-child {
    border-bottom: none;
}

.schedule-time-cell {
    padding: 12px 8px;
    text-align: center;
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
}

.schedule-cell {
    padding: 6px;
    border-left: 1px solid var(--border-color);
    position: relative;
    min-height: 80px;
}

.schedule-item {
    padding: 8px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    cursor: grab;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.schedule-item:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-md);
    z-index: 10;
}

.schedule-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.schedule-item.math { background: rgba(79, 70, 229, 0.1); border-color: rgba(79, 70, 229, 0.2); }
.schedule-item.science { background: rgba(16, 185, 129, 0.1); border-color: rgba(16, 185, 129, 0.2); }
.schedule-item.kurdish { background: rgba(245, 158, 11, 0.1); border-color: rgba(245, 158, 11, 0.2); }
.schedule-item.english { background: rgba(59, 130, 246, 0.1); border-color: rgba(59, 130, 246, 0.2); }
.schedule-item.arabic { background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.2); }
.schedule-item.sport { background: rgba(139, 92, 246, 0.1); border-color: rgba(139, 92, 246, 0.2); }
.schedule-item.art { background: rgba(236, 72, 153, 0.1); border-color: rgba(236, 72, 153, 0.2); }

.schedule-item-subject {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.schedule-item-class {
    color: var(--text-secondary);
}

.schedule-item-room {
    color: var(--text-muted);
    font-size: 10px;
}

/* ============================================
   REPORTS PAGE
   ============================================ */
.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.report-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    text-align: center;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.report-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.report-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 16px;
}

.report-title {
    font-size: var(--font-size-base);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.report-desc {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
}

/* ============================================
   SETTINGS PAGE
   ============================================ */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

.settings-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.settings-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.settings-icon {
    font-size: 24px;
}

.settings-title {
    font-size: var(--font-size-base);
    font-weight: 700;
    color: var(--text-primary);
}

.settings-card-body {
    padding: 20px;
}

/* Logo Upload */
.logo-upload {
    cursor: pointer;
}

.logo-preview {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    transition: all var(--transition-fast);
}

.logo-preview:hover {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.02);
}

.logo-preview span {
    font-size: 40px;
    display: block;
    margin-bottom: 8px;
}

.logo-preview p {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.logo-preview img {
    max-width: 100%;
    max-height: 120px;
    border-radius: var(--radius-md);
}

/* Font Size Slider */
.font-size-slider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.font-size-slider span {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    font-weight: 700;
}

.slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-secondary);
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.4);
    transition: transform var(--transition-fast);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.font-preview {
    display: block;
    text-align: center;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    margin-top: 8px;
}

/* Toggle Switch */
.toggle-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

.toggle-group:last-child {
    border-bottom: none;
}

.toggle-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--font-size-sm);
}

.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    cursor: pointer;
}

.toggle-switch input {
    display: none;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border-color);
    border-radius: 26px;
    transition: background var(--transition-fast);
}

.toggle-slider::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    top: 3px;
    right: 3px;
    transition: transform var(--transition-fast);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::after {
    transform: translateX(-22px);
}

/* ============================================
   MODALS
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    z-index: 2001;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.modal-large {
    max-width: 800px;
}

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

.modal-title {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-secondary);
    color: var(--danger);
}

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

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    justify-content: flex-end;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ============================================
   TOASTS
   ============================================ */
.toast-container {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    animation: toastSlideIn 0.3s ease;
    min-width: 280px;
    max-width: 400px;
}

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.toast.toast-exit {
    animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideOut {
    to { opacity: 0; transform: translateX(-20px); }
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 700;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

.toast-message {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    margin-top: 2px;
}

.toast-success { border-right: 4px solid var(--success); }
.toast-error { border-right: 4px solid var(--danger); }
.toast-warning { border-right: 4px solid var(--warning); }
.toast-info { border-right: 4px solid var(--info); }

/* ============================================
   OFFLINE INDICATOR
   ============================================ */
.offline-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--danger);
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 3000;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.offline-indicator button {
    background: white;
    color: var(--danger);
    border: none;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: var(--font-size-xs);
    font-weight: 700;
    cursor: pointer;
}

/* ============================================
   UTILITIES
   ============================================ */
.hidden {
    display: none !important;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(100%);
    }
    .sidebar.active {
        transform: translateX(0);
    }
    .sidebar-close {
        display: block;
    }
    .main-content {
        margin-right: 0;
    }
    .menu-toggle {
        display: block;
    }
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .page-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .search-box {
        max-width: none;
    }
    .filter-group {
        flex-direction: column;
    }
    .students-grid,
    .exams-grid,
    .reports-grid {
        grid-template-columns: 1fr;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .modal {
        width: 95%;
        max-height: 95vh;
    }
    .modal-footer {
        flex-direction: column;
    }
    .modal-footer .btn {
        width: 100%;
    }
    .schedule-header,
    .schedule-row {
        grid-template-columns: 60px repeat(6, 1fr);
    }
    .schedule-day {
        font-size: var(--font-size-xs);
        padding: 10px 4px;
    }
    .schedule-cell {
        min-height: 60px;
        padding: 4px;
    }
    .schedule-item {
        padding: 4px;
    }
    .schedule-item-subject {
        font-size: 10px;
    }
    .schedule-item-class,
    .schedule-item-room {
        font-size: 9px;
    }
    .top-bar {
        padding: 0 16px;
    }
    .page-container {
        padding: 16px;
    }
    .role-selector {
        grid-template-columns: 1fr;
    }
    .auth-container {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    :root {
        --font-size-base: 15px;
    }
    .stat-card {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
    .stat-trend {
        margin-right: 0;
    }
    .today-schedule {
        flex-direction: column;
    }
    .schedule-slot {
        min-width: auto;
    }
}

/* Print Styles */
@media print {
    .sidebar,
    .top-bar,
    .page-toolbar,
    .modal-overlay,
    .toast-container,
    .offline-indicator {
        display: none !important;
    }
    .main-content {
        margin-right: 0;
    }
    .page {
        display: block !important;
    }
    .page:not(.active) {
        display: none !important;
    }
    body {
        background: white;
        color: black;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000;
        --text-primary: #000;
    }
    .btn-primary {
        border: 2px solid #000;
    }
}
