/* ============================================================================
   MESHWAR TAWERGHA - MOBILE-FIRST PROFESSIONAL UI SYSTEM
   ============================================================================ */

/* ===== CSS CUSTOM PROPERTIES (DESIGN TOKENS) ===== */
:root {
    /* Custom Green Brand Colors */
    --color-primary: #051F20;          /* Deepest Dark - Main backgrounds */
    --color-primary-dark: #0B2B26;     /* Dark Green - Cards/Secondary backgrounds */
    --color-primary-light: #163832;    /* Deep Muted Green - Borders/Structural */
    --color-accent: #235347;           /* Medium Forest Green - Secondary buttons/Accents */
    --color-accent-dark: #163832;      /* Darker accent */
    --color-success: #8EB69B;          /* Muted Mint - Main buttons/Highlights/Active */
    --color-success-dark: #235347;     /* Darker success state */
    --color-danger: #ef4444;           /* Keep danger red */
    --color-warning: #f59e0b;          /* Keep warning yellow */
    --color-info: #8EB69B;             /* Use muted mint for info */
    
    /* Additional Green Palette */
    --color-mint-light: #DAF1DE;       /* Light Mint - Badges/Hover/Light backgrounds */
    --color-forest-medium: #235347;    /* Medium Forest Green */
    --color-green-deep: #163832;       /* Deep Muted Green */
    --color-green-dark: #0B2B26;       /* Dark Green */
    --color-green-darkest: #051F20;    /* Deepest Dark */
    
    /* Background & Surface Colors */
    --color-background: #DAF1DE;       /* Light mint background */
    --color-surface: #ffffff;          /* White surface */
    --color-surface-hover: #DAF1DE;    /* Light mint hover */
    --color-surface-dark: #0B2B26;     /* Dark surface for cards */
    --color-overlay: rgba(5, 31, 32, 0.5);
    
    /* Text Colors */
    --color-text-primary: #051F20;     /* Dark text on light backgrounds */
    --color-text-secondary: #163832;   /* Secondary text */
    --color-text-tertiary: #235347;    /* Tertiary text */
    --color-text-inverse: #ffffff;     /* Light text on dark backgrounds */
    --color-text-light: #DAF1DE;       /* Very light text for dark backgrounds */
    
    /* Typography System */
    --font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-size-xs: 0.75rem;      /* 12px */
    --font-size-sm: 0.875rem;     /* 14px */
    --font-size-base: 1rem;       /* 16px - منع التكبير التلقائي */
    --font-size-lg: 1.125rem;     /* 18px */
    --font-size-xl: 1.25rem;      /* 20px */
    --font-size-2xl: 1.5rem;      /* 24px */
    --font-size-3xl: 1.875rem;    /* 30px */
    --font-size-4xl: 2.25rem;     /* 36px */
    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --font-weight-extrabold: 800;
    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;
    
    /* Spacing Scale (Mobile-Optimized) */
    --space-1: 0.25rem;   /* 4px */
    --space-2: 0.5rem;    /* 8px */
    --space-3: 0.75rem;   /* 12px */
    --space-4: 1rem;      /* 16px */
    --space-5: 1.25rem;   /* 20px */
    --space-6: 1.5rem;    /* 24px */
    --space-8: 2rem;      /* 32px */
    --space-10: 2.5rem;   /* 40px */
    --space-12: 3rem;     /* 48px */
    --space-16: 4rem;     /* 64px */
    
    /* Border Radius Scale */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 9999px;
    
    /* Shadow System (Elevation Levels) */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 2px 4px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 8px -2px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 16px -4px rgba(0, 0, 0, 0.10);
    --shadow-xl: 0 12px 24px -6px rgba(0, 0, 0, 0.12);
    --shadow-2xl: 0 20px 40px -8px rgba(0, 0, 0, 0.15);
    --shadow-glow-success: 0 0 20px rgba(17, 192, 128, 0.4);
    --shadow-glow-accent: 0 0 20px rgba(249, 115, 22, 0.4);
    
    /* Touch Targets (iOS & Android Guidelines) */
    --touch-target-min: 44px;     /* iOS minimum */
    --touch-target-optimal: 48px; /* Material Design */
    
    /* Safe Area Insets (للشاشات الحديثة) */
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-right: env(safe-area-inset-right, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-left: env(safe-area-inset-left, 0px);
    
    /* Z-Index Scale */
    --z-base: 1;
    
    /* ===== Natural Warm Loading Colors ===== */
    --loading-bg-cream: #FEFAE0;
    --loading-text-olive: #283618;
    --loading-green-olive: #606C38;
    --loading-mid-olive: #DDA15E;
    --loading-copper: #BC6C25;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal-backdrop: 400;
    --z-modal: 500;
    --z-popover: 600;
    --z-tooltip: 700;
    
    /* Transition Timing */
    --duration-fast: 150ms;
    --duration-base: 250ms;
    --duration-slow: 350ms;
    --easing-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --easing-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --easing-sharp: cubic-bezier(0.4, 0, 0.6, 1);
}


/* ===== RESET & BASE STYLES (MOBILE-FIRST) ===== */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent; /* إزالة التمييز الأزرق على iOS */
}

html {
    font-size: 16px; /* حجم أساسي يمنع التكبير التلقائي في Safari iOS */
    -webkit-text-size-adjust: 100%; /* منع تغيير حجم النص في المتصفحات */
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
    /* منع التمرير المطاطي (Rubber Band) على iOS */
    overscroll-behavior-y: none;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-normal);
    color: var(--color-text-primary);
    background-color: var(--color-background);
    direction: rtl;
    min-height: 100vh;
    min-height: -webkit-fill-available; /* دعم Safari iOS */
    /* منع التمرير الأفقي بشكل كامل */
    overflow-x: hidden;
    max-width: 100vw;
    /* دعم Safe Area للشاشات الحديثة */
    padding-top: var(--safe-area-top);
    padding-right: var(--safe-area-right);
    padding-bottom: var(--safe-area-bottom);
    padding-left: var(--safe-area-left);
    /* تحسين أداء التمرير */
    -webkit-overflow-scrolling: touch;
}

/* منع التحديد والنسخ غير المرغوب على العناصر التفاعلية */
button, a {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* السماح بالتحديد في حقول الإدخال والنصوص */
input, textarea, p, span, h1, h2, h3, h4, h5, h6 {
    -webkit-user-select: text;
    user-select: text;
}

/* ===== TYPOGRAPHY SYSTEM ===== */

h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
    color: var(--color-text-primary);
    margin-bottom: var(--space-4);
}

h1 {
    font-size: clamp(1.75rem, 5vw, var(--font-size-4xl));
    font-weight: var(--font-weight-extrabold);
}

h2 {
    font-size: clamp(1.5rem, 4vw, var(--font-size-3xl));
    font-weight: var(--font-weight-bold);
}

h3 {
    font-size: clamp(1.25rem, 3vw, var(--font-size-2xl));
}

h4 {
    font-size: clamp(1.125rem, 2.5vw, var(--font-size-xl));
}

h5 {
    font-size: var(--font-size-lg);
}

h6 {
    font-size: var(--font-size-base);
}

p {
    margin-bottom: var(--space-4);
    line-height: var(--line-height-relaxed);
}

a {
    color: #235347;
    text-decoration: none;
    transition: color var(--duration-fast) var(--easing-smooth);
}

a:hover {
    color: #8EB69B;
}

a:active {
    color: #051F20;
}

/* ===== BUTTONS (MOBILE-OPTIMIZED) ===== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: var(--touch-target-optimal);
    padding: var(--space-3) var(--space-6);
    font-family: var(--font-family);
    font-size: var(--font-size-base); /* منع التكبير التلقائي */
    font-weight: var(--font-weight-semibold);
    line-height: 1;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    user-select: none;
    transition: all var(--duration-base) var(--easing-smooth);
    /* تحسينات الأداء */
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.btn:active {
    transform: scale(0.96);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary {
    background: linear-gradient(135deg, #8EB69B 0%, #235347 100%);
    color: #051F20;
    font-weight: var(--font-weight-bold);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    background: linear-gradient(135deg, #235347 0%, #163832 100%);
    color: #ffffff;
}

.btn-primary:active {
    transform: translateY(0) scale(0.96);
    box-shadow: var(--shadow-sm);
}

.btn-success {
    background: linear-gradient(135deg, #8EB69B 0%, #235347 100%);
    color: #051F20;
    font-weight: var(--font-weight-bold);
    box-shadow: var(--shadow-md);
}

.btn-success:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    background: linear-gradient(135deg, #235347 0%, #163832 100%);
    color: #ffffff;
}

.btn-accent {
    background: linear-gradient(135deg, #235347 0%, #163832 100%);
    color: #ffffff;
    font-weight: var(--font-weight-semibold);
    box-shadow: var(--shadow-md);
}

.btn-accent:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    background: linear-gradient(135deg, #163832 0%, #0B2B26 100%);
}

.btn-secondary {
    background: #ffffff;
    color: #051F20;
    border: 2px solid #235347;
    box-shadow: var(--shadow-sm);
    font-weight: var(--font-weight-semibold);
}

.btn-secondary:hover {
    background: #DAF1DE;
    border-color: #163832;
}

/* Button Sizes */
.btn-sm {
    min-height: var(--touch-target-min);
    padding: var(--space-2) var(--space-4);
    font-size: var(--font-size-sm);
}

.btn-lg {
    min-height: 56px;
    padding: var(--space-4) var(--space-8);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
}

.btn-block {
    display: flex;
    width: 100%;
}


/* ===== CARD SYSTEM (MOBILE-FIRST) ===== */

.card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: all var(--duration-base) var(--easing-smooth);
    /* تحسينات الأداء */
    will-change: transform;
    contain: layout style paint;
}

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

.card:active {
    transform: translateY(-2px) scale(0.98);
}

.card-header {
    padding: var(--space-4) var(--space-5);
    background: linear-gradient(135deg, rgba(218, 241, 222, 0.3) 0%, rgba(142, 182, 155, 0.1) 100%);
    border-bottom: 1px solid rgba(35, 83, 71, 0.15);
}

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

.card-footer {
    padding: var(--space-4) var(--space-5);
    background: rgba(0, 0, 0, 0.01);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

/* Grid & List Layouts */
.cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
}

@media (min-width: 640px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .cards-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-6);
    }
}

.cards-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* Card Variations */
.card-interactive {
    cursor: pointer;
    user-select: none;
}

.card-interactive:active {
    transform: scale(0.97);
}

.card-elevated {
    box-shadow: var(--shadow-lg);
}

.card-flat {
    box-shadow: none;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* ===== FORM CONTROLS (MOBILE-OPTIMIZED) ===== */

.form-group {
    margin-bottom: var(--space-5);
}

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

.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="date"],
textarea,
select {
    display: block;
    width: 100%;
    min-height: var(--touch-target-optimal);
    padding: var(--space-3) var(--space-4);
    font-family: var(--font-family);
    font-size: 16px; /* منع التكبير التلقائي في iOS - هام جداً! */
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-normal);
    color: var(--color-text-primary);
    background-color: var(--color-surface);
    background-clip: padding-box;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-md);
    appearance: none;
    transition: all var(--duration-base) var(--easing-smooth);
}

.form-control:focus,
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #8EB69B;
    box-shadow: 0 0 0 4px rgba(142, 182, 155, 0.2);
}

.form-control::placeholder,
input::placeholder,
textarea::placeholder {
    color: var(--color-text-tertiary);
    opacity: 1;
}

/* Textarea Specific */
textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

/* Select Styling */
select.form-control {
    padding-right: var(--space-8);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left 0.75rem center;
    background-size: 16px 12px;
}

/* Form Validation States */
.form-control.is-valid,
.valid.modified:not([type=checkbox]) {
    border-color: #8EB69B;
    box-shadow: 0 0 0 4px rgba(142, 182, 155, 0.2);
}

.form-control.is-invalid,
.invalid {
    border-color: var(--color-danger);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.valid-feedback,
.invalid-feedback,
.validation-message {
    display: block;
    margin-top: var(--space-2);
    font-size: var(--font-size-sm);
}

.valid-feedback {
    color: #235347;
}

.invalid-feedback,
.validation-message {
    color: var(--color-danger);
}

/* Checkbox & Radio */
input[type="checkbox"],
input[type="radio"] {
    width: 20px;
    height: 20px;
    min-height: auto;
    margin-left: var(--space-2);
    cursor: pointer;
}

.form-check {
    display: flex;
    align-items: center;
    min-height: var(--touch-target-min);
    padding: var(--space-2) 0;
}

.form-check-label {
    cursor: pointer;
    user-select: none;
}

/* ===== ALERTS & NOTIFICATIONS ===== */

.alert {
    position: relative;
    padding: var(--space-4) var(--space-5);
    margin-bottom: var(--space-4);
    border-radius: var(--radius-md);
    border-right: 4px solid;
    font-size: var(--font-size-sm);
    line-height: var(--line-height-relaxed);
}

.alert-success {
    background-color: rgba(142, 182, 155, 0.15);
    border-color: #8EB69B;
    color: #051F20;
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: var(--color-danger);
    color: #991b1b;
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.1);
    border-color: var(--color-warning);
    color: #92400e;
}

.alert-info {
    background-color: rgba(59, 130, 246, 0.1);
    border-color: var(--color-info);
    color: #1e3a8a;
}


/* ===== LAYOUT SYSTEM (MOBILE-FIRST) ===== */

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

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

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

@media (min-width: 1024px) {
    .container {
        max-width: 1024px;
    }
}

@media (min-width: 1280px) {
    .container {
        max-width: 1200px;
    }
}

/* Main Content Layout with Bottom Nav Protection */
.content,
.main-content {
    min-height: calc(100vh - 72px); /* Header height */
    padding-top: var(--space-4);
    padding-bottom: calc(96px + var(--safe-area-bottom)); /* Bottom nav + safe area */
}

@media (min-width: 768px) {
    .content,
    .main-content {
        padding-bottom: var(--space-8); /* No bottom nav on desktop */
    }
}

/* Page Header */
.page-header {
    padding: var(--space-6) 0;
    margin-bottom: var(--space-6);
}

.page-title {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-extrabold);
    margin-bottom: var(--space-2);
}

.page-subtitle {
    font-size: var(--font-size-base);
    color: var(--color-text-secondary);
    margin-bottom: 0;
}

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

/* Spacing Utilities */
.m-0 { margin: 0 !important; }
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mt-2 { margin-top: var(--space-2) !important; }
.mb-2 { margin-bottom: var(--space-2) !important; }
.mt-4 { margin-top: var(--space-4) !important; }
.mb-4 { margin-bottom: var(--space-4) !important; }
.mt-6 { margin-top: var(--space-6) !important; }
.mb-6 { margin-bottom: var(--space-6) !important; }

.p-0 { padding: 0 !important; }
.p-2 { padding: var(--space-2) !important; }
.p-4 { padding: var(--space-4) !important; }
.p-6 { padding: var(--space-6) !important; }

/* Text Utilities */
.text-center { text-align: center !important; }
.text-left { text-align: left !important; }
.text-right { text-align: right !important; }

.text-primary { color: #8EB69B !important; }
.text-success { color: #235347 !important; }
.text-danger { color: var(--color-danger) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-secondary { color: #163832 !important; }
.text-tertiary { color: #235347 !important; }

.text-sm { font-size: var(--font-size-sm) !important; }
.text-base { font-size: var(--font-size-base) !important; }
.text-lg { font-size: var(--font-size-lg) !important; }
.text-xl { font-size: var(--font-size-xl) !important; }

.font-normal { font-weight: var(--font-weight-regular) !important; }
.font-medium { font-weight: var(--font-weight-medium) !important; }
.font-semibold { font-weight: var(--font-weight-semibold) !important; }
.font-bold { font-weight: var(--font-weight-bold) !important; }

/* Background Utilities */
.bg-primary { background-color: #051F20 !important; color: #DAF1DE !important; }
.bg-success { background-color: #8EB69B !important; color: #051F20 !important; }
.bg-surface { background-color: var(--color-surface) !important; }

/* Display Utilities */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-inline-flex { display: inline-flex !important; }

/* Responsive Display */
@media (max-width: 767px) {
    .d-mobile-none { display: none !important; }
}

@media (min-width: 768px) {
    .d-desktop-none { display: none !important; }
}

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

/* Border Utilities */
.rounded-sm { border-radius: var(--radius-sm) !important; }
.rounded-md { border-radius: var(--radius-md) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-full { border-radius: var(--radius-full) !important; }

/* Shadow Utilities */
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow-md { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }
.shadow-none { box-shadow: none !important; }

/* Overflow Control (مهم للموبايل) */
.overflow-hidden { overflow: hidden !important; }
.overflow-x-hidden { overflow-x: hidden !important; }
.overflow-y-auto { overflow-y: auto !important; }
.overflow-scroll { overflow: auto !important; -webkit-overflow-scrolling: touch !important; }

/* Width Utilities */
.w-full { width: 100% !important; }
.w-auto { width: auto !important; }

/* Height Utilities */
.h-full { height: 100% !important; }
.min-h-screen { min-height: 100vh !important; }

/* ===== LOADING & SPINNERS ===== */

.loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(142, 182, 155, 0.2);
    border-right-color: #8EB69B;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-spinner-lg {
    width: 48px;
    height: 48px;
    border-width: 4px;
}

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

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

/* ===== SCROLLBAR STYLING ===== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    transition: background var(--duration-fast);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* ===== ACCESSIBILITY ===== */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus Visible (Modern Browsers) */
:focus-visible {
    outline: 2px solid #8EB69B;
    outline-offset: 2px;
}

/* Skip to Content Link */
.skip-to-content {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-modal);
    padding: var(--space-3) var(--space-6);
    background: #051F20;
    color: #DAF1DE;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: var(--font-weight-semibold);
}

.skip-to-content:focus {
    top: var(--space-4);
}


/* ===== BLAZOR LOADING PROGRESS ===== */

.loading-progress {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: var(--z-modal);
}

.loading-progress svg {
    width: 100px;
    height: 100px;
}

.loading-progress circle {
    fill: none;
    stroke: rgba(0, 0, 0, 0.1);
    stroke-width: 4;
    transform-origin: 50% 50%;
}

.loading-progress circle:last-child {
    stroke: #8EB69B;
    stroke-dasharray: calc(3.14159 * var(--blazor-load-percentage, 0%) * 0.9), 500%;
    stroke-linecap: round;
    transition: stroke-dasharray 0.1s ease-in-out;
    animation: loading-rotate 2s linear infinite;
}

@keyframes loading-rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-progress-text {
    position: fixed;
    top: calc(50% + 60px);
    left: 50%;
    transform: translateX(-50%);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    text-align: center;
}

.loading-progress-text::after {
    content: var(--blazor-load-percentage-text, "جاري التحميل...");
    display: block;
}

/* ===== BLAZOR ERROR UI ===== */

#blazor-error-ui {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: var(--z-tooltip);
    padding: var(--space-4) var(--space-5);
    padding-bottom: calc(var(--space-4) + var(--safe-area-bottom));
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    color: #991b1b;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    box-shadow: var(--shadow-2xl);
    border-top: 3px solid var(--color-danger);
    display: none;
}

#blazor-error-ui.show {
    display: block;
}

#blazor-error-ui .dismiss {
    position: absolute;
    top: var(--space-4);
    left: var(--space-4);
    padding: var(--space-2);
    background: none;
    border: none;
    color: inherit;
    font-size: var(--font-size-xl);
    line-height: 1;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity var(--duration-fast);
}

#blazor-error-ui .dismiss:hover {
    opacity: 1;
}

#blazor-error-ui .reload {
    color: inherit;
    font-weight: var(--font-weight-bold);
    text-decoration: underline;
}

.blazor-error-boundary {
    position: relative;
    padding: var(--space-5);
    padding-right: var(--space-12);
    margin-bottom: var(--space-4);
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    color: #991b1b;
    border-radius: var(--radius-lg);
    border-right: 4px solid var(--color-danger);
}

.blazor-error-boundary::before {
    content: "⚠️";
    position: absolute;
    top: var(--space-5);
    right: var(--space-5);
    font-size: var(--font-size-2xl);
}

.blazor-error-boundary::after {
    content: "حدث خطأ في التطبيق. يرجى المحاولة مرة أخرى.";
    display: block;
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--space-2);
}

/* ===== CODE STYLING ===== */

code {
    padding: var(--space-1) var(--space-2);
    background-color: rgba(142, 182, 155, 0.1);
    color: #235347;
    border-radius: var(--radius-sm);
    font-family: 'Cascadia Code', 'Fira Code', 'SF Mono', 'Consolas', monospace;
    font-size: 0.9em;
}

pre {
    padding: var(--space-4);
    background-color: rgba(142, 182, 155, 0.1);
    border-radius: var(--radius-md);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

pre code {
    padding: 0;
    background: none;
}

/* ===== PERFORMANCE & OPTIMIZATION ===== */

/* تحسينات الأداء للأنيميشن والتحويلات */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* تحسين الأداء للعناصر المتحركة */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

/* GPU Acceleration */
.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* ===== PRINT STYLES ===== */

@media print {
    *,
    *::before,
    *::after {
        background: transparent !important;
        color: #000 !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    a,
    a:visited {
        text-decoration: underline;
    }

    img {
        page-break-inside: avoid;
    }

    p,
    h2,
    h3 {
        orphans: 3;
        widows: 3;
    }

    h2,
    h3 {
        page-break-after: avoid;
    }

    /* إخفاء عناصر التنقل عند الطباعة */
    .bottom-nav,
    .glass-header,
    nav,
    .btn {
        display: none !important;
    }
}

/* ===== MODERN LOADING SCREEN ===== */

/* Natural Warm Color Palette */
:root {
    --loading-bg-cream: #FEFAE0;        /* خلفية كريمي هادئ */
    --loading-text-olive: #283618;      /* زيتوني غامق للنصوص */
    --loading-green-olive: #606C38;     /* أخضر زيتوني */
    --loading-copper: #BC6C25;          /* نحاسي */
    --loading-mid-olive: #798645;       /* لون متوسط للتدرج */
}

.modern-loading-screen {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-8);
    background: var(--loading-bg-cream);
    overflow: hidden;
}

/* Animated Background Pattern */
.modern-loading-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(96, 108, 56, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(188, 108, 37, 0.05) 0%, transparent 50%);
    animation: pulse-bg 4s ease-in-out infinite;
}

@keyframes pulse-bg {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Loading Animation Container */
.loading-animation {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Spinner Rings */
.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid transparent;
    border-radius: 50%;
    animation: spin-ring 2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.spinner-ring:nth-child(1) {
    border-top-color: var(--loading-green-olive);
    border-right-color: var(--loading-green-olive);
    animation-duration: 1.5s;
}

.spinner-ring:nth-child(2) {
    border-top-color: var(--loading-mid-olive);
    border-right-color: var(--loading-mid-olive);
    animation-duration: 2s;
    animation-delay: -0.3s;
    width: 80%;
    height: 80%;
}

.spinner-ring:nth-child(3) {
    border-top-color: var(--loading-copper);
    border-right-color: var(--loading-copper);
    animation-duration: 2.5s;
    animation-delay: -0.6s;
    width: 60%;
    height: 60%;
}

@keyframes spin-ring {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* App Title */
.modern-loading-screen .app-title {
    font-family: 'Tajawal', sans-serif;
    font-size: clamp(1.75rem, 6vw, 2.5rem);
    font-weight: 800;
    color: var(--loading-text-olive);
    text-align: center;
    margin: 0;
    letter-spacing: -0.02em;
    line-height: 1.2;
    animation: fade-in-up 0.8s ease-out 0.3s both;
    text-shadow: 0 2px 4px rgba(40, 54, 24, 0.1);
}

/* Loading Text */
.modern-loading-screen .loading-text {
    font-family: 'Tajawal', sans-serif;
    font-size: clamp(0.875rem, 2.5vw, 1rem);
    font-weight: 500;
    color: var(--loading-green-olive);
    text-align: center;
    margin: 0;
    animation: fade-in-up 0.8s ease-out 0.5s both, pulse-text 2s ease-in-out 1s infinite;
}

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

@keyframes pulse-text {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* Responsive Adjustments */
@media (max-width: 480px) {
    .loading-animation {
        width: 90px;
        height: 90px;
    }
    
    .spinner-ring {
        border-width: 3px;
    }
    
    .modern-loading-screen {
        gap: var(--space-6);
    }
}

/* Hide loading screen when app is ready */
.modern-loading-screen.loaded {
    animation: fade-out 0.5s ease-out forwards;
}

@keyframes fade-out {
    to {
        opacity: 0;
        pointer-events: none;
    }
}

/* Update Color Palette Variables */
:root {
    /* Update existing palette with natural warm colors */
    --color-primary: #283618;          /* زيتوني غامق */
    --color-primary-dark: #1a2410;     /* أغمق */
    --color-primary-light: #606C38;    /* أخضر زيتوني */
    --color-accent: #BC6C25;           /* نحاسي */
    --color-accent-dark: #9a571f;      /* نحاسي داكن */
    --color-success: #606C38;          /* أخضر زيتوني */
    --color-background: #FEFAE0;       /* كريمي */
    --color-surface: #ffffff;
    --color-text-primary: #283618;     /* زيتوني غامق */
}

/* ===== CUSTOM PROPERTIES FOR DARK MODE (FUTURE) ===== */

@media (prefers-color-scheme: dark) {
    /* يمكن إضافة دعم الوضع الداكن لاحقاً */
    /* :root {
        --color-background: #0f172a;
        --color-surface: #1e293b;
        --color-text-primary: #f1f5f9;
    } */
}

/* ===== END OF APP.CSS ===== */