/**
 * نظام التصميم الموحد - منظومة التميز المدرسي
 * Ibn Khaldoun Schools Excellence System - Design System
 * Version 2.0 - Modern Professional Design
 */

/* ============================================
   CSS CUSTOM PROPERTIES (DESIGN TOKENS)
   ============================================ */
:root {
    /* Primary Colors - Deep Blue Theme */
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-200: #bfdbfe;
    --primary-300: #93c5fd;
    --primary-400: #60a5fa;
    --primary-500: #3b82f6;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;
    --primary-800: #1e40af;
    --primary-900: #1e3a8a;
    --primary-950: #172554;

    /* Secondary Colors - Emerald */
    --secondary-50: #ecfdf5;
    --secondary-100: #d1fae5;
    --secondary-200: #a7f3d0;
    --secondary-300: #6ee7b7;
    --secondary-400: #34d399;
    --secondary-500: #10b981;
    --secondary-600: #059669;
    --secondary-700: #047857;
    --secondary-800: #065f46;
    --secondary-900: #064e3b;

    /* Accent Colors - Amber */
    --accent-50: #fffbeb;
    --accent-100: #fef3c7;
    --accent-200: #fde68a;
    --accent-300: #fcd34d;
    --accent-400: #fbbf24;
    --accent-500: #f59e0b;
    --accent-600: #d97706;
    --accent-700: #b45309;

    /* Neutral Colors */
    --neutral-50: #fafafa;
    --neutral-100: #f4f4f5;
    --neutral-200: #e4e4e7;
    --neutral-300: #d4d4d8;
    --neutral-400: #a1a1aa;
    --neutral-500: #71717a;
    --neutral-600: #52525b;
    --neutral-700: #3f3f46;
    --neutral-800: #27272a;
    --neutral-900: #18181b;

    /* Semantic Colors */
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --error: #ef4444;
    --error-light: #fee2e2;
    --info: #3b82f6;
    --info-light: #dbeafe;

    /* Background Colors */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-dark: #0f172a;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-gradient-primary: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-800) 100%);
    --bg-gradient-secondary: linear-gradient(135deg, var(--secondary-500) 0%, var(--secondary-700) 100%);
    --bg-gradient-accent: linear-gradient(135deg, var(--accent-400) 0%, var(--accent-600) 100%);

    /* Glass Effect */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-bg-dark: rgba(15, 23, 42, 0.8);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-blur: blur(20px);

    /* Typography */
    --font-primary: 'Tajawal', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-display: 'Cairo', 'Tajawal', sans-serif;
    --font-mono: 'IBM Plex Mono', 'Consolas', monospace;

    /* Font Sizes */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;
    --text-5xl: 3rem;

    /* Font Weights */
    --font-light: 300;
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    --font-extrabold: 800;

    /* Line Heights */
    --leading-tight: 1.25;
    --leading-normal: 1.6;
    --leading-relaxed: 1.8;

    /* Spacing Scale */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    --space-24: 6rem;

    /* Border Radius */
    --radius-sm: 0.5rem;
    --radius-md: 0.625rem;
    --radius-lg: 0.875rem;
    --radius-xl: 1.125rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;

    /* Shadows — Softer, Dual-Layer */
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 4px 8px -2px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 20px -4px rgba(0, 0, 0, 0.08), 0 4px 8px -4px rgba(0, 0, 0, 0.06);
    --shadow-xl: 0 20px 30px -6px rgba(0, 0, 0, 0.1), 0 8px 12px -6px rgba(0, 0, 0, 0.06);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 24px rgba(59, 130, 246, 0.25), 0 0 8px rgba(59, 130, 246, 0.15);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.04), 0 4px 20px rgba(0, 0, 0, 0.06);
    --shadow-card-hover: 0 8px 24px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.06);

    /* Transitions — Material Design Easing */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slower: 500ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Z-Index Scale */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
    --z-toast: 1080;

    /* Container Widths */
    --container-sm: 640px;
    --container-md: 768px;
    --container-lg: 1024px;
    --container-xl: 1280px;
    --container-2xl: 1536px;

    /* Purple Accent */
    --purple-50: #f5f3ff;
    --purple-100: #ede9fe;
    --purple-400: #a78bfa;
    --purple-500: #7c3aed;
    --purple-600: #6d28d9;
    --purple-700: #5b21b6;

    /* Teal Accent */
    --teal-50: #f0fdfa;
    --teal-100: #ccfbf1;
    --teal-400: #2dd4bf;
    --teal-500: #14b8a6;
    --teal-600: #0d9488;
}

/* ============================================
   DARK MODE - Variable Overrides
   ============================================ */
[data-theme="dark"] {
    /* Background Colors */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-gradient: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);

    /* Neutral — invert light/dark shades */
    --neutral-50: #18181b;
    --neutral-100: #1e293b;
    --neutral-200: #334155;
    --neutral-300: #475569;
    --neutral-400: #64748b;
    --neutral-500: #94a3b8;
    --neutral-600: #cbd5e1;
    --neutral-700: #e2e8f0;
    --neutral-800: #f1f5f9;
    --neutral-900: #f8fafc;

    /* Semantic light variants — darken for dark mode */
    --success-light: #064e3b;
    --warning-light: #78350f;
    --error-light: #7f1d1d;
    --info-light: #1e3a8a;

    /* Primary light shades — darken */
    --primary-50: #172554;
    --primary-100: #1e3a8a;

    /* Secondary light shades — darken */
    --secondary-50: #064e3b;
    --secondary-100: #065f46;

    /* Accent light shades — darken */
    --accent-50: #78350f;
    --accent-100: #92400e;

    /* Glass Effect */
    --glass-bg: rgba(15, 23, 42, 0.8);
    --glass-border: rgba(255, 255, 255, 0.1);

    /* Purple / Teal dark overrides */
    --purple-50: #2e1065;
    --purple-100: #3b0764;
    --teal-50: #042f2e;
    --teal-100: #134e4a;

    /* Shadows — stronger on dark, dual-layer */
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.25), 0 1px 2px -1px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 8px -2px rgba(0, 0, 0, 0.35), 0 2px 4px -2px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 12px 20px -4px rgba(0, 0, 0, 0.35), 0 4px 8px -4px rgba(0, 0, 0, 0.25);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.2), 0 4px 20px rgba(0, 0, 0, 0.25);
    --shadow-card-hover: 0 8px 24px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2);

    color-scheme: dark;
}

[data-theme="dark"] body {
    background: var(--bg-primary);
    color: var(--neutral-900);
}

/* ============================================
   GOOGLE FONTS - Optimized Loading
   ============================================ */
/* Font loading is now handled via <link> tags in HTML for better performance */
/* Use preconnect and font-display: swap for optimal loading */

/* ============================================
   CSS RESET & BASE STYLES
   ============================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-primary);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--neutral-800);
    background-color: var(--bg-primary);
    direction: rtl;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Focus Styles */
:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

[data-theme="dark"] :focus-visible {
    outline-color: var(--primary-400);
}

/* Selection */
::selection {
    background-color: var(--primary-200);
    color: var(--primary-900);
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: var(--font-bold);
    line-height: var(--leading-tight);
    letter-spacing: -0.01em;
    color: var(--neutral-900);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
    color: var(--neutral-600);
    margin-bottom: var(--space-4);
}

a {
    color: var(--primary-600);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-700);
}

/* ============================================
   LAYOUT COMPONENTS
   ============================================ */

/* Container */
.container {
    width: 100%;
    max-width: var(--container-xl);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--space-4);
    padding-right: var(--space-4);
}

@media (min-width: 640px) {
    .container {
        padding-left: var(--space-6);
        padding-right: var(--space-6);
    }
}

@media (min-width: 1024px) {
    .container {
        padding-left: var(--space-8);
        padding-right: var(--space-8);
    }
}

/* Grid System */
.grid {
    display: grid;
    gap: var(--space-6);
}

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (min-width: 640px) {
    .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sm\:grid-cols-3 { grid-template-columns: repeat(3, 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)); }
    .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Flex Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* ============================================
   CARD COMPONENT
   ============================================ */
.card {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    padding: var(--space-6);
    transition: all var(--transition-base);
    border: 1px solid var(--neutral-200);
    position: relative;
    overflow: hidden;
}

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

.card-glass {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--neutral-100);
    margin-bottom: var(--space-4);
}

.card-title {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    color: var(--neutral-900);
}

.card-body {
    padding: var(--space-4) 0;
}

.card-footer {
    padding-top: var(--space-4);
    border-top: 1px solid var(--neutral-100);
    margin-top: var(--space-4);
}

/* Card with Accent Border */
.card-accent {
    border-top: 4px solid var(--primary-500);
}

.card-accent-secondary {
    border-top: 4px solid var(--secondary-500);
}

.card-accent-warning {
    border-top: 4px solid var(--accent-500);
}

/* ============================================
   BUTTON COMPONENTS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-family: var(--font-primary);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    line-height: 1;
    border-radius: var(--radius-lg);
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Button Sizes */
.btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-xs);
}

.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--text-base);
}

.btn-xl {
    padding: var(--space-5) var(--space-10);
    font-size: var(--text-lg);
}

/* Primary Button */
.btn-primary {
    background: var(--bg-gradient-primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Secondary Button */
.btn-secondary {
    background: var(--bg-gradient-secondary);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-secondary:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

/* Outline Button */
.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-500);
    color: var(--primary-600);
}

.btn-outline:hover {
    background: var(--primary-50);
    border-color: var(--primary-600);
}

/* Ghost Button */
.btn-ghost {
    background: transparent;
    color: var(--neutral-600);
}

.btn-ghost:hover {
    background: var(--neutral-100);
    color: var(--neutral-800);
}

/* Success Button */
.btn-success {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-success:hover {
    box-shadow: var(--shadow-lg), 0 0 20px rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
}

.btn-success:active {
    transform: translateY(0);
}

/* Danger Button */
.btn-danger {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-danger:hover {
    box-shadow: var(--shadow-lg), 0 0 20px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

.btn-danger:active {
    transform: translateY(0);
}

/* Warning Button */
.btn-warning {
    background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-warning:hover {
    box-shadow: var(--shadow-lg), 0 0 20px rgba(245, 158, 11, 0.4);
    transform: translateY(-1px);
}

.btn-warning:active {
    transform: translateY(0);
}

/* ============================================
   FORM COMPONENTS
   ============================================ */
.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--neutral-700);
    margin-bottom: var(--space-2);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-family: var(--font-primary);
    font-size: var(--text-base);
    color: var(--neutral-800);
    background-color: var(--bg-secondary);
    border: 1.5px solid var(--neutral-200);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
    border-color: var(--neutral-300);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100), 0 1px 2px rgba(0, 0, 0, 0.04);
}

.form-input::placeholder {
    color: var(--neutral-400);
}

/* Input with Icon */
.input-group {
    position: relative;
}

.input-group .form-input {
    padding-right: var(--space-12);
}

.input-icon {
    position: absolute;
    right: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    color: var(--neutral-400);
    pointer-events: none;
}

/* ============================================
   NAVIGATION HEADER
   ============================================ */
.nav-header {
    background: linear-gradient(135deg, var(--primary-800) 0%, var(--primary-900) 50%, var(--primary-950) 100%) !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: none;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .nav-header {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 50%, #020617 100%) !important;
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: var(--container-xl);
    margin: 0 auto;
    padding: var(--space-4) var(--space-6);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.nav-logo {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    object-fit: contain;
    background: #ffffff !important;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    border: 3px solid rgba(255, 255, 255, 0.6);
}

.nav-logo svg {
    width: 36px;
    height: 36px;
    fill: #1e40af !important;
}

.nav-title {
    font-family: var(--font-display);
    font-size: 1.5rem !important;
    font-weight: 800 !important;
    color: #ffffff !important;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.nav-subtitle {
    font-size: 1rem !important;
    color: #bfdbfe !important;
    font-weight: 700 !important;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.nav-link {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--neutral-600);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.nav-link:hover {
    background: var(--primary-50);
    color: var(--primary-600);
}

.nav-link.active {
    background: var(--primary-100);
    color: var(--primary-700);
}

/* User Menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.25) !important;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.4) !important;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-fast);
    color: #ffffff !important;
}

.user-menu:hover {
    background: rgba(255, 255, 255, 0.35) !important;
}

.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.35) !important;
    color: #ffffff !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-semibold);
    font-size: var(--text-sm);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
    border: 2px solid rgba(255, 255, 255, 0.5) !important;
}

.user-avatar svg {
    width: 24px;
    height: 24px;
    fill: #ffffff !important;
}

.user-info {
    text-align: right;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.user-name {
    font-size: 1rem !important;
    font-weight: 800 !important;
    color: #ffffff !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.user-role {
    font-size: 0.85rem !important;
    color: #60a5fa !important;
    font-weight: 700 !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* ============================================
   SIDEBAR NAVIGATION
   ============================================ */
.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--neutral-100);
    height: 100vh;
    position: fixed;
    right: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    z-index: var(--z-fixed);
    transition: transform var(--transition-slow);
}

.sidebar-header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--neutral-100);
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-4);
    overflow-y: auto;
}

.sidebar-section {
    margin-bottom: var(--space-6);
}

.sidebar-section-title {
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--neutral-400);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-2);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    color: var(--neutral-600);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    margin-bottom: var(--space-1);
}

.sidebar-link:hover {
    background: var(--primary-50);
    color: var(--primary-600);
}

.sidebar-link.active {
    background: var(--primary-100);
    color: var(--primary-700);
    font-weight: var(--font-medium);
}

.sidebar-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* ============================================
   STATS CARDS
   ============================================ */
.stat-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--neutral-100);
    transition: all var(--transition-base);
}

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

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 28px;
    height: 28px;
    color: white;
}

.stat-icon-primary {
    background: var(--bg-gradient-primary);
}

.stat-icon-secondary {
    background: var(--bg-gradient-secondary);
}

.stat-icon-warning {
    background: var(--bg-gradient-accent);
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: var(--text-sm);
    color: var(--neutral-500);
    margin-bottom: var(--space-1);
}

.stat-value {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    color: var(--neutral-900);
    font-family: var(--font-display);
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-sm);
    margin-top: var(--space-2);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-full);
}

.stat-change-positive {
    background: var(--success-light);
    color: var(--success);
}

.stat-change-negative {
    background: var(--error-light);
    color: var(--error);
}

/* ============================================
   TABLE COMPONENT
   ============================================ */
.table-container {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    border: 1px solid var(--neutral-100);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    background: var(--neutral-50);
    padding: var(--space-4) var(--space-5);
    text-align: right;
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--neutral-700);
    border-bottom: 2px solid var(--neutral-100);
}

.table td {
    padding: var(--space-4) var(--space-5);
    font-size: var(--text-sm);
    color: var(--neutral-600);
    border-bottom: 1px solid var(--neutral-100);
    vertical-align: middle;
}

.table tbody tr {
    transition: background var(--transition-fast);
}

.table tbody tr:hover {
    background: var(--neutral-50);
}

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

/* ============================================
   BADGE COMPONENT
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    border-radius: var(--radius-full);
}

.badge-primary {
    background: var(--primary-100);
    color: var(--primary-700);
}

.badge-secondary {
    background: var(--secondary-100);
    color: var(--secondary-700);
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-error {
    background: var(--error-light);
    color: var(--error);
}

.badge-info {
    background: var(--info-light);
    color: var(--info);
}

/* ============================================
   PROGRESS BAR
   ============================================ */
.progress {
    height: 8px;
    background: var(--neutral-100);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

.progress-primary {
    background: var(--bg-gradient-primary);
}

.progress-secondary {
    background: var(--bg-gradient-secondary);
}

.progress-success {
    background: linear-gradient(90deg, var(--success) 0%, #34d399 100%);
}

/* Progress with Label */
.progress-labeled {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.progress-labeled .progress {
    flex: 1;
}

.progress-label {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--neutral-700);
    min-width: 50px;
    text-align: left;
}

/* ============================================
   MODAL COMPONENT
   ============================================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal-backdrop);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

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

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

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

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

.modal-title {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--neutral-100);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--neutral-500);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--neutral-200);
    color: var(--neutral-700);
}

.modal-body {
    padding: var(--space-6);
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--neutral-100);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    top: var(--space-6);
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    pointer-events: none;
}

.toast {
    background: var(--bg-secondary);
    padding: var(--space-4) var(--space-6);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    pointer-events: auto;
    animation: slideIn 0.3s ease;
    border-right: 4px solid var(--primary-500);
}

.toast-success {
    border-right-color: var(--success);
}

.toast-error {
    border-right-color: var(--error);
}

.toast-warning {
    border-right-color: var(--warning);
}

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

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
    background: var(--bg-gradient-primary);
    padding: var(--space-20) 0;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    color: white;
}

.hero-title {
    font-size: var(--text-5xl);
    font-weight: var(--font-extrabold);
    color: white;
    margin-bottom: var(--space-4);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hero-subtitle {
    font-size: var(--text-xl);
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto var(--space-8);
}

/* ============================================
   FEATURE CARDS (Homepage)
   ============================================ */
.feature-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-2xl);
    padding: var(--space-8);
    text-align: center;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--neutral-100);
    transition: all var(--transition-slow);
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 4px;
    background: var(--bg-gradient-primary);
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-2xl);
}

.feature-card:hover .feature-icon {
    transform: scale(1.1);
}

.feature-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-6);
    border-radius: var(--radius-2xl);
    background: var(--bg-gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-base);
}

.feature-icon svg {
    width: 40px;
    height: 40px;
    color: white;
}

.feature-title {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--neutral-900);
    margin-bottom: var(--space-3);
}

.feature-description {
    font-size: var(--text-sm);
    color: var(--neutral-500);
    margin-bottom: var(--space-6);
    line-height: var(--leading-relaxed);
}

.feature-list {
    list-style: none;
    text-align: right;
    margin-bottom: var(--space-6);
}

.feature-list li {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) 0;
    font-size: var(--text-sm);
    color: var(--neutral-600);
}

.feature-list li::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--primary-500);
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    background: var(--bg-dark);
    color: white;
    padding: var(--space-8) 0;
    text-align: center;
}

.footer-content {
    max-width: var(--container-xl);
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.footer-logo {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    margin-bottom: var(--space-3);
}

.footer-text {
    color: var(--neutral-400);
    font-size: var(--text-sm);
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: var(--space-6);
    margin-top: var(--space-4);
}

.footer-link {
    color: var(--neutral-400);
    font-size: var(--text-sm);
    transition: color var(--transition-fast);
}

.footer-link:hover {
    color: white;
}

/* ============================================
   LOADING SPINNER
   ============================================ */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--neutral-200);
    border-top-color: var(--primary-500);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
}

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

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-fadeIn { animation: fadeIn 0.5s ease; }
.animate-fadeInUp { animation: fadeInUp 0.5s ease; }
.animate-fadeInDown { animation: fadeInDown 0.5s ease; }
.animate-scaleIn { animation: scaleIn 0.3s ease; }
.animate-pulse { animation: pulse 2s infinite; }

/* ============================================
   CONTEXTUAL TIPS
   ============================================ */

.iks-tip {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    border: 1px solid #93c5fd;
    border-radius: var(--radius-xl);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
    transition: opacity 0.3s ease;
}

.iks-tip-content {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.iks-tip-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.iks-tip-text {
    flex: 1;
    font-size: var(--text-sm);
    color: #1e3a5f;
    line-height: 1.6;
}

.iks-tip-close {
    background: #1e40af;
    color: #fff;
    border: none;
    padding: 6px 16px;
    border-radius: 8px;
    font-family: inherit;
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.iks-tip-close:hover {
    background: #1e3a8a;
}

[data-theme="dark"] .iks-tip {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border-color: #334155;
}

[data-theme="dark"] .iks-tip-text {
    color: #cbd5e1;
}

[data-theme="dark"] .iks-tip-close {
    background: #2563eb;
}

/* ============================================
   OVERALL PROGRESS BAR
   ============================================ */

.overall-progress-section {
    background: var(--bg-secondary);
    border: 1px solid var(--neutral-100);
    border-radius: var(--radius-xl);
    padding: var(--space-4) var(--space-5);
    margin-bottom: var(--space-4);
}

.overall-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
}

.overall-progress-title {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
}

.overall-progress-value {
    font-size: var(--text-sm);
    font-weight: var(--font-bold);
    color: var(--primary-600);
}

.overall-progress-bar {
    width: 100%;
    height: 12px;
    background: var(--neutral-100);
    border-radius: 6px;
    overflow: hidden;
}

.overall-progress-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.6s ease, background 0.3s ease;
}

[data-theme="dark"] .overall-progress-section {
    background: var(--bg-tertiary);
    border-color: var(--neutral-200);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Text */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-primary { color: var(--primary-600); }
.text-secondary { color: var(--secondary-600); }
.text-muted { color: var(--neutral-500); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-warning { color: var(--warning); }

/* Background */
.bg-primary { background-color: var(--primary-500); }
.bg-secondary { background-color: var(--secondary-500); }
.bg-white { background-color: white; }
.bg-light { background-color: var(--bg-primary); }

/* Spacing */
.m-0 { margin: 0; }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

/* Display */
.hidden { display: none !important; }
.block { display: block; }
.inline-block { display: inline-block; }

/* Width/Height */
.w-full { width: 100%; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }

/* Rounded */
.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

/* Shadow */
.shadow { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }

/* ============================================
   RESPONSIVE UTILITIES
   ============================================ */
@media (max-width: 640px) {
    :root {
        --text-4xl: 1.875rem;
        --text-5xl: 2.25rem;
    }

    .hero {
        padding: var(--space-12) 0;
    }

    .hero-title {
        font-size: var(--text-3xl);
    }

    .feature-card {
        padding: var(--space-6);
    }

    .stat-card {
        flex-direction: column;
        text-align: center;
    }

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

    .sidebar.active {
        transform: translateX(0);
    }

    .iks-tip {
        padding: var(--space-3);
    }

    .iks-tip-content {
        flex-direction: column;
        text-align: center;
    }

    .overall-progress-section {
        padding: var(--space-3);
    }

    .overall-progress-header {
        flex-direction: column;
        gap: var(--space-1);
        text-align: center;
    }
}

@media (max-width: 768px) {
    .nav-menu {
        display: none;
    }

    .modal {
        width: 95%;
        max-width: none;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    @page {
        size: A4;
        margin: 10mm;
    }

    body {
        background: white !important;
        color: black !important;
        font-size: 10pt !important;
    }

    /* Hide non-printable UI elements */
    .nav-header,
    .sidebar,
    .footer,
    .site-footer,
    .no-print,
    .skip-link,
    .search-filter-bar,
    .filter-actions,
    .nav-tabs-container,
    .offline-banner,
    #shared-header,
    [role="navigation"],
    .system-toast,
    .confirm-overlay,
    .confirm-dialog,
    .theme-toggle,
    .charts-summary,
    .iks-tip,
    .overall-progress-section {
        display: none !important;
    }

    .btn:not(.print-only),
    button:not(.print-only) {
        display: none !important;
    }

    /* Cards & containers */
    .card,
    .settings-card,
    .stat-card-mini,
    .chart-card,
    .section-card,
    .table-section {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        page-break-inside: avoid;
    }

    /* Page header */
    .page-header {
        background: #1e40af !important;
        padding: 10px !important;
        margin-bottom: 15px !important;
        border-radius: 0 !important;
    }

    .page-header .back-link {
        display: none !important;
    }

    /* Tables */
    .data-table th,
    .employees-table th {
        background: #1e40af !important;
        color: white !important;
        padding: 6px 8px !important;
    }

    .data-table td,
    .employees-table td {
        padding: 5px 8px !important;
    }

    tr {
        page-break-inside: avoid !important;
    }

    .status-badge,
    .score-badge {
        border: 1px solid #999 !important;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Charts at reduced size */
    .chart-container {
        height: 200px !important;
    }

    .charts-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
    }

    .analytics-section {
        page-break-inside: avoid;
    }

    main {
        padding: 0 !important;
    }

    .stats-grid {
        gap: 5px !important;
    }
}
