/* =========================
   القواعد العامة
========================= */

/* Body */
body{
margin:0;
font-family:Arial;
background:#f3f3f3;
}

/* Header */
.header{
padding:15px;
font-size:20px;
font-weight:bold;
}

/* زر القائمة */
.menu-btn {
background: none;
border: none;
color: white;
font-size: 24px;
cursor: pointer;
}

/* اسم المتجر */
.store-name {
font-size: 20px;
font-weight: bold;
text-align: center;
flex: 1;
}

/* اللوغو */
.store-logo {
width: 40px;
height: 40px;
border-radius: 50%;
object-fit: cover;
}










/* --- تنسيق شبكة المنتجات الرئيسي --- */
.products {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* منتجين في السطر للجوال */
    gap: 12px;
    padding: 10px;
    max-width: 1200px;
    margin: 0 auto;
}

/* --- تصميم بطاقة المنتج --- */
.card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.card:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

/* --- صورة المنتج --- */
.card img {
    width: 100%;
    aspect-ratio: 1 / 1; /* جعل الصورة مربعة تماماً */
    object-fit: contain; /* لضمان عدم قص المكونات الإلكترونية */
    margin-bottom: 10px;
    background: #f9f9f9;
}

/* --- الشارات (Badges) --- */
.badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #ff0000;
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 3px;
    z-index: 2;
    text-transform: uppercase;
}

/* --- العنوان --- */
.card .title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    height: 36px; /* ارتفاع ثابت لسطرين */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* قص النص بعد سطرين */
    -webkit-box-orient: vertical;
    margin-bottom: 5px;
    line-height: 1.3;
}

/* --- السعر والمخزون --- */
.card .price {
    margin-top: auto; /* دفع السعر للأسفل */
    padding: 5px 0;
}

.card .price span {
    font-size: 16px;
    font-weight: 800;
    color: #27ae60;
}

.card .stock {
    font-size: 11px;
    color: #777;
    margin-bottom: 8px;
}

/* --- أدوات التحكم بالكمية --- */
.quantity-controls {
    background: #f1f1f1;
    border-radius: 5px;
    padding: 2px;
    margin-bottom: 10px;
}

.quantity-controls button {
    background: none;
    border: none;
    width: 25px;
    height: 25px;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
}

.quantity-input {
    border: none !important;
    background: transparent;
    font-weight: bold;
}

/* --- أزرار الإجراءات --- */
.add-cart {
    width: 100%;
    padding: 10px;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.add-cart:hover {
    background: #333;
}

.out-of-stock {
    font-size: 12px;
    font-weight: bold;
    padding: 10px;
    background: #fff0f0;
    border-radius: 5px;
}

/* --- زر المفضلة النشط --- */
/* --- زر المفضلة المطور --- */
/* --- زر المفضلة (نسخة الأداء السلس) --- */
.favorite-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    
    /* تخفيف تأثير الزجاج لسرعة الريندر */
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    
    /* تحديد الخصائص بدقة بدلاً من all لتخفيف الحمل */
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    color: #94a3b8; 
}

.favorite-btn svg {
    width: 18px;
    height: 18px;
    /* إزالة الترانزيشن من داخل السافيج لتسريع التفاعل */
    pointer-events: none; 
}

/* حالة التمرير (Hover) - حركة بسيطة جداً */
.favorite-btn:hover {
    transform: translateY(-1px); /* رفع بسيط جداً بدلاً من التكبير الضخم */
    color: #ef4444;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* --- الحالة النشطة (Active) --- */
.favorite-btn.active {
    background: #fff;
    color: #ef4444;
}

.favorite-btn.active svg {
    fill: #ef4444;
    /* تخفيف الظل المتوهج */
    filter: drop-shadow(0 0 2px rgba(239, 68, 68, 0.3));
    /* تنعيم الأنيميشن وتقليل القفزة */
    animation: favoritePop 0.3s ease-out;
}

/* أنيميشن الانبثاق (أكثر نعومة وسرعة) */
@keyframes favoritePop {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); } /* تقليل التكبير من 1.4 إلى 1.15 */
    100% { transform: scale(1); }
}

/* تأثير الضغط الفوري */
.favorite-btn:active {
    transform: scale(0.95);
    transition: transform 0.05s linear;
}

/* --- التجاوب مع الشاشات الكبيرة (Desktop) --- */
@media (min-width: 768px) {
    .products {
        grid-template-columns: repeat(4, 1fr); /* 4 منتجات في السطر */
        gap: 20px;
    }
    
    .card .title {
        font-size: 15px;
    }
}

/* --- لمسة إضافية لعنوان القسم --- */
h1 {
    text-align: center;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    margin: 20px 0;
    color: #222;
    font-size: 1.5rem;
}










/* طبقة التغبيش الخلفية */
#cart-blur-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1); /* لون خفيف جداً */
    backdrop-filter: blur(0px); /* يبدأ بدون تغبيش */
    -webkit-backdrop-filter: blur(0px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    transition: all 0.4s ease;
    pointer-events: none; /* لمنع المستخدم من الضغط على أي شيء أثناء التأثير */
}

/* عندما تصبح الطبقة نشطة */
#cart-blur-overlay.active {
    opacity: 1;
    backdrop-filter: blur(8px); /* تغبيش محتوى الصفحة الخلفي */
    -webkit-backdrop-filter: blur(8px);
}

/* صندوق الرسالة في المنتصف */
.cart-message-box {
    background: white;
    padding: 30px 50px;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    text-align: center;
    transform: scale(0.7); /* تبدأ صغيرة */
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#cart-blur-overlay.active .cart-message-box {
    transform: scale(1); /* تكبر عند الظهور */
}

.cart-icon-anim {
    font-size: 50px;
    margin-bottom: 10px;
    animation: bounce 0.5s ease infinite alternate;
}

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-10px); }
}

.cart-message-box h2 {
    margin: 0;
    color: #27ae60;
    font-size: 24px;
}

.cart-message-box p {
    color: #666;
    margin-top: 5px;
}

