/**
 * ═══════════════════════════════════════════════════════════════════════════════
 * 🎨 تصميم سوق شيخة الموحد - Sheikha Unified Design System
 * ═══════════════════════════════════════════════════════════════════════════════
 * تصميم فخم وأنيق وسهل الاستخدام
 * متوافق مع جميع الأجهزة (حاسب، جوال، تابلت)
 * ═══════════════════════════════════════════════════════════════════════════════
 */

/* ═══════════════════════════════════════════════════════════════════════════════
   المتغيرات الأساسية - Root Variables
   ═══════════════════════════════════════════════════════════════════════════════ */
:root {
    /* الألوان الرئيسية */
    --primary: #0a5c36;
    --primary-dark: #063d24;
    --primary-light: #0d7a47;
    --gold: #d4af37;
    --gold-light: #f0d060;
    --gold-dark: #b8960c;
    
    /* ألوان الحالة */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    /* ألوان الخلفية */
    --bg-dark: #050810;
    --bg-card: #0d1424;
    --bg-card-hover: #111c30;
    
    /* ألوان النصوص */
    --text-primary: #ffffff;
    --text-secondary: #e2e8f0;
    --text-muted: #94a3b8;
    --text-faint: #64748b;
    
    /* الحدود */
    --border-color: #1e3a5f;
    --border-light: #2d4a6f;
    
    /* الانحناءات */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* الظلال */
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.15);
    --shadow-md: 0 4px 24px rgba(0,0,0,0.25);
    --shadow-lg: 0 8px 48px rgba(0,0,0,0.35);
    --shadow-gold: 0 4px 32px rgba(212,175,55,0.25);
    
    /* الحركة */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* أحجام الخطوط - الأساس للجوال */
    --font-xs: 0.75rem;    /* 12px */
    --font-sm: 0.875rem;   /* 14px */
    --font-base: 1rem;     /* 16px */
    --font-lg: 1.125rem;   /* 18px */
    --font-xl: 1.25rem;    /* 20px */
    --font-2xl: 1.5rem;    /* 24px */
    --font-3xl: 1.875rem;  /* 30px */
    --font-4xl: 2.25rem;   /* 36px */
    
    /* المسافات */
    --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;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   إعادة التعيين والأساسيات - Reset & Base
   ═══════════════════════════════════════════════════════════════════════════════ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   تحسينات الجوال - Mobile Optimizations
   ═══════════════════════════════════════════════════════════════════════════════ */

/* منع تكبير النص تلقائياً على iOS */
@media screen and (max-width: 768px) {
    html {
        font-size: 14px; /* حجم أساس أصغر للجوال */
    }
    
    body {
        font-size: var(--font-base);
    }
    
    /* تحسين أحجام العناوين للجوال */
    h1 { font-size: var(--font-2xl) !important; }
    h2 { font-size: var(--font-xl) !important; }
    h3 { font-size: var(--font-lg) !important; }
    h4, h5, h6 { font-size: var(--font-base) !important; }
    
    /* تحسين المسافات للجوال */
    .section, section {
        padding: var(--space-8) var(--space-4) !important;
    }
    
    .container {
        padding-left: var(--space-4) !important;
        padding-right: var(--space-4) !important;
    }
}

/* تحسينات الشاشات الصغيرة جداً */
@media screen and (max-width: 480px) {
    html {
        font-size: 13px;
    }
    
    h1 { font-size: var(--font-xl) !important; }
    h2 { font-size: var(--font-lg) !important; }
    
    .btn {
        padding: var(--space-3) var(--space-4) !important;
        font-size: var(--font-sm) !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   الأزرار - Buttons
   ═══════════════════════════════════════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: var(--font-sm);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition-normal);
    white-space: nowrap;
    touch-action: manipulation; /* تحسين اللمس */
    -webkit-tap-highlight-color: transparent;
}

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

.btn-gold {
    background: linear-gradient(135deg, var(--gold-light), var(--gold));
    color: var(--bg-dark);
    box-shadow: var(--shadow-gold);
}

.btn-gold:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--gold);
    color: var(--gold);
}

.btn-outline:hover {
    background: var(--gold);
    color: var(--bg-dark);
}

/* حجم الأزرار للجوال - أكبر للمس */
@media screen and (max-width: 768px) {
    .btn {
        min-height: 48px; /* حجم مناسب للمس */
        padding: var(--space-3) var(--space-5);
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   البطاقات - Cards
   ═══════════════════════════════════════════════════════════════════════════════ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    transition: var(--transition-normal);
}

.card:hover {
    border-color: var(--gold);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   حقول الإدخال - Form Inputs
   ═══════════════════════════════════════════════════════════════════════════════ */
input, textarea, select {
    width: 100%;
    padding: var(--space-4);
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--font-base);
    transition: var(--transition-fast);
    -webkit-appearance: none;
    appearance: none;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

/* حجم حقول الإدخال للجوال */
@media screen and (max-width: 768px) {
    input, textarea, select {
        min-height: 48px;
        font-size: 16px !important; /* منع تكبير iOS */
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   التنقل - Navigation
   ═══════════════════════════════════════════════════════════════════════════════ */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(13, 20, 36, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* قائمة الجوال */
@media screen and (max-width: 768px) {
    .nav {
        display: none;
    }
    
    .mobile-menu-btn {
        display: flex !important;
    }
    
    .header-actions {
        gap: var(--space-2);
    }
    
    .header-actions .btn {
        padding: var(--space-2) var(--space-3);
        font-size: var(--font-xs);
    }
}

/* زر القائمة للجوال */
.mobile-menu-btn {
    display: none;
    width: 44px;
    height: 44px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.5rem;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   القائمة المنسدلة للجوال - Mobile Menu
   ═══════════════════════════════════════════════════════════════════════════════ */
.mobile-nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 320px;
    height: 100vh;
    background: var(--bg-card);
    border-left: 1px solid var(--border-color);
    z-index: 2000;
    transition: right 0.3s ease;
    overflow-y: auto;
    padding: var(--space-6);
}

.mobile-nav.open {
    right: 0;
}

.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
}

.mobile-nav-overlay.open {
    opacity: 1;
    visibility: visible;
}

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

.mobile-nav-close {
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-nav a {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    font-size: var(--font-base);
}

.mobile-nav a:hover, .mobile-nav a.active {
    background: rgba(212, 175, 55, 0.1);
    color: var(--gold);
}

.mobile-nav-section {
    margin-top: var(--space-6);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-color);
}

.mobile-nav-section-title {
    font-size: var(--font-xs);
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: var(--space-2);
    padding: 0 var(--space-4);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   تحسينات الشبكة - Grid Improvements
   ═══════════════════════════════════════════════════════════════════════════════ */
.grid {
    display: grid;
    gap: var(--space-6);
}

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

@media screen and (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media screen and (max-width: 768px) {
    .grid-4, .grid-3, .grid-2 {
        grid-template-columns: 1fr;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   الحركات والتأثيرات - Animations
   ═══════════════════════════════════════════════════════════════════════════════ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

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

.animate-fade-in {
    animation: fadeIn 0.5s ease forwards;
}

.animate-fade-in-up {
    animation: fadeInUp 0.5s ease forwards;
}

/* إيقاف الحركات للمستخدمين الذين يفضلون ذلك */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   مساعد الأتمتة - Automation Helper
   ═══════════════════════════════════════════════════════════════════════════════ */
.auto-assistant {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 1500;
}

.auto-assistant-btn {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--gold-light), var(--gold));
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    transition: var(--transition-normal);
    animation: pulse 2s infinite;
}

.auto-assistant-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 40px rgba(212, 175, 55, 0.4);
}

.auto-assistant-panel {
    position: absolute;
    bottom: 80px;
    left: 0;
    width: 320px;
    max-height: 70vh;
    background: var(--bg-card);
    border: 1px solid var(--gold);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: var(--transition-normal);
}

.auto-assistant-panel.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.auto-assistant-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    padding: var(--space-4) var(--space-5);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.auto-assistant-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 700;
    color: white;
}

.auto-assistant-close {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 1.5rem;
    cursor: pointer;
    padding: var(--space-1);
}

.auto-assistant-body {
    padding: var(--space-4);
    max-height: 400px;
    overflow-y: auto;
}

.auto-action {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2);
    cursor: pointer;
    transition: var(--transition-fast);
}

.auto-action:hover {
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.05);
}

.auto-action-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, rgba(212,175,55,0.2), rgba(10,92,54,0.2));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.auto-action-text {
    flex: 1;
}

.auto-action-text h4 {
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.auto-action-text p {
    font-size: var(--font-xs);
    color: var(--text-muted);
}

/* الجوال */
@media screen and (max-width: 768px) {
    .auto-assistant {
        bottom: 16px;
        left: 16px;
    }
    
    .auto-assistant-btn {
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
    }
    
    .auto-assistant-panel {
        width: calc(100vw - 32px);
        max-width: 320px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   شريط التقدم العلوي - Top Progress Bar
   ═══════════════════════════════════════════════════════════════════════════════ */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--gold), var(--primary));
    z-index: 9999;
    transition: width 0.3s ease;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   تحسينات الوصول - Accessibility
   ═══════════════════════════════════════════════════════════════════════════════ */
:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

/* تحسين التباين */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   تحسينات الطباعة - Print Styles
   ═══════════════════════════════════════════════════════════════════════════════ */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .header, .footer, .auto-assistant, .mobile-nav {
        display: none !important;
    }
}
