/* ==========================================================================
   Products Styles (product.css) - نالش
   يحتوي على: شبكات العرض، كروت المنتجات بجميع أنواعها، وصفحة تفاصيل المنتج
   ========================================================================== */

/* ----------------------------------
   1. حاويات وشبكات العرض (Grids & Scrollers)
------------------------------------- */
.product-row-container { position: relative; }
.product-row, .horizontal-scroller { 
    display: flex; gap: 15px; overflow-x: auto; padding: 10px 20px 20px; 
    scrollbar-width: none; scroll-snap-type: x mandatory; 
    -webkit-overflow-scrolling: touch; transform: translateZ(0); 
}
.product-row::-webkit-scrollbar, .horizontal-scroller::-webkit-scrollbar { display: none; }
.hero-product-row { display: flex; gap: 20px; overflow-x: auto; padding: 10px 20px 20px; scrollbar-width: none; scroll-snap-type: x mandatory; }
.hero-product-row::-webkit-scrollbar { display: none; }

.product-grid, .store-premium-grid, .ultra-product-grid { 
    display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); 
    gap: 15px; padding: 10px 20px 30px; 
}
.discovery-feed { display: grid; grid-template-columns: repeat(2, 1fr); grid-auto-rows: 150px; gap: 12px; padding: 15px 20px 100px; }
.bento-grid { display: grid; grid-template-columns: repeat(2, 1fr); grid-auto-rows: 180px; gap: 15px; padding: 0 20px 30px; }

/* ----------------------------------
   2. الكرت الافتراضي والمدمج (Compact & Store Item)
------------------------------------- */
.product-card-compact, .store-item-card, .premium-product-card, .ultra-card, .product-list-item {
    background: var(--bg-card); border-radius: 20px; border: none; /* تم التنظيف بناء على طلبك بالملف الأصلي */
    display: flex; flex-direction: column; overflow: hidden; position: relative;
    content-visibility: auto; contain-intrinsic-size: 250px;
    will-change: transform; transition: transform 0.2s ease-out, background-color 0.2s;
}
.product-row .product-card-compact { flex: 0 0 180px; width: 180px; scroll-snap-align: start; }
.horizontal-scroller .product-card-compact, .horizontal-scroller .store-item-card {
    flex: 0 0 calc(43vw) !important; width: calc(43vw) !important; max-width: 180px !important; scroll-snap-align: start;
}

.product-card-compact:active, .store-item-card:active, .premium-product-card:active, .ultra-card:active { 
    transform: scale(0.97) !important; background-color: rgba(0, 0, 0, 0.02) !important; 
}
.dark-mode .product-card-compact:active { background-color: rgba(255, 255, 255, 0.02) !important; }

/* صور الكروت */
.compact-img-wrapper, .sic-img-box, .ppc-img-box, .ultra-img-wrapper {
    width: 100%; aspect-ratio: 1/1; padding-top: 100%; position: relative; background: transparent;
}
.compact-img-wrapper img, .sic-img-box img, .ppc-img-box img, .ultra-img-wrapper img {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 5px; opacity: 1 !important; transform: scale(1) !important;
}
.image-container-wrapper { position: absolute; inset: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.image-container-wrapper i.placeholder-icon { color: var(--text-muted); opacity: 0.3; font-size: 2rem; position: absolute; z-index: 1; }
.image-container-wrapper img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 2; opacity: 1 !important;}

/* تفاصيل الكروت */
.compact-details, .sic-details, .ppc-details, .ultra-card-body { 
    padding: 12px; display: flex; flex-direction: column; flex: 1; 
}
.compact-category, .sic-cat, .ppc-category, .ultra-card-cat { 
    font-size: 0.75rem; color: var(--primary); font-weight: 800; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; 
}
.compact-name, .sic-name, .ppc-title, .ultra-card-title { 
    font-size: 0.95rem; font-weight: 900; line-height: 1.3; margin-bottom: auto; 
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--text-main);
}
.compact-department { font-size: 0.8rem; font-weight: 700; color: var(--primary); margin-bottom: 2px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compact-merchant { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compact-desc { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.4; }

/* فوتر السعر والزر في الكروت */
.modern-card-footer, .sic-footer, .ppc-footer, .ultra-card-footer { 
    display: flex; justify-content: space-between; align-items: flex-end; margin-top: auto; padding-top: 12px; width: 100%; 
}
.modern-price-box, .sic-price-box, .ppc-price-area, .ultra-price-box { display: flex; flex-direction: column; justify-content: center; }
.modern-price-current, .sic-price, .ppc-price, .ultra-current-price, .compact-price { 
    font-size: 1.25rem; font-weight: 900; color: var(--text-main); display: flex; align-items: baseline; gap: 4px; line-height: 1;
}
.modern-price-current small, .ppc-price small, .ultra-current-price small { font-size: 0.75rem; font-weight: 700; color: var(--primary); }
.modern-price-old-wrapper { display: flex; align-items: center; gap: 6px; margin-top: 5px; }
.modern-price-old, .sic-old, .ppc-old-price, .ultra-old-price, .compact-old-price { 
    font-size: 0.85rem; text-decoration: line-through; color: var(--text-muted); font-weight: 600; 
}
.modern-discount-tag { background: rgba(244, 63, 94, 0.1); color: var(--danger); font-size: 0.7rem; font-weight: 900; padding: 2px 6px; border-radius: 6px; letter-spacing: 0.5px; }

.modern-add-cart-btn, .sic-add-btn, .ppc-add-btn, .ultra-add-btn {
    width: 42px; height: 42px; border-radius: 14px; background: var(--bg-body); color: var(--primary);
    border: 1.5px solid var(--border); display: flex; justify-content: center; align-items: center; font-size: 1.2rem; cursor: pointer; transition: 0.3s;
}
.modern-add-cart-btn:hover, .ppc-add-btn:hover { background: var(--primary); color: white; border-color: transparent; }

/* ----------------------------------
   3. الكرت الكبير (Hero Card)
------------------------------------- */
.product-card-hero { flex: 0 0 300px; width: 300px; scroll-snap-align: center; background: var(--bg-card); border-radius: 20px; overflow: hidden; position: relative; cursor: pointer; }
.hero-img-wrapper { width: 100%; height: 220px; position: relative; overflow: hidden; }
.hero-img-wrapper img { width: 100%; height: 100%; object-fit: cover; }
.hero-details { padding: 20px; position: relative; z-index: 2; background: linear-gradient(to top, var(--bg-card) 80%, transparent); }
.hero-merchant { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 5px; }
.hero-name { font-size: 1.2rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 12px; }
.hero-price-row { display: flex; align-items: baseline; gap: 10px; }
.hero-price { font-size: 1.6rem; font-weight: 900; color: var(--primary); }
.hero-old-price { font-size: 1.1rem; text-decoration: line-through; color: var(--text-muted); }

/* ----------------------------------
   4. كرت القائمة (List Item)
------------------------------------- */
.product-list-container { display: flex; flex-direction: column; gap: 15px; }
.product-list-item { display: flex; gap: 15px; padding: 15px; cursor: pointer; }
.list-item-img-container { width: 110px; height: 110px; flex-shrink: 0; border-radius: 18px; background: transparent; display: flex; justify-content: center; align-items: center; }
.list-item-img-container img { width: 100%; height: 100%; object-fit: contain; }
.list-item-details { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.list-item-category { font-size: 0.85rem; font-weight: 700; color: var(--primary); margin-bottom: 3px; }
.list-item-merchant { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 5px; }
.list-item-name { font-weight: 800; font-size: 1.15rem; margin-bottom: 5px; line-height: 1.3; }
.list-item-desc { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.list-item-footer { margin-top: auto; display: flex; justify-content: space-between; align-items: center; }
.list-item-price { font-size: 1.3rem; font-weight: 900; color: var(--text-main); }
.list-item-old-price { font-size: 0.95rem; text-decoration: line-through; color: var(--text-muted); margin-left: 8px; font-weight: 500; }

/* ----------------------------------
   5. شارات الخصم والأزرار العائمة
------------------------------------- */
.discount-badge, .sic-discount, .ppc-discount, .ultra-discount { 
    position: absolute; top: 10px; right: 10px; background: var(--danger); color: white; 
    padding: 4px 10px; font-size: 0.75rem; font-weight: 900; z-index: 5; border-radius: 8px; 
}
.card-actions-container { position: absolute; top: 12px; left: 12px; z-index: 5; display: flex; flex-direction: column; gap: 8px; }
.action-btn { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.9); border: none; cursor: pointer; font-size: 1.1rem; }
.dark-mode .action-btn { background: rgba(30,41,59,0.9); }
.fav-btn { color: var(--text-muted); }
.fav-btn.active { color: var(--danger); }
.share-btn { color: var(--primary); }
.list-item-footer .card-actions-container { position: static; flex-direction: row; }
.list-item-footer .action-btn { transform: scale(0.9); }

/* ----------------------------------
   6. صفحة تفاصيل المنتج (Product Details Page)
------------------------------------- */
#product-detail-page .page-body { padding: 0; }
.pd-image-container { width: 100%; height: 50vh; background-color: transparent; position: relative; }
.pd-image-container .image-container-wrapper img { object-fit: contain !important; background-color: var(--bg-card); }
.pd-image-container::after { content:''; position:absolute; bottom:0; left:0; width:100%; height:30%; background: linear-gradient(to top, var(--bg-body), transparent); z-index:3; }
.pd-content { padding: 30px 25px; background: var(--bg-body); border-top-left-radius: 30px; border-top-right-radius: 30px; margin-top: -30px; position: relative; z-index: 4; }
#pd-name { font-size: 2.2rem; font-weight: 900; line-height: 1.3; margin-bottom: 10px; }
#pd-price { font-size: 2rem; font-weight: 900; color: var(--primary); display:block; margin-bottom: 20px; }
#pd-desc { color: var(--text-muted); font-size: 1.1rem; line-height: 1.8; margin: 20px 0; }
.option-chip { display: inline-block; padding: 10px 20px; margin: 0 0 10px 10px; border: 2px solid var(--border); border-radius: 12px; cursor: pointer; font-weight: 700; background: var(--bg-card); }
.option-chip.selected { border-color: var(--primary); background: rgba(79,70,229,0.1); color: var(--primary); }
.related-products-section { padding: 30px 0; background: var(--bg-body); }
.related-products-section h3 { font-size: 1.6rem; font-weight:900; padding: 0 25px 20px 25px; }

/* ----------------------------------
   7. تأثير التحميل (Skeletons)
------------------------------------- */
.skeleton-card, .store-skeleton { 
    background: var(--bg-card); border-radius: 20px; border: none; height: 280px; position: relative; overflow: hidden; 
}
.skeleton-card::after, .store-skeleton::after {
    content: ""; position: absolute; inset: 0; transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
    animation: skeleton-loading 1.5s infinite;
}
@keyframes skeleton-loading { 100% { transform: translateX(100%); } }

/* ----------------------------------
   8. كروت بينتو السريعة (Bento / Fast Card)
------------------------------------- */
.fast-card { background: var(--bg-card); border-radius: 20px; overflow: hidden; position: relative; display: flex; flex-direction: column; contain: content; content-visibility: auto; will-change: transform; border: none; }
.card-standard { grid-column: span 1; grid-row: span 2; }
.card-wide { grid-column: span 2; grid-row: span 1; flex-direction: row; }
.card-wide .card-img-box { width: 40%; height: 100%; border-radius: 0; }
.card-wide .card-info { width: 60%; justify-content: center; }
.card-img-box { width: 100%; height: 60%; position: relative; background: transparent; }
.card-img-box img { width: 100%; height: 100%; object-fit: contain; }
.card-info { padding: 10px; flex: 1; display: flex; flex-direction: column; justify-content: space-between; }
.card-title { font-size: 0.95rem; font-weight: 900; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-price { font-size: 1.15rem; font-weight: 900; color: var(--primary); }

.bento-card { position: relative; border-radius: 24px; overflow: hidden; background: var(--bg-card); border: none; display: flex; flex-direction: column; }
.bento-card.large { grid-column: span 2; grid-row: span 2; }
.bento-card.tall { grid-row: span 2; }
.bento-card.wide { grid-column: span 2; }
.bento-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.bento-overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.2) 50%, transparent 100%); z-index: 2; }
.bento-content { position: absolute; bottom: 0; left: 0; right: 0; padding: 15px; z-index: 3; display: flex; flex-direction: column; gap: 5px; }
.bento-store { font-size: 0.75rem; color: #fff; background: rgba(255,255,255,0.2); backdrop-filter: blur(5px); padding: 4px 10px; border-radius: 50px; width: fit-content; font-weight: 800; }
.bento-title { color: white; font-size: 1.1rem; font-weight: 900; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bento-card.large .bento-title { font-size: 1.5rem; }
.bento-price-row { display: flex; justify-content: space-between; align-items: center; margin-top: 5px; }
.bento-price { color: var(--accent); font-size: 1.2rem; font-weight: 900; }
.bento-btn { background: var(--primary); color: white; width: 35px; height: 35px; border-radius: 50%; display: flex; justify-content: center; align-items: center; border: none; }

/* ----------------------------------
   9. الشاشات الكبيرة (Desktop Adjustments)
------------------------------------- */
@media (min-width: 576px) {
    .horizontal-scroller .product-card-compact, .horizontal-scroller .store-item-card { flex: 0 0 calc(30vw) !important; width: calc(30vw) !important; max-width: 200px !important; }
}
@media (min-width: 768px) {
    .product-grid, .store-premium-grid, .ultra-product-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important; gap: 20px; padding: 20px 40px !important; }
    .horizontal-scroller .product-card-compact, .horizontal-scroller .store-item-card { flex: 0 0 220px !important; width: 220px !important; max-width: 220px !important; }
    .product-card-hero { flex: 0 0 350px !important; width: 350px !important; }
    .bento-grid { grid-template-columns: repeat(4, 1fr); grid-auto-rows: 250px; }
    .discovery-feed { grid-template-columns: repeat(4, 1fr); grid-auto-rows: 200px; gap: 16px; }
}