/* =========================================
   إعدادات عامة (Global Reset & Body)
   ========================================= */

/* إعادة ضبط الهوامش والحشو لكل العناصر
   واستخدام box-sizing: border-box لتسهيل التحكم في الأحجام */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* إعدادات جسم الصفحة: خط افتراضي، خلفية متدرجة،
   لون نص افتراضي، وارتفاع لا يقل عن طول الشاشة */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #2d3748;
}

/* حاوية مركزية للمحتوى تضبط العرض الأقصى وتوسّط المحتوى */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 15px 40px;
}

/* تنسيق حقل اختيار الدولة/رمز الهاتف في نماذج الهاتف */
.phone-country-row select {
    width: 100%;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #cbd5e0;
    font-size: 0.9em;
}


/* =========================================
   قسم الاشتراك في العروض (Subscription Section)
   ========================================= */

/* صندوق الاشتراك في العروض: خلفية متدرجة شفافة،
   حواف ناعمة، وإطار خفيف يعطي إحساس بطاقة زجاجية */
.subscription-section {
    margin-top: 24px;
    margin-bottom: 16px;
    padding: 16px 14px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.2));
    border: 1px solid rgba(255, 255, 255, 0.12);
}

/* نص توضيحي للاشتراك */
.subscription-text {
    font-size: 0.9em;
    color: #e2e8f0;
    margin: 4px 0 10px;
}

/* نموذج الاشتراك منظم عموديًا مع مسافة بين الحقول */
.subscription-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* إزالة الهامش السفلي الافتراضي في الـ field-group داخل نموذج الاشتراك */
.subscription-form .field-group {
    margin-bottom: 0;
}

/* منطقة لعرض رسالة نجاح/خطأ بعد محاولة الاشتراك */
.subscription-message {
    margin-top: 6px;
    font-size: 0.8em;
    min-height: 1.2em; /* ارتفاع بسيط حتى لا تتحرك العناصر عند ظهور الرسالة */
}

/* لون رسالة النجاح */
.subscription-message.success {
    color: #9ae6b4;
}

/* لون رسالة الخطأ */
.subscription-message.error {
    color: #feb2b2;
}

/* تحسين بسيط للموبايل: تقليل الـ padding والـ radius للقسم */
@media (max-width: 600px) {
    .subscription-section {
        padding: 12px 10px;
        border-radius: 12px;
    }
}


/* =========================================
   الهيدر والشعار (Header & Logo)
   ========================================= */

/* رأس الصفحة: توسيط النص، مسافة سفلية، ومسافة علوية إضافية */
header {
    text-align: center;
    margin-bottom: 25px;
    position: relative;
    padding-top: 30px;
}

/* العنوان الرئيسي للمتجر */
header h1 {
    font-size: 1.8em;
    color: white;
    margin-bottom: 5px;
}

/* وصف أو سطر فرعي تحت العنوان */
header p {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95em;
}

/* غلاف الشعار لتوسيط صورة الشعار */
.logo-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
}

/* صورة الشعار: ارتفاع محدود، حواف مستديرة، خلفية بيضاء، وظل بسيط */
.logo-wrapper img {
    max-height: 60px;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
    background: #fff;
    padding: 4px;
}


/* =========================================
   الأقسام (Categories)
   ========================================= */

/* شريط علوي قد يحتوي الأقسام وعناصر أخرى، مرتب عموديًا */
.top-bar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 10px;
}

/* شريط أزرار الأقسام كـ سكرول أفقي (خاصة للموبايل) */
.categories {
    display: flex;
    overflow-x: auto;
    padding-bottom: 5px;
    gap: 8px;
    scrollbar-width: thin; /* لمتصفحات تدعم هذا الخيار */
}

/* تنسيق شريط التمرير للأقسام (للـ WebKit) */
.categories::-webkit-scrollbar {
    height: 5px;
}

.categories::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.4);
    border-radius: 10px;
}

/* زر القسم (Category Button) على شكل حبة */
.category-btn {
    border: none;
    padding: 7px 14px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.9);
    color: #4a5568;
    font-size: 0.85em;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transition: all 0.2s ease;
}

/* تغيير لون الزر عند التمرير بالفأرة */
.category-btn:hover {
    background: #667eea;
    color: white;
}

/* مظهر الزر النشط (القسم المختار حاليًا) */
.category-btn.active {
    background: #667eea;
    color: white;
}


/* =========================================
   شريط الفلاتر (Filter Bar)
   ========================================= */

/* صندوق الفلاتر فوق المنتجات: يشبه بطاقة بيضاء بظل قوي */
.filters-bar {
    margin: 8px 0 18px;
    background: rgba(255,255,255,0.96);
    border-radius: 16px;
    padding: 10px 10px 8px;
    box-shadow: 0 6px 14px rgba(0,0,0,0.12);
}

/* صف داخلي للحقول داخل الفلاتر (بحث/ترتيب/سعر...) */
.filters-row {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap; /* حتى يلتف في الشاشات الصغيرة */
}

/* إزالة المسافة السفلية عن آخر صف فلاتر */
.filters-row:last-child {
    margin-bottom: 0;
}

/* تنسيق حقول الإدخال والقوائم المنسدلة داخل الفلاتر */
.filters-bar input[type="text"],
.filters-bar select {
    flex: 1;
    min-width: 120px;
    padding: 7px 9px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    font-size: 0.85em;
    outline: none;
}

/* مظهر الحقول عند التركيز (Focus) */
.filters-bar input[type="text"]:focus,
.filters-bar select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 1px rgba(102,126,234,0.35);
}

/* نصوص توضيحية صغيرة فوق الحقول (Labels) */
.filters-label {
    font-size: 0.8em;
    color: #4a5568;
    margin-bottom: 3px;
}

/* شريط أزرار الفلاتر الإضافية (مثل إعادة ضبط/فرز ...) */
.filters-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}


/* =========================================
   شبكة المنتجات (Products Grid)
   ========================================= */

/* توزيع المنتجات على شبكة مرنة بعدة أعمدة حسب العرض المتاح */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 15px;
}

/* بطاقة المنتج: كرت أبيض بحواف مستديرة وظل */
.product-card {
    background: rgba(255, 255, 255, 0.96);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0,0,0,0.16);
    display: flex;
    flex-direction: column;
}

/* منطقة صورة/معرض المنتج أعلى البطاقة */
.product-image {
    position: relative;
    width: 100%;
    background: #edf2f7;
    overflow: hidden;
}


/* الشارات (Badges) */

/* شارة "جديد" باللون الأخضر في أعلى يسار صورة المنتج */
.badge-new {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #38a169;
    color: #fff;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.75em;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    z-index: 2;
}

/* شارة "عرض/خصم" باللون الأحمر في أعلى يمين صورة المنتج */
.badge-offer {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #e53e3e;
    color: #fff;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.75em;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    z-index: 2;
}

/* عنصر بديل (Placeholder) يظهر عند عدم وجود صورة حقيقية */
.placeholder {
    width: 100%;
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3em;
    color: #a0aec0;
}


/* معلومات المنتج داخل البطاقة */
.product-info {
    padding: 14px 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* اسم المنتج */
.product-name {
    font-weight: 700;
    font-size: 1em;
    color: #2d3748;
}

/* القسم الذي ينتمي إليه المنتج */
.product-category {
    font-size: 0.8em;
    color: #718096;
}

/* وصف مختصر للمنتج */
.product-description {
    font-size: 0.85em;
    color: #4a5568;
}

/* سعر المنتج بلون أزرق مميز */
.product-price {
    margin-top: 5px;
    font-weight: 700;
    font-size: 1.1em;
    color: #2b6cb0;
}


/* =========================================
   أزرار المنتج (Actions)
   ========================================= */

/* منطقة الأزرار أسفل معلومات المنتج (واتساب/سلة/مشاركة...) */
.product-actions {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-items: stretch;
}

/* شكل الأزرار داخل كرت المنتج */
.product-actions button {
    width: 100%;
    border-radius: 999px; /* زر كبسولة */
    padding: 9px 12px;
    font-size: 0.85em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease, background-color 0.15s ease;
}

/* أيقونة الزر الأولى (مثل رمز واتساب / سلة) */
.product-actions button span:first-child {
    font-size: 1.15em;
}

/* نص الزر */
.product-actions button span:last-child {
    font-weight: 600;
}

/* زر مراسلة واتساب */
.whatsapp-btn {
    background: #25d366;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35);
}

/* زر إضافة للسلة */
.cart-btn {
    background: #3182ce;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(49, 130, 206, 0.35);
}

/* زر المشاركة */
.share-btn {
    background: #edf2f7;
    color: #2d3748;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.10);
}

/* تأثير عام عند التمرير على الأزرار */
.product-actions button:hover {
    transform: translateY(-1px);
    filter: brightness(1.03);
}

/* تعزيز الظل عند التمرير على واتساب */
.whatsapp-btn:hover {
    box-shadow: 0 5px 14px rgba(37, 211, 102, 0.45);
}

/* تعزيز الظل عند التمرير على السلة */
.cart-btn:hover {
    box-shadow: 0 5px 14px rgba(49, 130, 206, 0.45);
}

/* تغيّر خلفية زر المشاركة عند التمرير */
.share-btn:hover {
    background: #e2e8f0;
}


/* =========================================
   الأزرار العائمة (Floating Buttons)
   ========================================= */

/* زر إضافة منتج (للأدمن) ثابت بأسفل الشاشة - لا يظهر إلا مع كلاس show */
.add-product-btn {
    position: fixed;
    bottom: 80px;
    right: 16px;
    left: auto;
    transform: none;
    background: #ffb347;
    color: #2d3748;
    border: none;
    border-radius: 30px;
    padding: 10px 20px;
    font-size: 0.95em;
    font-weight: 600;
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
    cursor: pointer;
    display: none;
    gap: 8px;
    align-items: center;
    z-index: 10;
}

/* عند إضافة هذا الكلاس من جافاسكربت يظهر الزر */
.add-product-btn.show {
    display: inline-flex;
}

/* أيقونة الزر (مثل +) */
.add-product-btn span:first-child {
    font-size: 1.4em;
}

/* تأثير بسيط عند التمرير بالفأرة */
.add-product-btn:hover {
    filter: brightness(1.05);
}

/* زر السلة العائم (FAB) يظهر عند وجود عناصر في السلة */
.cart-fab {
    position: fixed;
    bottom: 20px;
    right: 16px;
    background: #2b6cb0;
    color: #ffffff;
    border: none;
    border-radius: 999px;
    padding: 10px 16px;
    font-size: 0.9em;
    font-weight: 600;
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
    cursor: pointer;
    display: none;
    gap: 6px;
    align-items: center;
    z-index: 11;
}

/* أيقونة السلة داخل الزر */
.cart-fab span:first-child {
    font-size: 1.2em;
}

/* تأثير عند التمرير */
.cart-fab:hover {
    filter: brightness(1.05);
}


/* =========================================
   لوحة التحكم والعناصر (Admin & Inputs)
   ========================================= */

/* عنوان صغير للأقسام مثل "لوحة الإدارة" أو "إحصائيات" */
.section-title {
    color: white;
    font-size: 1.1em;
    margin: 15px 0 8px;
    font-weight: 600;
}

/* حاوية لوحة الإدارة (تظهر فقط للأدمن) */
.admin-panel {
    margin-bottom: 20px;
    display: none;
}

/* بطاقة تحتوي نموذج إضافة/تعديل المنتج */
.admin-card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 18px;
    padding: 16px 14px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* مجموعة حقل: label + input/textarea */
.field-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 5px;
}

/* تسمية الحقل */
.field-group label {
    font-size: 0.85em;
    color: #4a5568;
}

/* حقول الإدخال داخل لوحة الإدارة */
.field-group input,
.field-group textarea {
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    font-size: 0.9em;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* مظهر الحقول عند الـ Focus */
.field-group input:focus,
.field-group textarea:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 1px rgba(102, 126, 234, 0.4);
}

/* السماح بتغيير ارتفاع مربع النص يدويًا */
.field-group textarea {
    resize: vertical;
    min-height: 60px;
}

/* تقسيم جزء من النموذج لعمودين: مثلاً (معلومات أساسية / معلومات سعرية) */
.two-cols {
    display: grid;
    grid-template-columns: 1.3fr 0.7fr;
    gap: 10px;
}

/* شريط أزرار أسفل النموذج (حفظ / جديد / مسح ... ) */
.admin-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 6px;
}

/* الأزرار العامة في النظام */
.btn {
    border: none;
    padding: 7px 12px;
    border-radius: 10px;
    font-size: 0.85em;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* حجم أصغر للزر */
.btn.small {
    padding: 6px 10px;
    font-size: 0.8em;
}

/* زر أساسي (Primary) غالبًا للحفظ */
.btn.primary {
    background: #667eea;
    color: white;
}

/* زر ثانوي (Secondary) */
.btn.secondary {
    background: #edf2f7;
    color: #4a5568;
}

/* زر خطير (Danger) للحذف ونحوه */
.btn.danger {
    background: #fff5f5;
    color: #c53030;
}

/* تأثيرات Hover للأزرار */
.btn.primary:hover {
    background: #5a67d8;
}

.btn.secondary:hover {
    background: #e2e8f0;
}

.btn.danger:hover {
    background: #feb2b2;
    color: #742a2a;
}


/* =========================================
   النوافذ المنبثقة (Modals)
   ========================================= */

/* طبقة نصف شفافة تغطي الشاشة عند عرض نافذة تسجيل الدخول للأدمن */
.admin-login {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

/* بطاقة تسجيل الدخول */
.admin-login-card {
    background: white;
    padding: 20px 18px 16px;
    border-radius: 16px;
    width: 92%;
    max-width: 350px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

/* عنوان نافذة الدخول */
.admin-login-card h2 {
    margin-bottom: 2px;
    font-size: 1.05em;
    color: #2d3748;
}

/* نص توضيحي صغير تحت العنوان */
.admin-login-card p {
    font-size: 0.85em;
    color: #718096;
    margin-bottom: 10px;
}

/* أزرار تأكيد/إلغاء في نافذة الدخول */
.admin-login-actions {
    margin-top: 8px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* حقول إدخال الدخول (اسم المستخدم/كلمة المرور) */
.admin-login input {
    width: 100%;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    font-size: 0.9em;
    margin-top: 5px;
    outline: none;
}

/* مظهر التركيز على حقول الدخول */
.admin-login input:focus {
    border-color: #667eea;
}


/* =========================================
   الرفع والمعاينة (Upload & Preview)
   ========================================= */

/* أزرار اختيار نوع المرفوع (صور / فيديو...) */
.upload-options {
    display: flex;
    margin-top: 6px;
    margin-bottom: 8px;
    background: #edf2f7;
    border-radius: 10px;
    padding: 3px;
}

.upload-options button {
    flex: 1;
    border: none;
    background: transparent;
    padding: 6px 4px;
    border-radius: 8px;
    font-size: 0.8em;
    cursor: pointer;
}

/* زر مفعّل حاليًا */
.upload-options button.active {
    background: white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* منطقة رفع الملفات (input[type=file]) داخل إطار متقطع */
.upload-area {
    border: 1px dashed #cbd5e0;
    border-radius: 10px;
    padding: 10px;
    background: #f7fafc;
}

.upload-area input[type="file"] {
    width: 100%;
    font-size: 0.85em;
}

/* نص مساعدة تحت حقل الرفع */
.upload-hint {
    font-size: 0.78em;
    color: #718096;
    margin-top: 6px;
}

/* حاوية لمعاينة الملفات بعد رفعها */
.preview-container {
    margin-top: 10px;
    display: none;
}

/* شبكة للصور المصغرة للملفات المرفوعة */
.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 6px;
}

/* كرت صغير لكل ملف مرفوع */
.preview-item {
    position: relative;
    border-radius: 9px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    background: white;
}

/* عرض صورة/فيديو المعاينة */
.preview-item img,
.preview-item video {
    width: 100%;
    height: 70px;
    object-fit: cover;
}

/* زر إزالة ملف منفرد (X) في أعلى اليسار */
.preview-remove {
    position: absolute;
    top: 2px;
    left: 2px;
    background: rgba(229,62,62,0.9);
    border: none;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.8em;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* رابط/نص لحذف جميع الملفات المرفوعة */
.remove-all {
    margin-top: 6px;
    font-size: 0.8em;
    color: #e53e3e;
    cursor: pointer;
    text-align: left;
}


/* =========================================
   المعرض (Gallery) داخل بطاقة المنتج
   ========================================= */

/* حاوية المعرض في أعلى بطاقة المنتج */
.gallery-container {
    position: relative;
    width: 100%;
    height: 220px;
    overflow: hidden;
}

/* عنصر واحد من المعرض (صورة/فيديو/iframe) */
.gallery-item {
    width: 100%;
    height: 100%;
    position: relative;
    background: #000;
}

/* جعل الوسائط تملأ المعرض بالكامل مع القص المناسب */
.gallery-item img,
.gallery-item video,
.gallery-item iframe {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* أزرار التنقل يمين/يسار في داخل المعرض */
.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.45);
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1em;
}

/* زر السهم "السابق" في يمين المعرض (حسب اتجاه التصميم) */
.gallery-nav.prev {
    right: 8px;
}

/* زر السهم "التالي" في يسار المعرض */
.gallery-nav.next {
    left: 8px;
}

/* نقاط أسفل المعرض لتمثيل عدد الشرائح */
.gallery-dots {
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
}

/* نقطة واحدة للشرائح */
.gallery-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: rgba(255,255,255,0.6);
    cursor: pointer;
}

/* النقطة النشطة (الشرحة الحالية) */
.gallery-dot.active {
    background: #667eea;
}

/* شريط الصور المصغرة (Thumbnails) أسفل المعرض */
.gallery-thumbs {
    display: flex;
    gap: 6px;
    padding: 6px 8px 8px;
    background: #f7fafc;
    border-top: 1px solid #e2e8f0;
    overflow-x: auto;
}

/* تخصيص شريط التمرير للـ thumbnails */
.gallery-thumbs::-webkit-scrollbar {
    height: 4px;
}
.gallery-thumbs::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 10px;
}

/* صورة مصغّرة واحدة */
.gallery-thumb {
    width: 46px;
    height: 46px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid #e2e8f0;
    background: #000;
    position: relative;
    cursor: pointer;
}

/* صورة المصغّر نفسها */
.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* في حال كانت المصغّر عبارة عن أيقونة (لفيديو مثلاً) */
.gallery-thumb-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    color: #fff;
    background: rgba(0,0,0,0.7);
}

/* المصغّر النشط */
.gallery-thumb.active {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102,126,234,0.5);
}


/* =========================================
   مكبر الصور (Lightbox)
   ========================================= */

/* غطاء كامل الشاشة عند تكبير الصورة/الفيديو */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 30;
}

/* حاوية المحتوى داخل الليتبوكس */
.lightbox-content-wrapper {
    position: relative;
    max-width: 95%;
    max-height: 95vh;
    width: 900px;
}

/* الإطار الذي يعرض الصورة/الفيديو المكبّر */
.lightbox-content {
    width: 100%;
    max-height: 80vh;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 10px;
}

/* الوسائط داخل الليتبوكس */
.lightbox-content img,
.lightbox-content video,
.lightbox-content iframe {
    max-width: 100%;
    max-height: 80vh;
}

/* زر إغلاق الليتبوكس (X) */
.lightbox-close {
    position: absolute;
    top: -40px;
    left: 0;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.5em;
    cursor: pointer;
}

/* أزرار التنقل بين الوسائط داخل الليتبوكس */
.lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #fff;
    font-size: 2em;
    cursor: pointer;
}

/* سهم "السابق" في يمين المحتوى */
.lightbox-arrow.prev {
    right: -25px;
}

/* سهم "التالي" في يسار المحتوى */
.lightbox-arrow.next {
    left: -25px;
}


/* =========================================
   قوائم وإحصائيات المدير (Admin Lists)
   ========================================= */

/* قائمة المنتجات في لوحة الإدارة */
.admin-products-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* كرت أعلى يعرض إحصائيات عامة للأدمن (مخفي افتراضيًا) */
.admin-top-stats {
    display: none;
    margin: 10px 0 12px;
    background: rgba(255,255,255,0.97);
    border-radius: 16px;
    padding: 10px 12px 8px;
    box-shadow: 0 6px 14px rgba(0,0,0,0.16);
}

/* رأس الإحصائيات: عنوان صغير + معلومات جانبية */
.admin-top-stats-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px;
    margin-bottom: 8px;
    font-size: 0.85em;
    color: #4a5568;
}

/* العنوان الأساسي للإحصائيات */
.admin-top-stats-header span:first-child {
    font-weight: 600;
    color: #2d3748;
}

/* نصوص صغيرة إضافية */
.admin-top-stats-small {
    font-size: 0.78em;
    color: #718096;
}

/* شبكة البطاقات الصغيرة للإحصائيات (عدد منتجات، زيارات...) */
.admin-top-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 6px;
}

/* بطاقة إحصائية واحدة */
.admin-top-card {
    background: #f7fafc;
    border-radius: 12px;
    padding: 7px 8px;
}

/* عنوان صغير داخل البطاقة */
.admin-top-label {
    font-size: 0.78em;
    color: #718096;
    margin-bottom: 2px;
}

/* قيمة الإحصائية (مثلاً: 35 منتج) */
.admin-top-value {
    font-size: 1.05em;
    font-weight: 700;
    color: #2d3748;
}

/* شريط صغير أسفل الإحصائيات لكلمات توضيحية/فلترة */
.admin-top-filters {
    font-size: 0.78em;
    color: #718096;
    border-top: 1px dashed #e2e8f0;
    padding-top: 5px;
}

/* صف واحد يمثل منتج في قائمة الإدارة */
.admin-product-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: 10px;
    background: #f7fafc;
}

/* الجزء الرئيسي من الصف (معلومات المنتج) */
.admin-product-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* اسم المنتج في قائمة الإدارة */
.admin-product-name {
    font-size: 0.95em;
    font-weight: 600;
    color: #2d3748;
}

/* معلومات إضافية صغيرة (قسم، سعر، عدد مشاهدات...) */
.admin-product-meta {
    font-size: 0.8em;
    color: #718096;
}

/* مجموعة أزرار (تعديل/حذف) يمين الصف */
.admin-product-actions {
    display: flex;
    gap: 6px;
}


/* =========================================
   التصفح الصفحي (Pagination)
   ========================================= */

/* شريط أزرار التصفح بين الصفحات */
.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 5px;
}

/* نص يشرح الصفحة الحالية وعدد المنتجات */
.pagination-info {
    font-size: 0.8em;
    color: #edf2f7;
    margin-inline: 6px;
}

/* زر صفحة واحد في التصفح */
.pagination button {
    border: none;
    padding: 5px 9px;
    border-radius: 8px;
    font-size: 0.8em;
    cursor: pointer;
    background: rgba(255,255,255,0.9);
    color: #4a5568;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

/* الصفحة النشطة حاليًا */
.pagination button.active {
    background: #667eea;
    color: #fff;
}

/* زر غير فعّال (مثلاً: لا توجد صفحة سابقة/تالية) */
.pagination button:disabled {
    opacity: 0.5;
    cursor: default;
    box-shadow: none;
}


/* =========================================
   الفوتر (Footer)
   ========================================= */

/* ذيل الموقع: خط فاصل علوي، نص صغير، ولون أبيض شبه شفاف */
.site-footer {
    margin-top: 25px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.25);
    text-align: center;
    font-size: 0.8em;
    color: rgba(255,255,255,0.85);
}

/* إبراز اسم المتجر في الفوتر */
.site-footer #storeNameFooter {
    font-weight: 600;
}

/* رابط إداري صغير (مثلاً: دخول الأدمن) */
.site-footer .admin-link {
    margin-top: 6px;
    border: none;
    background: none;
    color: rgba(255,255,255,0.85);
    cursor: pointer;
    font-size: 0.8em;
    text-decoration: underline;
    display: inline-block;
}

/* زر/رابط تسجيل الخروج بلون أحمر فاتح */
.site-footer .admin-link.logout-btn {
    color: #fed7d7;
    text-decoration: none;
}


/* =========================================
   التجاوب مع الشاشات (Media Queries)
   ========================================= */

/* شاشات متوسطة وصغيرة (تابلت وما شابه) */
@media (max-width: 768px) {
    /* تقليل عدد أعمدة الإحصائيات من 4 إلى 2 */
    .admin-top-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    
    /* إضافة مسافة علوية للهيدر إن احتجنا */
    header {
        padding-top: 30px;
    }
    
    /* المنتجات تصبح في عمود واحد لسهولة التصفح */
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    /* تقسيمات الأعمدة داخل لوحة الإدارة تصبح عمودًا واحدًا */
    .two-cols {
        grid-template-columns: 1fr;
    }

    /* تقليل ارتفاع المعرض في البطاقات على الشاشات الصغيرة */
    .gallery-container {
        height: 210px;
    }

    /* الليتبوكس يأخذ كامل عرض الشاشة تقريبًا */
    .lightbox-content-wrapper {
        width: 100%;
    }

    /* ضبط موضع الأسهم في الليتبوكس لتكون داخل الشاشة على الموبايل */
    .lightbox-arrow.prev {
        right: 5px;
    }

    .lightbox-arrow.next {
        left: 5px;
    }

    /* تقريب زر الإغلاق داخل أعلى الليتبوكس */
    .lightbox-close {
        top: -35px;
        left: 5px;
    }

    /* صف المنتج في قائمة الإدارة يصبح عمودي بدل أفقي */
    .admin-product-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    /* أزرار المنتج في قائمة الإدارة تصطف يمينًا وتأخذ عرضًا أكثر */
    .admin-product-actions {
        width: 100%;
        justify-content: flex-end;
    }

    /* نص معلومات التصفح يأخذ سطر كامل في المنتصف */
    .pagination-info {
        width: 100%;
        text-align: center;
        margin-top: 4px;
    }
}

/* شاشات صغيرة جدًا (موبايل ضيق أقل من 480px) */
@media (max-width: 480px) {
    /* أزرار المنتج داخل البطاقة تصبح في عمود واحد */
    .product-actions {
        grid-template-columns: 1fr;
    }
}
