:root {
    --primary: #0f172a; 
    --accent: #2563eb; 
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --success: #10b981;
}
/* تفعيل النزول السلس عند الضغط على التصنيفات */
html { scroll-behavior: smooth; }

/* 💡 تم إزالة overflow: hidden لكي يعمل الـ Sticky (الشريط الثابت) بنجاح! */
body { 
    margin: 0; padding: 0;
    background-color: var(--bg); color: var(--text-main); line-height: 1.4; -webkit-font-smoothing: antialiased; 
    display: flex; flex-direction: column; min-height: 100vh;
}

* { box-sizing: border-box; font-family: 'Tajawal', sans-serif; }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 👑 ترويسة الكاتلوج الفخمة */
.catalog-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: white; 
    text-align: center; 
    padding: 40px 15px 35px 15px;
    border-bottom: 5px solid var(--accent);
    border-radius: 0 0 30px 30px; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
    position: relative;
    z-index: 10;
}
.catalog-header h1 { font-size: 1.8rem; font-weight: 900; margin: 0; display: flex; align-items: center; justify-content: center; gap: 10px;}
.catalog-header h1 i { color: var(--accent); }

/* 📑 شريط التصنيفات (Sticky Nav) - الآن يثبت في الأعلى عند النزول! */
.category-tabs {
    position: -webkit-sticky; /* لدعم سفاري */
    position: sticky;
    top: 0;
    z-index: 900;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 12px 15px;
    display: flex;
    gap: 10px;
    overflow-x: auto;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    /* إخفاء شريط التمرير لشكل أنيق */
    scrollbar-width: none; 
    -ms-overflow-style: none; 
}
.category-tabs::-webkit-scrollbar { display: none; }

.tab-btn {
    background: white;
    border: 1px solid #cbd5e1;
    color: var(--text-muted);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
    transition: 0.3s;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
}
.tab-btn i { font-size: 0.8rem; }
.tab-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}

/* 🔥 هوامش متزنة */
.container { 
    width: 100%; 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 20px 12px 40px 12px; 
    flex: 1; 
}

/* 🏷️ التصنيفات (scroll-margin لكي لا يغطيه شريط التصنيفات عند النزول) */
.category-section { margin-bottom: 35px; animation: fadeInUp 0.5s ease-out forwards; opacity: 0; scroll-margin-top: 80px; }
.category-section:nth-child(1) { animation-delay: 0.1s; }
.category-section:nth-child(2) { animation-delay: 0.2s; }

.category-title {
    display: flex; align-items: center; font-size: 1.3rem; color: var(--primary); font-weight: 900; margin-bottom: 15px; padding: 0 4px; gap: 8px;
}
.category-title i { color: var(--accent); font-size: 1.1rem;}
.category-title::before { content: ""; display: inline-block; width: 4px; height: 18px; background: var(--accent); border-radius: 4px; }
.category-title::after { content: ""; flex: 1; height: 1px; background: #e2e8f0; margin-right: 8px; }

/* 📱 شبكة المنتجات */
.products-grid {
    display: grid; 
    gap: 10px; 
    grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 600px) { .products-grid { grid-template-columns: repeat(3, 1fr); gap: 15px; } }
@media (min-width: 1024px) { .products-grid { grid-template-columns: repeat(5, 1fr); gap: 20px; } }

/* 💳 بطاقة المنتج المصغرة */
.product-card {
    background: var(--card-bg); border-radius: 12px; overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05); border: 1px solid #e2e8f0;
    display: flex; flex-direction: column; text-align: center; 
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    width: 100%;
    height: 100%;
    padding: 8px;
}
.product-card:hover { transform: translateY(-3px); box-shadow: 0 8px 15px rgba(0,0,0,0.08); border-color: #cbd5e1;}

/* 📝 اسم المنتج */
.product-name { 
    font-size: 0.9rem; font-weight: 800; color: var(--primary); 
    margin: 0 0 8px 0; 
    line-height: 1.4;
    height: 2.8em; 
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* 🖼️ الحاوية المربعة للصورة */
.img-wrapper {
    width: 100%; 
    padding-top: 100%; 
    background: #f8fafc; 
    position: relative; 
    overflow: hidden; 
    border-radius: 8px;
    margin-bottom: 10px; 
}
.product-img {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%; height: 100%; 
    object-fit: cover !important; 
    object-position: center !important; 
    transition: transform 0.4s ease;
}
.product-card:hover .product-img { transform: scale(1.05); }

/* 💵 صندوق الحجم فقط (السعر ملغي تماماً) */
.split-box {
    display: flex;
    width: 100%;
    border: 1.5px solid var(--accent);
    border-radius: 8px;
    overflow: hidden;
    margin-top: auto; 
}
.split-box-size {
    flex: 1; 
    background: #eff6ff;
    color: var(--accent);
    font-size: 1.1rem; /* تكبير خط الحجم */
    font-weight: 900;
    padding: 8px 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    text-align: center;
}

/* 👑 الفوتر الأنيق */
.footer { 
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    text-align: center; 
    padding: 25px 15px; 
    color: #e2e8f0; 
    font-size: 0.95rem; 
    font-weight: 700;
    border-radius: 30px 30px 0 0; 
    margin-top: auto; 
    box-shadow: 0 -10px 20px rgba(0,0,0,0.05);
}

/* 🤩 النافذة التفصيلية المنبثقة (Product Modal) */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.85); z-index: 9999; backdrop-filter: blur(5px);
    justify-content: center; align-items: flex-end; 
    opacity: 0; transition: opacity 0.3s ease;
}
.modal-overlay.active { opacity: 1; }

.modal-content {
    background: white; width: 100%; max-width: 800px;
    border-radius: 24px 24px 0 0; padding: 25px 20px;
    transform: translateY(100%); transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 90vh; overflow-y: auto; position: relative;
    display: flex; flex-direction: column; gap: 15px;
}
@media (min-width: 768px) {
    .modal-overlay { align-items: center; }
    .modal-content { border-radius: 16px; flex-direction: row; padding: 30px; gap: 30px;}
}
.modal-overlay.active .modal-content { transform: translateY(0); }

.modal-close {
    position: absolute; top: 15px; right: 15px; background: #f1f5f9; border: none;
    width: 38px; height: 38px; border-radius: 50%; font-size: 1.4rem; color: var(--text-main);
    cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 10; transition: 0.3s;
}
.modal-close:hover { background: #e2e8f0; color: var(--danger); }

.modal-gallery { flex: 1; display: flex; flex-direction: column; gap: 10px; width: 100%; min-width: 0;}

.modal-main-img-wrapper {
    width: 100%; padding-top: 100%; position: relative; border-radius: 12px; overflow: hidden; border: 1px solid #e2e8f0; background: #f8fafc;
    touch-action: none; 
}
.modal-main-img { 
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; object-position: center;
    cursor: zoom-in; transition: transform 0.2s ease-out; 
}

.modal-thumbs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 5px; }
.modal-thumb { width: 65px; height: 65px; object-fit: cover; border-radius: 8px; border: 2px solid transparent; cursor: pointer; transition: 0.2s;}
.modal-thumb.active { border-color: var(--accent); }

.modal-info { flex: 1; display: flex; flex-direction: column; width: 100%;}
.modal-cat { font-size: 0.85rem; color: var(--accent); font-weight: 800; background: #eff6ff; padding: 5px 12px; border-radius: 8px; align-self: flex-start; margin-bottom: 12px;}
.modal-title { font-size: 1.4rem; font-weight: 900; color: var(--primary); line-height: 1.3; margin-bottom: 20px;}

/* الصندوق الموحد للحجم داخل المودال (بدون سعر) */
.modal-split-box {
    display: flex; width: 100%; border: 1.5px solid var(--accent); border-radius: 8px; overflow: hidden; margin-bottom: 20px;
}
.modal-split-size {
    flex: 1; background: #eff6ff; color: var(--accent); font-size: 1.2rem; font-weight: 900; padding: 12px; display: flex; align-items: center; justify-content: center; text-align: center;
}

.modal-section { background: #f8fafc; padding: 15px; border-radius: 10px; border: 1px dashed #cbd5e1; margin-bottom: 10px;}
.modal-section h4 { font-size: 0.95rem; color: var(--primary); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; font-weight: 800;}
.modal-section p { font-size: 0.9rem; color: var(--text-muted); line-height: 1.6; white-space: pre-wrap; font-weight: 500;}


/* Extracted inline styles from the corresponding PHP page. */
.catalog-inline-001 { text-align: center !important; padding: 40px !important; background: white !important; border-radius: 12px !important; border: 1px solid #e2e8f0 !important; margin-top: 20px !important; }
.catalog-inline-002 { font-size: 3rem !important; color: var(--text-light) !important; margin-bottom: 15px !important; }
.catalog-inline-003 { color: var(--text-muted) !important; font-size: 1.1rem !important; }
.catalog-inline-004 { display: none; }
.catalog-inline-005 { color: var(--accent) !important; }
.catalog-inline-006 { color: var(--success) !important; }
