/* ملف css/components.css */

/* --- 1. الأزرار (Buttons) --- */
.btn-primary {
    background: var(--gradient-primary);
    color: var(--surface-container-lowest); /* أبيض نقي */
    padding: 16px 32px;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1); /* حركة ناعمة جداً */
}

.btn-primary:hover {
    transform: scale(1.02);
    box-shadow: 0px 8px 24px rgba(112, 42, 225, 0.25);
}

/* --- 2. الشريط العائم (Navigation) --- */
.floating-nav {
    position: fixed;
    top: 24px;
    /* التعديل هنا لتمركز مثالي */
    left: 0;
    right: 0;
    margin: 0 auto;
    
    width: 90%;
    max-width: 1200px;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: var(--radius-full);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    z-index: 1000;
    border: var(--ghost-border-light);
}




/* --- 3. تأثير النبضة والوسم (The Pulse & Badge) --- */
.badge {
    background: var(--surface-container-lowest);
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-ambient); /* ظل واسع وهادئ */
    margin-bottom: 24px;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    background-color: var(--primary);
    border-radius: 50%;
    animation: softPulse 2s infinite ease-in-out; /* نبض هادئ بدل الوميض المزعج */
}

@keyframes softPulse {
    0% { opacity: 0.4; box-shadow: 0 0 0px var(--primary); }
    50% { opacity: 1; box-shadow: 0 0 10px var(--primary); }
    100% { opacity: 0.4; box-shadow: 0 0 0px var(--primary); }
}
/* --- 4. بطاقات المنتجات (Cards - The Product Showcase) --- */
/* تطبيق قاعدة: Zero borders, 32px padding, Ambient shadow on hover */
.product-card {
    background: var(--surface-container-lowest); /* أبيض نقي */
    padding: 32px; /* مساحة تنفس واسعة */
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    text-decoration: none; /* لأنها ستكون رابط غالباً */
}

.product-card:hover {
    background: var(--surface-bright);
    box-shadow: var(--shadow-ambient); /* الظل الهادئ الملون */
    transform: translateY(-4px); /* رفع خفيف جداً */
}

/* خلفية الصورة داخل البطاقة لتجنب الخطوط */
.product-img-wrapper {
    background: var(--surface-container-low);
    border-radius: var(--radius-md);
    width: 100%;
    height: 240px;
    overflow: hidden;
    position: relative;
}

/* التاج (Tag) الذي يستخدم لون الـ Primary الباهت */
.tag {
    background: var(--primary-fixed-dim);
    color: var(--primary-dim);
    padding: 6px 16px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    align-self: flex-start;
}

/* --- 5. حقول الإدخال (Inputs - The Focused Workspace) --- */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.input-label {
    font-family: var(--font-body);
    font-size: 0.875rem;
    color: var(--on-surface-variant);
    font-weight: 500;
}

.premium-input {
    background: var(--surface-container-high); /* طبقة عميقة */
    color: var(--on-surface);
    padding: 16px 24px;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: all 0.3s ease;
}

/* تطبيق تأثير Ghost Border عند التركيز */
.premium-input:focus {
    background: var(--surface-container-lowest); /* يرتفع للسطح */
    box-shadow: 0 0 0 1px rgba(112, 42, 225, 0.2); /* حدود وهمية 20% */
    outline: none;
}
/* --- 6. النافذة المنبثقة (Modal) - Authentication --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(14, 14, 14, 0.4); /* خلفية داكنة شفافة */
    backdrop-filter: blur(8px); /* تأثير الزجاج للخلفية */
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    
    /* إخفاء افتراضي مع حركة ناعمة */
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: var(--surface-container-lowest);
    width: 90%;
    max-width: 440px;
    padding: 48px;
    border-radius: 24px;
    box-shadow: var(--shadow-ambient);
    position: relative;
    
    /* حركة دخول من الأسفل */
    transform: translateY(40px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.modal-overlay.active .modal-container {
    transform: translateY(0) scale(1);
}

.close-modal {
    position: absolute;
    top: 24px;
    right: 24px;
    background: var(--surface-container-low);
    color: var(--on-surface);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.3s ease;
}

.close-modal:hover {
    background: var(--surface-container-high);
}

.modal-header {
    margin-bottom: 32px;
    text-align: center;
}
/* مساحة الروابط */
.nav-links {
    display: flex;
    gap: 8px; /* قللنا المسافة لأن الكبسولة ستأخذ مساحة */
}

/* تصميم الرابط الأساسي */
.nav-links a {
    text-decoration: none;
    color: var(--on-surface);
    font-weight: 500;
    padding: 8px 20px; /* مساحة الكبسولة */
    border-radius: var(--radius-full); /* شكل الكبسولة */
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1); /* انتقال فائق النعومة */
}

/* تأثير الهوفر للروابط (الكبسولة الملونة) */
.nav-links a:hover {
    color: var(--primary-dim);
    background-color: var(--primary-fixed-dim); /* لون خلفية ناعم جداً */
    transform: scale(1.05); /* تكبير خفيف جداً */
}

/* تصميم زر تسجيل الدخول */
#loginBtn {
    padding: 8px 24px;
    border-radius: var(--radius-full);
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    border: 1px solid transparent; /* تجهيز للأنيميشن */
}

/* تأثير الهوفر لزر تسجيل الدخول (استخدام الـ Ghost Border) */
#loginBtn:hover {
    background-color: var(--surface-container-high);
    color: var(--primary);
    border: var(--ghost-border); /* حدود وهمية تعطي طابع زجاجي */
    box-shadow: var(--shadow-ambient);
}
/* --- 7. نظام التصفية والبحث (Filters & Search) --- */

.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap; /* يتجاوب مع الهواتف وينزل لسطر جديد */
}

/* شريط البحث */
.search-wrapper {
    position: relative;
    flex-grow: 1; /* يأخذ المساحة المتبقية */
    max-width: 400px;
}

.search-input {
    width: 100%;
    padding-left: 48px; /* مساحة لأيقونة البحث */
    border-radius: var(--radius-full); /* شكل كبسولة يتناسب مع الهوية */
}

/* أزرار التصفية (الكبسولات) */
.filter-pills {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-pill {
    background: var(--surface-container-low);
    color: var(--on-surface-variant);
    padding: 10px 20px;
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    border: 1px solid transparent; /* قاعدة اللا خطوط */
}

/* الهوفر (Hover) للزر غير المفعل */
.filter-pill:hover:not(.active) {
    background: var(--surface-container-high);
    color: var(--on-surface);
}

/* الزر المفعل (Active) - تباين عالي */
.filter-pill.active {
    background: var(--inverse-surface); /* أسود/داكن */
    color: var(--surface); /* أبيض/فاتح */
    box-shadow: 0 4px 12px rgba(14, 14, 14, 0.15);
}
/* --- 8. السلة الجانبية التفاعلية (Cart Drawer) --- */
.cart-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100vh;
    background: rgba(14, 14, 14, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1500;
    opacity: 0; visibility: hidden;
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

.cart-drawer {
    position: fixed;
    top: 0; right: 0;
    width: 100%;
    max-width: 480px;
    height: 100vh;
    background: var(--surface-container-lowest);
    z-index: 1501;
    box-shadow: -10px 0 40px rgba(0,0,0,0.1);
    display: flex; flex-direction: column;
    
    /* الأنيميشن: إخفاء السلة لليمين */
    transform: translateX(100%);
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1); /* حركة فيزيائية ناعمة جداً */
}

/* حالات التفعيل */
.cart-overlay.active { opacity: 1; visibility: visible; }
.cart-drawer.active { transform: translateX(0); }

/* تنسيق داخل السلة */
.cart-header { padding: 32px; border-bottom: var(--ghost-border-light); display: flex; justify-content: space-between; align-items: center; }
.cart-items-container { padding: 32px; flex-grow: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 24px; }
.cart-item { display: flex; gap: 16px; align-items: center; }
.cart-footer { padding: 32px; background: var(--surface-container-low); border-top: var(--ghost-border-light); }

/* نقطة الإشعارات (Badge) على أيقونة السلة */
.cart-badge {
    position: absolute; top: -2px; right: -2px;
    background: var(--primary); color: white;
    font-size: 0.7rem; font-weight: bold;
    width: 18px; height: 18px; border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    border: 2px solid var(--surface);
}

/* تأثير الهوفر على أيقونة السلة */
#cartBtn:hover { transform: scale(1.05); background: var(--surface-container-high); }
/* --- 9. تأثير العمق لصور المنتجات الحقيقية (Image Scale Hover) --- */
.product-img-wrapper {
    background: var(--surface-container-low);
    border-radius: var(--radius-md);
    width: 100%;
    height: 240px;
    overflow: hidden;
    position: relative;
}

.product-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s cubic-bezier(0.25, 1, 0.5, 1);
}

.product-card:hover .product-img-wrapper img {
    transform: scale(1.08); /* تكبير الصورة الحقيقية بنعومة عند مرور الماوس */
}

/* --- 10. أنيميشن فلترة المتجر (Grid Filtering) --- */
.product-card.hide {
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none;
    position: absolute; /* لمنع ترك فراغ في الشبكة */
}
/* --- إضافة: كبسولة المستخدم (Logged In User) --- */
.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface-container-high);
    padding: 6px 16px 6px 6px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.3s ease;
    border: var(--ghost-border-light);
}

.user-profile:hover {
    background: var(--primary-fixed-dim);
    border-color: rgba(112, 42, 225, 0.3);
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.user-name {
    font-family: var(--font-body);
    font-weight: 600;
    color: var(--on-surface);
    font-size: 0.9rem;
}

/* --- إضافة: نظام الإشعارات (Toast Notifications) --- */
.toast-container {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: var(--inverse-surface);
    color: var(--surface);
    padding: 12px 24px;
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideUpToast 0.4s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes slideUpToast {
    0% { opacity: 0; transform: translateY(20px) scale(0.9); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}
/* =========================================
   Bento Box Premium Animations
   ========================================= */

.bento-card {
    position: relative;
    background: var(--surface-container-lowest);
    border-radius: 24px;
    padding: 2px; /* مساحة صغيرة جداً للحدود المضيئة */
    overflow: hidden;
    box-shadow: var(--shadow-ambient);
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    z-index: 1;
}

.bento-content {
    background: var(--surface-container-lowest);
    border-radius: 22px; /* أقل قليلاً من الحاوية الأم */
    padding: 40px;
    height: 100%;
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

/* الأيقونة التي تطفو عند مرور الماوس */
.bento-icon-wrapper {
    width: 56px;
    height: 56px;
    background: var(--surface-container-low);
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 24px;
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    border: 1px solid transparent;
}

.bento-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    margin-bottom: 12px;
    color: var(--inverse-surface);
    transition: color 0.3s ease;
}

.bento-desc {
    font-size: 1rem;
    color: var(--on-surface-variant);
    line-height: 1.6;
}

/* === تفاعلات الماوس (Hover Dynamics) === */

.bento-card:hover {
    transform: translateY(-6px);
}

.bento-card:hover .bento-icon-wrapper {
    background: var(--primary-fixed-dim);
    border-color: rgba(112, 42, 225, 0.2);
    transform: translateY(-4px) scale(1.05); /* طفو الأيقونة وتكبيرها قليلاً */
    box-shadow: 0 10px 20px rgba(112, 42, 225, 0.15);
}

/* === تأثير إضاءة الماوس (The Spotlight Effect) === */

.spotlight-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.3s ease;
    /* الإضاءة تعتمد على متغيرات x و y التي سنحسبها بالـ JS */
    background: radial-gradient(
        800px circle at var(--mouse-x) var(--mouse-y), 
        rgba(112, 42, 225, 0.12), /* لون الإضاءة */
        transparent 40%
    );
}

.bento-card:hover .spotlight-overlay {
    opacity: 1;
}
/* ==============================================
   إضافات وتعديلات استجابة الهاتف (Mobile Responsive)
   ============================================== */

/* --- تخصيص الشعار والروابط --- */
.logo-text {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.25rem;
}
.logo-text span { color: var(--primary); }

.nav-actions {
    display: flex;
    gap: 16px;
    align-items: center;
}

.cart-btn {
    background: var(--surface-container-low);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    color: var(--on-surface);
}
/* --- الهواتف الذكية (Mobile Magic) --- */
@media (max-width: 768px) {
    
    /* 1. الكبسولة الرقيقة (تمركز مثالي في الأسفل) */
    .floating-nav {
        position: fixed;
        top: auto;
        bottom: 24px; /* المسافة من الأسفل */
        
        /* التمركز المثالي (The Centering Fix) */
        left: 0;
        right: 0;
        margin: 0 auto;
        
        /* الحجم الملموم (تأخذ حجم المحتوى فقط) */
        width: fit-content;
        max-width: 96%; /* كي لا تلمس حواف الشاشة إذا كان الهاتف صغيراً جداً */
        
        padding: 8px 10px; /* حشوة رقيقة جداً */
        border-radius: 50px;
        
        display: flex;
        align-items: center;
        justify-content: center; /* توسيط المحتوى الداخلي */
        gap: 12px; /* مسافة بين الروابط والأيقونات */
        z-index: 2000;
        
        background: var(--glass-bg);
        backdrop-filter: var(--glass-blur);
        -webkit-backdrop-filter: var(--glass-blur);
        box-shadow: 0 10px 40px rgba(0,0,0,0.15);
        border: var(--ghost-border-light);
    }
    
    /* 2. إخفاء الشعار تماماً */
    .logo-text { display: none !important; }
    
    /* 3. حاوية الروابط */
    .nav-links {
        position: static;
        background: transparent;
        box-shadow: none;
        border: none;
        padding: 0;
        display: flex;
        gap: 4px;
    }
    
    /* 4. أزرار الروابط داخل الكبسولة السفلية */
    .nav-links a {
        padding: 8px 12px;
        font-size: 0.8rem; /* تصغير الخط قليلاً ليتسع في الشاشات الصغيرة */
        background: transparent;
        border-radius: 40px;
        font-weight: 600;
        white-space: nowrap; /* منع النص من النزول لسطر جديد */
        transition: all 0.3s ease;
    }
    
    .nav-links a.active-link, 
    .nav-links a:hover {
        background: var(--inverse-surface);
        color: var(--surface);
    }

    /* 5. قسم الأيقونات (المستخدم + السلة) */
    .nav-actions {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .cart-btn {
        width: 36px;
        height: 36px;
    }
    
    .user-profile { 
        padding: 0; 
        background: transparent; 
        border: none;
    }
    
    .user-avatar { width: 34px; height: 34px; }
    .user-name { display: none; }

    /* 6. السلة الجانبية (شاشة كاملة) */
    .cart-drawer { max-width: 100%; border-radius: 0; }
    .btn-primary { padding: 12px 24px; font-size: 0.95rem; }
}

/* --- Utilities Classes --- */
.w-full { width: 100%; }
.flex-center { display: flex; justify-content: center; align-items: center; gap: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-max-300 { max-width: 300px; }
.btn-inverse { background: var(--inverse-surface); color: var(--surface); }
.badge-success { background: rgba(16, 185, 129, 0.1); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.2); }
.pulse-success { background-color: #10b981; }
@media (max-width: 768px) {
    
    /* ... (أكوادك السابقة الموجودة هنا) ... */

    /* --- توسيط محتوى بطاقات Bento للهاتف --- */
    .bento-content {
        align-items: center; /* توسيط الأيقونة والبادج أفقياً */
        text-align: center;  /* توسيط النصوص (العنوان والوصف) */
        padding: 32px 24px;  /* تقليل المساحة الداخلية قليلاً لتناسب الشاشات الصغيرة */
    }

    /* ضمان توسيط الأيقونة والمسافات حولها */
    .bento-icon-wrapper {
        margin-left: auto;
        margin-right: auto;
    }

    /* ضمان توسيط الوسم (Badge) مثل Apprentissage Pratique */
    .bento-content .badge {
        margin: 0 auto 20px auto;
        justify-content: center;
    }

    /* تقليل حجم الخط قليلاً في الهاتف ليكون أكثر أناقة */
    .bento-title {
        font-size: 1.3rem;
    }
}