@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;
}

/* ✅ استغلال كامل الشاشة على الهواتف */
@media (max-width: 768px) {
    body {
        padding: 0.5rem;
    }
    
    .container {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0.25rem;
    }
    
    .container {
        padding: 5px;
    }
}

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;
}

/* ✅ تقليل الهوامش في الهيدر على الهواتف */
@media (max-width: 480px) {
    header {
        padding: 2rem 0.75rem;
        margin-bottom: 1rem;
        border-radius: 16px;
    }
}

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;
    }
}

/* ✅ استغلال كامل العرض للفئات على الهواتف */
@media (max-width: 480px) {
    .categories-filter {
        margin: 1rem -0.25rem;
        padding: 0.5rem 0.25rem;
    }
}

.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;
}

/* ✅ تحسين Stats على الهواتف */
@media (max-width: 480px) {
    .stats {
        gap: 0.75rem;
        margin-bottom: 1rem;
    }
    
    .stat-item {
        padding: 0.75rem 1.25rem;
        border-radius: 12px;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .stat-label {
        font-size: 0.8rem;
    }
}

.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;
}

/* ✨ إشعار توضيحي للتقسيط */
.installment-info-banner {
    max-width: 800px;
    margin: 2rem auto;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, rgba(0, 113, 227, 0.08), rgba(0, 119, 237, 0.08));
    border: 2px solid rgba(0, 113, 227, 0.2);
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 4px 15px rgba(0, 113, 227, 0.1);
}

/* 📄 بطاقة الوثائق المطلوبة */
.documents-card {
    max-width: 800px;
    margin: 1.5rem auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border: 1px solid #d2d2d7;
    overflow: hidden;
}

.documents-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, rgba(0, 113, 227, 0.05), rgba(0, 119, 237, 0.03));
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.documents-header:hover {
    background: linear-gradient(135deg, rgba(0, 113, 227, 0.08), rgba(0, 119, 237, 0.05));
}

.documents-icon {
    font-size: 1.75rem;
    flex-shrink: 0;
}

.documents-title {
    flex: 1;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.documents-arrow {
    color: var(--primary);
    font-size: 0.9rem;
    transition: transform 0.3s ease;
}

.documents-card.expanded .documents-arrow {
    transform: rotate(180deg);
}

.documents-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, padding 0.4s ease-out;
    padding: 0 1.5rem;
}

.documents-card.expanded .documents-content {
    max-height: 1200px;
    padding: 1.5rem;
}

.documents-section {
    margin-bottom: 1.5rem;
}

.documents-section.special {
    background: rgba(255, 193, 7, 0.05);
    border: 1px solid rgba(255, 193, 7, 0.2);
    border-radius: 12px;
    padding: 1rem;
}

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

.documents-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.document-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.65rem 0;
    border-bottom: 1px dashed rgba(0, 0, 0, 0.08);
}

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

.document-item.required .doc-text {
    font-weight: 600;
    color: var(--text-primary);
}

.document-item.optional .doc-text {
    color: var(--text-secondary);
}

.doc-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.doc-text {
    flex: 1;
    line-height: 1.5;
    font-size: 0.95rem;
}

.documents-note {
    background: linear-gradient(135deg, rgba(0, 113, 227, 0.05), rgba(0, 119, 237, 0.03));
    border: 1px solid rgba(0, 113, 227, 0.15);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-top: 1rem;
}

.note-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.documents-note p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Dark Mode للوثائق */
body.dark-mode .documents-card {
    background: #2d2d2d;
    border-color: #3d3d3d;
}

body.dark-mode .documents-header {
    background: linear-gradient(135deg, rgba(0, 113, 227, 0.12), rgba(0, 119, 237, 0.08));
}

body.dark-mode .documents-header:hover {
    background: linear-gradient(135deg, rgba(0, 113, 227, 0.18), rgba(0, 119, 237, 0.12));
}

body.dark-mode .documents-section.special {
    background: rgba(255, 193, 7, 0.1);
    border-color: rgba(255, 193, 7, 0.3);
}

body.dark-mode .documents-note {
    background: linear-gradient(135deg, rgba(0, 113, 227, 0.12), rgba(0, 119, 237, 0.08));
    border-color: rgba(0, 113, 227, 0.25);
}

body.dark-mode .document-item {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

/* استجابة للهواتف */
@media (max-width: 768px) {
    .documents-card {
        margin: 1rem auto;
    }
    
    .documents-header {
        padding: 1rem;
    }
    
    .documents-title {
        font-size: 1rem;
    }
    
    .documents-card.expanded .documents-content {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .documents-card {
        margin: 0.75rem auto;
        border-radius: 12px;
    }
    
    .documents-header {
        padding: 0.85rem;
        gap: 0.75rem;
    }
    
    .documents-icon {
        font-size: 1.5rem;
    }
    
    .documents-title {
        font-size: 0.9rem;
    }
    
    .doc-text {
        font-size: 0.85rem;
    }
}

.info-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.installment-info-banner p {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.6;
}

.installment-info-banner strong {
    color: var(--primary);
}

/* Dark Mode للإشعار */
body.dark-mode .installment-info-banner {
    background: rgba(0, 113, 227, 0.15);
    border-color: rgba(0, 113, 227, 0.3);
}

/* استجابة للهواتف */
@media (max-width: 768px) {
    .installment-info-banner {
        padding: 0.8rem 1rem;
        font-size: 0.8rem;
        gap: 0.75rem;
    }
    
    .info-icon {
        font-size: 1.2rem;
    }
    
    .installment-info-banner p {
        font-size: 0.8rem;
        line-height: 1.5;
    }
}

@media (max-width: 480px) {
    .installment-info-banner {
        padding: 0.7rem 0.75rem;
        margin: 1rem auto;
        gap: 0.6rem;
        border-radius: 12px;
    }
    
    .info-icon {
        font-size: 1.1rem;
    }
    
    .installment-info-banner p {
        font-size: 0.75rem;
    }
    
    /* ✅ استغلال كامل عرض الشاشة */
    .search-container {
        margin: 1.5rem 0;
        padding: 0;
    }
}

/* ✨ أقساط سريعة على البطاقة */
.quick-installments-preview {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed rgba(0, 113, 227, 0.2);
    background: rgba(0, 113, 227, 0.02);
    padding: 0.75rem 0.5rem 0.5rem 0.5rem;
    border-radius: 8px;
    margin-left: -0.5rem;
    margin-right: -0.5rem;
}

.installment-preview-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0.5rem;
    font-size: 0.9rem;
}

.installment-preview-label {
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

.installment-preview-value {
    color: var(--primary);
    font-weight: 700;
    white-space: nowrap;
}

/* Dark Mode للأقساط السريعة */
body.dark-mode .quick-installments-preview {
    border-top-color: rgba(0, 113, 227, 0.3);
    background: rgba(0, 113, 227, 0.08);
}

.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: 900px;
    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;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

@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;
    overflow-y: auto;
    max-height: calc(100vh - 120px);
    scroll-behavior: smooth;
}

.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-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.4fr);
    gap: 1.75rem;
    align-items: flex-start;
}

.modal-main-column {
    border-radius: 18px;
    background: linear-gradient(135deg, #f5f5f7 0%, #e5e5e7 100%);
}

.modal-side-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cart-actions {
    margin-top: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cart-actions-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.cart-actions .input-group {
    margin-bottom: 0;
}

.quantity-input {
    max-width: 110px;
}

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

    .modal-main-column {
        order: 1;
    }

    .modal-side-column {
        order: 2;
    }
}

/* ✅ اسم المنتج كامل في Modal */
.modal-product-name {
    font-size: 26px;
    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: 1.5rem;
    border-radius: 16px;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(0, 113, 227, 0.1);
    position: relative;
}

/* شارة نوع المنتج (هاتف أو جهاز) */
.product-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.product-type-badge.phone {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.product-type-badge.device {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
}

.installment-method-note {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    line-height: 1.5;
}

.installment-method-note.phone {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #047857;
}

.installment-method-note.device {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    color: #4338ca;
}

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

.cash-price-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
    font-weight: 500;
}

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

.installment-quick-summary {
    margin-top: 0.75rem;
    font-size: 1rem;
    color: var(--text-secondary);
}

.installment-quick-summary strong {
    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: 1.5rem;
    border-radius: 16px;
}

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

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

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

.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: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(0, 113, 227, 0.08), rgba(0, 119, 237, 0.08));
    border-radius: 12px;
    text-align: center;
    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: 0.95rem;
    margin-bottom: 0.4rem;
}

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

/* ✨ زر إضافة للسلة مباشرة بعد النتيجة */
.add-to-cart-section {
    margin-top: 1rem;
}

.add-to-cart-btn {
    width: 100%;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    padding: 1rem;
    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(16, 185, 129, 0.3);
    position: relative;
    overflow: hidden;
    transform: translateZ(0);
    will-change: transform;
}

.add-to-cart-btn:hover {
    transform: translateZ(0) translateY(-2px);
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.4);
    background: linear-gradient(135deg, #059669, #047857);
}

.add-to-cart-btn.is-added {
    background: linear-gradient(135deg, #0071e3, #0077ED);
    animation: successPulse 0.5s ease;
}

@keyframes successPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

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

.specs-title {
    font-size: 1.1rem;
    font-weight: 600;
    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: 0;
        max-width: 100%;
        border-radius: 24px 24px 0 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
    }

    .modal {
        align-items: flex-end;
        padding: 0;
    }

    .modal-body {
        padding: 1rem 1.25rem 1.25rem 1.25rem;
        max-height: calc(100vh - 80px);
        overflow-y: auto;
    }

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

    .quick-installments {
        grid-template-columns: 1fr;
    }
    
    .modal-product-name {
        font-size: 20px;
    }
    
    .cash-price-value {
        font-size: 1.4rem;
    }
    
    .custom-calculator {
        padding: 1.25rem;
    }
    
    .calculator-title {
        font-size: 1rem;
    }
    
    .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;
    }
    
    .custom-result {
        padding: 0.85rem;
    }
    
    .custom-result-value {
        font-size: 1.5rem;
    }
    
    .add-to-cart-btn {
        padding: 0.9rem;
        font-size: 1rem;
    }
    
    .specs-section {
        padding: 1.25rem;
        margin-top: 1.25rem;
    }
    
    .specs-title {
        font-size: 1rem;
    }
    
    /* ✅ تحسين عرض الأقساط على التابلت */
    .product-name {
        font-size: 15px;
    }
    
    .product-price {
        font-size: 1.6rem;
    }
    
    .installment-preview-item {
        font-size: 0.8rem;
        padding: 0.35rem 0;
    }
    
    .installment-preview-label {
        font-size: 0.8rem;
    }
    
    .installment-preview-value {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem; /* ✅ تقليل الفجوة لاستغلال المساحة */
        padding: 0; /* ✅ إزالة الهوامش الجانبية */
    }

    .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;
        margin-bottom: 1rem;
    }
    
    .modal-product-name {
        font-size: 18px;
        margin-bottom: 1rem;
    }
    
    .price-section {
        padding: 1.25rem;
        margin-bottom: 1rem;
    }
    
    .cash-price-value {
        font-size: 1.3rem;
    }
    
    .custom-calculator {
        padding: 1rem;
    }
    
    .calculator-title {
        font-size: 0.95rem;
    }
    
    .custom-result-value {
        font-size: 1.4rem;
    }
    
    .add-to-cart-btn {
        padding: 0.85rem;
        font-size: 0.95rem;
    }
    
    .specs-section {
        padding: 1rem;
        margin-top: 1rem;
    }
    
    .specs-title {
        font-size: 0.95rem;
    }
    
    .specs-list li {
        font-size: 0.85rem;
        padding: 0.6rem 0;
    }
    
    /* ✅ تحسين جذري للأقساط على الهواتف */
    .product-details {
        padding: 0.9rem;
    }
    
    .product-name {
        font-size: 12.5px;
        margin-bottom: 0.4rem;
        line-height: 1.3;
        font-weight: 600;
    }
    
    .product-price {
        font-size: 1.3rem;
        margin-bottom: 0.1rem;
    }
    
    .price-label {
        font-size: 0.7rem;
        margin-bottom: 0.2rem;
    }
    
    /* ✨ تصميم مدمج وأنيق للأقساط على الهواتف */
    .quick-installments-preview {
        margin-top: 0.4rem;
        padding: 0.4rem 0.4rem 0.3rem 0.4rem;
        border-radius: 6px;
        margin-left: -0.4rem;
        margin-right: -0.4rem;
        background: rgba(0, 113, 227, 0.04);
        border-top: 1px solid rgba(0, 113, 227, 0.12);
    }
    
    .installment-preview-item {
        font-size: 0.68rem;
        padding: 0.2rem 0.3rem;
        line-height: 1.3;
    }
    
    .installment-preview-label {
        font-size: 0.68rem;
        font-weight: 500;
    }
    
    .installment-preview-value {
        font-size: 0.7rem;
        font-weight: 700;
    }
}

/* ✨ للهواتف الصغيرة جداً (مثل iPhone SE) */
@media (max-width: 375px) {
    body {
        padding: 0.15rem;
    }
    
    .container {
        padding: 3px;
    }
    
    .products-grid {
        gap: 0.4rem; /* ✅ فجوة أصغر لاستغلال المساحة */
        padding: 0;
    }
    
    .product-details {
        padding: 0.65rem;
    }
    
    .product-name {
        font-size: 11.5px;
        margin-bottom: 0.3rem;
    }
    
    .product-price {
        font-size: 1.2rem;
    }
    
    .price-label {
        font-size: 0.65rem;
    }
    
    .quick-installments-preview {
        padding: 0.3rem 0.3rem 0.2rem 0.3rem;
        margin-top: 0.3rem;
    }
    
    .installment-preview-item {
        font-size: 0.65rem;
        padding: 0.15rem 0.2rem;
    }
    
    .installment-preview-label {
        font-size: 0.65rem;
    }
    
    .installment-preview-value {
        font-size: 0.68rem;
    }
    
    header {
        padding: 1.5rem 0.5rem;
        margin-bottom: 0.75rem;
        border-radius: 12px;
    }
    
    .categories-filter {
        margin: 0.75rem -0.15rem;
    }
}

.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 .product-type-badge.phone {
  background: linear-gradient(135deg, #059669, #047857);
}

body.dark-mode .product-type-badge.device {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
}

body.dark-mode .installment-method-note.phone {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

body.dark-mode .installment-method-note.device {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
}

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;
}

/* Dark Mode لزر إضافة للسلة */
body.dark-mode .add-to-cart-btn {
    background: linear-gradient(135deg, #10b981, #059669);
}

body.dark-mode .add-to-cart-btn:hover {
    background: linear-gradient(135deg, #059669, #047857);
}

body.dark-mode .add-to-cart-btn.is-added {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}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 }
}

/* زر واتساب عائم للتواصل السريع */
.whatsapp-float {
    position: fixed;
    bottom: 90px;
    left: 20px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background-color: #25D366;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    z-index: 10003;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.whatsapp-float:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 14px 30px rgba(0,0,0,0.35);
}

body.dark-mode .whatsapp-float {
    box-shadow: 0 10px 25px rgba(0,0,0,0.6);
}

/* نافذة منبثقة لاختيار رقم الواتساب */
.whatsapp-modal {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 10005;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.3s ease;
}

.whatsapp-modal-content {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

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

.whatsapp-modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    text-align: center;
}

.whatsapp-numbers {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.whatsapp-number-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, rgba(37, 211, 102, 0.08), rgba(37, 211, 102, 0.05));
    border: 2px solid rgba(37, 211, 102, 0.2);
    border-radius: 16px;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.whatsapp-number-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(37, 211, 102, 0.3);
    border-color: #25D366;
    background: linear-gradient(135deg, rgba(37, 211, 102, 0.15), rgba(37, 211, 102, 0.08));
}

.whatsapp-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
}

.whatsapp-number-info {
    flex: 1;
    text-align: right;
}

.whatsapp-number-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.whatsapp-number-text {
    color: #25D366;
    font-size: 1.25rem;
    font-weight: 700;
    direction: ltr;
}

/* Dark Mode للنافذة المنبثقة */
body.dark-mode .whatsapp-modal {
    background-color: rgba(0, 0, 0, 0.9);
}

body.dark-mode .whatsapp-modal-content {
    background: #2d2d2d;
}

body.dark-mode .whatsapp-modal-title {
    color: #f5f5f7;
}

body.dark-mode .whatsapp-number-card {
    background: linear-gradient(135deg, rgba(37, 211, 102, 0.15), rgba(37, 211, 102, 0.08));
    border-color: rgba(37, 211, 102, 0.3);
}

body.dark-mode .whatsapp-number-card:hover {
    background: linear-gradient(135deg, rgba(37, 211, 102, 0.25), rgba(37, 211, 102, 0.15));
}

/* استجابة للهواتف */
@media (max-width: 480px) {
    .whatsapp-modal-content {
        padding: 1.5rem;
    }
    
    .whatsapp-modal-title {
        font-size: 1.25rem;
    }
    
    .whatsapp-number-card {
        padding: 1rem;
    }
    
    .whatsapp-icon {
        font-size: 2rem;
    }
    
    .whatsapp-number-text {
        font-size: 1.1rem;
    }
}

/* =========================
   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;
  }
}