/* =========================================
   1. المتغيرات والإعدادات العامة
   ========================================= */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary-color: #D4AF37;
    --dark-bg: #1e293b; 
    --light-bg: #f8fafc;
    --text-color: #334155;
    --border-color: #e2e8f0;
    --border-radius: 16px; 
}

/* إغلاق ثغرة التمدد ومنع المساحات البيضاء */
html, body.main-body {
    margin: 0 !important;
    padding: 0 !important;
    position: relative;
    font-family: 'Tajawal', sans-serif; 
    background: #f0f2f5;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

.main-header {
    margin-top: 0 !important;
    top: 0 !important;
    width: 100%;
}
a { text-decoration: none; color: inherit; }

/* =========================================
   2. تطويرات الهيدر (الأنيميشن والأزرار)
   ========================================= */
.main-header {
    background-color: var(--dark-bg);
    padding: 15px 5% !important;
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex !important;
    align-items: center;
    justify-content: flex-start;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.header-logo a { 
    display: flex; 
    align-items: center; 
    text-decoration: none; 
}

.dynamic-nav { 
    display: flex; 
    gap: 20px; 
    align-items: center; 
    margin-right: 8%; 
}

.nav-item {
    color: #fff;
    font-weight: bold;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.nav-item i { 
    color: var(--primary-color); 
    font-size: 16px; 
    transition: 0.3s; 
}

.nav-item::before {
    content: '';
    position: absolute;
    bottom: 0; left: 0; width: 0; height: 3px;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
    border-radius: 2px;
}
.nav-item:hover::before { width: 100%; }
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--primary-color); }
.nav-item:hover i { transform: scale(1.2); }

@media (max-width: 900px) {
    .main-header {
        flex-direction: column;
        justify-content: center;
        gap: 15px;
        padding: 15px !important;
    }
    .dynamic-nav {
        margin-right: 0;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    .nav-item { font-size: 13px; padding: 6px 10px; }
}

/* =========================================
   3. تطويرات الفوتر الشامل
   ========================================= */
.main-footer {
    background-color: #111;
    padding: 50px 20px 20px;
    border-top: 4px solid var(--primary-color);
}
.footer-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1.5fr;
    gap: 40px;
    text-align: right;
}

.footer-title { color: var(--primary-color); font-size: 18px; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; font-weight: 900;}
.footer-desc { color: #aaa; line-height: 1.8; font-size: 14px; font-weight: bold;}

.footer-links { display: flex; flex-direction: column; gap: 12px; }
.footer-contact-link { color: #ccc; display: flex; align-items: center; gap: 10px; font-size: 14px; transition: 0.3s; font-weight: bold;}
.footer-contact-link i { color: #fff; background: rgba(255,255,255,0.1); padding: 8px; border-radius: 50%; font-size: 13px; transition: 0.3s; }
.footer-contact-link:hover { color: #fff; transform: translateX(-5px); }
.footer-contact-link.whatsapp i { color: #25D366; background: rgba(37, 211, 102, 0.1); }
.footer-contact-link.whatsapp:hover i { background: #25D366; color: #fff; }

.footer-social { display: flex; gap: 15px; flex-wrap: wrap; }
.footer-social a { width: 45px; height: 45px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: rgba(255,255,255,0.05); color: #fff; font-size: 20px; transition: all 0.3s ease; }
.footer-social a.fb:hover { background: #1877F2; transform: translateY(-5px); }
.footer-social a.ig:hover { background: #E1306C; transform: translateY(-5px); }
.footer-social a.snap:hover { background: #FFFC00; color: #000; transform: translateY(-5px); }
.footer-social a.tiktok:hover { background: #fff; color: #000; transform: translateY(-5px); }
.footer-social a.yt:hover { background: #FF0000; transform: translateY(-5px); }
.footer-social a.tw:hover { background: #1DA1F2; transform: translateY(-5px); }

.footer-copyright { text-align: center; margin-top: 40px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.05); color: #888; font-size: 13px; font-weight: bold;}

@media (max-width: 768px) {
    .footer-grid { grid-template-columns: 1fr; gap: 30px; text-align: center; }
    .footer-title { justify-content: center; }
    .footer-contact-link { justify-content: center; }
    .footer-social { justify-content: center; }
}

/* =========================================
   4. الصفحة الرئيسية (شبكة السيارات)
   ========================================= */
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 30px; padding: 40px 20px; max-width: 1200px; margin: 0 auto; }
.car-card-new { display: flex; flex-direction: column; background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 4px 15px rgba(0,0,0,0.06); border: 1px solid var(--border-color); transition: 0.3s; height: 100%; position: relative;}
.car-card-new:hover { transform: translateY(-8px); box-shadow: 0 12px 25px rgba(0,0,0,0.1); }

.img-wrap { width: 100%; aspect-ratio: 4/3; position: relative; background: var(--light-bg); overflow: hidden; }
.img-wrap img { width: 100%; height: 100%; object-fit: cover; transition: 0.5s;}
.car-card-new:hover .img-wrap img { transform: scale(1.05); }

.badge-status { position: absolute; top: 15px; right: 15px; padding: 6px 15px; border-radius: 20px; font-size: 12px; font-weight: 900; color: #fff; z-index: 10; backdrop-filter: blur(5px); white-space: nowrap; box-shadow: 0 4px 10px rgba(0,0,0,0.2);}
.bg-green { background: rgba(16, 185, 129, 0.95); }
.bg-red { background: rgba(239, 68, 68, 0.95); }

.car-body { padding: 20px; display: flex; flex-direction: column; flex-grow: 1; }
.car-title { font-size: 18px; margin: 0 0 5px 0; color: var(--dark-bg); font-weight: 900;}
.car-subtitle { font-size: 13px; color: #64748b; margin-bottom: 15px; border-bottom: 1px dashed var(--border-color); padding-bottom: 15px; font-weight: bold;}

.specs-grid-home { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.spec-item-home { background: var(--light-bg); padding: 8px 10px; border-radius: 8px; font-size: 12px; color: var(--text-color); display: flex; align-items: center; gap: 8px; font-weight: bold; border: 1px solid var(--border-color);}
.spec-item-home i { color: #3b82f6; }

.car-footer { margin-top: auto; display: flex; justify-content: space-between; align-items: center; border-top: 2px dashed var(--border-color); padding-top: 15px; }
.price-tag { font-size: 22px; font-weight: 900; color: #3b82f6; display: flex; align-items: baseline; gap: 4px;}
.price-currency { font-size: 13px; color: #94a3b8; font-weight: bold;}

.btn-details { background: var(--dark-bg); color: #fff; padding: 10px 20px; border-radius: 10px; font-size: 14px; font-weight: 900; transition: all 0.3s ease; text-align: center; border: none; }
.btn-details:hover { background: #3b82f6; transform: translateY(-2px); box-shadow: 0 5px 15px rgba(59, 130, 246, 0.3); color: #fff;}

/* =========================================
   5. صفحة تفاصيل السيارة (Car Details) المحدثة 
   ========================================= */
.car-layout { 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 40px 20px; 
    display: grid; 
    grid-template-columns: 1fr 360px; 
    gap: 30px; 
    align-items: start; 
    width: 100%;
}

.main-col, .sidebar-col {
    min-width: 0;
    width: 100%;
}

.car-header-black { background: #1a1a24; color: white; border-radius: 16px; padding: 20px 30px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; box-shadow: 0 10px 20px rgba(0,0,0,0.1); width: 100%;}
.car-header-black .title-wrap { display: flex; align-items: center; gap: 15px; }
.car-header-black h1 { margin: 0; font-size: 28px; font-weight: 900; color: #fff; display: flex; gap: 8px; flex-wrap: wrap;}
.car-header-black h1 span { color: #3b82f6; }
.car-header-black p { margin: 5px 0 0 0; font-size: 14px; color: #94a3b8; font-weight: bold; }
.car-header-black i.main-icon { font-size: 32px; color: #3b82f6; animation: bounce 2s infinite; }

.social-circles { display: flex; gap: 12px; }
.social-circle { width: 45px; height: 45px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; color: white; text-decoration: none; transition: 0.3s; }
.social-circle:hover { transform: scale(1.1); filter: brightness(1.1); }
.sc-link { background: #64748b; } .sc-fb { background: #1877f2; } .sc-wa { background: #25d366; }

.gallery-card { background: #fff; border-radius: 16px; padding: 15px; box-shadow: 0 4px 15px rgba(0,0,0,0.03); margin-bottom: 25px; width: 100%;}
.gallery-main { width: 100%; height: 420px; border-radius: 12px; overflow: hidden; position: relative; background: #f8fafc; }
.gallery-main img { width: 100%; height: 100%; object-fit: cover; transition: 0.5s; }
.gallery-main:hover img { transform: scale(1.03); }

/* التعديل الجذري للشريط الأحمر هنا */
.status-alert-badge { 
    position: absolute; 
    top: 15px; 
    right: 15px; 
    z-index: 10; 
    background: rgba(220, 38, 38, 0.95); 
    backdrop-filter: blur(5px); 
    color: white; 
    padding: 10px 20px; 
    border-radius: 8px; 
    font-weight: 900; 
    font-size: 14px; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    box-shadow: 0 5px 15px rgba(220, 38, 38, 0.4); 
}

.gallery-thumbs { display: flex; gap: 10px; margin-top: 15px; overflow-x: auto; padding-bottom: 5px; justify-content: flex-start; width: 100%; max-width: 100%;}
.gallery-thumbs img { width: 110px; height: 75px; object-fit: cover; border-radius: 8px; cursor: pointer; transition: 0.3s; border: 2px solid transparent; opacity: 0.7; flex-shrink: 0;}
.gallery-thumbs img:hover { opacity: 1; border-color: #3b82f6; transform: translateY(-3px); box-shadow: 0 4px 10px rgba(0,0,0,0.1); }

.specs-card { background: #fff; border-radius: 16px; padding: 30px; box-shadow: 0 4px 15px rgba(0,0,0,0.03); margin-bottom: 25px; width: 100%;}
.sub-heading { margin-top: 0; color: #1e293b; font-size: 20px; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; font-weight: 900; }

.specs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 15px; margin-bottom: 30px; }
.terms-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; margin-bottom: 0; }

.spec-box { padding: 15px; border-radius: 12px; display: flex; flex-direction: column; gap: 5px; position: relative; overflow: hidden; transition: 0.3s; border: 1px solid; }
.spec-box:hover { transform: translateY(-3px); box-shadow: 0 5px 15px rgba(0,0,0,0.05);}
.spec-box i { position: absolute; left: -10px; bottom: -10px; font-size: 50px; opacity: 0.1; transition: 0.3s; }
.spec-box:hover i { transform: scale(1.2) rotate(-10deg); opacity: 0.2; }
.spec-box strong { font-size: 12px; font-weight: bold; z-index: 1;}
.spec-box span { font-size: 15px; font-weight: 900; z-index: 1;}

.c-blue { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.c-green { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.c-orange { background: #fffbeb; border-color: #fde68a; color: #b45309; }
.c-purple { background: #faf5ff; border-color: #e9d5ff; color: #7e22ce; }
.c-red { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.c-gray { background: #f8fafc; border-color: #e2e8f0; color: #334155; }
.dashed-divider { border: 0; border-top: 2px dashed #e2e8f0; margin: 0 0 25px 0; }

/* الشريط الجانبي */
.sidebar-col { display: flex; flex-direction: column; gap: 20px; position: sticky; top: 20px; }
.booking-card { background: #fff; border-radius: 16px; padding: 25px; box-shadow: 0 10px 30px rgba(0,0,0,0.05); text-align: center; border-top: 5px solid #3b82f6; width: 100%;}
.booking-title-rect { background: #1e293b; color: #fff; padding: 15px; border-radius: 12px; margin-bottom: 25px; font-size: 16px; font-weight: 900; display: flex; align-items: center; justify-content: center; gap: 10px; box-shadow: 0 4px 15px rgba(30,41,59,0.2); }

.price-display { background: #1a1a24; color: white; padding: 25px; border-radius: 16px; margin-bottom: 15px; box-shadow: 0 10px 20px rgba(0,0,0,0.1); position: relative; overflow: hidden;}
.price-display::before { content: '\f02b'; font-family: 'Font Awesome 6 Free'; font-weight: 900; position: absolute; right: -20px; top: -20px; font-size: 120px; color: rgba(255,255,255,0.03); transform: rotate(-20deg); }
.price-display p { margin: 0 0 5px 0; font-size: 13px; color: #94a3b8; font-weight: bold; }
.price-display h2 { margin: 0; font-size: 40px; font-weight: 900; color: #38bdf8; display: flex; align-items: baseline; justify-content: center; gap: 5px; transition: 0.3s; }
.price-display h2 span { font-size: 16px; color: #cbd5e1; }

.currency-wrap { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 15px; background: #f8fafc; padding: 10px; border-radius: 10px; border: 1px solid #e2e8f0; }
.currency-wrap label { font-size: 13px; font-weight: bold; color: #475569; }
.currency-wrap select { padding: 6px 10px; border-radius: 6px; border: 1px solid #cbd5e1; font-family: inherit; font-weight: bold; color: #1e293b; background: #fff; cursor: pointer; outline: none; transition: 0.2s;}

.currency-disclaimer { background: #fffbeb; border: 1px dashed #f59e0b; color: #b45309; padding: 12px; border-radius: 10px; font-size: 12px; font-weight: bold; line-height: 1.6; margin-bottom: 20px; display: flex; align-items: flex-start; gap: 8px; text-align: right; transition: all 0.3s ease; }
.currency-disclaimer i { font-size: 16px; margin-top: 2px; }

.btn-main { width: 100%; padding: 16px; border-radius: 12px; font-size: 16px; font-weight: 900; color: #fff; border: none; cursor: pointer; transition: 0.3s; display: flex; justify-content: center; align-items: center; gap: 10px; margin-bottom: 15px; }
.btn-book { background: #3b82f6; box-shadow: 0 5px 15px rgba(59,130,246,0.3); }
.btn-book:hover { background: #2563eb; transform: translateY(-2px); }
.btn-wa { background: #22c55e; box-shadow: 0 5px 15px rgba(34,197,94,0.3); margin-bottom: 0; }
.btn-wa:hover { background: #16a34a; transform: translateY(-2px); }

.modern-ai-box { background: #fff; border-radius: 16px; padding: 25px; box-shadow: 0 4px 15px rgba(0,0,0,0.03); position: relative; overflow: hidden; border-right: 4px solid #8b5cf6; width: 100%;}
.modern-ai-box .bg-quote { position: absolute; left: 10px; top: 10px; font-size: 80px; color: #f1f5f9; z-index: 0; }
.modern-ai-box h4 { margin-top: 0; font-size: 16px; color: #1e293b; display: flex; align-items: center; gap: 8px; margin-bottom: 15px; position: relative; z-index: 1; border-bottom: 1px dashed #e2e8f0; padding-bottom: 10px; }
.modern-ai-box h4 i { color: #8b5cf6; }
.modern-ai-box p { margin: 0; font-size: 14px; color: #475569; line-height: 1.8; font-weight: bold; text-align: justify; position: relative; z-index: 1; }

/* =========================================
   6. النافذة المنبثقة (Modal) ونموذج الحجز
   ========================================= */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 9999; justify-content: center; align-items: center; overflow-y: auto; padding: 20px; backdrop-filter: blur(5px); }
.modal-content { background: #fff; width: 100%; max-width: 800px; border-radius: 20px; padding: 30px; position: relative; box-shadow: 0 20px 50px rgba(0,0,0,0.3); margin: auto; }
.close-modal { position: absolute; top: 20px; right: 20px; background: none; border: none; font-size: 24px; cursor: pointer; color: #ef4444; transition: 0.3s; z-index: 10; }
.close-modal:hover { transform: scale(1.1); }

.modal-header { margin-top: 0; color: #1e293b; border-bottom: 2px dashed #f1f5f9; padding-bottom: 15px; margin-bottom: 20px; font-size: 20px; font-weight: 900;}
.form-input { width: 100%; padding: 12px; border-radius: 10px; border: 1px solid #cbd5e1; font-family: inherit; font-size: 14px; background: #fff; transition: 0.3s; font-weight: bold;}
.form-input:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.1); outline: none; }
.form-row-flex { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 15px; }
.file-label { font-size: 12px; font-weight: bold; color: #475569; display: block; margin-bottom: 5px; }

.section-title-form { font-size: 16px; color: #3b82f6; margin: 25px 0 15px 0; border-bottom: 1px dashed #e2e8f0; padding-bottom: 8px; font-weight: 900;}

.calc-box { background: #eff6ff; padding: 20px; border-radius: 12px; margin: 20px 0; display: flex; justify-content: space-between; align-items: center; border: 1px dashed #bfdbfe; }
.calc-days { font-size: 15px; color: #475569; font-weight: bold; }
.calc-total { font-size: 24px; color: #059669; font-weight: 900; }

.btn-submit-booking { width: 100%; padding: 18px; background: #10b981; color: #fff; font-weight: 900; font-size: 18px; border: none; border-radius: 12px; cursor: pointer; transition: 0.3s; box-shadow: 0 5px 15px rgba(16, 185, 129, 0.3); display: flex; align-items: center; justify-content: center; gap: 10px; }
.btn-submit-booking:hover { background: #059669; transform: translateY(-2px); }

/* =========================================
   Media Queries لضمان التوافق التام مع الموبايل
   ========================================= */
@media (max-width: 992px) {
    .car-layout { grid-template-columns: 1fr; padding-top: 20px; }
    .sidebar-col { position: static; }
}

@media (max-width: 768px) {
    .car-header-black { flex-direction: column; text-align: center; gap: 15px; padding: 20px; }
    .car-header-black .title-wrap { flex-direction: column; text-align: center; }
    .car-header-black .title-wrap div { text-align: center !important; }
    .car-header-black h1 { font-size: 24px; justify-content: center; }
    .car-header-black p { justify-content: center; }
    .car-header-black i.main-icon { display: none; }
    
    /* التعديل الجذري لمنع تكدس المستطيل الأحمر فوق الصور في الشاشات المتوسطة والصغيرة */
    .status-alert-badge {
        top: 10px !important;
        right: 10px !important;
        left: 10px !important;
        width: auto !important;
        max-width: none !important;
        transform: none !important;
        justify-content: center !important;
        text-align: center !important;
        font-size: 13px !important;
        padding: 8px !important;
        white-space: normal !important;
        line-height: 1.5;
    }
    
    .gallery-main { height: 280px; }
    .specs-card { padding: 20px 15px; }
}

@media (max-width: 480px) {
    .gallery-main { height: 220px; }
    .gallery-thumbs img { width: 80px; height: 60px; }
    
    /* إجبار قوي للشبكة لتبقى عمودين (2x2) على الموبايل */
    .specs-grid, .terms-grid { 
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important; 
        gap: 8px !important; 
        margin-bottom: 20px;
        width: 100%;
    }
    .spec-box { 
        padding: 12px 10px !important; 
        min-width: 0 !important; 
        width: 100%;
        word-wrap: break-word;
        overflow: hidden;
    }
    .spec-box strong { 
        font-size: 11px !important; 
        white-space: normal !important; 
        line-height: 1.4;
        display: block;
    }
    .spec-box span { 
        font-size: 13px !important; 
        white-space: normal !important;
        word-break: break-word;
    }
    .spec-box i { 
        font-size: 35px !important; 
        left: -5px !important; 
        bottom: -5px !important; 
    }
    
    .modal-content { padding: 20px 15px; border-radius: 15px; }
    .form-row-flex { grid-template-columns: 1fr; gap: 10px; } 
    
    .price-display h2 { font-size: 32px; }
    .calc-box { flex-direction: column; gap: 10px; text-align: center; justify-content: center; }
}

@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }