/* ==========================================================================
   1. الإعدادات العامة والمتغيرات (Root & General)
   ========================================================================== */
:root { 
    --primary: #cc0000; 
    --primary-hover: #ba0000;
    --dark: #333; 
    --bg: #f2f2f7; /* تم دمج light و bg هنا */
    --text: #333333;
    --whatsapp-color: #25d366;
    --whatsapp-hover: #20ba5a;
}

*, *::before, *::after { /* تم حذف كلمة box-sizing-base الخطأ */
    box-sizing: border-box;
}

body { 
    background-color: var(--bg); 
    color: var(--text); 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    margin: 0; 
    padding-top: 80px; 
    padding-bottom: 80px; 
    direction: rtl; 
    overflow-x: hidden; 
}

.spacer { 
    height: 70px; 
}

/* ==========================================================================
   2. الهيدر وشريط البحث (Header & Search)
   ========================================================================== */
.site-header { 
    background-color: var(--primary); 
    padding: 10px 20px; 
    position: fixed; 
    top: 0; 
    left: 0;
    width: 100%; 
    z-index: 999; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    height: 70px; 
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.menu-toggle { 
    background: rgba(255, 255, 255, 0.15); 
    border: none; 
    color: white; 
    padding: 8px 12px; 
    cursor: pointer; 
    font-size: 20px; 
    border-radius: 5px;
    transition: background 0.3s ease;
}

.menu-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
}

.search-container {
    position: relative;
}

.search-form {
    display: flex;
    align-items: center;
}

.search-input {
    padding: 8px 35px 8px 15px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 20px;
    outline: none;
    font-size: 14px;
    background: rgba(255,255,255,0.2);
    color: white;
    width: 160px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-input::placeholder {
    color: rgba(255,255,255,0.7);
}

.search-input:focus {
    width: 240px;
    background: #ffffff;
    color: #333333;
    border-color: #ffffff;
    box-shadow: 0 0 8px rgba(0,0,0,0.15);
}

.search-icon {
    position: absolute;
    right: 12px;
    color: rgba(255,255,255,0.7);
    pointer-events: none;
    transition: color 0.3s ease;
    font-size: 14px;
}

.search-input:focus + .search-icon {
    color: var(--primary);
}

.header-cart { 
    color: white; 
    text-decoration: none; 
    font-size: 16px; 
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 15px;
    border-radius: 20px;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.header-cart:hover {
    background: rgba(255, 255, 255, 0.25);
}

.logo-container {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.site-logo-img { 
    max-height: 50px; 
    width: auto; 
    display: block; 
    background: white; 
    padding: 5px 15px; 
    border-radius: 5px; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* ==========================================================================
   3. السلايدر الاحترافي (Swiper Slider)
   ========================================================================== */
.swiper { 
    width: 95% !important; 
    margin: 15px auto !important; 
    border-radius: 15px !important; 
    overflow: hidden !important; 
    aspect-ratio: 16 / 9 !important; 
    background: #eee !important;
}

.swiper-wrapper { 
    height: 100%; 
}

.swiper-slide { 
    width: 100%; 
    height: 100%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
}

.swiper-slide img { 
    width: 100% !important; 
    height: 100% !important; 
    object-fit: cover !important; 
    display: block;
}

.swiper-button-next, .swiper-button-prev { 
    color: #fff !important; 
    background: rgba(0,0,0,0.5) !important; 
    width: 40px !important; 
    height: 40px !important; 
    border-radius: 50% !important; 
}

.swiper-pagination-bullet { 
    background: #fff !important; 
    opacity: 1 !important; 
}

.swiper-pagination-bullet-active { 
    background: var(--primary) !important; 
}

/* ==========================================================================
   4. تنسيق القوائم والشبكة وعرض المنتجات (Grid & Categories)
   ========================================================================== */
.section-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 0 20px; 
    margin-bottom: 10px; 
    text-align: center;
}

.cat-title {
    background: linear-gradient(135deg, #cc0000, #a00000); 
    color: #ffffff;
    padding: 12px 25px;
    border-radius: 50px; 
    display: inline-block;
    margin-bottom: 20px;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(204, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    outline: none;
    text-align: center;
}

.cat-title:hover {
    background: linear-gradient(135deg, #e60000, #cc0000);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 20px rgba(204, 0, 0, 0.5); 
}

.cat-title:active {
    transform: translateY(0) scale(1);
    box-shadow: 0 2px 5px rgba(204, 0, 0, 0.3);
}

.sub-title { 
    color: #888; 
    font-size: 14px; 
    margin-top: 5px; 
}

.category-title {
    padding-right: 20px;
}

.more-btn { 
    font-size: 13px; 
    color: var(--primary); 
    text-decoration: none; 
    font-weight: bold; 
    border: 1px solid var(--primary); 
    padding: 5px 12px; 
    border-radius: 15px; 
    transition: 0.3s;
}

.more-btn:hover { 
    background: var(--primary); 
    color: white; 
}

.grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); 
    gap: 15px; 
    padding: 10px; 
}

/* ==========================================================================
   5. بطاقة المنتج والأزرار (Product Card & Buttons)
   ========================================================================== */
.card, .product-card { 
    background: white; 
    padding: 10px; 
    border-radius: 15px; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.08); 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #eee;
}

.card:hover, .product-card:hover { 
    transform: translateY(-5px); 
    box-shadow: 0 5px 15px rgba(0,0,0,0.15); 
}

.card-img-container { 
    width: 100%; 
    aspect-ratio: 1 / 1; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    background: #f9f9f9; 
    border-radius: 8px; 
    margin-bottom: 8px; 
    overflow: hidden; 
}

/* تم دمج التكرارات هنا لصور المنتجات */
.card img, .product-card img, .card-img-container img { 
    width: 100% !important; 
    height: 140px !important; 
    object-fit: contain !important; 
    background: #fff;
    border-radius: 10px;
}

.card h3, .product-card h3 { 
    font-size: 14px; 
    height: 35px; 
    overflow: hidden; 
    margin: 10px 0; 
    color: #333; 
}

.card p, .product-card p, .price-text { 
    color: var(--primary); 
    font-weight: bold; 
    font-size: 14px; 
    margin: 5px 0;
}

.btn-buy, .btn-cart, .btn-order, .btn-out { 
    display: block; 
    width: 100%; 
    padding: 8px; 
    margin-top: 5px; 
    border-radius: 8px; 
    text-decoration: none; 
    font-size: 13px; 
    cursor: pointer; 
    border: none; 
    text-align: center;
    font-weight: bold;
}

.btn-buy { background: var(--primary); color: white; }
.btn-buy:hover { background: var(--primary-hover); }
.btn-cart { background: #333; color: white; }
.btn-order { background: #ff6666; color: white; }
.btn-out { background: #ccc; color: #666; cursor: not-allowed; }

.special-offer-box {
    border: 2px solid #555; 
    background-color: #ddd; 
    padding: 15px; 
    margin: 10px 0; 
    color: #333; 
    font-weight: bold; 
    border-radius: 0; 
}

.price-display { 
    font-size: 28px; 
    font-weight: bold; 
    color: var(--primary); 
    text-align: center; 
    padding: 15px; 
    background: #fff5f5; 
    border: 2px dashed var(--primary); 
    border-radius: 15px; 
    margin-bottom: 15px; 
}

/* ==========================================================================
   6. النوافذ المنبثقة ومعرض الصور (Modal & Gallery)
   ========================================================================== */
.gallery-wrap { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); 
    gap: 15px; 
    padding: 15px 0; 
}

.gallery-wrap img { 
    width: 100%; 
    height: 100px; 
    object-fit: cover; 
    border-radius: 12px; 
    cursor: pointer; 
    border: 3px solid #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-wrap img:hover { 
    transform: scale(1.08); 
    box-shadow: 0 8px 20px rgba(204,0,0,0.3);
    border-color: var(--primary);
}

.modal { 
    display: none; 
    position: fixed; 
    z-index: 10000; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0,0,0,0.8); 
    justify-content: center; 
    align-items: center; 
}

.modal img { 
    max-width: 90%; 
    max-height: 80%; 
    border-radius: 10px; 
}

/* ==========================================================================
   7. القوائم الجانبية وأشرطة التنقل السفلية (Navigation)
   ========================================================================== */
.side-nav { 
    height: 100%; 
    width: 250px; 
    position: fixed; 
    top: 0; 
    right: -250px; 
    background: #fff; 
    z-index: 2000; 
    transition: 0.3s; 
    padding-top: 60px; 
    box-shadow: -2px 0 5px rgba(0,0,0,0.2); 
}

.side-nav.active { right: 0; }
.side-nav a { display: block; padding: 15px 25px; text-decoration: none; color: #333; border-bottom: 1px solid #eee; }
.close-btn { position: absolute; top: 10px; left: 15px; font-size: 30px; cursor: pointer; }

.overlay { 
    display: none; 
    position: fixed; 
    top:0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0,0,0,0.5); 
    z-index: 1500; 
}
.overlay.active { display: block; }

.bottom-nav, .mobile-nav {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 60px !important;
    background: #ffffff !important;
    display: flex !important;
    justify-content: space-around !important;
    align-items: center !important;
    box-shadow: 0 -2px 15px rgba(0,0,0,0.1) !important;
    z-index: 9999 !important;
    border-top: 2px solid var(--primary) !important;
    padding-bottom: env(safe-area-inset-bottom) !important;
}

.bottom-nav a, .nav-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-decoration: none !important;
    color: #555 !important;
    flex: 1 !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    gap: 2px;
    transition: all 0.3s ease;
}

.bottom-nav a i, .nav-item i, .bottom-nav a span {
    font-size: 20px !important;
    margin-bottom: 2px !important;
}

/* تم إصلاح المسافة الزائدة هنا لتعمل خاصية الـ active للروابط بشكل صحيح */
.bottom-nav a:hover, .bottom-nav a:active, .nav-item.active {
    color: var(--primary) !important;
}

/* ==========================================================================
   8. أزرار التواصل والحقول (Contact & Widgets)
   ========================================================================== */
.whatsapp-btn {
    position: fixed;
    bottom: 75px; 
    right: 25px;  
    z-index: 99999; 
    background-color: var(--whatsapp-color); 
    color: #ffffff !important;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4); 
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    animation: pulse 2s infinite;
}

.whatsapp-btn:hover {
    transform: translateY(-5px) scale(1.08); 
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6);
    background-color: var(--whatsapp-hover);
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

input, select, textarea { 
    width: 100%; 
    padding: 12px; 
    margin: 5px 0 10px; 
    border: 1px solid #ddd; 
    border-radius: 10px; 
    box-sizing: border-box; 
    font-size: 16px;
}

/* ==========================================================================
   9. الشاشات المتجاوبة (Responsive Media Queries)
   ========================================================================== */
@media (min-width: 992px) {
    .grid { 
        grid-template-columns: repeat(4, 1fr); 
        gap: 20px; 
        padding: 20px; 
    }
    .card img, .product-card img { 
        height: 220px !important; 
    }
}

@media (max-width: 576px) {
    .search-input { width: 100px; }
    .search-input:focus { width: 140px; }
    .site-logo-img { max-height: 40px; padding: 5px 10px; }
    .header-cart { padding: 6px 10px; font-size: 14px; }
    .whatsapp-btn { bottom: 70px; right: 20px; width: 50px; height: 50px; font-size: 24px; }
    .swiper { height: 150px; }
}