/* ==========================================
   1. المحرك والأساسيات (The Engine)
   ========================================== */
:root {
    --primary: #1e3a8a;
    --secondary: #fbbf24;
    --bg: #f1f5f9;
    --card-bg: #ffffff;
    --text: #1e293b;
    
    /* ألوان النطاقات الفاتحة (للخلفية) */
    --zone-a: #dcfce7;
    --zone-b: #dbeafe;
    --zone-c: #fee2e2;

    /* ألوان النطاقات الغامقة (للنص) */
    --zone-a-dark: #16a34a; 
    --zone-b-dark: #2563eb;
    --zone-c-dark: #dc2626;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    direction: rtl;
}

.container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 10px;
}

/* ==========================================
   2. الهيدر (Header)
   ========================================== */
header {
    text-align: center;
    background: #ffffff;
    padding: 30px 10px;
    border-radius: 0 0 20px 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.header-image {
    width: 100%;
    height: auto;
    border-radius: 0 0 20px 20px;
    margin-bottom: 15px;
}

header h1 {
    color: var(--primary);
    font-size: clamp(1.5rem, 6vw, 2.5rem);
}

/* ==========================================
   3. العناصر التفاعلية والمدخلات
   ========================================== */
.form-control {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border-radius: 8px;
    border: 1px solid #ddd;
    font-family: inherit;
    box-sizing: border-box;
}

.hidden { display: none; }

/* ==========================================
   4. الأزرار والحركة (The Animation Magic)
   ========================================== */

/* زر ابدأ التخيل (الأحمر النباض) */
#start-design button {
    background: linear-gradient(45deg, #ff0000, #cc0000);
    color: white;
    font-size: 1.8rem !important;
    font-weight: bold;
    padding: 20px 50px !important;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(255, 0, 0, 0.3);
    display: block;
    margin: 20px auto;
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 12px rgba(255, 0, 0, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 0, 0, 0); }
}

/* زر الـ PDF الأخضر */
.pdf-btn {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: white !important;
    padding: 18px 45px !important;
    font-size: 1.2rem !important;
    border-radius: 50px !important;
    border: none !important;
    box-shadow: 0 8px 15px rgba(16, 185, 129, 0.3) !important;
    margin: 30px auto !important;
    display: block !important;
    cursor: pointer !important;
    font-weight: bold;
}

/* ==========================================
   5. الجداول والنتائج (الترتيب والنطاقات)
   ========================================== */
.results-table-container {
    background: #fff;
    border-radius: 12px;
    border: 2px solid var(--primary);
    overflow-x: auto;
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background-color: var(--primary);
    color: white;
    padding: 15px 10px;
    text-align: right;
}

td {
    padding: 12px 10px;
    border-bottom: 1px solid #edf2f7;
    font-weight: 600;
}

/* تلوين الصفوف حسب النطاق الجغرافي */
.zone-a { background-color: var(--zone-a) !important; color: var(--zone-a-dark) !important; }
.zone-b { background-color: var(--zone-b) !important; color: var(--zone-b-dark) !important; }
.zone-c { background-color: var(--zone-c) !important; color: var(--zone-c-dark) !important; }





button:active {
    transform: scale(0.95);
    transition: 0.1s;
}



/* ==========================================
   6. الطباعة والحماية (Final Touches)
   ========================================== */
@media print {
    body * { visibility: hidden; }
    #my-final-table, #my-final-table * { visibility: visible; }
    #my-final-table { position: absolute; left: 0; top: 0; width: 100%; }
    .no-print, button, .pdf-btn { display: none !important; }
    
    table { border: 1px solid #000; }
    th, td { border: 1px solid #000; color: #000 !important; }
}

/* لضمان ظهور الألوان في الـ PDF */
* {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}

.no-print { display: block; }


/* ==========================================
   تنسيق أزرار الأرشيف وزيارة الموقع الرسمي
   ========================================== */

/* أزرار الأرشيف (العلمي والأدبي) */
.archive-buttons-container button {
    padding: 12px 25px;
    margin: 10px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.btn-elmy {
    background-color: #1e3a8a !important; /* أزرق غامق */
    color: white !important;
}

.btn-adaby {
    background-color: #be123c !important; /* أحمر نبيتي */
    color: white !important;
}

.archive-buttons-container button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
    opacity: 0.9;
}

/* زر زيارة موقع التنسيق الرسمي */
.btn-official {
    display: inline-block;
    background-color: #ffffff;
    color: #1e3a8a !important;
    padding: 15px 30px;
    border: 2px solid #1e3a8a;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.btn-official:hover {
    background-color: #1e3a8a;
    color: #ffffff !important;
    box-shadow: 0 5px 15px rgba(30, 58, 138, 0.2);
}

/* تنسيق زر الـ PDF الصغير اللي ظهر في الصورة */
#results-area button {
    cursor: pointer;
}


/* نافذة النصائح المنزلقة */
.tips-container {
    max-height: 400px; /* طول النافذة اللي إنت عايزه */
    overflow-y: auto;  /* يظهر شريط التمرير لو الكلام كبر */
    padding: 20px;
    background: #f0f9ff; /* نفس درجة اللون اللي في الصورة */
    border: 2px solid #bae6fd;
    border-radius: 15px;
    margin: 20px 0;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.05); /* ظل داخلي خفيف */
}

/* تجميل شكل شريط التمرير (بالمزورة) */
.tips-container::-webkit-scrollbar {
    width: 8px;
}
.tips-container::-webkit-scrollbar-thumb {
    background: #0ea5e9; 
    border-radius: 10px;
}
.tips-container::-webkit-scrollbar-track {
    background: #e0f2fe;
}


/* الألوان الافتراضية (الوضع الفاتح) */
:root {
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e3a8a;
    --text-secondary: #475569;
    --border-color: #e2e8f0;
}


/* ألوان الوضع الليلي الاحترافية (الهادئة) */
[data-theme="dark"] {
    /* خلفية الموقع: بدلاً من الأسود الصريح، نستخدم أزرق مسود غامق جداً */
    --bg-color: #0b0f1a; 
    
    /* خلفية الكروت (التي كانت بيضاء): نستخدم درجة أفتح قليلاً من الخلفية */
    --card-bg: #161e2d; 
    
    /* اللون الأساسي للنصوص (بدل الأبيض الصريح): نستخدم رمادي فاتح مريح */
    --text-primary: #e2e8f0; 
    
    /* لون النصوص الثانوية */
    --text-secondary: #94a3b8; 
    
    /* لون الحدود (Borders) */
    --border-color: #2d3748;
}


body {
    background-color: var(--bg-color);
    color: var(--text-secondary);
    transition: background 0.3s, color 0.3s; /* نعومة في القلب */
}

.card, .archive-container, table {
    background-color: var(--card-bg) !important;
    color: var(--text-secondary) !important;
}

h1, h2, h3, .college-name {
    color: var(--text-primary) !important;
}


[data-theme="dark"] img {
    filter: brightness(0.8) contrast(1.1);
}

[data-theme="dark"] input, 
[data-theme="dark"] select {
    background-color: #1e293b !important;
    color: white !important;
    border: 1px solid #334155 !important;
}

[data-theme="dark"] .accordion-header {
    color: var(--text-primary) !important;
}
