/* ============================================================
   ملف التصميم الرئيسي - Main Stylesheet (النسخة النهائية والمعدلة للموبايل)
   ============================================================ */

/* 1. إعدادات عامة للصفحة لمنع الاهتزاز في الموبايل */
html, body {
    overflow-x: hidden;
    width: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Cairo', sans-serif;
    background-color: var(--bg);
}

body {
    padding-bottom: 100px;
    position: relative;
}

a {
    text-decoration: none;
    transition: all 0.3s ease-in-out;
}

/* 2. الشريط العلوي (Topbar) - تصميم احترافي في سطر واحد دائماً */
.topbar {
    width: 100%;
    z-index: 1001;
    position: relative;
}

.topbar-wrapper {
    display: flex;
    justify-content: space-between; /* العلم والسوشيال يمين، والهاتف يسار */
    align-items: center;
    width: 100%;
    flex-wrap: nowrap !important; /* إجبار العناصر على البقاء في سطر واحد قطعياً */
}

/* تنسيق أعلام اللغات */
.lang-switch {
    display: flex;
    align-items: center;
}

.lang-flag-btn img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    object-position: left center; /* التركيز على الجزء الأيسر من العلم */
    border: 2px solid rgba(255,255,255,0.3);
    transition: 0.3s;
    display: block;
}

.lang-flag-btn:hover img {
    transform: scale(1.1);
    border-color: white;
}

/* تنسيق أيقونات السوشيال ميديا */
.social-icons {
    display: flex;
    align-items: center;
    gap: 15px !important; /* مسافة ثابتة وأنيقة بين الأيقونات */
    margin-inline-start: 12px;
}

.social-icons a {
    color: inherit;
    font-size: 16px;
    margin: 0 !important;
    padding: 0;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.social-icons a:hover {
    opacity: 0.7;
    transform: translateY(-2px);
}

/* معلومات الاتصال (الهاتف والوقت) */
.topbar-info {
    font-weight: 600;
    display: flex;
    gap: 15px;
    align-items: center;
    margin: 0;
    padding: 0;
    border: none;
}

/* تحسينات الشاشات الصغيرة (الموبايل) لتتسع في سطر واحد براحة */
@media (max-width: 576px) {
    .social-icons {
        gap: 12px !important; /* تقليل المسافة قليلاً لتوفير المساحة */
        margin-inline-start: 8px;
    }
    .social-icons a {
        font-size: 15px; /* تصغير الأيقونات درجة واحدة */
    }
    .lang-flag-btn img {
        width: 22px; /* تصغير العلم درجة واحدة */
        height: 22px;
    }
}

/* 3. الترويسة وصورة الخلفية (Header) */
.header-section {
    background-color: var(--primary);
    padding: 40px 0 30px;
    text-align: center;
    color: white;
    position: relative;
    box-shadow: inset 0 0 0 1000px rgba(0,0,0,0.4); 
    background-size: cover;
    background-position: center;
    margin-bottom: 0;
}

.logo-img {
    width: 120px;
    height: 120px;
    border-radius: 15px;
    border: 3px solid white;
    background: white;
    object-fit: contain;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    padding: 5px;
}

.site-title {
    margin-top: 15px;
    font-weight: 800;
    font-size: 24px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* 4. شريط الأقسام العائم (Sticky Nav) */
.category-nav-sticky {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 999;
    background: #ffffff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    padding: 12px 0;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    border-bottom: 1px solid #f0f0f0;
}

.category-nav-sticky::-webkit-scrollbar {
    display: none;
}
.category-nav-sticky {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.cat-link {
    display: inline-block;
    padding: 8px 18px;
    margin: 0 4px;
    border-radius: 25px;
    color: #555;
    font-weight: 700;
    font-size: 14px;
    background: #f8f9fa;
    border: 1px solid #eee;
    cursor: pointer;
}

.cat-link.active {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.section-title {
    font-weight: 800;
    font-size: 20px;
    margin-top: 30px;
    margin-bottom: 15px;
    color: #333;
    padding-inline-start: 12px;
    border-inline-start: 5px solid var(--primary);
}

/* 5. كارت الصنف (Item Card) */
.item-card {
    background: white;
    border-radius: 16px;
    display: flex;
    align-items: stretch;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #f1f1f1;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    transition: transform 0.2s;
}

.item-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.06);
}

.item-img {
    width: 110px;
    height: 85px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
}

.item-details {
    flex-grow: 1;
    padding: 0 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.item-title {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 5px;
    color: #222;
    line-height: 1.3;
}

.item-desc {
    font-size: 12px;
    color: #777;
    margin-bottom: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.item-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    min-width: 85px;
    border-inline-start: 1px dashed #eee;
    padding-inline-start: 10px;
}

.item-price {
    color: var(--primary);
    font-weight: 900;
    font-size: 16px;
    margin-bottom: 5px;
}

.item-unit {
    font-size: 10px;
    color: #aaa;
    margin-bottom: auto;
}

/* 6. أزرار التحكم بالكمية */
.qty-control {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 25px;
    padding: 3px;
    border: 1px solid #e0e0e0;
    width: 100%;
}

.qty-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: white;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    font-size: 14px;
}

.qty-input {
    width: 25px;
    text-align: center;
    border: none;
    background: transparent;
    font-weight: bold;
    font-size: 14px;
    color: #333;
    padding: 0;
}

/* 7. زر السلة العائم */
.floating-cart-btn {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 450px;
    background: #25D366;
    color: white;
    padding: 16px 20px;
    border-radius: 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: 16px;
    box-shadow: 0 10px 30px rgba(37, 211, 102, 0.4);
    z-index: 1000;
    text-decoration: none;
    transition: 0.3s;
    border: 2px solid rgba(255,255,255,0.2);
}

.floating-cart-btn:hover {
    color: white;
    transform: translateX(-50%) scale(1.02);
}

.cart-badge {
    background: white;
    color: #25D366;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 900;
}

/* 8. صندوق إتمام الطلب (Checkout) */
.order-summary-container {
    margin-top: 30px;
    margin-bottom: 50px;
}

.order-box {
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
    border: 1px solid #f0f0f0;
}

.form-label-bold {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 8px;
    display: block;
    color: #444;
}

.required-star {
    color: #dc3545;
    font-weight: bold;
    margin-inline-start: 3px;
}

.form-control, 
.select2-container .select2-selection--single {
    height: 50px !important;
    border-radius: 10px !important;
    border: 1px solid #dee2e6 !important;
    font-size: 15px;
    box-shadow: none !important;
    background-color: #fcfcfc;
}

.form-control:focus,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--primary) !important;
    background-color: #fff;
}

.select2-container .select2-selection--single {
    display: flex !important;
    align-items: center !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 48px !important;
    top: 1px !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 50px !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
    color: #333 !important;
}

/* 9. زر التبديل (توصيل/استلام) */
.ios-toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 25px;
    background: #f9f9f9;
    padding: 10px;
    border-radius: 15px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #e4e4e4;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(26px); }

.toggle-text {
    font-weight: 700;
    font-size: 16px;
    color: #bbb;
    cursor: pointer;
    transition: 0.3s;
}

.toggle-text.active {
    color: #333;
    transform: scale(1.1);
}

.mode-description {
    text-align: center;
    font-size: 13px;
    color: #666;
    background: #eefbf3;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px dashed #25D366;
}

/* 10. الفاتورة (Bill) */
.bill-items-list {
    background-color: #fafafa;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    font-size: 14px;
}

.bill-item-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    color: #555;
    border-bottom: 1px dashed #e0e0e0;
    padding-bottom: 8px;
}

.bill-item-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.empty-cart-msg {
    text-align: center;
    color: #aaa;
    font-size: 14px;
    padding: 10px;
    font-style: italic;
}

.bill-summary {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 2px solid #f0f0f0;
}

.bill-row {
    display: flex;
    justify-content: space-between;
    font-size: 15px;
    color: #666;
    margin-bottom: 5px;
}

.bill-total {
    display: flex;
    justify-content: space-between;
    padding-top: 12px;
    margin-top: 12px;
    border-top: 2px solid #ddd;
    font-size: 20px;
    font-weight: 900;
    color: var(--primary);
}

.btn-whatsapp-submit {
    background: #25D366;
    color: white;
    border: none;
    padding: 16px;
    border-radius: 14px;
    font-weight: 800;
    width: 100%;
    font-size: 18px;
    margin-top: 25px;
    box-shadow: 0 5px 15px rgba(37, 211, 102, 0.3);
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-whatsapp-submit:hover {
    background: #1ebc57;
    transform: translateY(-2px);
}