/* ==========================================
   1. الإعدادات العامة والألوان الأساسية
   ========================================== */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&display=swap');
   * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #171311;
    color: #f4ede2;
    font-family: 'Cairo', sans-serif;
    line-height: 1.6;
    direction: rtl;
}

/* ==========================================
   2. الهيدر الموحد
   ========================================== */
.official-header {
    width: 100%;
    background-color: #171311;
    border-bottom: 1px solid #433830;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1400px;
    width: 95%;
    margin: 0 auto;
    padding: 14px 1rem;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
}

.logo-section {
    display: flex;
    align-items: center;
    justify-self: start;
}

.logo-text {
    font-size: 1.3rem;
    font-weight: 700;
    color: #f4ede2;
}

.navigation {
    justify-self: center;
}

.navigation ul {
    list-style: none;
    display: flex;
    gap: 1.8rem;
    padding: 0;
    margin: 0;
}

.navigation a {
    text-decoration: none;
    color: #b8afa4;
    font-size: 18px;
    font-weight: 700;
    transition: color 0.2s ease;
}

.navigation a:hover,
.navigation a.active {
    color: #d4a373;
}

.header-actions {
    justify-self: end;
}

/* ==========================================
   3. محتوى دليل الطالب
   ========================================== */
.guide-container {
    max-width: 1200px;
    width: 95%;
    margin: 2.5rem auto;
    padding: 0 1rem;
}

.guide-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.page-title {
    font-size: 32px;
    color: #f4ede2;
    margin-bottom: 8px;
}

.page-desc {
    font-size: 18px;
    color: #b8afa4;
}

.guide-section {
    margin-bottom: 3rem;
}

.section-title {
    font-size: 24px;
    color: #f4ede2;
    margin-bottom: 1.2rem;
    border-bottom: 2px solid #433830;
    padding-bottom: 8px;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}

.cards-grid.two-cols {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.guide-card {
    background-color: #28221d;
    border: 1px solid #433830;
    border-radius: 12px;
    padding: 1.5rem;
    color: #f4ede2;
}

.guide-card.full-width {
    width: 100%;
}

.guide-card h3 {
    font-size: 20px;
    color: #d4a373;
    margin-bottom: 10px;
}

.guide-card p {
    font-size: 16px;
    color: #b8afa4;
    line-height: 1.6;
}

.steps-list {
    font-size: 16px;
    color: #f4ede2;
    line-height: 1.9;
    padding-right: 22px;
    margin: 10px 0;
}

.sub-list, .bullet-list {
    list-style: square;
    padding-right: 22px;
    color: #b8afa4;
    margin-top: 5px;
}

.alert-box {
    background-color: rgba(212, 163, 115, 0.1);
    border-right: 4px solid #d4a373;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 15px;
    color: #f4ede2;
    margin-top: 15px;
}

.sub-heading {
    font-size: 18px;
    color: #f4ede2;
    margin: 20px 0 12px;
}

.halls-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.hall-btn {
    display: block;
    text-align: center;
    background-color: #1c1815;
    border: 1px solid #433830;
    color: #d4a373;
    text-decoration: none;
    font-size: 14px;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.hall-btn:hover {
    background-color: #d4a373;
    color: #1c1815;
    transform: translateY(-2px);
}

.highlight-card {
    border-color: #d4a373;
    background: linear-gradient(145deg, #28221d, #332b25);
}

/* ==========================================
   4. التجاوب مع شاشات الهواتف
   ========================================== */
@media (max-width: 900px) {
    .header-container {
        display: flex;
        flex-direction: column;
        gap: 14px;
        padding: 14px 10px;
    }

    .navigation ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px 14px;
    }

    .navigation a {
        font-size: 15px;
    }

    .cards-grid, 
    .cards-grid.two-cols {
        grid-template-columns: 1fr;
    }

    .page-title {
        font-size: 26px;
    }

    .page-desc {
        font-size: 15px;
    }

    .halls-links-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================
   تنسيقات بطاقات التطبيقات والقوائم المنسدلة
   ========================================== */
.app-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.app-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.app-icon {
    font-size: 1.6rem;
}

.app-brief {
    font-size: 15px;
    color: #b8afa4;
    margin-bottom: 15px;
}

/* روابط التحميل */
.app-download-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.store-btn {
    display: inline-block;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 6px;
    border: 1px solid #433830;
    background-color: #1c1815;
    color: #d4a373;
    transition: all 0.2s ease;
}

.store-btn:hover {
    background-color: #d4a373;
    color: #171311;
    transform: translateY(-2px);
}

/* زر إظهار التفاصيل (details / summary) */
.app-details-toggle {
    margin-top: auto;
    border-top: 1px dashed #433830;
    padding-top: 12px;
}

.app-details-toggle summary {
    cursor: pointer;
    font-weight: 700;
    color: #d4a373;
    font-size: 14px;
    outline: none;
    user-select: none;
    transition: color 0.2s ease;
}

.app-details-toggle summary:hover {
    color: #f4ede2;
}

/* إخفاء السهم الافتراضي للمتصفح واستبداله بمظهر أنيق */
.app-details-toggle summary::-webkit-details-marker {
    display: none;
}

/* محتوى الشرح المنسدل */
.app-expanded-content {
    margin-top: 12px;
    padding: 12px;
    background-color: #1e1916;
    border-radius: 8px;
    border: 1px solid #332b25;
}

.app-expanded-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.app-expanded-content li {
    font-size: 14px;
    color: #b8afa4;
    line-height: 1.7;
    margin-bottom: 8px;
    padding-right: 14px;
    position: relative;
}

.app-expanded-content li::before {
    content: "•";
    color: #d4a373;
    position: absolute;
    right: 0;
    font-weight: bold;
}

.app-expanded-content strong {
    color: #f4ede2;
}

/* ==========================================
   تنسيق كروت التطبيقات وزر الفتح
   ========================================== */
.app-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 250px;
}

.open-modal-btn {
    width: 100%;
    margin-top: auto;
    padding: 10px 14px;
    background-color: rgba(212, 163, 115, 0.08);
    border: 1px solid #d4a373;
    color: #d4a373;
    font-size: 14px;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.open-modal-btn:hover {
    background-color: #d4a373;
    color: #171311;
    transform: translateY(-2px);
}

/* ==========================================
   تنسيق النافذة المنبثقة (Popup Modal)
   ========================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    padding: 20px;
    box-sizing: border-box;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background-color: #241e19;
    border: 1px solid #d4a373;
    border-radius: 14px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 28px 24px 24px;
    position: relative;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.7);
    animation: modalAppear 0.25s ease-out;
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: scale(0.92);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-close-btn {
    position: absolute;
    top: 14px;
    left: 16px;
    background: none;
    border: none;
    color: #b8afa4;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.modal-close-btn:hover {
    color: #d4a373;
}

.modal-title {
    color: #d4a373;
    font-size: 20px;
    margin-top: 0;
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 1px solid #433830;
}

.modal-body ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.modal-body li {
    font-size: 15px;
    color: #b8afa4;
    line-height: 1.8;
    margin-bottom: 12px;
    padding-right: 18px;
    position: relative;
}

.modal-body li::before {
    content: "•";
    color: #d4a373;
    position: absolute;
    right: 0;
    font-size: 18px;
}

.modal-body strong {
    color: #f4ede2;
}

/* ==========================================
   تحسينات مخصصة للجوال (Mobile Optimization)
   ========================================== */
@media (max-width: 600px) {
    .modal-overlay {
        padding: 12px; /* تقليل الفراغ الخارجي ليبقى النص واسعاً وواضحاً */
        align-items: flex-end; /* جعل النافذة تفتح من أسفل الشاشة مثل تطبيقات الهاتف */
    }

    .modal-box {
        max-height: 85vh; /* استغلال مساحة الشاشة بشكل مريح */
        border-radius: 18px 18px 10px 10px; /* تدوير الزوايا العلوية */
        padding: 22px 18px 20px;
        -webkit-overflow-scrolling: touch; /* تفعيل التمرير فائق السلاسة باللمس للآيفون */
    }

    /* تكبير مساحة اللمس لزر الإغلاق ليسهل ضغطه بالإصبع */
    .modal-close-btn {
        top: 10px;
        left: 12px;
        font-size: 32px;
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .modal-title {
        font-size: 18px;
        padding-left: 35px; /* ترك مسافة عشان العنوان ما يغطي زر الإغلاق */
    }

    .modal-body li {
        font-size: 14.5px;
        line-height: 1.7;
    }
}

/* ==========================================
   تجميل شريط التمرير (Scrollbar) للنافذة المنبثقة
   ========================================== */

/* 1. للمتصفحات الحديثة (Firefox) */
.modal-box {
    scrollbar-width: thin; /* جعله نحيفاً */
    scrollbar-color: #d4a373 #1a1613; /* اللون الذهبي للمقبض والغامق للخلفية */
}

/* 2. لمتصفحات Chrome و Edge و Safari */
.modal-box::-webkit-scrollbar {
    width: 6px; /* عرض نحيف وأنيق جداً بدل العريض الافتراضي */
}

.modal-box::-webkit-scrollbar-track {
    background: #1a1613; /* خلفية الشريط لتندمج مع لون النافذة */
    border-radius: 10px;
}

.modal-box::-webkit-scrollbar-thumb {
    background-color: #433830; /* لون المقبض بني موكا متناسق */
    border-radius: 10px;
    border: 1px solid #1a1613;
}

.modal-box::-webkit-scrollbar-thumb:hover {
    background-color: #d4a373; /* يتحول للذهبي عند التمرير عليه */
}

/* ==========================================
   تنسيق بطاقات الخطوات والمراحل التفاعلية
   ========================================== */
.main-phase-card {
    background-color: #201a16;
    border: 1px solid #3d332a;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 25px;
}

.phase-header {
    margin-bottom: 22px;
    border-bottom: 1px solid #332b23;
    padding-bottom: 15px;
}

.phase-tag {
    display: inline-block;
    background-color: rgba(212, 163, 115, 0.15);
    color: #d4a373;
    font-size: 13px;
    font-weight: bold;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 8px;
    border: 1px solid rgba(212, 163, 115, 0.3);
}

.phase-tag.danger {
    background-color: rgba(224, 122, 95, 0.15);
    color: #e07a5f;
    border-color: rgba(224, 122, 95, 0.3);
}

.phase-title {
    font-size: 20px;
    color: #f4ede2;
    margin: 5px 0 6px 0;
}

.phase-subtitle {
    font-size: 15px;
    color: #b8afa4;
    margin: 0;
}

/* قائمة الخطوات المنفصلة */
.stepped-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 20px;
}

.step-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background-color: #27201b;
    border: 1px solid #3a3027;
    border-radius: 12px;
    padding: 16px;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.step-item:hover {
    transform: translateY(-2px);
    border-color: #d4a373;
}

.step-number {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    background-color: #171311;
    border: 2px solid #d4a373;
    color: #d4a373;
    font-size: 17px;
    font-weight: bold;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-body {
    flex: 1;
}

.step-body h4 {
    font-size: 16px;
    color: #f4ede2;
    margin: 0 0 6px 0;
}

.step-body p {
    font-size: 14.5px;
    color: #b8afa4;
    line-height: 1.6;
    margin: 0;
}

/* أزرار الإجراءات داخل الخطوات */
.step-action-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 6px 14px;
    background-color: #171311;
    color: #d4a373;
    border: 1px solid #433830;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: bold;
    transition: all 0.2s ease;
}

.step-action-btn:hover {
    background-color: #d4a373;
    color: #171311;
}

.step-action-btn.highlight {
    background-color: rgba(212, 163, 115, 0.15);
    border-color: #d4a373;
}

/* صناديق التوضيح المميزة (Callouts) */
.concept-callout {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    background-color: rgba(212, 163, 115, 0.08);
    border: 1px solid rgba(212, 163, 115, 0.3);
    border-right: 4px solid #d4a373;
    border-radius: 10px;
    padding: 16px;
    margin-top: 15px;
}

.concept-callout.warning {
    background-color: rgba(224, 122, 95, 0.08);
    border-color: rgba(224, 122, 95, 0.3);
    border-right-color: #e07a5f;
}

.callout-icon {
    font-size: 24px;
    line-height: 1;
}

.callout-text strong {
    display: block;
    color: #f4ede2;
    font-size: 15.5px;
    margin-bottom: 6px;
}

.callout-text p {
    font-size: 14px;
    color: #b8afa4;
    line-height: 1.6;
    margin: 0;
}

/* التجاوب مع شاشات الهواتف */
@media (max-width: 600px) {
    .main-phase-card {
        padding: 16px 12px;
    }

    .step-item {
        gap: 12px;
        padding: 14px 12px;
    }

    .step-number {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .step-body h4 {
        font-size: 15px;
    }

    .step-body p {
        font-size: 13.5px;
    }

    .concept-callout {
        padding: 12px;
    }
}