/* =========================================
   1. المتغيرات الأساسية (النسخة الاحترافية)
   ========================================= */
:root {
    --primary-color: #6366f1; /* لون بنفسجي/نيلي عصري */
    --primary-dark: #4f46e5;
    --secondary-color: #ec4899; /* لون وردي للفت الانتباه للخصومات */
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --bg-body: #f9fafb; /* رمادي فاتح جداً يبرز البطاقات */
    --white: #ffffff;
    --border-color: #e5e7eb;
    
    /* حواف دائرية عصرية */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    
    /* ظلال ناعمة وثلاثية الأبعاد */
    --shadow-sm: 0 2px 10px rgba(0,0,0,0.03);
    --shadow-md: 0 10px 30px rgba(99, 102, 241, 0.08);
    --shadow-hover: 0 20px 40px rgba(99, 102, 241, 0.15);
    
    /* حركة سلسة */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================
   2. الإعدادات العامة (Reset & Globals)
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Tajawal', sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.text-primary { color: var(--primary-color); }
.text-warning { color: #f59e0b; }
.mt-20 { margin-top: 20px; }

/* أزرار عامة */
.btn-primary {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 15px;
    font-weight: bold;
    transition: var(--transition);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-block {
    width: 100%;
    display: block;
    text-align: center;
}

/* =========================================
   3. الترويسة العلوية (Glassmorphism Sticky)
   ========================================= */
.main-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}

.logo h2 {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -1px;
}

.search-bar {
    display: flex;
    width: 45%;
    background: var(--bg-body);
    border-radius: 50px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: var(--transition);
}

.search-bar:focus-within {
    background: var(--white);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.search-bar input {
    width: 100%;
    padding: 14px 20px;
    border: none;
    background: transparent;
    outline: none;
    font-size: 15px;
}

.search-bar button {
    background: var(--primary-color);
    border: none;
    padding: 0 25px;
    color: var(--white);
    cursor: pointer;
    font-size: 16px;
    border-radius: 50px;
    margin: 3px;
    transition: var(--transition);
}

.search-bar button:hover {
    background: var(--primary-dark);
}

.user-actions {
    display: flex;
    gap: 25px;
}

.action-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    transition: var(--transition);
}

.action-item:hover, .action-item.active {
    color: var(--primary-color);
    transform: translateY(-2px);
}

.cart-icon {
    position: relative;
    font-size: 22px;
    background: var(--bg-body);
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--text-main);
    transition: var(--transition);
}

.action-item:hover .cart-icon {
    background: var(--primary-color);
    color: var(--white);
}

.cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--secondary-color);
    color: white;
    font-size: 11px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: bold;
    border: 2px solid var(--white);
}

/* شريط التنقل السفلي */
.bottom-header { background: transparent; }

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
}

.delivery-location {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-links a {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
    padding-bottom: 5px;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0%;
    height: 3px;
    background: var(--primary-color);
    border-radius: 5px;
    transition: var(--transition);
}

.nav-links a:hover { color: var(--primary-color); }
.nav-links a:hover::after, .nav-links a.active::after { width: 100%; }
.nav-links a.active { color: var(--primary-color); }

/* =========================================
   4. الصفحة الرئيسية (البانر والأقسام)
   ========================================= */
.hero-and-grid { margin-top: 30px; }

.banner-section {
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    margin-bottom: 30px;
}

.main-banner {
    background-image: url('https://images.unsplash.com/photo-1607082349566-187342175e2f?ixlib=rb-4.0.3&auto=format&fit=crop&w=1200&q=80');
    background-size: cover;
    background-position: center;
    position: relative;
    height: 380px;
}

.banner-overlay {
    background: linear-gradient(to left, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.2) 100%);
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 50px;
}

.banner-content {
    color: var(--white);
    max-width: 50%;
}

.banner-content h2 {
    font-size: 40px;
    margin-bottom: 15px;
    font-weight: 800;
}

.banner-content p {
    font-size: 18px;
    margin-bottom: 25px;
    line-height: 1.6;
}

.btn-banner {
    display: inline-block;
    background: var(--primary-color);
    color: var(--white);
    padding: 14px 35px;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: bold;
    transition: var(--transition);
}

.btn-banner:hover {
    background: var(--primary-dark);
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.offers-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.offer-card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.offer-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary-color);
    transform: scaleX(0);
    transition: var(--transition);
}

.offer-card:hover::before { transform: scaleX(1); }
.offer-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.card-header h3 {
    font-size: 18px;
    color: var(--text-main);
    font-weight: 700;
    margin-bottom: 5px;
}

.card-header p {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.offer-card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    margin-bottom: 15px;
}

.btn-grid {
    background: var(--bg-body);
    color: var(--primary-color);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: var(--transition);
    width: 100%;
}

.btn-grid:hover {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

/* =========================================
   5. الماركات وفلاتر الصفحة الرئيسية
   ========================================= */
.section-title {
    text-align: center;
    font-size: 28px;
    margin: 60px 0 30px;
    color: var(--text-main);
    font-weight: 800;
}

.brands-grid {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    flex-wrap: wrap;
}

.brand-item {
    background: var(--white);
    padding: 20px 40px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    font-weight: bold;
    font-size: 18px;
    color: var(--text-muted);
    text-align: center;
    flex: 1;
    min-width: 120px;
    transition: var(--transition);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.brand-item:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

.filter-tabs {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.tab-btn {
    background: var(--white);
    border: 2px solid var(--border-color);
    padding: 10px 30px;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
}

.tab-btn:hover, .tab-btn.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

/* =========================================
   6. كروت المنتجات (Product Cards)
   ========================================= */
.products-grid {
    flex: 3;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
}

.product-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    position: relative;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-5px);
    border-color: var(--primary-color);
}

.product-card img {
    width: 100%;
    height: 180px;
    object-fit: contain;
    margin-bottom: 15px;
    transition: transform 0.3s;
}

.product-card:hover img {
    transform: scale(1.05);
}

.product-card h3 {
    font-size: 16px;
    margin-bottom: 10px;
    color: var(--text-main);
    height: 44px;
    overflow: hidden;
}

.product-rating {
    font-size: 12px;
    margin-bottom: 10px;
}

.price-container { margin-bottom: 15px; }

.old-price {
    text-decoration: line-through;
    color: var(--text-muted);
    font-size: 13px;
    margin-left: 8px;
}

.new-price {
    color: var(--primary-color);
    font-size: 20px;
    font-weight: 800;
}

.discount-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--secondary-color);
    color: white;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: bold;
    z-index: 2;
}

.add-to-cart-btn {
    margin-top: auto;
    width: 100%;
    background: var(--bg-body);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.add-to-cart-btn:hover {
    background: var(--primary-color);
    color: var(--white);
}

/* =========================================
   7. تخطيط صفحة الأقسام (المنتجات + الفلاتر)
   ========================================= */
.breadcrumb {
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-muted);
}
.breadcrumb a { color: var(--primary-color); font-weight: 600; }
.breadcrumb a:hover { text-decoration: underline; }

.products-layout {
    display: flex;
    gap: 30px;
    margin-top: 30px;
    margin-bottom: 50px;
}

.sidebar-filters {
    flex: 1;
    background: var(--white);
    padding: 25px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    height: fit-content;
}

.sidebar-filters h3 {
    font-size: 18px;
    border-bottom: 2px solid var(--bg-body);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.filter-group { margin-bottom: 25px; }
.filter-group h4 {
    font-size: 15px;
    margin-bottom: 12px;
    color: var(--primary-color);
}
.filter-group label {
    display: block;
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* =========================================
   8. صفحة تسجيل الدخول (Auth)
   ========================================= */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

.auth-box {
    background: var(--white);
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 450px;
    border: 1px solid var(--border-color);
}

.auth-tabs {
    display: flex;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--bg-body);
}

.auth-tab {
    flex: 1;
    padding: 15px;
    border: none;
    background: none;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
}

.auth-tab.active {
    color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
}

.input-group { margin-bottom: 20px; }
.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
}
.input-group input {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: var(--transition);
}
.input-group input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.auth-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    margin-bottom: 25px;
}
.auth-options a { color: var(--primary-color); font-weight: 600; }

.social-auth {
    margin-top: 30px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}
.social-auth span {
    display: block;
    margin-bottom: 15px;
    font-size: 14px;
    color: var(--text-muted);
}
.social-icons {
    display: flex;
    justify-content: center;
    gap: 15px;
}
.social-icons button {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--white);
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition);
}
.social-icons button:hover {
    background: var(--bg-body);
    color: var(--primary-color);
}

/* =========================================
   9. سلة المشتريات (Cart)
   ========================================= */
.cart-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-top: 40px;
    margin-bottom: 60px;
}

.cart-items-section .page-title {
    font-size: 24px;
    margin-bottom: 25px;
}

.cart-item {
    display: flex;
    align-items: center;
    background: var(--white);
    padding: 20px;
    border-radius: var(--radius-md);
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.cart-item:hover { box-shadow: var(--shadow-md); }
.cart-item img {
    width: 90px;
    height: 90px;
    object-fit: contain;
    margin-left: 20px;
    background: var(--bg-body);
    border-radius: var(--radius-sm);
    padding: 5px;
}

.item-info { flex: 2; }
.item-info h3 { font-size: 16px; margin-bottom: 5px; }
.item-price { color: var(--primary-color); font-weight: bold; font-size: 18px; }

.item-qty {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--bg-body);
    padding: 8px 15px;
    border-radius: 50px;
    margin-left: 20px;
}

.qty-btn {
    border: none;
    background: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-main);
    transition: color 0.3s;
}
.qty-btn:hover { color: var(--primary-color); }

.remove-item {
    border: none;
    background: rgba(236, 72, 153, 0.1);
    color: var(--secondary-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
}
.remove-item:hover { background: var(--secondary-color); color: white; }

.cart-summary {
    background: var(--white);
    padding: 30px;
    border-radius: var(--radius-md);
    height: fit-content;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}
.cart-summary h3 { margin-bottom: 25px; font-size: 20px; }
.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    color: var(--text-muted);
    font-size: 15px;
}
.summary-row.total {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    font-size: 22px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 25px;
}

.payment-methods-img {
    margin-top: 25px;
    text-align: center;
    color: var(--text-muted);
}
.payment-methods-img p { margin-bottom: 10px; font-size: 13px; }
.payment-methods-img i, .payment-methods-img img {
    margin: 0 5px;
    vertical-align: middle;
}

/* =========================================
   10. التذييل (Footer)
   ========================================= */
.main-footer {
    background-color: var(--white);
    padding: 40px 0;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-logo { font-size: 28px; font-weight: 800; color: var(--primary-color); }

.footer-links {
    display: flex;
    gap: 30px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-muted);
}
.footer-links a:hover { color: var(--primary-color); }

.payment-icons {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 24px;
    color: #9ca3af;
}

/* =========================================
   11. التجاوب مع الجوالات (Responsive)
   ========================================= */
@media (max-width: 768px) {
    .top-header { flex-direction: column; gap: 15px; text-align: center; }
    .search-bar { width: 100%; }
    .user-actions { width: 100%; justify-content: center; }
    .nav-container { flex-direction: column; gap: 15px; }
    .nav-links { flex-wrap: wrap; justify-content: center; gap: 15px; }
    
    .main-banner { height: 280px; }
    .banner-overlay { padding: 0 20px; justify-content: center; text-align: center; }
    .banner-content { max-width: 100%; }
    .banner-content h2 { font-size: 28px; }
    
    .offers-grid { grid-template-columns: repeat(2, 1fr); }
    .products-layout { flex-direction: column; }
    .sidebar-filters { width: 100%; }
    
    .cart-layout { grid-template-columns: 1fr; }
    .cart-item { flex-direction: column; text-align: center; gap: 15px; padding: 25px 15px;}
    .cart-item img { margin-left: 0; }
    .item-qty { margin-left: 0; justify-content: center;}
    
    .footer-content { flex-direction: column; gap: 20px; text-align: center; }
}

@media (max-width: 480px) {
    .offers-grid { grid-template-columns: repeat(1, 1fr); }
    .brands-grid { flex-direction: column; }
}
/* =========================================
   12. الإضافات الجديدة (الإشعارات والتحسينات)
   ========================================= */

/* نظام الإشعارات */
.toast-notification {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--white);
    color: var(--text-main);
    padding: 15px 25px;
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    z-index: 9999;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border-right: 4px solid var(--primary-color);
}

.toast-notification.show {
    transform: translateY(0);
    opacity: 1;
}

.toast-notification.success i { color: #10b981; }
.toast-notification.info i { color: var(--primary-color); }

/* زر المفضلة على بطاقة المنتج */
.wishlist-btn-card {
    position: absolute;
    top: 15px;
    left: 15px;
    background: var(--bg-body);
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 16px;
    z-index: 2;
    transition: var(--transition);
}

.wishlist-btn-card:hover {
    color: var(--secondary-color);
    background: #ffe4e6;
}

@keyframes fadeOut {
    to { opacity: 0; transform: scale(0.9); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* تنسيقات صفحة تواصل معنا */
.contact-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin: 40px auto;
}
.contact-info-card {
    background: var(--white);
    padding: 30px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}
.contact-info-item {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}
.contact-info-item i {
    font-size: 24px;
    color: var(--primary-color);
}