/* =========================================
   1. استدعاء الخطوط المحلية (بدون جوجل فونتس لضمان سرعة 100%)
========================================= */

/* الخط الفرنسي (Google Sans) */
@font-face {
    font-family: 'Google Sans';
    src: url('../fonts/GoogleSans-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap; 
}
@font-face {
    font-family: 'Google Sans';
    src: url('../fonts/GoogleSans-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap; 
}

/* الخط العربي (Tajawal) */
@font-face {
    font-family: 'Tajawal';
    src: url('../fonts/Tajawal-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap; 
}
@font-face {
    font-family: 'Tajawal';
    src: url('../fonts/Tajawal-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap; 
}

/* =========================================
   متغيرات ثيم Abaytic المحدثة
========================================= */
:root {
    --brand-main: #063f47; /* الأخضر الملكي الداكن */
    --brand-dark: #03252a; /* درجة أغمق للظلال ثلاثية الأبعاد */
    --brand-light: #e8eff0; /* درجة فاتحة جداً لخلفيات الأزرار */
    --brand-accent: #C6A059; /* الذهبي */
    --bg-light: #f8f9fa;
    --text-main: #2d3436;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* =========================================
   2. الذكاء الاصطناعي في CSS (التبديل التلقائي للغة)
========================================= */
/* الحالة الافتراضية: الفرنسية (LTR) */
body {
    font-family: 'Google Sans', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-main);
    direction: ltr;
    text-align: left;
    -webkit-font-smoothing: antialiased;
}

/* عندما يكون الموقع باللغة العربية (RTL) */
html[dir="rtl"] body, body.rtl {
    font-family: 'Tajawal', sans-serif;
    direction: rtl;
    text-align: right;
}

/* =========================================
   تنسيقات الهيدر (تم إصلاح التناسق للموبايل 📱)
========================================= */
.abaytic-header { 
    background-color: #fff; 
    padding: 12px 15px; /* حواف أنحف لزيادة المساحة */
    box-shadow: 0 2px 10px rgba(0,0,0,0.05); 
    position: sticky; 
    top: 0; 
    z-index: 1000; 
}

.header-container { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    max-width: 1200px; 
    margin: 0 auto; 
}

/* توزيع المساحات بالتساوي لكي يبقى الشعار في المنتصف تماماً */
.header-action-group {
    display: flex;
    align-items: center;
    flex: 1; /* يأخذ مساحة متساوية يميناً ويساراً */
}
.right-actions { gap: 12px; justify-content: flex-start; }
.left-actions { justify-content: flex-end; }

/* إزالة الإطار من الأيقونات لتبدو أنظف وأكثر عصرية */
.menu-icon span, .search-icon span { 
    font-size: 24px; 
    color: var(--brand-main); 
    cursor: pointer; 
    display: flex;
    padding: 2px;
}

.lang-switcher { 
    display: flex; 
    gap: 4px; 
}

.lang-btn { 
    background: #fff; 
    color: var(--brand-main); 
    border: 1px solid var(--brand-main); 
    padding: 3px 6px; 
    font-size: 11px; 
    border-radius: 4px; 
    cursor: pointer; 
    font-weight: bold; 
}
.lang-btn.active-lang { 
    background: var(--brand-main); 
    color: #fff; 
}

.site-logo { 
    flex: 1; 
    text-align: center; 
}

/* تنسيق صورة الشعار في الهيدر */
.site-logo-img {
    max-height: 35px; /* هذا الارتفاع مثالي ومريح للعين في الموبايل */
    width: auto;
    display: block;
    object-fit: contain;
}

/* تكبير اللوغو قليلاً في شاشات الكمبيوتر */
@media (min-width: 768px) {
    .site-logo-img {
        max-height: 45px;
    }
}
/* إصلاحات طوارئ للموبايلات الصغيرة جداً (مثل آيفون SE) */
@media (max-width: 360px) {
    .site-logo-img { max-height: 30px; }
    .lang-btn { padding: 2px 4px; font-size: 10px; }
    .right-actions { gap: 6px; }
    .menu-icon span, .search-icon span { font-size: 20px; }
}

/* =========================================
   تنسيقات السلايدر المحسن
========================================= */
.single-product-section { padding-bottom: 40px; }
.product-container { max-width: 500px; margin: auto; padding: 15px; }
.single-product-title { text-align: center; font-size: 1.9rem; font-weight: 700; margin-bottom: 10px; color: #000; }
.price-wrap { text-align: center; margin-bottom: 20px; }
.current-price { font-size: 2.2rem; font-weight: 700; color: var(--brand-main); }
.product-description { margin-bottom: 20px; color: #555; line-height: 1.6; }

.slider-container {
    width: 100%;
    background: #e9ecef;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 10px;
    overflow: hidden; 
    position: relative;
    aspect-ratio: 669 / 892; /* الحماية من القفز CLS */
}

.image-box {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    height: 100%;
    width: 100%;
}
.image-box::-webkit-scrollbar { display: none; }
.image-box { -ms-overflow-style: none; scrollbar-width: none; }

.image-box img {
    min-width: 100%;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    scroll-snap-align: start;
}

.swipe-hint { text-align: center; font-size: 0.9rem; color: #7f8c8d; padding: 0 0 15px 0; font-weight: bold; }

/* =========================================
   إعادة ضبط شاملة واحترافية للفورم (Abaytic Ultimate)
========================================= */

/* 1. تصفير شامل ومنع تدخل المتصفحات */
.input-highlight, 
select.input-highlight, 
.submit-order-btn-large {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    outline: none !important;
    font-family: 'Tajawal', sans-serif !important;
    box-sizing: border-box !important;
}

/* 2. تنسيق حقول الإدخال (الاسم، الهاتف) والقوائم */
.input-highlight {
    display: block !important;
    width: 100% !important; /* ملء العرض بالكامل */
    padding: 16px !important;
    margin-bottom: 15px !important;
    border: 2px solid #eee !important;
    border-radius: 10px !important;
    background-color: #fcfcfc !important;
    color: #333 !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    
    /* ضبط الاتجاه للعربية */
    direction: rtl !important;
    text-align: right !important;
    
    /* منع الآيفون من تغيير لون النص */
    -webkit-text-fill-color: #333 !important;
}

/* 3. تنسيق خاص للقوائم المنسدلة (الولاية والبلدية) */
select.input-highlight {
    cursor: pointer !important;
    /* تحديث السهم للون الأخضر الجديد %23063f47 بدلا من البنفسجي */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23063f47' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: left 15px center !important;
    background-size: 15px !important;
    padding-left: 40px !important; /* مساحة للسهم */
}

/* 4. الإصلاح النهائي لزر الطلب */
.submit-order-btn-large {
    display: flex !important;
    width: 100% !important;
    background: var(--brand-main) !important;
    color: #ffffff !important;
    padding: 20px !important;
    margin: 20px 0 !important;
    border: none !important;
    border-radius: 50px !important;
    font-size: 1.4rem !important;
    font-weight: 700 !important;
    justify-content: center !important;
    align-items: center !important;
    /* تحديث لون الظل للدرجة الداكنة من الأخضر */
    box-shadow: 0 6px 0 var(--brand-dark) !important; 
    cursor: pointer !important;
    text-align: center !important;
    transition: all 0.2s ease !important;
}

.submit-order-btn-large:active {
    transform: translateY(4px) !important;
    box-shadow: 0 2px 0 var(--brand-dark) !important;
}

/* 5. تحسين شكل صندوق المجموع */
.order-summary-box {
    background: #ffffff !important;
    border: 2px dashed var(--brand-main) !important;
    border-radius: 12px !important;
    padding: 15px !important;
    margin: 20px 0 !important;
    direction: rtl !important;
}

/* ضمان أن الحقول لا تلتصق ببعضها في الموبايل */
@media (max-width: 768px) {
    #quick-order-form {
        display: block !important; /* منع أي flex قديم */
    }
}

.input-highlight:focus { 
    border-color: var(--brand-main) !important; 
    outline: none !important;
}

/* =========================================
   تنسيق متغيرات المنتج (الألوان، المقاسات)
========================================= */

/* 1. تنسيق الحاوية لتكون شبكة (Grid) متناسقة */
.product-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
    direction: rtl;
}

/* 2. إخفاء زر الراديو الدائري الافتراضي تماماً */
.option-item input[type="radio"] {
    display: none;
}

/* 3. تصميم المربع (Label) في الحالة العادية */
.option-item .option-label {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 50px;
    background-color: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 8px; /* حواف دائرية ناعمة مثل الصورة */
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
    color: #333;
    transition: all 0.2s ease-in-out;
    text-align: center;
    user-select: none; /* لمنع تظليل النص عند النقر السريع */
}

/* تأثير خفيف عند تمرير الماوس */
.option-item .option-label:hover {
    border-color: #b5c7c9;
}

/* 4. تصميم المربع عند اختياره (Active / Checked) */
.option-item input[type="radio"]:checked + .option-label {
    background-color: var(--brand-light); /* خلفية خضراء فاتحة متناسقة */
    border-color: var(--brand-main); /* الإطار يأخذ لون البراند */
    color: var(--brand-main);
}

/* 5. تنسيق عنوان المتغير (مثال: 1. اختر اللّون) */
.section-label {
    display: block;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 12px;
    color: #2d3436;
}
    
/* =========================================
   تصميم شبكة المنتجات (الصفحة الرئيسية)
========================================= */

/* الشبكة: عمودين في الموبايل، و 4 في الكمبيوتر */
.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    max-width: 1200px;
    margin: 0 auto;
    direction: rtl;
    padding: 10px;
}

@media (min-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 25px;
    }
}

/* تصميم البطاقة الأساسي */
.abaytic-product-card {
    background-color: #fff;
    border-radius: 16px; /* حواف دائرية ناعمة */
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03); /* ظل خفيف جداً ومريح للعين */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #f2f2f2;
}

/* تأثير الرفع عند تمرير الماوس وتغيير الظل للون الأخضر الجديد */
.abaytic-product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(6, 63, 71, 0.15); /* ظل يميل للأخضر الملكي */
}

.card-link {
    text-decoration: none !important;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* حاوية الصورة لتكون متناسقة الطول دائماً */
.card-image {
    width: 100%;
    aspect-ratio: 3/4; /* مقاس طولي مثالي لصور الأزياء والعبايات */
    overflow: hidden;
    background-color: #fdfdfd;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

/* زووم راقي للصورة عند اللمس/الماوس */
.abaytic-product-card:hover .card-image img {
    transform: scale(1.05); 
}

/* قسم النصوص والأزرار */
.card-details {
    padding: 12px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    text-align: right;
}

.card-title {
    font-size: 14px;
    font-weight: 700;
    color: #2d3436;
    margin: 0 0 4px 0;
    line-height: 1.4;
    /* إخفاء النص إذا كان طويلاً جداً للحفاظ على التناسق */
    display: -webkit-box;
    -webkit-line-clamp: 2; 
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-category {
    font-size: 11px;
    color: #999;
    margin-bottom: 8px;
}

.card-category a {
    color: #999;
    text-decoration: none;
}

.card-price {
    font-size: 17px;
    font-weight: bold;
    color: var(--brand-main); /* لون البراند المحدث */
    margin-bottom: 12px;
    margin-top: auto; /* لدفع السعر للأسفل ليكون بمحاذاة البطاقات الأخرى */
}

/* زر الطلب الأنيق (تم تحديثه للأخضر الفاتح) */
.card-btn {
    width: 100%;
    background-color: var(--brand-light); /* خلفية خضراء فاتحة متناسقة */
    color: var(--brand-main);
    border: none;
    padding: 10px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.abaytic-product-card:hover .card-btn,
.card-btn:active {
    background-color: var(--brand-main);
    color: #fff;
}