/*
Theme Name: Royal Food
Theme URI: https://example.com/royal-food
Author: moamen abou alkhair
Author URI: https://example.com/
Description: قالب ووردبريس مخصص لشركة رويال للصناعات الغذائية مع متجر إلكتروني. (Custom WordPress theme for Royal Food company with e-commerce).
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: royal-food
Tags: custom-theme, e-commerce, responsive, bilingual, rtl, fast, core-web-vitals
*/

/* ==============================================
1. متغيرات الألوان الرئيسية (CSS Variables) - من Figma
==============================================
*/
@import url('assets/css/home-page.css');
:root {
    /* الألوان الأساسية */
    --color-main: #3F7F03;           /* (main) اللون الأخضر الأساسي */
    --color-bg-light: #E8EEE7;       /* (bg) خلفية خضراء فاتحة */
    
    /* ألوان النصوص */
    --color-text-dark: #2D3940;      /* (TEXT) لون العناوين/النص الغامق */
    --color-text: #4C4C4C;           /* (text) لون النص الأساسي */
    --color-text-description: #838383; /* (DESCRIPTION) لون الوصف */

    /* ألوان مساعدة (من الصورة) */
    --color-white: #ffffff;
    --color-black: #000000;
    --color-border: #AFAFAF;         /* (Gray 3 / AFAFAF) لون الحدود الفاصلة */
    
    /* الخط */
    --font-primary: 'Cairo', sans-serif; /* كمثال، يمكنك تغييره */
}

/* ==============================================
2. تنسيقات أساسية
==============================================
*/
body {
    font-family: var(--font-primary);
    color: var(--color-text);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: var(--color-white);
}

.container {
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 15px;
    padding-right: 15px;
}

a {
    text-decoration: none;
    color: var(--color-text);
    transition: color 0.3s ease;
}

img {
    max-width: 100%;
    height: auto;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--color-text-dark);
}

/* ==============================================
3. تنسيقات الهيدر (Site Header)
==============================================
*/
.site-header {
    border-bottom: 1px solid #f0f0f0;
}

.header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    padding-bottom: 20px;
}

/* 3.1 أقسام الهيدر (يسار، وسط، يمين) */
.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.site-branding {
    /* اللوجو سيأخذ مساحته في المنتصف */
}
.site-branding .custom-logo {
    max-height: 80px;
    max-width: 250px;
    width: auto;
}

/* 3.2 زر "اتصل بنا" */
.btn-contact-us {
    display: inline-block;
    background-color: transparent;
    border: 1px solid var(--color-main);
    color: var(--color-main);
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}
.btn-contact-us:hover {
    background-color: var(--color-main);
    color: var(--color-white);
}

.main-navigation-desktop {
    display: flex;
    justify-content: center; 
   /*  padding: 10px 0;*/
}

.main-navigation-desktop ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 10px;
}

.main-navigation-desktop li a {
    display: block;
    padding: 10px 20px;
    font-weight: 500;
    border-radius: 5px 5px 0px 0px;
    color: var(--color-text-dark);
}

.main-navigation-desktop li a:hover {
    background-color: var(--color-bg-light);
}

/* العنصر النشط (الصفحة الحالية) */
.main-navigation-desktop .current-menu-item a {
    background-color: var(--color-bg-light);
}

/* ==============================================
4. دعم اللغات (RTL & LTR)
==============================================
*/

/* الوضع الافتراضي (LTR - English) */
html[dir="ltr"] .main-navigation-desktop ul {
    /* لا تغييرات هنا، الوضع الافتراضي */
}

/* الوضع العربي (RTL - Arabic) */
html[dir="rtl"] {
    text-align: right;
}

html[dir="rtl"] .header-left,
html[dir="rtl"] .header-right {
    /* يمكننا عكس ترتيب الأيقونات إذا احتجنا بـ flex-direction: row-reverse */
}

/* ==============================================
5. التجاوب (Responsive - Mobile)
==============================================
*/
@media (max-width: 768px) {
    
    /* 1. إخفاء عناصر الديسك توب */
    .header-left,
    .header-right,
    .main-navigation-desktop {
        display: none;
    }
    
    /* 2. إظهار زر البرجر */
    .burger-menu-toggle {
        display: block !important;
        color: var(--color-text-dark);
    }
    
    /* 3. تعديل الهيدر العلوي */
    .header-top-row {
        flex-direction: row;
        gap: 15px;
        align-items: center;
        justify-content: space-between;
    }

    /* 4. ترتيب الهيدر (لوجو وبرجر) حسب اللغة */
    html[dir="ltr"] .header-top-row {
        /* LTR: (Logo) ... (Burger) */
    }
    
    html[dir="rtl"] .header-top-row {
        /* RTL: (Burger) ... (Logo) */
        flex-direction: row-reverse; 
    }
}
/* ==============================================
6. تنسيق مربع البحث المنبثق
==============================================
*/
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.search-overlay.active {
    visibility: visible;
    opacity: 1;
}

.search-overlay .search-box {
    width: 90%;
    max-width: 600px;
}

.search-overlay .search-form {
    position: relative;
    display: flex;
}
.search-overlay .search-field {
    width: 100%;
    padding: 20px;
    font-size: 1.2rem;
    border: none;
    border-radius: 5px;
}
.search-overlay .search-submit {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--color-main);
    color: var(--color-white);
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
}

.search-overlay .close-search {
    position: absolute;
    top: 30px;
    right: 40px;
    font-size: 3rem;
    color: var(--color-white);
    background: transparent;
    border: none;
    cursor: pointer;
}

/* ==============================================
7. تنسيقات أيقونة السلة
==============================================
*/
.cart-icon {
    position: relative;
    color: var(--color-text);
}
.cart-icon svg {
    width: 24px;
    height: 24px;
    vertical-align: middle;
}
.cart-icon .cart-count {
    position: absolute;
    top: -8px;
    right: -10px;
    background-color: var(--color-main);
    color: var(--color-white);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 11px;
    font-weight: bold;
    line-height: 1;
}

.cart-icon .cart-count:empty,
.cart-icon .cart-count:contains('0') {
    display: none;
}


/* ==============================================
8. Mobile Menu (Off-Canvas)
==============================================
*/

/* لمنع الصفحة من السكرول عند فتح القائمة */
body.no-scroll {
    overflow: hidden;
}

/* زر البرجر (مخفي افتراضياً) */
.burger-menu-toggle {
    display: none;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
}
.burger-menu-toggle svg {
    vertical-align: middle;
}

/* الغطاء الخلفي (Overlay) */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9997;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.mobile-menu-overlay.active {
    visibility: visible;
    opacity: 1;
}

/* حاوية القائمة الجانبية */
.mobile-nav-container {
    position: fixed;
    top: 0;
    width: 85%;
    max-width: 320px;
    height: 100vh;
    background-color: var(--color-white);
    z-index: 9998;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    
    padding: 60px 20px 30px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    
    transition: transform 0.3s ease-in-out;
}

/* زر إغلاق القائمة */
.close-mobile-menu {
    position: absolute;
    top: 15px;
    font-size: 2.5rem;
    color: var(--color-text);
    background: transparent;
    border: none;
    cursor: pointer;
}

/* تنسيق القائمة داخل الموبايل */
.mobile-navigation ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
}
.mobile-navigation li a {
    display: block;
    padding: 12px 10px;
    font-weight: 600;
    color: var(--color-text-dark);
    border-bottom: 1px solid #f0f0f0;
}
.mobile-navigation li a:hover {
    background-color: var(--color-bg-light);
}
.mobile-navigation .current-menu-item a {
    color: var(--color-main);
}

/* تنسيق الإضافات (البحث، الأزرار) */
.mobile-menu-extras {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid var(--color-bg-light);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* (--- هنا التعديل ---) */
.mobile-menu-extras .btn-contact-us {
    text-align: center;
    display: block; /* لجعله بعرض كامل */
    box-sizing: border-box; /* لضمان حساب البادينج بشكل صحيح */
}

.mobile-search-box .search-form {
    display: flex;
    position: relative;
}

/* (--- وهنا التعديل ---) */
.mobile-search-box .search-field {
    width: 106%;
    border: 1px solid var(--color-main); /* 1. تغيير لون البوردر ليطابق الزر */
    border-radius: 8px; /* 2. تغيير انحناء الحواف ليطابق الزر */
    
    /* 3. تطبيق بادينج مشابه للزر */
    padding-top: 10px;
    padding-bottom: 10px;
    padding-left: 24px;
    padding-right: 40px; /* الحفاظ على مساحة أيقونة البحث */

    box-sizing: border-box; /* 4. إضافة لضمان حساب العرض بشكل صحيح */
    font-size: 1rem; /* 5. توحيد حجم الخط (لضمان نفس الارتفاع) */
    background-color: transparent; /* 6. جعل الخلفية شفافة مثل الزر */
}
/* تغيير لون placeholder (اختياري) */
.mobile-search-box .search-field::placeholder {
    color: var(--color-text-description);
    opacity: 1;
}


.mobile-search-box .search-submit {
    display: block;
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--color-text-description);
    padding: 0;
    cursor: pointer;
}
.mobile-search-box .search-submit {
    font-size: 0;
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23838383' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}


.mobile-icons-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 25px;
}
.mobile-icons-row .cart-icon {
    color: var(--color-text-dark);
}

/* --- حركة القائمة حسب اللغة --- */

/* LTR (English) - تظهر من اليسار */
html[dir="ltr"] .mobile-nav-container {
    left: 0;
    transform: translateX(-100%);
}
html[dir="ltr"] .mobile-nav-container.active {
    transform: translateX(0);
}
html[dir="ltr"] .close-mobile-menu {
    right: 15px;
}

/* RTL (Arabic) - تظهر من اليمين */
html[dir="rtl"] .mobile-nav-container {
    right: 0;
    transform: translateX(100%);
}
html[dir="rtl"] .mobile-nav-container.active {
    transform: translateX(0);
}
html[dir="rtl"] .close-mobile-menu {
    left: 15px;
}

/* ==============================================
   11. Page Header (Breadcrumbs)
============================================== */
.page-header-section {
    /* (استخدام نفس لون خلفية الهيرو) */
    background-color: var(--color-bg-light); 
    padding: 40px 0;
    text-align: center;
    position: relative;
    overflow: hidden; /* لإخفاء الانحناء الزائد */
}

/* إضافة الانحناء السفلي (نفس كود الهيرو) */
.page-header-section::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 80px; /* عمق الكيرف */
    background-color: var(--color-white); /* لون السكشن التالي (الأبيض) */
    border-top-left-radius: 50%;
    border-top-right-radius: 50%;
    transform: translateY(50%);
}

.page-header-section .container {
    position: relative;
    z-index: 1; /* ليكون فوق الانحناء */
}

.page-title {
    font-size: 2.5rem;
    color: var(--color-text-dark);
    margin: 0 0 15px 0;
}

/* تنسيق مسار التنقل الخاص بـ WooCommerce */
.breadcrumb-wrapper {
    font-size: 0.9rem;
    color: var(--color-text-description);
}
.woocommerce-breadcrumb {
    display: flex;
    justify-content: center;
    gap: 8px;
}
.woocommerce-breadcrumb a {
    text-decoration: none;
    color: var(--color-text-description);
    transition: color 0.3s ease;
}
.woocommerce-breadcrumb a:hover {
    color: var(--color-main);
}
.woocommerce-breadcrumb .breadcrumb-separator {
    color: var(--color-text-description);
    opacity: 0.7;
}

/* دعم اللغات (RTL/LTR) */
html[dir="rtl"] .woocommerce-breadcrumb .breadcrumb-separator {
    /* (يتم ضبطه تلقائياً بواسطة ووكومرس، لكن للتأكيد) */
    /* ( < ) */
}
html[dir="ltr"] .woocommerce-breadcrumb .breadcrumb-separator {
    /* ( > ) */
}

/* ==============================================
   12. Default Page Layout (page.php)
============================================== */

/* تنسيق الحاوية العامة للصفحة */
.page-container {
    max-width: 1140px;
    margin: 0 auto;
}
.page-content-wrapper {
    padding: 10px 0;
}

/* تنسيق الحقول المخصصة */
.custom-fields-wrapper {
    margin-top: 10px;
}

.about-section {
    margin-bottom: 10px;
    display: grid;
    gap: 40px;
    align-items: center;
}

/* 1. السكشن الرئيسي (الكبير) - 50/50 */
.about-section-main {
    grid-template-columns: 1fr 1fr;
}


/* 2. العنوان الفرعي (وعدنا) */
.about-headline {
    text-align: center;
    padding: 20px 0;
}
.promise-headline {
    font-size: 2.2rem;
    color: var(--color-text-dark);
    display: inline-block;
    position: relative;
    font-weight: 700;
}
.promise-headline .green-text {
    color: var(--color-main);
}
.promise-headline .leaf-bg {
    position: relative;
    display: inline-block;
}
.promise-headline .leaf-bg::before {
    content: '';
    position: absolute;
    top: 0;
    width: 70px;
    height: 100%;
    background-color: var(--color-main);
    opacity: 0.3;
    z-index: -1;
}
html[dir="rtl"] .promise-headline .leaf-bg::before {
    left: auto;
    right: -20px;
    border-radius: 0 50% 50% 0;
}
html[dir="ltr"] .promise-headline .leaf-bg::before {
    left: -20px;
    right: auto;
    border-radius: 50% 0 0 50%;
}


/* --- 3. تثبيت نسب الأعمدة للسكاشن الفرعية --- */

/* RTL: السكشن 2 (الصورة يسار 1fr، المحتوى يمين 2fr) */
html[dir="rtl"] .about-section-sub.section-2 {
    grid-template-columns: 1fr 2fr; /* يسار صورة | يمين محتوى */
}

/* RTL: السكشن 3 (المحتوى يسار 2fr، الصورة يمين 1fr) */
html[dir="rtl"] .about-section-sub.section-3 {
    grid-template-columns: 2fr 1fr; /* يسار محتوى | يمين صورة */
}


/* LTR: السكشن 2 (الصورة يمين 1fr، المحتوى يسار 2fr) */
html[dir="ltr"] .about-section-sub.section-2 {
    grid-template-columns: 2fr 1fr; /* يسار محتوى | يمين صورة */
}

/* LTR: السكشن 3 (المحتوى يمين 2fr، الصورة يسار 1fr) */
html[dir="ltr"] .about-section-sub.section-3 {
    grid-template-columns: 1fr 2fr; /* يسار صورة | يمين محتوى */
}


/* --- تنسيق المحتوى والصور --- */

.about-section-main .about-text-content,
.about-section-sub .about-text-content {
    background-color: var(--color-white);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.07);
    line-height: 1.8;
    color: var(--color-text-description);
}
.about-section-main .about-text-content { font-size: 1rem; }
.about-section-sub .about-text-content { font-size: 0.95rem; }

.about-section-main .about-image-content img {
    width: 100%;
    height: auto;
    border-radius: 15px;
}
.about-section-sub .about-image-content {
    height: 250px; 
}
.about-section-sub .about-image-content img {
    width: 100%;
    height: 100%;
    object-fit: cover; 
    border-radius: 10px;
}


/* --- 5. تثبيت الترتيب المتعرج باستخدام ORDER --- */

/* RTL: السكشن 1 (الصورة يمين، النص يسار) */
html[dir="rtl"] .about-section-main .about-text-content { order: 1; }
html[dir="rtl"] .about-section-main .about-image-content { order: 2; }

/* RTL: السكشن 2 (الصورة يسار، النص يمين) */
html[dir="rtl"] .about-section-sub.section-2 .about-text-content { order: 2; }
html[dir="rtl"] .about-section-sub.section-2 .about-image-content { order: 1; }

/* RTL: السكشن 3 (النص يسار، الصورة يمين) */
html[dir="rtl"] .about-section-sub.section-3 .about-text-content { order: 1; }
html[dir="rtl"] .about-section-sub.section-3 .about-image-content { order: 2; }

/* LTR: السكشن 1 (النص يسار، الصورة يمين) */
html[dir="ltr"] .about-section-main .about-text-content { order: 1; }
html[dir="ltr"] .about-section-main .about-image-content { order: 2; }

/* LTR: السكشن 2 (النص يسار، الصورة يمين) */
html[dir="ltr"] .about-section-sub.section-2 .about-text-content { order: 1; }
html[dir="ltr"] .about-section-sub.section-2 .about-image-content { order: 2; }

/* LTR: السكشن 3 (الصورة يسار، النص يمين) */
html[dir="ltr"] .about-section-sub.section-3 .about-text-content { order: 2; }
html[dir="ltr"] .about-section-sub.section-3 .about-image-content { order: 1; }


/* 6. تنسيق الموبايل */
@media (max-width: 768px) {
    .page-content-wrapper {
        padding: 40px 0;
    }
    
    .about-section-main,
    .about-section-sub {
        grid-template-columns: 1fr;
    }
    
    .about-section .about-text-content {
        order: 1 !important;
    }
    .about-section .about-image-content {
        order: 2 !important;
    }
    
    .about-section-sub .about-image-content {
        height: 250px;
    }
}


