
/* ==========================================
   1. General & Base Styles (طابع المكتبة الذكية)
   ========================================== */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&display=swap');
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
    font-family: 'Cairo', sans-serif !important; /* توحيد الخط العربي في كامل الموقع */
}

body {
    background-color: #1c1815; /* خلفية داكنة دافئة شبيهة بالموكا */
    color: #f4ede2;            /* نص كريمي مريح للعين */
    direction: rtl;
}

a {
    text-decoration: none;
}

hr {
    opacity: 0.15;
    border-color: #433830;
}

/* ==========================================
   2. Header & Navigation
   ========================================== */
.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: 12px 1rem;
    display: grid;
    grid-template-columns: 1fr auto 1fr; /* 3 أعمدة: الشعار يمين، القائمة وسط، الأزرار يسار */
    align-items: center;
}

/* الشعار وعنوان المنصة */
.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-self: start; /* يثبت الشعار في جهة اليمين */
}

.site-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.logo-text {
    font-family: 'Cairo', sans-serif;
    color: #f4ede2;
    font-size: 1.2rem;
    font-weight: 700;
}

/* روابط القائمة الرئيسية - ثابتة في المنتصف تماماً */
.navigation {
    justify-self: center; 
}

.navigation ul {
    list-style: none;
    display: flex;
    gap: 2rem;
    margin: 0;
    padding: 0;
}

.navigation a {
    text-decoration: none;
    color: #b8afa4;
    font-family: 'Cairo', sans-serif;
    font-size: 19px;
    font-weight: 700;
    position: relative;
    padding: 4px 0;
    transition: color 0.25s ease;
}

.navigation a:hover,
.navigation a.active {
    color: #d4a373; /* لون عسلي/ذهبي دافئ */
}

/* الأزرار الجانبية */
.header-actions {
    justify-self: end; /* تثبيت الأزرار في أقصى اليسار */
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ==========================================
/* ==============================================================
   الهيدر العائم والزجاجي (خاص بالصفحة الرئيسية فقط)
   ============================================================== */
.official-header.home-header {
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    width: 92%;
    max-width: 1300px;
    margin: 0 auto;
    background: rgba(23, 19, 17, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(212, 163, 115, 0.3);
    border-radius: 40px;
    z-index: 1000;
}

.home-header .header-container {
    padding: 10px 1.5rem;
}

/* ==============================================================
   الواجهة السينمائية (Hero Banner)
   ============================================================== */
/* ==============================================================
   الواجهة الرئيسية الجديدة (خلفية تدرج ناعمة وبطاقات إحصائيات)
   ============================================================== */
.hero-banner {
    position: relative;
    min-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
    padding: 130px 1.5rem 4rem;
    /* إضاءة ذهبية خافتة بالمنتصف تندمج مع لون الموقع */
    background: radial-gradient(circle at 50% 25%, rgba(212, 163, 115, 0.12) 0%, #1c1815 75%);
}

.hero-content {
    position: relative;
    z-index: 10;
    max-width: 950px;
    margin: 0 auto;
}

.hero-title {
    font-size: 44px;
    font-weight: 800;
    line-height: 1.4;
    color: #ffffff;
    margin-bottom: 20px;
}

.hero-title .highlight {
    color: #d4a373;
    background: linear-gradient(120deg, #f5dcb7, #d4a373);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-intro {
    font-size: 18px;
    line-height: 1.85;
    color: #ded7ce;
    max-width: 780px;
    margin: 0 auto 32px;
}

.hero-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 45px;
}

/* ==============================================================
   صناديق الإحصائيات وعداد الزوار
   ============================================================== */
.hero-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 18px;
    max-width: 880px;
    margin: 0 auto;
}

.stat-box {
    background: rgba(40, 34, 29, 0.65);
    border: 1px solid rgba(67, 56, 48, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 14px;
    padding: 18px 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.3s ease;
}

.stat-box:hover {
    border-color: #d4a373;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(212, 163, 115, 0.1);
}

.stat-icon {
    font-size: 26px;
}

.stat-data {
    display: flex;
    flex-direction: column;
    text-align: right;
}

.stat-number {
    font-size: 22px;
    font-weight: 800;
    color: #d4a373;
    line-height: 1.2;
}

.stat-label {
    font-size: 13px;
    color: #b8afa4;
    font-weight: 600;
}

@media (max-width: 768px) {
    .hero-banner { padding: 3rem 1rem 3.5rem; min-height: auto; }
    .hero-title { font-size: 28px; }
    .hero-intro { font-size: 15px; }
    .hero-stats { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}

.btn-primary-hero {
    background-color: #d4a373;
    color: #171311;
    font-size: 18px;
    font-weight: 700;
    padding: 12px 34px;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.25s ease;
    box-shadow: 0 6px 20px rgba(212, 163, 115, 0.3);
    cursor: pointer;
}

.btn-primary-hero:hover {
    background-color: #e4b585;
    transform: translateY(-2px);
}

.btn-secondary-hero {
    background: rgba(255, 255, 255, 0.12);
    color: #f4ede2;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(8px);
    font-size: 18px;
    font-weight: 700;
    padding: 12px 30px;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.25s ease;
    cursor: pointer;
}

.btn-secondary-hero:hover {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
    transform: translateY(-2px);
}

/* التجاوب مع الجوال */
@media (max-width: 900px) {
    .official-header.home-header {
        position: relative;
        top: 0;
        width: 100%;
        border-radius: 0;
        border: none;
    }
    .hero-banner { 
        padding: 3rem 1rem 4rem; 
        min-height: auto;
    }
    .hero-title { font-size: 28px; }
    .hero-intro { font-size: 15px; }
    .hero-actions { flex-direction: column; width: 100%; }
    .btn-primary-hero, .btn-secondary-hero { width: 100%; }
}

/* ==========================================
   4. Features & Cards Section
   ========================================== */
.features-section {
    max-width: 1400px;
    width: 95%;
    margin: 4rem auto;
    padding: 0 1rem;
    text-align: center;
}

.section-title {
    font-family: 'Cairo', sans-serif;
    font-size: 34px;
    color: #f4ede2;
    margin-bottom: 8px;
}

.section-subtitle {
    font-family: 'Cairo', sans-serif;
    font-size: 18px;
    color: #b8afa4;
    margin-bottom: 3rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.feature-card {
    background-color: #28221d; /* خلفية كرت دافئة */
    border: 1px solid #433830;   /* إطار هادئ */
    border-radius: 12px;
    padding: 24px 20px;
    text-align: right;
    transition: all 0.3s ease;
    cursor: pointer;
}

.feature-card:hover {
    background-color: #332b25;   /* تفتيح بسيط عند تمرير الماوس */
    border-color: #d4a373;       /* إطار عسلي */
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(212, 163, 115, 0.08);
}

.feature-card .icon,
.feature-card .card-icon {
    font-size: 28px;
    margin-bottom: 12px;
    display: inline-block;
    padding: 8px;
    background: #1c1815;
    border-radius: 8px;
}

.feature-card h3 {
    font-family: 'Cairo', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: #f4ede2;
    margin-bottom: 8px;
}

.feature-card p {
    font-family: 'Cairo', sans-serif;
    font-size: 15px;
    color: #b8afa4;
    line-height: 1.6;
}

/* ==========================================
   5. Buttons & Action Controls
   ========================================== */
.btn-start {
    display: inline-block;
    font-family: 'Cairo', sans-serif;
    font-size: 19px;
    font-weight: 700;
    color: #1c1815;
    background-color: #d4a373; /* زر بارز بلون ذهبي دافئ */
    padding: 10px 28px;
    border-radius: 8px;
    text-decoration: none;
    transition: background-color 0.25s ease, transform 0.2s ease;
}

.btn-start:hover {
    background-color: #e9c46a;
    transform: translateY(-2px);
}

.btn-portal {
    font-family: 'Cairo', sans-serif;
    background-color: #28221d;
    color: #f4ede2;
    border: 1px solid #433830;
    padding: 6px 18px;
    border-radius: 8px;
    font-size: 17px;
    font-weight: 700;
    text-decoration: none;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn-portal:hover {
    background-color: #d4a373;
    border-color: #d4a373;
    color: #1c1815;
}

.theme-toggle-btn {
    background: #28221d;
    border: 1px solid #433830;
    color: #f4ede2;
    font-size: 0.95rem;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.theme-toggle-btn:hover {
    background-color: #332b25;
    border-color: #d4a373;
}

/* ==========================================
   6. Footer
   ========================================== */
.official-footer {
    width: 100%;
    text-align: center;
    padding: 1.5rem 1rem;
    margin-top: 3rem;
    background-color: #171311;
    border-top: 1px solid #433830;
}

.official-footer p {
    font-family: 'Cairo', sans-serif;
    font-size: 16px;
    color: #b8afa4;
    margin: 0;
}
/* ==========================================
   تعديلات شاملة للتجاوب مع الشاشات الصغيرة (Mobile Optimization)
   ========================================== */
@media (max-width: 900px) {

    /* 1. إصلاح الهيدر والقائمة العلوية لتتكدس بترتيب */
    .header-container {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px;
        padding: 10px;
        text-align: center;
    }
    
    .logo-section {
        justify-self: center !important;
        justify-content: center;
    }

    .navigation {
        justify-self: center !important;
    }

    .navigation ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem !important;
    }

    .navigation a {
        font-size: 16px !important;
    }

    .header-actions {
        justify-self: center !important;
    }

    /* 2. إصلاح الواجهة الرئيسية (Hero Section) */
    .hero {
        flex-direction: column-reverse !important;
        text-align: center !important;
        margin: 1.5rem auto !important;
        gap: 20px;
    }
    
    .herosup, .hero-title, .intro {
        text-align: center !important;
    }

    .hero-title {
        font-size: 26px !important;
        line-height: 1.3;
    }

    .intro {
        font-size: 15px !important;
    }

    .hero-image-wrapper {
        flex: 0 0 auto !important;
        width: 100% !important;
        max-width: 260px !important;
        margin: 0 auto;
    }

    /* 3. تحويل جميع الشبكات والكروت إلى عمود واحد لتعبئة الشاشة */
    .features-grid, 
    .builder-layout, 
    .pomodoro-layout, 
    .input-grid, 
    .cumulative-inputs, 
    .details-grid,
    .status-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }

    /* 4. منع الجداول من الخروج عن حدود الشاشة وجعلها قابلة للتمرير بسلاسة */
    .schedule-table, 
    .whatif-table, 
    .courses-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    /* 5. ضبط العناوين والأزرار لتناسب أصابع الجوال */
    .section-title, .page-title {
        font-size: 24px !important;
    }
    
    .section-subtitle, .page-desc {
        font-size: 14px !important;
    }

    .btn-start, .btn-calc, .btn-add, .btn-submit, .btn-calc-tracker {
        width: 100% !important;
        font-size: 17px !important;
        padding: 12px !important;
        text-align: center;
    }

    /* 6. تصغير الحاويات الرئيسية والهوامش لتناسب الشاشات الضيقة */
    .calculator-container,
    .whatif-container,
    .pomodoro-container,
    .tracker-container,
    .feedback-container,
    .map-page-container {
        padding: 0 10px !important;
        margin: 1.5rem auto !important;
    }
}


/* ==========================================
   إصلاحات خاصة بالهيدر والخريطة على الجوال
   ========================================== */
@media (max-width: 900px) {

    /* 1. إعطاء الهيدر مساحة وبراح لتتكدس العناصر بدون حشر */
    .header-container {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
        padding: 18px 10px !important;
    }

    .navigation ul {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 10px 15px !important; /* مسافات مريحة بين الروابط سطر بسطر */
    }

    .navigation a {
        font-size: 15px !important;
        padding: 4px 8px !important;
    }

    /* 2. جعل الخريطة أسهل وأوسع للحركة باللمس على الجوال */
    .map-view-box {
        height: 450px !important; /* زيادة ارتفاع الخريطة لتصير واضحة ومريحة للتصفح */
    }

    .map-image-scroll-wrapper {
        -webkit-overflow-scrolling: touch !important; /* تفعيل التمرير السلس بالاصبع */
        touch-action: pan-x pan-y !important; /* السماح بحركة اللمس بحرية داخل الخريطة */
    }
}
/* ==========================================
   إصلاح تفاعل الخريطة أو الموقع المضمت على الجوال
   ========================================== */
@media (max-width: 900px) {
    .map-view-box {
        height: 450px !important;
        overflow: hidden !important;
        position: relative;
        -webkit-overflow-scrolling: touch !important;
    }

    /* لو كانت الخريطة عبارة عن iframe أو صفحة ويب مضمنة */
    .map-view-box iframe, 
    .map-view-box object, 
    .map-view-box embed {
        width: 100% !important;
        height: 100% !important;
        border: none !important;
        pointer-events: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .map-image-scroll-wrapper {
        width: 100% !important;
        height: 100% !important;
        overflow: auto !important;
        -webkit-overflow-scrolling: touch !important;
        touch-action: pan-x pan-y !important;
    }
}
