/* ========== Reset & Base ========== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Cairo', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background 0.3s, color 0.3s;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

ul, ol {
    list-style: none;
}

/* ========== Utilities ========== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.main {
    flex: 1;
    padding: 20px 0;
}

.mobile-only { display: none; }

@media (max-width: 768px) {
    .mobile-only { display: block; }
    .desktop-only { display: none !important; }
}

/* ========== Header ========== */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 12px 0;
}

.logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}

.logo img {
    height: 40px;
    width: auto;
}

.search-box {
    flex: 1;
    max-width: 400px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 10px 45px 10px 15px;
    border: 1px solid var(--border);
    border-radius: 25px;
    background: var(--bg);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
}

.search-box input:focus {
    border-color: var(--primary);
}

.search-box button {
    position: absolute;
    left: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary);
    color: white;
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-top: 5px;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    z-index: 100;
}

.search-results.active { display: block; }

.search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.search-item:hover {
    background: var(--bg);
}

.search-item img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 8px;
}

.search-item-info h4 {
    font-size: 0.9rem;
    margin-bottom: 3px;
}

.search-item-info span {
    color: var(--primary);
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: var(--bg);
}

.cart-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.cart-count {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--primary);
    color: white;
    font-size: 11px;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Wishlist Button */
.wishlist-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    color: var(--text);
    transition: color 0.3s;
}

.wishlist-btn:hover {
    color: #ef4444;
}

.wishlist-count {
    position: absolute;
    top: 0;
    right: 0;
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Wishlist Button in Product */
.btn-wishlist {
    padding: 10px 15px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-wishlist:hover {
    border-color: #ef4444;
    color: #ef4444;
}

.btn-wishlist.active {
    background: #fef2f2;
    border-color: #ef4444;
    color: #ef4444;
}

[data-theme="dark"] .btn-wishlist.active {
    background: rgba(239, 68, 68, 0.1);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 40px 0 20px;
    flex-wrap: wrap;
}

.page-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.page-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.page-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.page-btn.prev,
.page-btn.next {
    padding: 0 10px;
}

.pagination-info {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

/* Load More Button */
.load-more-section {
    text-align: center;
    margin: 40px 0;
}

.load-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 15px 40px;
    background: var(--bg-card);
    border: 2px solid var(--primary);
    color: var(--primary);
    font-size: 1rem;
    font-weight: 600;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s;
}

.load-more-btn:hover {
    background: var(--primary);
    color: white;
}

.load-more-btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

.load-more-btn .spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.load-more-btn.loading .spinner {
    display: block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== Navigation ========== */
.nav {
    background: var(--primary);
    color: white;
}

.nav-list {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.nav-list::-webkit-scrollbar { display: none; }

.nav-list li a {
    display: block;
    padding: 12px 18px;
    white-space: nowrap;
    transition: background 0.2s;
}

.nav-list li a:hover {
    background: var(--primary-dark);
}

@media (max-width: 768px) {
    .header-content {
        flex-wrap: wrap;
    }
    
    .search-box {
        order: 3;
        max-width: 100%;
        width: 100%;
        margin-top: 10px;
    }
    
    .nav {
        display: none;
    }
    
    .nav.active {
        display: block;
    }
    
    .nav-list {
        flex-direction: column;
    }
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn-block {
    width: 100%;
}

/* ========== Cards ========== */
.card {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

/* ========== Section Title ========== */
.section-title {
    font-size: 1.5rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-title a {
    font-size: 0.9rem;
    color: var(--primary);
}

/* ========== Products Grid & List ========== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.products-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* ========== Product Card - New Design ========== */
.product-card {
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.12);
}

/* الشريط المائل */
.product-badge {
    position: absolute;
    top: 15px;
    right: -30px;
    width: 110px;
    padding: 5px 0;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
    transform: rotate(45deg);
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.product-badge.new {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.product-badge.discount {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.product-badge.bestseller {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

/* زر المفضلة في Header */
.wishlist-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    color: var(--text);
    transition: color 0.3s;
}

.wishlist-btn:hover {
    color: #ef4444;
}

/* زر المفضلة في بطاقة المنتج */
.product-wishlist-btn {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.product-wishlist-btn:hover {
    background: #fff;
    transform: scale(1.1);
}

.product-wishlist-btn svg {
    color: #9ca3af;
    transition: all 0.3s ease;
}

.product-wishlist-btn:hover svg {
    color: #ef4444;
}

.product-wishlist-btn.active svg {
    color: #ef4444;
    fill: #ef4444;
}

[data-theme="dark"] .product-wishlist-btn {
    background: rgba(30, 41, 59, 0.95);
}

[data-theme="dark"] .product-wishlist-btn:hover {
    background: #1e293b;
}

/* صورة المنتج */
.product-image-link {
    display: block;
}

.product-image {
    position: relative;
    padding-top: 100%;
    background: linear-gradient(145deg, #f8fafc, #f1f5f9);
    overflow: hidden;
}

[data-theme="dark"] .product-image {
    background: linear-gradient(145deg, #1e293b, #334155);
}

.product-image img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 85%;
    height: 85%;
    object-fit: contain;
    transition: transform 0.4s ease;
}

.product-card:hover .product-image img {
    transform: translate(-50%, -50%) scale(1.08);
}

/* معلومات المنتج */
.product-info {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-name-link {
    display: block;
    margin-bottom: 8px;
}

.product-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.8em;
    transition: color 0.2s;
}

.product-name-link:hover .product-name {
    color: var(--primary);
}

/* السعر */
.product-price {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.current-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
}

.old-price {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: line-through;
}

/* زر أضف للسلة */
.add-to-cart-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 15px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: auto;
}

.add-to-cart-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.add-to-cart-btn svg {
    flex-shrink: 0;
}

/* معلومات إضافية - مخفية في Grid View */
.product-extra-info {
    display: none;
}

/* ========== List View Styles ========== */
.products-list .product-card {
    flex-direction: row;
    align-items: stretch;
}

.products-list .product-card .product-image {
    width: 180px;
    min-width: 180px;
    padding-top: 0;
    height: 180px;
}

.products-list .product-card .product-image img {
    width: 90%;
    height: 90%;
}

.products-list .product-card .product-badge {
    top: 10px;
    right: -35px;
}

.products-list .product-card .wishlist-btn {
    top: 10px;
    left: auto;
    right: 10px;
}

.products-list .product-card .product-info {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.products-list .product-card .product-name {
    font-size: 1.1rem;
    -webkit-line-clamp: 1;
    min-height: auto;
}

.products-list .product-card .product-price {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
}

.products-list .product-card .current-price {
    font-size: 1.3rem;
}

.products-list .product-card .add-to-cart-btn {
    width: auto;
    align-self: flex-start;
}

.products-list .product-card .product-extra-info {
    display: block;
    margin-top: 10px;
}

.product-description {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.6;
    margin-bottom: 10px;
}

.view-product-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 600;
    transition: gap 0.2s;
}

.view-product-btn:hover {
    gap: 8px;
}

/* ========== Mobile Responsive for Product Cards ========== */
@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .product-card {
        border-radius: 12px;
    }
    
    .product-badge {
        font-size: 0.6rem;
        width: 90px;
        top: 10px;
        right: -25px;
    }
    
    .wishlist-btn {
        width: 30px;
        height: 30px;
        top: 8px;
        left: 8px;
    }
    
    .wishlist-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .product-info {
        padding: 10px;
    }
    
    .product-name {
        font-size: 0.85rem;
        min-height: 2.4em;
    }
    
    .product-price {
        margin-bottom: 10px;
    }
    
    .current-price {
        font-size: 0.95rem;
    }
    
    .old-price {
        font-size: 0.75rem;
    }
    
    .add-to-cart-btn {
        padding: 8px 10px;
        font-size: 0.8rem;
    }
    
    .add-to-cart-btn span {
        display: none;
    }
    
    .add-to-cart-btn svg {
        width: 20px;
        height: 20px;
    }
    
    /* List View on Mobile */
    .products-list .product-card {
        flex-direction: column;
    }
    
    .products-list .product-card .product-image {
        width: 100%;
        height: auto;
        padding-top: 100%;
    }
    
    .products-list .product-card .product-info {
        padding: 15px;
    }
    
    .products-list .product-card .wishlist-btn {
        left: 8px;
        right: auto;
    }
}

@media (max-width: 400px) {
    .products-grid {
        gap: 10px;
    }
    
    .product-info {
        padding: 8px;
    }
    
    .product-name {
        font-size: 0.8rem;
    }
    
    .current-price {
        font-size: 0.9rem;
    }
}

/* ========== Banners ========== */
.banners {
    margin-bottom: 30px;
}

.banner-slider {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
}

.banner-slide {
    display: none;
}

.banner-slide.active {
    display: block;
}

.banner-slide img {
    width: 100%;
    height: auto;
    max-height: 350px;
    object-fit: cover;
}

.banner-dots {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.banner-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.banner-dot.active {
    background: white;
}

/* ========== Categories ========== */
.categories-section {
    margin-bottom: 30px;
}

.categories-scroll {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 10px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.categories-scroll::-webkit-scrollbar { display: none; }

.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-width: 100px;
    padding: 15px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.category-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
}

.category-card img {
    width: 60px;
    height: 60px;
    object-fit: contain;
}

.category-card span {
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
}

/* ========== Filters Bar ========== */
.filters-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 15px 20px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.view-toggle {
    display: flex;
    gap: 5px;
}

.view-toggle button {
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
}

.view-toggle button.active,
.view-toggle button:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Quick Filters */
.quick-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.quick-filter-btn {
    padding: 8px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    color: var(--text);
}

.quick-filter-btn:hover,
.quick-filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.quick-filter-btn.discount-filter {
    border-color: #ef4444;
    color: #ef4444;
}

.quick-filter-btn.discount-filter:hover,
.quick-filter-btn.discount-filter.active {
    background: #ef4444;
    color: white;
}

.quick-filter-btn.bestseller-filter {
    border-color: #f59e0b;
    color: #f59e0b;
}

.quick-filter-btn.bestseller-filter:hover,
.quick-filter-btn.bestseller-filter.active {
    background: #f59e0b;
    color: white;
}

.quick-filter-btn.new-filter {
    border-color: #22c55e;
    color: #22c55e;
}

.quick-filter-btn.new-filter:hover,
.quick-filter-btn.new-filter.active {
    background: #22c55e;
    color: white;
}

/* Sort Select */
.sort-select {
    padding: 8px 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
}

/* ========== Filters Sidebar ========== */
.filters-sidebar {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 20px;
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.filter-section {
    margin-bottom: 25px;
}

.filter-section:last-child {
    margin-bottom: 0;
}

.filter-section h4 {
    margin-bottom: 15px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.2s;
}

.filter-option:hover {
    background: var(--bg);
}

.filter-option input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* Price Range */
.price-range {
    display: flex;
    gap: 10px;
    align-items: center;
}

.price-range input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
}

.close-filters {
    display: none;
}

/* Mobile Filters Toggle */
.mobile-filter-btn {
    display: none;
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    gap: 8px;
    align-items: center;
    font-weight: 600;
}

@media (max-width: 900px) {
    .mobile-filter-btn {
        display: flex;
    }
    
    .filters-sidebar {
        display: none;
        position: fixed;
        top: 0;
        right: 0;
        width: 300px;
        height: 100%;
        max-height: 100%;
        z-index: 1000;
        border-radius: 0;
        overflow-y: auto;
    }
    
    .filters-sidebar.active {
        display: block;
    }
    
    .close-filters {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 20px;
        padding-bottom: 15px;
        border-bottom: 1px solid var(--border);
    }
    
    .close-filters button {
        background: none;
        border: none;
        font-size: 1.5rem;
        cursor: pointer;
        color: var(--text);
    }
    
    .filters-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    
    .filters-overlay.active {
        display: block;
    }
}

/* ========== Products Page Layout ========== */
.products-page-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 30px;
}

@media (max-width: 900px) {
    .products-page-layout {
        grid-template-columns: 1fr;
    }
}

/* ========== Product Details Page ========== */
.product-page {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

@media (max-width: 900px) {
    .product-page {
        grid-template-columns: 1fr;
    }
}

.product-gallery {
    position: sticky;
    top: 100px;
    height: fit-content;
    z-index: 1;
}

.product-page > .product-details {
    position: relative;
    z-index: 2;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 25px;
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.product-main-image {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid var(--border);
    margin-bottom: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.product-main-image img {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: contain;
}

.product-thumbs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
}

.product-thumbs img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.2s;
}

.product-thumbs img:hover,
.product-thumbs img.active {
    border-color: var(--primary);
}

.product-details h1 {
    font-size: 1.8rem;
    margin-bottom: 15px;
}

.product-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.product-meta a {
    color: var(--primary);
}

.product-meta a:hover {
    text-decoration: underline;
}

.product-price-large {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.product-price-large .current {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.product-price-large .old {
    font-size: 1.2rem;
    color: var(--text-muted);
    text-decoration: line-through;
}

.product-price-large .discount {
    background: #fef2f2;
    color: #ef4444;
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 600;
}

.variant-selector {
    margin-bottom: 20px;
}

.variant-selector h4 {
    margin-bottom: 10px;
}

.variant-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.variant-option {
    padding: 10px 20px;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    cursor: pointer;
    transition: all 0.2s;
}

.variant-option:hover,
.variant-option.active {
    border-color: var(--primary);
}

.variant-option.color {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
}

.variant-option.color.active {
    box-shadow: 0 0 0 3px var(--bg-card), 0 0 0 5px var(--primary);
}

.quantity-selector {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.quantity-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.quantity-input {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.quantity-selector .btn-wishlist {
    width: 44px;
    height: 44px;
    min-width: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
}

.quantity-input button {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg);
    cursor: pointer;
    font-size: 1.2rem;
    transition: background 0.2s;
}

.quantity-input button:hover {
    background: var(--primary);
    color: white;
}

.quantity-input input {
    width: 60px;
    height: 40px;
    border: none;
    text-align: center;
    font-size: 1rem;
    background: var(--bg-card);
    color: var(--text);
}

.add-to-cart-section {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.add-to-cart-section .btn {
    flex: 1;
}

.stock-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.stock-status.in-stock {
    background: #dcfce7;
    color: #166534;
}

.stock-status.out-of-stock {
    background: #fee2e2;
    color: #991b1b;
}

/* ========== Cart ========== */
.cart-page {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
}

@media (max-width: 900px) {
    .cart-page {
        grid-template-columns: 1fr;
    }
}

.cart-items {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.cart-item {
    display: flex;
    gap: 15px;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
}

.cart-item-info {
    flex: 1;
}

.cart-item-info h4 {
    margin-bottom: 5px;
}

.cart-item-info .variant {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.cart-item-info .price {
    color: var(--primary);
    font-weight: 600;
}

.cart-item-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.remove-item {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 0.9rem;
}

.cart-summary {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 25px;
    height: fit-content;
    position: sticky;
    top: 100px;
}

.cart-summary h3 {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.summary-row.total {
    font-size: 1.2rem;
    font-weight: 700;
    padding-top: 15px;
    border-top: 1px solid var(--border);
    margin-top: 15px;
}

.coupon-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.coupon-form input {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
}

.empty-cart {
    text-align: center;
    padding: 60px 20px;
}

.empty-cart svg {
    width: 100px;
    height: 100px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* ========== Checkout ========== */
.checkout-page {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 30px;
}

@media (max-width: 900px) {
    .checkout-page {
        grid-template-columns: 1fr;
    }
}

.checkout-form {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 25px;
}

.form-title {
    font-size: 1.2rem;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 500px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ========== Order Confirmation ========== */
.order-success {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
    max-width: 600px;
    margin: 0 auto;
}

.order-success .icon {
    width: 80px;
    height: 80px;
    background: #dcfce7;
    color: #166534;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.order-success h1 {
    color: #166534;
    margin-bottom: 10px;
}

.order-number {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--primary);
    margin: 20px 0;
}

.order-details {
    text-align: right;
    background: var(--bg);
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

/* ========== Footer ========== */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 40px 0 20px;
    margin-top: 40px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-section h4 {
    margin-bottom: 15px;
    color: var(--primary);
}

.footer-section ul li {
    margin-bottom: 8px;
}

.footer-section ul li a:hover {
    color: var(--primary);
}

.social-links {
    display: flex;
    gap: 12px;
    margin-top: 15px;
}

.social-links a {
    width: 40px;
    height: 40px;
    background: var(--bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.social-links a:hover {
    background: var(--primary);
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.dev-credit {
    margin-top: 8px;
}

.dev-credit a {
    color: var(--primary);
}

/* ========== WhatsApp Button ========== */
.whatsapp-btn {
    position: fixed;
    bottom: 25px;
    left: 25px;
    width: 55px;
    height: 55px;
    background: #25d366;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
    z-index: 99;
    transition: transform 0.2s;
}

.whatsapp-btn:hover {
    transform: scale(1.1);
}

/* ========== Toast ========== */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--bg-card);
    color: var(--text);
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    border-right: 4px solid #22c55e;
}

.toast.error {
    border-right: 4px solid #ef4444;
}

/* ========== Breadcrumb ========== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.breadcrumb a:hover {
    color: var(--primary);
}

.breadcrumb span {
    color: var(--text);
}

/* ========== Page Content ========== */
.page-content {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 30px;
    max-width: 800px;
}

.page-content h1 {
    margin-bottom: 20px;
}

.page-content p {
    margin-bottom: 15px;
}

/* ========== Loading ========== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== Pagination ========== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 30px;
}

.pagination a,
.pagination span {
    padding: 10px 15px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
}

.pagination a:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination .active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ========== No Products ========== */
.no-products {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.no-products svg {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* =====================================================================
   ========== تحسينات الواجهة (الهيدر/الفوتر/الهاتف/الوضع الليلي) =========
   تُضاف في النهاية لتجاوز القواعد السابقة بأمان ودون كسر التصميم الحالي.
   ===================================================================== */

/* ---------- الهيدر: ظل خفيف + ارتفاع متناسق ---------- */
.header {
    box-shadow: 0 1px 0 var(--border), 0 2px 12px rgba(0,0,0,0.04);
    backdrop-filter: saturate(1.1);
}
.header-content { gap: 16px; }

.logo img { height: 44px; transition: transform .2s; }
.logo:hover img { transform: scale(1.04); }

/* حقل البحث: تكبير منطقة اللمس وتباين أفضل */
.search-box input {
    padding: 11px 46px 11px 16px;
    border-radius: 28px;
    font-size: 0.95rem;
}
.search-box input::placeholder { color: var(--text-muted); }
.search-box button:hover { background: var(--primary-dark); }

/* أزرار الأكشن: مساحة لمس ≥ 40px */
.icon-btn, .cart-btn, .wishlist-btn {
    min-width: 42px;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* شريط التنقل: حواف ناعمة وحالة نشطة */
.nav-list li a { font-weight: 600; font-size: 0.95rem; }
.nav-list li a:active { background: var(--primary-dark); }

/* ---------- تحسينات الهاتف ---------- */
@media (max-width: 768px) {
    .container { padding: 0 12px; }

    /* ترتيب أنظف: الشعار + الأكشنز في صف، البحث صف كامل تحتهما */
    .header-content {
        gap: 10px;
        padding: 10px 0;
        flex-wrap: wrap;
    }
    .logo { font-size: 1.15rem; }
    .logo img { height: 36px; }

    .search-box {
        order: 3;
        width: 100%;
        max-width: 100%;
        margin-top: 8px;
    }
    .header-actions { gap: 4px; margin-right: auto; }

    /* أيقونات أصغر قليلاً على الجوال مع إبقاء منطقة اللمس */
    .icon-btn svg, .cart-btn svg, .wishlist-btn svg { width: 22px; height: 22px; }

    /* القائمة الجانبية للجوال: انزلاق ناعم */
    .nav.active .nav-list { animation: navSlideDown .25s ease; }
    @keyframes navSlideDown {
        from { opacity: 0; transform: translateY(-6px); }
        to   { opacity: 1; transform: translateY(0); }
    }
    .nav-list li a { padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,0.12); }

    /* زر واتساب والـ Toast لا يغطيان المحتوى السفلي */
    .whatsapp-btn { width: 50px; height: 50px; bottom: 18px; left: 18px; }
    .toast { right: 16px; left: 16px; bottom: 18px; text-align: center; }

    /* الفوتر: تكديس مرتب وعناصر بمحاذاة الوسط */
    .footer { padding: 28px 0 16px; }
    .footer-content { gap: 22px; text-align: center; }
    .social-links { justify-content: center; }
}

@media (max-width: 400px) {
    .header-actions .wishlist-btn { display: none; } /* توفير مساحة على الشاشات الصغيرة جداً */
}

/* ---------- الفوتر: مظهر أرقى + شارات ثقة ودفع ---------- */
.footer-section h4 {
    font-size: 1.05rem;
    position: relative;
    padding-bottom: 8px;
}
.footer-section h4::after {
    content: "";
    position: absolute;
    bottom: 0; right: 0;
    width: 36px; height: 3px;
    background: var(--primary);
    border-radius: 3px;
}
.footer-section ul li a {
    color: var(--text-muted);
    transition: color .2s, padding-right .2s;
    display: inline-block;
}
.footer-section ul li a:hover { padding-right: 4px; }

.footer-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}
.footer-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 0.82rem;
    color: var(--text-muted);
}
.footer-badge svg { width: 18px; height: 18px; color: var(--primary); flex-shrink: 0; }

/* ---------- تحسين تباين الوضع الليلي ---------- */
[data-theme="dark"] .header {
    box-shadow: 0 1px 0 var(--border), 0 2px 14px rgba(0,0,0,0.45);
}
[data-theme="dark"] .search-box input { background: #0b1220; }
[data-theme="dark"] .footer-badge { background: #0b1220; }
[data-theme="dark"] .search-results,
[data-theme="dark"] .nav-dropdown-menu { box-shadow: 0 12px 32px rgba(0,0,0,0.6); }
[data-theme="dark"] .toast { box-shadow: 0 12px 32px rgba(0,0,0,0.6); }

/* تحسين وضوح التركيز للوصولية (keyboard focus) */
.search-box input:focus-visible,
.icon-btn:focus-visible,
.cart-btn:focus-visible,
.wishlist-btn:focus-visible,
.btn:focus-visible,
.nav-list li a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* =====================================================================
   ========== تحسين الهيدر النهائي (بحث + تناسق أزرار + إخفاء القائمة) ====
   هذه الكتلة في آخر الملف لتتجاوز كل ما سبقها.
   ===================================================================== */

/* (1) إخفاء أيقونة القائمة على الديسكتوب نهائياً، وإظهارها على الجوال فقط */
@media (min-width: 769px) {
    #menuToggle,
    .mobile-only { display: none !important; }
}

/* (2) تناسق أحجام جميع أزرار الهيدر — مربعات موحّدة 40×40 بزوايا ناعمة */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.header-actions .icon-btn,
.header-actions .cart-btn,
.header-actions .wishlist-btn,
.header-actions #menuToggle {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
}
/* توحيد حجم الأيقونات داخل الأزرار (كانت 20 و24 مختلطة) */
.header-actions .icon-btn svg,
.header-actions .cart-btn svg,
.header-actions .wishlist-btn svg,
.header-actions #menuToggle svg {
    width: 21px;
    height: 21px;
}
.header-actions .icon-btn:hover,
.header-actions .cart-btn:hover,
.header-actions .wishlist-btn:hover,
.header-actions #menuToggle:hover {
    background: var(--bg);
}
.header-actions .wishlist-btn:hover { color: #ef4444; }

/* عدّادات السلة/المفضلة: محاذاة متّسقة فوق الزر */
.header-actions .cart-count,
.header-actions .wishlist-count {
    top: -2px;
    right: -2px;
}

/* (3) حقل البحث: متّزن مع زر بحث صغير أنيق بدل الدائرة الضخمة */
.search-box {
    flex: 1;
    max-width: 380px;
}
.search-box input {
    width: 100%;
    height: 42px;
    padding: 0 50px 0 16px;     /* مساحة للزر داخل الحقل */
    border-radius: 22px;
    font-size: 0.95rem;
    line-height: 42px;
}
.search-box button {
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .2s;
}
.search-box button svg { width: 17px; height: 17px; }
.search-box button:hover { background: var(--primary-dark); }

/* (4) ضبط الهيدر على الجوال: شعار + أزرار في صف، بحث صف كامل تحتها */
@media (max-width: 768px) {
    .header-content {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
        padding: 10px 0;
    }
    .logo { order: 1; }
    .header-actions { order: 2; margin-right: auto; gap: 6px; }
    .search-box {
        order: 3;
        flex: 1 1 100%;
        max-width: 100%;
        margin-top: 8px;
    }
    /* تصغير طفيف للأزرار على الجوال مع إبقاء منطقة لمس مريحة */
    .header-actions .icon-btn,
    .header-actions .cart-btn,
    .header-actions .wishlist-btn,
    .header-actions #menuToggle {
        width: 38px;
        height: 38px;
        min-width: 38px;
        min-height: 38px;
    }
    .search-box input { height: 44px; line-height: 44px; }
}

/* لا نُخفي المفضلة على الشاشات الصغيرة (تراجع عن قاعدة سابقة) */
@media (max-width: 400px) {
    .header-actions .wishlist-btn { display: flex !important; }
    .header-actions { gap: 4px; }
}

/* =====================================================================
   ========== القائمة الجانبية على الجوال (Slide-in Drawer) ============
   ===================================================================== */
@media (max-width: 768px) {
    /* تحويل شريط التنقل إلى لوحة منزلقة من اليمين */
    .nav {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 78%;
        max-width: 320px;
        background: var(--bg-card);
        color: var(--text);
        transform: translateX(100%);
        transition: transform .28s ease;
        z-index: 1001;
        overflow-y: auto;
        box-shadow: -6px 0 24px rgba(0,0,0,.18);
        display: block;            /* نتحكم بالإظهار عبر transform لا display */
        padding-top: 8px;
    }
    .nav.active { transform: translateX(0); }

    /* رأس اللوحة مع زر إغلاق */
    .nav .container { padding: 0; }
    .nav-drawer-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 18px;
        border-bottom: 1px solid var(--border);
        margin-bottom: 6px;
    }
    .nav-drawer-head span { font-weight: 700; color: var(--primary); font-size: 1.05rem; }
    .nav-drawer-close {
        background: var(--bg);
        border: none;
        color: var(--text);
        width: 36px; height: 36px;
        border-radius: 9px;
        font-size: 22px;
        line-height: 1;
        cursor: pointer;
        display: flex; align-items: center; justify-content: center;
    }

    .nav-list {
        flex-direction: column;
        overflow: visible;
    }
    .nav-list li { width: 100%; }
    .nav-list li a {
        padding: 14px 20px;
        font-size: 1rem;
        border-bottom: 1px solid var(--border);
        color: var(--text);
    }
    .nav-list li a:hover,
    .nav-list li a:active { background: var(--bg); color: var(--primary); }

    /* القوائم المنسدلة داخل اللوحة تظهر مفتوحة بشكل بسيط */
    .nav-dropdown-menu {
        position: static !important;
        display: block !important;
        box-shadow: none !important;
        border: none !important;
        background: var(--bg) !important;
        border-radius: 0 !important;
        padding: 0 !important;
    }
    .nav-dropdown-toggle svg { display: none; }

    /* الخلفية المعتمة خلف اللوحة */
    .nav-overlay {
        position: fixed;
        inset: 0;
        background: rgba(15,23,42,.5);
        backdrop-filter: blur(2px);
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
        transition: opacity .25s, visibility .25s;
    }
    .nav-overlay.active { opacity: 1; visibility: visible; }

    /* منع تمرير الصفحة خلف اللوحة */
    body.nav-open { overflow: hidden; }
}

/* على الديسكتوب لا نُظهر رأس اللوحة ولا الخلفية إطلاقاً */
@media (min-width: 769px) {
    .nav-drawer-head,
    .nav-overlay { display: none !important; }
}

/* =====================================================================
   ========== عناصر مستوحاة من تصميم متجر راقٍ (ريفي) ==================
   الشريط المتحرك + هيدر بشعار وسطي + لوحة ألوان أهدأ + سلة منزلقة
   ===================================================================== */

/* ---------- (1) الشريط الإعلاني المتحرك ---------- */
.announce-bar {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    overflow: hidden;
    white-space: nowrap;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: .2px;
}
.announce-track {
    display: inline-flex;
    gap: 60px;
    padding: 9px 0;
    animation: announceScroll 22s linear infinite;
    will-change: transform;
}
.announce-item { padding: 0 30px; }
@keyframes announceScroll {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }  /* نصف المسار لأننا كرّرنا النص مرتين */
}
/* في RTL نعكس الاتجاه ليبدو طبيعياً */
[dir="rtl"] .announce-track { animation-name: announceScrollRtl; }
@keyframes announceScrollRtl {
    from { transform: translateX(0); }
    to   { transform: translateX(50%); }
}
.announce-bar:hover .announce-track { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) {
    .announce-track { animation: none; }
}

/* ---------- (2) هيدر بشعار في الوسط (ديسكتوب) ---------- */
@media (min-width: 769px) {
    .header-content {
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        align-items: center;
        gap: 20px;
    }
    .header-content .search-box { order: 1; justify-self: start; max-width: 320px; width: 100%; }
    .header-content .logo       { order: 2; justify-self: center; }
    .header-content .header-actions { order: 3; justify-self: end; }
    .logo img { height: 48px; }
}

/* ---------- (3) لمسات لوحة الألوان الأهدأ ---------- */
.header { background: var(--bg-card); }
body { background: var(--bg); }

/* السعر: القديم مشطوب باهت + الجديد بلون التخفيض (نمط راقٍ للخصم) */
.price-old, .old-price, del {
    color: var(--text-muted);
    text-decoration: line-through;
    font-weight: 500;
    opacity: .8;
}
.price-new, .sale-price, .price-current {
    color: var(--sale);
    font-weight: 700;
}

/* بطاقات المنتجات: حواف أنعم وظل خفيف وحركة لمس */
.product-card {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: transform .18s, box-shadow .18s;
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

/* ---------- (4) تصميم الأزرار الموحّد ---------- */
.btn, .btn-primary, .add-to-cart, .buy-now {
    border-radius: var(--radius);
    font-weight: 700;
    letter-spacing: .2px;
    transition: transform .12s, box-shadow .2s, background .2s;
}
.btn-primary:hover, .add-to-cart:hover, .buy-now:hover {
    box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 35%, transparent);
}
.btn:active, .btn-primary:active { transform: translateY(1px); }
.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- (5) السلة المنزلقة (Drawer Cart) ---------- */
.cart-drawer {
    position: fixed;
    top: 0; bottom: 0; left: 0;          /* تنزلق من اليسار في RTL = جهة الإجراءات */
    width: 90%;
    max-width: 400px;
    background: var(--bg-card);
    color: var(--text);
    z-index: 1100;
    transform: translateX(-100%);
    transition: transform .3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}
[dir="rtl"] .cart-drawer { right: 0; left: auto; transform: translateX(100%); }
.cart-drawer.active { transform: translateX(0) !important; }

.cart-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}
.cart-drawer-head h3 { font-size: 1.1rem; margin: 0; }
.cart-drawer-close {
    background: var(--bg-soft);
    border: none;
    width: 36px; height: 36px;
    border-radius: 9px;
    font-size: 22px;
    cursor: pointer;
    color: var(--text);
    display: flex; align-items: center; justify-content: center;
}
.cart-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 18px;
}
.cart-drawer-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 50px 20px;
}
.cart-drawer-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.cart-drawer-item img {
    width: 64px; height: 64px;
    object-fit: cover;
    border-radius: 10px;
    flex-shrink: 0;
}
.cart-drawer-item .cdi-info { flex: 1; min-width: 0; }
.cart-drawer-item .cdi-name { font-size: .9rem; font-weight: 600; margin-bottom: 4px; }
.cart-drawer-item .cdi-meta { font-size: .8rem; color: var(--text-muted); }
.cart-drawer-item .cdi-price { color: var(--primary); font-weight: 700; margin-top: 4px; }
.cart-drawer-item .cdi-remove {
    background: none; border: none; color: var(--danger);
    cursor: pointer; font-size: .8rem; padding: 4px;
}
.cart-drawer-foot {
    border-top: 1px solid var(--border);
    padding: 16px 18px;
    background: var(--bg-soft);
}
.cart-drawer-total {
    display: flex; justify-content: space-between;
    font-size: 1.05rem; font-weight: 700;
    margin-bottom: 12px;
}
.cart-drawer-foot .btn { width: 100%; text-align: center; display: block; padding: 13px; }
.cart-drawer-foot .btn + .btn { margin-top: 8px; }

/* الخلفية المعتمة للسلة */
.cart-overlay {
    position: fixed; inset: 0;
    background: rgba(15,23,42,.5);
    backdrop-filter: blur(2px);
    z-index: 1099;
    opacity: 0; visibility: hidden;
    transition: opacity .25s, visibility .25s;
}
.cart-overlay.active { opacity: 1; visibility: visible; }
body.cart-open { overflow: hidden; }

/* ---------- اللوغو: حجم متحكَّم به + تبديل فاتح/داكن ---------- */
.logo img { height: var(--logo-size, 48px); width: auto; transition: height .2s; }
.logo .logo-dark { display: none; }
[data-theme="dark"] .logo .logo-light { display: none; }
[data-theme="dark"] .logo .logo-dark  { display: block; }
/* إن لم يوجد لوغو داكن، يبقى الفاتح ظاهراً */
[data-theme="dark"] .logo:not(:has(.logo-dark)) .logo-light { display: block; }
@media (max-width: 768px) {
    .logo img { height: calc(var(--logo-size, 48px) * 0.8); }
}

/* =====================================================================
   ========== صفحة التصنيف: فلاتر بتصميم محسّن (chips) ================
   ===================================================================== */
.catalog-filters {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    margin: 18px 0;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.filter-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 999px;
    border: 1.5px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .18s;
    white-space: nowrap;
}
.chip:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 35%, transparent);
}
.chip .chip-ic { font-size: 1rem; line-height: 1; }
.chip-clear { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, var(--border)); }
.chip-clear:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

.filter-selects { display: flex; gap: 10px; }
.filter-select {
    padding: 9px 14px;
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    min-width: 150px;
}
.filter-select:focus { outline: none; border-color: var(--primary); }

@media (max-width: 768px) {
    .catalog-filters { flex-direction: column; align-items: stretch; }
    .filter-chips { justify-content: center; }
    .filter-selects { width: 100%; }
    .filter-select { width: 100%; }
    /* تمرير أفقي للرقائق على الشاشات الصغيرة جداً */
    .filter-chips { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
}

/* =====================================================================
   ========== تحسين صفحة عرض المنتج =================================
   ===================================================================== */
@media (min-width: 993px) {
    .product-page { gap: 40px; align-items: start; }
    /* عمود التفاصيل يثبت أثناء التمرير لإبقاء زر الشراء ظاهراً */
    .product-page > .product-details {
        position: sticky;
        top: 90px;
    }
}

/* المعرض: حواف ناعمة وظل أنيق */
.product-main-image {
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    background: var(--bg-card);
    border: 1px solid var(--border);
}
.product-main-image img { transition: transform .4s; }
.product-main-image:hover img { transform: scale(1.04); }
.product-thumbs img {
    border-radius: 10px;
    border: 2px solid transparent;
    transition: border-color .2s, transform .2s;
}
.product-thumbs img:hover { transform: translateY(-2px); }
.product-thumbs img.active { border-color: var(--primary); }

/* العنوان والسعر */
.product-details h1 { font-size: 1.6rem; line-height: 1.4; }
.product-price-large .current { color: var(--primary); font-size: 2rem; font-weight: 800; }
.product-price-large .old { color: var(--text-muted); }
.product-price-large .discount {
    background: var(--sale);
    color: #fff;
    padding: 3px 10px;
    border-radius: 8px;
    font-size: .85rem;
    font-weight: 700;
}

/* خيارات المتغيرات: شكل حبّة أنيق */
.variant-option {
    border-radius: 10px;
    border: 1.5px solid var(--border);
    transition: all .18s;
    font-weight: 600;
}
.variant-option:hover { border-color: var(--primary); transform: translateY(-1px); }
.variant-option.active {
    border-color: var(--primary);
    background: var(--primary-tint);
    color: var(--primary);
}
.variant-option.color.active { box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent); }

/* أزرار الشراء */
.add-to-cart-section { gap: 12px; }
.add-to-cart-section .btn { padding: 15px; font-size: 1.02rem; border-radius: var(--radius); }

/* حالة التوفر */
.stock-status { border-radius: 10px; font-weight: 600; }

/* شارات الثقة أسفل الشراء */
.product-trust {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}
.product-trust .pt-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .82rem;
    color: var(--text-muted);
}
.product-trust .pt-item svg { width: 22px; height: 22px; color: var(--primary); flex-shrink: 0; }

/* =====================================================================
   ========== توسيط محتوى الفوتر بالكامل =============================
   ===================================================================== */
.footer-content {
    text-align: center;
    justify-items: center;       /* توسيط أعمدة الشبكة */
}
.footer-section { width: 100%; }
.footer-section h4 {
    text-align: center;
}
/* خط العنوان التزييني يصبح في المنتصف بدل اليمين */
.footer-section h4::after {
    right: 50%;
    transform: translateX(50%);
}
.footer-section ul { padding: 0; }
.footer-section ul li { text-align: center; }
.footer-section ul li a:hover { padding-right: 0; }  /* إلغاء الإزاحة الجانبية */

.social-links { justify-content: center; }

.footer-badges { justify-content: center; }

/* =====================================================================
   ========== شريط الشحن المجاني + عدّاد الكمية في السلة =============
   ===================================================================== */
.free-ship-bar {
    background: var(--bg-soft);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 14px;
}
.fsb-msg { font-size: .85rem; margin-bottom: 8px; text-align: center; }
.fsb-msg b { color: var(--primary); }
.fsb-msg.fsb-done { color: var(--success); font-weight: 700; }
.fsb-track {
    height: 8px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
}
.fsb-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    border-radius: 999px;
    transition: width .4s ease;
}

/* عدّاد الكمية داخل عنصر السلة */
.cdi-qty {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 6px 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2px 6px;
}
.cdi-qty button {
    width: 26px; height: 26px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
    border-radius: 6px;
    line-height: 1;
}
.cdi-qty button:hover { background: var(--primary); color: #fff; }
.cdi-qty span { min-width: 18px; text-align: center; font-weight: 700; font-size: .9rem; }

/* =====================================================================
   ========== مكبّر صورة المنتج + سطر الإجمالي المباشر ================
   ===================================================================== */
/* عند تفعيل التكبير نلغي تأثير hover-scale السابق ونتحكم عبر JS */
.product-main-image.zoom-enabled { cursor: zoom-in; overflow: hidden; }
.product-main-image.zoom-enabled:hover img { transform: none; } /* JS يتولّى التكبير */
.product-main-image.zoom-enabled img {
    transition: transform .15s ease-out;
    will-change: transform;
}

/* سطر الإجمالي حسب الكمية */
.product-total-line {
    margin: 10px 0 4px;
    font-size: .95rem;
    color: var(--text-muted);
}
.product-total-line strong { color: var(--primary); font-size: 1.15rem; }

/* =====================================================================
   ========== شريط التنقل السفلي للجوال (Mobile Bottom Nav) ==========
   ===================================================================== */
.bottom-nav { display: none; }

@media (max-width: 768px) {
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0; right: 0; left: 0;
        background: var(--bg-card);
        border-top: 1px solid var(--border);
        box-shadow: 0 -2px 16px rgba(15,23,42,.08);
        z-index: 900;
        padding-bottom: env(safe-area-inset-bottom, 0);  /* آيفون */
    }
    .bn-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 8px 4px;
        color: var(--text-muted);
        font-size: .68rem;
        font-weight: 600;
        position: relative;
        transition: color .15s;
    }
    .bn-item svg { width: 23px; height: 23px; }
    .bn-item:active { color: var(--primary); }
    .bn-item.bn-cart svg { color: var(--primary); }
    .bn-badge {
        position: absolute;
        top: 4px;
        right: 50%;
        transform: translateX(18px);
        background: var(--sale);
        color: #fff;
        min-width: 17px;
        height: 17px;
        border-radius: 9px;
        font-size: .62rem;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 4px;
        font-weight: 700;
    }

    /* مساحة سفلية حتى لا يغطّي الشريط محتوى الصفحة وزر واتساب */
    body { padding-bottom: 64px; }
    .whatsapp-btn { bottom: 76px !important; }
}

/* =====================================================================
   ========== فوتر أبسط على الجوال + تواصل اجتماعي + إلغاء آثار الشريط السفلي
   ===================================================================== */

/* إلغاء أي مساحة سفلية كانت للشريط السفلي المحذوف */
@media (max-width: 768px) {
    body { padding-bottom: 0; }
    .whatsapp-btn { bottom: 18px !important; }
}

/* أزرار التواصل الاجتماعي في الفوتر */
.footer-social {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin: 6px 0 22px;
}
.footer-social a {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s;
}
.footer-social a:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    transform: translateY(-2px);
}

/* عناصر القائمة الإضافية تظهر داخل قائمة الجوال فقط */
.nav-mobile-extra { display: none; }
.nav-divider { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; }

@media (max-width: 768px) {
    /* إخفاء روابط سريعة + تواصل من الفوتر (انتقلت للقائمة) */
    .footer-hide-mobile { display: none !important; }

    /* إظهار الروابط والتواصل داخل قائمة الجوال */
    .nav-mobile-extra { display: block; }

    /* فوتر مبسّط: نبذة المتجر + تواصل اجتماعي + الحقوق فقط */
    .footer { padding: 24px 0 16px; margin-top: 24px; }
    .footer-content { grid-template-columns: 1fr; gap: 0; margin-bottom: 16px; }
    .footer-section p { max-width: 340px; margin: 0 auto; }
    .footer-social { margin: 14px 0 16px; }
    /* تبقى شارات الثقة لكن أصغر */
    .footer-badges { gap: 8px; }
    .footer-badge { font-size: .75rem; padding: 6px 10px; }
}
