@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;600&display=swap');

:root {
    --primary: #0071e3;
    --secondary: #0077ED;
    --accent: #06c;
    --bg-main: #f5f5f7;
    --bg-card: #ffffff;
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --shadow: rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Tajawal', 'Segoe UI', sans-serif;
    background: #f5f5f7;
    min-height: 100vh;
    color: #1d1d1f;
    padding: 1rem;
    font-size: 17px;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    container-type: inline-size;
    padding: 20px;
}

header {
    text-align: center;
    padding: 3rem 1rem;
    margin-bottom: 2rem;
    /* ✅ تطبيق خلفية index.html الداكنة */
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border-radius: 24px;
    /* ✅ تطبيق ظل index.html المتوهج */
    box-shadow: 0 20px 60px rgba(0, 113, 227, 0.2);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
    animation: pulse 8s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-10%, -10%); }
}

h1 {
    font-size: clamp(32px, 5vw, 48px);
    font-weight: 700;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

h2 {
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 700;
    color: var(--text-primary);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.95;
    position: relative;
    z-index: 1;
    color: #cbd5e1;
}

.search-container {
    margin: 2rem auto;
    max-width: 600px;
    position: relative;
}

.search-box {
    width: 100%;
    padding: 1rem 3rem 1rem 1.5rem;
    border: 2px solid #d2d2d7;
    border-radius: 50px;
    background: white;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.search-box:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.1);
    transform: translateY(-2px);
}

.search-icon {
    position: absolute;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.3rem;
    color: var(--primary);
}

/* ✨ فلاتر الفئات الذكية */
.categories-filter {
    display: flex;
    gap: 0.75rem;
    margin: 2rem auto;
    padding: 1rem 0;
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    /* إخفاء scrollbar على الهواتف لمظهر أنظف */
    -ms-overflow-style: none;
}

.categories-filter::-webkit-scrollbar {
    display: none; /* إخفاء على الهواتف */
}

/* إظهار scrollbar على الشاشات الكبيرة فقط */
@media (min-width: 769px) {
    .categories-filter::-webkit-scrollbar {
        display: block;
        height: 6px;
    }
    
    .categories-filter::-webkit-scrollbar-track {
        background: transparent;
    }
    
    .categories-filter::-webkit-scrollbar-thumb {
        background: var(--primary);
        border-radius: 10px;
    }
}

.category-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: white;
    border: 2px solid #d2d2d7;
    border-radius: 50px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    font-family: inherit;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.category-chip:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 113, 227, 0.2);
    border-color: var(--primary);
    background: rgba(0, 113, 227, 0.05);
}

.category-chip.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(0, 113, 227, 0.3);
    transform: translateY(-2px);
}

.chip-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}

.category-chip.active .chip-count {
    background: rgba(255, 255, 255, 0.25);
}

.stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.stat-item {
    background: white;
    padding: 1rem 2rem;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border: 1px solid #d2d2d7;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 2rem;
    padding: 20px 0;
}

.product-card {
    background: #fbfbfd;
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #d2d2d7;
    position: relative;
    cursor: pointer;
    margin-bottom: 20px;
    opacity: 0;
    transform: translateY(30px);
    visibility: hidden;
    /* ✨ تسريع GPU للأداء الأفضل */
    transform: translateZ(0) translateY(30px);
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}
/* حالة الظهور */
.product-card.is-visible {
    opacity: 1;
    transform: translateZ(0) translateY(0);
    visibility: visible;
    transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ✨ تأثير Shine خفيف عند hover */
.product-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.15) 50%,
        transparent 70%
    );
    transform: translateX(-100%) rotate(45deg);
    transition: transform 0.6s;
    pointer-events: none;
    z-index: 1;
}

.product-card:hover::before {
    transform: translateX(100%) rotate(45deg);
}

.product-card:hover {
    transform: translateZ(0) translateY(-12px) scale(1.02);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15),
                0 0 40px rgba(0, 113, 227, 0.2);
    border-color: var(--primary);
}

/* ✨ تأثير 3D خفيف على البطاقة */
.product-card {
    transform-style: preserve-3d;
}

.product-details {
    position: relative;
    z-index: 2;
}

.product-image {
    width: 100%;
    aspect-ratio: 1 / 1; /* ✅ نسبة مربعة للصورة */
    overflow: visible; /* ✅ السماح بظهور الصورة كاملة */
    position: relative;
    background: linear-gradient(135deg, #e5e5e7 0%, #d2d2d7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* ✅ عرض الصورة كاملة بدون قص */
    padding: 10px; /* ✅ مساحة حول الصورة */
    transition: transform 0.6s ease, opacity 0.4s ease;
    /* 🚀 تحسين أداء الصور */
    opacity: 0;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.product-card:hover .product-image img {
    transform: scale(1.05); /* ✅ تكبير طفيف فقط لعدم قص الصورة */
}

.image-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 10;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* 🚀 Skeleton placeholder أثناء التحميل */
.product-image img[data-src] {
    background: linear-gradient(
        90deg,
        rgba(0, 113, 227, 0.05) 0%,
        rgba(0, 113, 227, 0.15) 50%,
        rgba(0, 113, 227, 0.05) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.product-details {
    padding: 1.5rem;
}

/* ✅ إزالة قص الاسم - عرض كامل */
.product-name {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    line-height: 1.5;
    min-height: auto;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

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

.price-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 0.3rem;
}

.badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: linear-gradient(135deg, #0071e3, #0077ED);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    z-index: 10;
    box-shadow: 0 4px 15px rgba(0, 113, 227, 0.3);
}

.no-results {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.no-results-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px) saturate(150%);
    -webkit-backdrop-filter: blur(10px) saturate(150%);
    animation: fadeIn 0.3s ease;
    overflow-y: auto;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem 1rem;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ✅ Modal أكبر وأوضح مع Glass Effect خفيف */
.modal-content {
    background: white;
    border-radius: 24px;
    max-width: 800px;
    width: 100%;
    max-height: none;
    position: relative;
    animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.3),
                0 0 0 1px rgba(0, 113, 227, 0.1) inset;
    margin: 2rem auto;
    /* ✨ تسريع GPU */
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
}

@keyframes slideUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ✅ إزالة الخلفية الزرقاء */
.modal-header {
    position: relative;
    background: white;
    padding: 1.5rem 1.5rem 0.5rem 1.5rem;
    border-radius: 24px 24px 0 0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
}

.close-btn {
    background: rgba(0, 113, 227, 0.1);
    border: 2px solid var(--primary);
    color: var(--primary);
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.close-btn:hover {
    background: var(--primary);
    color: white;
    transform: rotate(90deg);
}

.back-btn {
    background: rgba(0, 113, 227, 0.1);
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.05);
}

.modal-body {
    padding: 1.5rem 2rem 2rem 2rem;
}

.product-modal-image {
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 16px;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    background: linear-gradient(135deg, #f5f5f7 0%, #e5e5e7 100%);
    max-height: none; /* ✅ إزالة القيد على الارتفاع لعرض الصورة كاملة */
    padding: 20px; /* ✅ مساحة حول الصورة */
}

/* ✅ اسم المنتج كامل في Modal */
.modal-product-name {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    line-height: 1.5;
    word-wrap: break-word;
    text-align: center;
}

.price-section {
    background: linear-gradient(135deg, rgba(0, 113, 227, 0.05), rgba(0, 119, 237, 0.05));
    padding: 2rem;
    border-radius: 16px;
    margin-bottom: 2rem;
    border: 1px solid rgba(0, 113, 227, 0.1);
}

.cash-price {
    text-align: center;
    margin-bottom: 1.5rem;
}

.cash-price-label {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.cash-price-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
}

.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, #d2d2d7, transparent);
    margin: 2rem 0;
}

.installment-section {
    margin-top: 2rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quick-installments {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.installment-card {
    background: rgba(0, 113, 227, 0.05);
    border: 2px solid rgba(0, 113, 227, 0.2);
    padding: 1.5rem;
    border-radius: 16px;
    text-align: center;
    transition: all 0.3s ease;
}

.installment-card:hover {
    background: rgba(0, 113, 227, 0.1);
    border-color: var(--primary);
    transform: translateY(-5px);
}

.installment-months {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.installment-amount {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
}

.installment-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.3rem;
}

.custom-calculator {
    background: rgba(0, 119, 237, 0.05);
    border: 2px solid rgba(0, 119, 237, 0.2);
    padding: 2rem;
    border-radius: 16px;
}

.calculator-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.months-input-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* ✨ قائمة منسدلة مخصصة جميلة */
.custom-select-wrapper {
    position: relative;
    width: 100%;
}

.custom-select {
    width: 100%;
    padding: 1rem 3rem 1rem 1.5rem;
    background: white;
    border: 2px solid #d2d2d7;
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.custom-select:hover {
    border-color: var(--primary);
    background: rgba(0, 113, 227, 0.02);
}

.custom-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.1);
    background: white;
}

.select-arrow {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    font-size: 0.8rem;
    pointer-events: none;
    transition: all 0.3s ease;
}

.custom-select:focus + .select-arrow {
    transform: translateY(-50%) rotate(180deg);
}

.months-input {
    flex: 1;
    padding: 1rem;
    background: white;
    border: 2px solid #d2d2d7;
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-family: inherit;
    text-align: center;
    transition: all 0.3s ease;
    font-weight: 600;
}

.months-input:hover {
    border-color: var(--primary);
    background: rgba(0, 113, 227, 0.02);
}

.months-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.1);
    background: white;
}

.months-buttons {
    display: flex;
    gap: 0.5rem;
}

.month-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.month-btn:hover {
    background: var(--secondary);
    transform: translateY(-2px);
}

.calculate-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 1.2rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 113, 227, 0.3);
    position: relative;
    overflow: hidden;
    /* ✨ تسريع GPU */
    transform: translateZ(0);
    will-change: transform;
}

/* ✨ تأثير Ripple خفيف عند الضغط */
.calculate-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}

.calculate-btn:active::after {
    width: 300px;
    height: 300px;
}

.calculate-btn:hover {
    transform: translateZ(0) translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 113, 227, 0.4);
}

.custom-result {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(0, 113, 227, 0.08), rgba(0, 119, 237, 0.08));
    border-radius: 12px;
    text-align: center;
    display: none;
}

.custom-result.show {
    display: block;
    animation: slideDown 0.4s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.custom-result-label {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.custom-result-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.specs-section {
    background: rgba(0, 113, 227, 0.03);
    padding: 2rem;
    border-radius: 16px;
    margin-top: 2rem;
    border: 1px solid rgba(0, 113, 227, 0.1);
}

.specs-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.specs-list {
    list-style: none;
    padding: 0;
}

.specs-list li {
    padding: 0.8rem 0;
    border-bottom: 1px solid rgba(0, 113, 227, 0.1);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.specs-list li:last-child {
    border-bottom: none;
}

.specs-list li::before {
    content: '✓';
    color: var(--primary);
    font-weight: 700;
    font-size: 1.2rem;
}

@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }

    header {
        padding: 2rem 1rem;
    }
    
    .categories-filter {
        gap: 0.5rem;
        padding: 0.75rem 0;
        margin: 1.5rem auto;
    }
    
    .category-chip {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    .modal-content {
        margin: 1rem;
        max-width: 95%;
    }

    .modal-body {
        padding: 1rem 1.5rem 1.5rem 1.5rem;
    }

    .product-modal-image {
        max-height: none; /* ✅ عرض الصورة كاملة على الهواتف */
        padding: 15px;
    }

    .quick-installments {
        grid-template-columns: 1fr;
    }
    
    .modal-product-name {
        font-size: 20px;
    }
    
    .custom-select {
        padding: 0.9rem 3rem 0.9rem 1.2rem;
        font-size: 1rem;
    }
    
    .select-arrow {
        left: 1rem;
    }
    
    .months-input {
        padding: 0.9rem;
        font-size: 1rem;
    }
    
    .cart-actions > div {
        flex-direction: column !important;
        width: 100%;
    }
    
    .cart-actions .input-group {
        width: 100% !important;
        min-width: 100% !important;
    }
    
    .cart-actions button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .modal.active {
        padding: 0.5rem;
    }

    .modal-content {
        border-radius: 16px;
    }

    .modal-header {
        border-radius: 16px 16px 0 0;
        padding: 1rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .product-modal-image {
        max-height: none; /* ✅ عرض الصورة كاملة على الهواتف الصغيرة */
        padding: 10px;
        border-radius: 12px;
    }
}

.skeleton {
    background: linear-gradient(90deg,
        #f0f0f0 25%,
        rgba(0, 113, 227, 0.05) 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}


/* ===================================
   🌙 DARK MODE - زر ثابت ومناسب
   =================================== */

/* ✅ الزر ثابت من الأعلى - داخل Container */
.theme-toggle {
  position: fixed;
  top: 15px;
  left: 15px;
  z-index: 10000;
  background: var(--bg-card);
  border: 2px solid var(--primary);
  color: var(--primary);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px var(--shadow);
}

.theme-toggle:hover {
  transform: scale(1.15) rotate(15deg);
  box-shadow: 0 8px 30px var(--shadow);
  border-color: var(--secondary);
}

.theme-toggle:active {
  transform: scale(0.95);
}

/* ✅ Dark Mode Styles */
body.dark-mode {
  background: #1a1a1a;
  color: #f5f5f7;
  --bg-main: #1a1a1a;
  --bg-card: #2d2d2d;
  --text-primary: #f5f5f7;
  --text-secondary: #a1a1a6;
  --shadow: rgba(255, 255, 255, 0.1);
}

/* البطاقات */
body.dark-mode .product-card {
  background: #2d2d2d;
  border-color: #3d3d3d;
}

body.dark-mode .product-card:hover {
  border-color: var(--primary);
  box-shadow: 0 12px 24px rgba(0, 113, 227, 0.3),
              0 0 50px rgba(0, 113, 227, 0.25);
}

/* ✨ تأثير Shine في Dark Mode */
body.dark-mode .product-card::before {
  background: linear-gradient(
      45deg,
      transparent 30%,
      rgba(255, 255, 255, 0.08) 50%,
      transparent 70%
  );
}

/* 🚀 Skeleton في Dark Mode */
body.dark-mode .product-image img[data-src] {
  background: linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.05) 0%,
      rgba(255, 255, 255, 0.1) 50%,
      rgba(255, 255, 255, 0.05) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

/* فلاتر الفئات في الوضع الليلي */
body.dark-mode .category-chip {
  background: #2d2d2d;
  border-color: #3d3d3d;
  color: #f5f5f7;
}

body.dark-mode .category-chip:hover {
  background: rgba(0, 113, 227, 0.15);
  border-color: var(--primary);
}

body.dark-mode .category-chip.active {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border-color: var(--primary);
}

/* الإحصائيات */
body.dark-mode .stat-item {
  background: #2d2d2d;
  border-color: #3d3d3d;
}

/* صندوق البحث */
body.dark-mode .search-box {
  background: #2d2d2d;
  border-color: #3d3d3d;
  color: #f5f5f7;
}

body.dark-mode .search-box:focus {
  border-color: var(--primary);
}

body.dark-mode .search-box::placeholder {
  color: #a1a1a6;
}

/* Modal في Dark Mode */
body.dark-mode .modal {
  background-color: rgba(0, 0, 0, 0.95);
}

body.dark-mode .modal-content,
body.dark-mode .modal-header,
body.dark-mode .modal-body {
  background: #2d2d2d;
  color: #f5f5f7;
}

body.dark-mode .modal-header {
  border-bottom-color: #3d3d3d;
}

body.dark-mode .modal-product-name,
body.dark-mode .section-title,
body.dark-mode .calculator-title,
body.dark-mode .specs-title {
  color: #f5f5f7;
}

body.dark-mode .price-section,
body.dark-mode .custom-calculator,
body.dark-mode .specs-section {
  background: rgba(0, 113, 227, 0.15);
  border-color: rgba(0, 113, 227, 0.3);
}

body.dark-mode .installment-card {
  background: rgba(0, 113, 227, 0.15);
  border-color: rgba(0, 113, 227, 0.3);
}

body.dark-mode .installment-card:hover {
  background: rgba(0, 113, 227, 0.25);
}

body.dark-mode .months-input {
  background: #1a1a1a;
  border-color: #3d3d3d;
  color: #f5f5f7;
}

body.dark-mode .months-input:hover {
  background: rgba(0, 113, 227, 0.15);
  border-color: var(--primary);
}

body.dark-mode .months-input:focus {
  background: #1a1a1a;
}

body.dark-mode .custom-select {
  background: #1a1a1a;
  border-color: #3d3d3d;
  color: #f5f5f7;
}

body.dark-mode .custom-select:hover {
  background: rgba(0, 113, 227, 0.15);
  border-color: var(--primary);
}

body.dark-mode .custom-select:focus {
  background: #1a1a1a;
}

body.dark-mode .custom-result {
  background: rgba(0, 113, 227, 0.2);
}

/* الأزرار */
body.dark-mode .close-btn,
body.dark-mode .back-btn {
  background: rgba(0, 113, 227, 0.2);
  color: var(--primary);
}

body.dark-mode .close-btn:hover,
body.dark-mode .back-btn:hover {
  background: var(--primary);
  color: white;
}

/* استجابة للهواتف */
@media (max-width: 768px) {
  .theme-toggle {
    width: 44px;
    height: 44px;
    font-size: 1.3rem;
    top: 12px;
    left: 12px;
  }
}

@media (max-width: 480px) {
  .theme-toggle {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    top: 10px;
    left: 10px;
  }
}

/* =========================
     Cart styles
     ========================= */
.cart-button {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 10001;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0.6rem 0.8rem;
    border-radius: 999px;
    font-size: 1rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    cursor: pointer;
}

.cart-button span{margin-left:.5rem;font-weight:700}

.cart-panel {
    position: fixed;
    right: 20px;
    top: 60px;
    width: 360px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    z-index: 10002;
    overflow: auto;
    padding: 0;
    display: none;
}

.cart-panel.open { display: block; }

.cart-header { display:flex;justify-content:space-between;align-items:center;padding:1rem;border-bottom:1px solid #eee }
.cart-items { padding: .5rem 1rem }
.cart-item { display:flex;justify-content:space-between;gap:.6rem;padding:.6rem 0;border-bottom:1px dashed #f0f0f0 }
.cart-item-name{font-weight:700;color:var(--text-primary)}
.cart-item-meta{color:var(--text-secondary);font-size:.9rem}
.cart-item-install{color:var(--primary);font-weight:600}
.cart-totals{padding:1rem;border-top:1px solid #eee;background:#fafafa}
.cart-total-row{font-size:1rem;margin-bottom:.4rem}
.cart-plan-row{font-size:.95rem;color:#374151;margin-top:.2rem}

@media (max-width: 768px) {
    .cart-panel { width: 92%; right: 4%; top: 60px }
}

/* =========================
   Aesthetic V2 - Modal Accordion
   ========================= */

/* جعل العنوان قابلاً للنقر مع أيقونة */
.specs-title {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none; /* لمنع تحديد النص عند النقر */
}

/* أيقونة السهم (▶ مغلق افتراضياً) */
.specs-title::after {
    content: '▶'; /* أيقونة السهم */
    font-size: 0.8em;
    color: var(--primary);
    transition: transform 0.3s ease-in-out;
    padding-left: 1rem; /* مسافة عن النص */
}

/* قائمة المواصفات (التحكم بالارتفاع) */
.specs-list {
    /* هذه هي الخصائص الأساسية للأنيميشن */
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, opacity 0.3s ease-out, margin-top 0.4s ease-out;
    opacity: 0;
    
    /* إخفاء الهوامش والحدود عندما يكون مغلقاً */
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-top: none;
}

/* الحالة المفتوحة (عند إزالة .is-collapsed) */
.specs-section:not(.is-collapsed) .specs-list {
    max-height: 1000px; /* ارتفاع أقصى كافٍ للمحتوى */
    opacity: 1;
    
    /* إعادة الهوامش الأصلية عند الفتح */
    margin-top: 1rem;
    padding-top: 0; /* li لديها padding خاص بها */
    padding-bottom: 0;
    border-top: 1px solid rgba(0, 113, 227, 0.1);
}

/* تدوير السهم عند الفتح */
.specs-section:not(.is-collapsed) .specs-title::after {
    transform: rotate(90deg); /* ▶ يتحول إلى ▼ */
}

/* ضمان تطبيق الحدود في الوضع الليلي عند الفتح */
body.dark-mode .specs-section:not(.is-collapsed) .specs-list {
    border-top-color: rgba(0, 113, 227, 0.3);
}

.calculate-btn.is-added {
    /* استخدام نفس تدرج الهيدر ولكن بدرجة أخف 
      أو لون أخضر صريح للنجاح. لنجرب الأخضر.
    */
    background: linear-gradient(135deg, #28a745, #218838); /* تدرج أخضر للنجاح */
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
    transform: translateY(-2px); /* إعطاء إحساس بالنقر */
}
/* =========================
   Aesthetic V2 - إخفاء الإحصائيات
   ========================= */
.stats {
    display: none;
}
/* =========================
   Aesthetic V2 - إصلاح تمرير المودال
   ========================= */
/* نقل التمرير للداخل بدون blur */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  overflow: hidden;
  background-color: rgba(0, 0, 0, 0.85);
  animation: fadeIn 0.3s ease;
}

.modal.active {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 2rem 1rem;
}

.modal-content {
  max-width: 800px;
  width: 100%;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  position: relative;
  margin: 2rem auto;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.3);
  animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  padding: 1.5rem;
  border-radius: 24px 24px 0 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}

.product-modal-image {
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 16px;
  margin-bottom: 2rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

/* Dark Mode في Modal */
body.dark-mode .modal {
  background-color: rgba(0, 0, 0, 0.95);
}

body.dark-mode .modal-content,
body.dark-mode .modal-header {
  background: #2d2d2d;
  color: #f5f5f7;
}

/* استجابة للهواتف */
@media (max-width: 768px) {
  .modal.active {
    padding: 1rem;
  }

  .modal-content {
    margin: 1rem auto;
    max-height: calc(100vh - 2rem);
  }

  .modal-header {
    padding: 1rem;
    border-radius: 16px 16px 0 0;
  }
}

@media (max-width: 480px) {
  .modal.active {
    padding: 0.5rem;
  }

  .modal-content {
    border-radius: 16px;
  }
}