/* =========================================
   MixShop DZ - Index Page Styles
   Page-only: hero slider, filters/search, product grid.
   Shared styles (vars, reset, header, cart, toast, footer) live in shared.css.
========================================= */

/* ==================== HERO ==================== */
.hero { position: relative; background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); padding: 50px 0 80px; overflow: hidden; }
.hero::before { content: ''; position: absolute; inset: 0; background-image: url("data:image/svg+xml,%3Csvg width='50' height='50' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='25' y1='20' x2='25' y2='30' stroke='rgba(255,255,255,0.12)' stroke-width='2' stroke-linecap='round'/%3E%3Cline x1='20' y1='25' x2='30' y2='25' stroke='rgba(255,255,255,0.12)' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); z-index: 1; }
.carousel { max-width: 1000px; margin: 0 auto; position: relative; min-height: 280px; display: flex; align-items: center; padding: 0 50px; z-index: 2; overflow: hidden; }
.slide-content { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 50px; position: relative; transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.6s ease-in-out; }
.slide-content.slide-exit-left { transform: translateX(-40px); opacity: 0; }
.slide-content.slide-exit-right { transform: translateX(40px); opacity: 0; }
.slide-content.slide-enter-prep-left { transition: none; transform: translateX(-40px); opacity: 0; }
.slide-content.slide-enter-prep-right { transition: none; transform: translateX(40px); opacity: 0; }

.hero-img-frame { position:relative; width:280px; height:280px; flex-shrink:0; overflow:hidden; border-radius:20px; background:transparent; isolation:isolate; }
.hero-img-skeleton { position:absolute; inset:0; z-index:1; border-radius:20px; background:linear-gradient(90deg, rgba(255,255,255,.08) 25%, rgba(255,255,255,.20) 50%, rgba(255,255,255,.08) 75%); background-size:200% 100%; animation:hero-shimmer 1.2s linear infinite; opacity:1; pointer-events:none; }
@keyframes hero-shimmer{ from{ background-position:200% 0; } to{ background-position:-200% 0; } }

.slide-content img#hero-img { position:relative; z-index:2; display:block; width:100%; height:100%; object-fit:contain; opacity:0; transform:scale(.98); filter:none; transition: opacity .35s ease, transform .35s ease; background:transparent; backface-visibility:hidden; -webkit-backface-visibility:hidden; }
.slide-content img#hero-img.loaded { opacity:1; transform:scale(1); filter:none; }
.slide-content img#hero-img:hover { transform:scale(1.04) translateY(-4px); }

.slide-text { flex: 1; }
html[dir="rtl"] .slide-text { text-align: right; }
html[dir="ltr"] .slide-text { text-align: left; }
.slide-text h2 { font-size: 34px; margin-bottom: 15px; color: #ffffff; font-weight: 900; line-height: 1.3; }
.prices { display: flex; gap: 15px; align-items: center; flex-wrap: wrap; margin-bottom: 25px; }
.old-price { text-decoration: line-through; color: rgba(255,255,255,0.6); font-size: 18px; font-weight: 600; }
.new-price { font-size: 30px; font-weight: 900; color: #ffffff; }
.discount { background: var(--danger); color: #fff; padding: 5px 15px; border-radius: 20px; font-weight: 800; font-size: 14px; }
.slider-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 45px; height: 45px; background: rgba(255, 255, 255, 0.2); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; z-index: 10; transition: var(--transition); backdrop-filter: blur(5px); }
.slider-arrow:hover { background: rgba(255, 255, 255, 0.4); color: var(--text); }
.arrow-left { left: 10px; }
.arrow-right { right: 10px; }
.hero-wave { position: absolute; bottom: -2px; left: 0; right: 0; height: 40px; background: var(--bg); border-radius: 100% 100% 0 0; transition: background 0.3s; z-index: 2; }

/* ==================== SLIDER DOTS ==================== */
.slider-meta { position: relative; z-index: 3; display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 14px; }
.slider-dots { display: flex; align-items: center; gap: 8px; }

.slider-dot {
    position: relative;
    width: 9px;
    height: 9px;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.35);
    border: none;
    padding: 0;
    cursor: pointer;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease;
    overflow: hidden;
}
.slider-dot:hover { background: rgba(255, 255, 255, 0.6); }

.slider-dot.active {
    width: 34px;
    background: rgba(255, 255, 255, 0.25);
}

.slider-dot.active.running::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--warning);
    transform-origin: left;
    animation-name: dot-fill;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
    animation-duration: var(--dot-dur, 6000ms);
}
html[dir="rtl"] .slider-dot.active.running::after { transform-origin: right; }

@keyframes dot-fill {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

/* ==================== SECTION TITLES & FILTERS ==================== */
.section-main-title { text-align: center; margin: 40px auto 10px; font-size: 28px; font-weight: 900; color: var(--text); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.section-main-title span { font-size: 14px; color: var(--text-light); text-transform: uppercase; font-weight: 700; letter-spacing: 2px; }
.section-main-title::after { content: ''; width: 60px; height: 4px; background: var(--primary); border-radius: 2px; margin-top: 8px; }

.filters { max-width: 1100px; margin: 20px auto 0; padding: 0 20px; }
.search-box-wrap { position: relative; width: 100%; }
.search-bar {
    display: flex;
    align-items: center;
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: 50px;
    padding: 12px 25px;
    gap: 15px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}
.search-bar:focus-within { border-color: var(--primary); box-shadow: var(--shadow-lg); }
.search-bar > i.fa-magnifying-glass { color: var(--primary); font-size: 18px; flex-shrink: 0; }
.search-bar input { flex: 1; min-width: 0; border: none; outline: none; font-size: 16px; background: transparent; color: var(--text); font-family: 'Cairo', sans-serif; font-weight: 600; }
.search-bar input::placeholder { color: var(--text-light); }
.search-clear-btn { color: var(--text-light); font-size: 14px; display: none; cursor: pointer; flex-shrink: 0; }
.search-clear-btn.show { display: block; }
.search-bar-divider { width: 1px; height: 24px; background: var(--border); flex-shrink: 0; }

.filter-toggle-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px; background: var(--bg);
    border: none; border-radius: 50px; padding: 13px 20px; font-weight: 700; font-size: 14px; color: var(--text);
    flex-shrink: 0; transition: var(--transition); position: relative;
}
.filter-toggle-btn:hover, .filter-toggle-btn.active { background: var(--primary); color: #fff; }
.filter-toggle-btn .filter-badge {
    position: absolute; top: -2px; inset-inline-end: -2px; background: var(--danger); color: #fff;
    font-size: 9px; width: 14px; height: 14px; border-radius: 50%; display: none; align-items: center; justify-content: center;
}
.filter-toggle-btn .filter-badge.show { display: flex; }

/* اقتراحات البحث + آخر عمليات البحث */
.search-suggestions {
    position: absolute; top: calc(100% + 8px); left: 0; right: 0;
    background: var(--white); border: 1px solid var(--border); border-radius: 18px;
    box-shadow: var(--shadow-lg); z-index: 20; overflow: hidden;
    max-height: 320px; overflow-y: auto; display: none;
}
.search-suggestions.show { display: block; }
.search-suggestions-label { padding: 10px 18px 4px; font-size: 12px; font-weight: 700; color: var(--text-light); display: flex; align-items: center; justify-content: space-between; }
.search-suggestions-label .clear-recent { color: var(--primary); cursor: pointer; font-weight: 700; }
.suggestion-item { display: flex; align-items: center; gap: 12px; padding: 10px 18px; cursor: pointer; transition: background 0.15s ease; }
.suggestion-item:hover, .suggestion-item.active { background: var(--primary-light); }
.suggestion-item img { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; background: var(--bg); flex-shrink: 0; }
.suggestion-item span { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggestion-item i { color: var(--text-light); font-size: 13px; }

/* لوحة الفلاتر - على شكل شريط أفقي */
.filter-panel {
    max-width: 1100px; margin: 0 auto; padding: 0 20px;
    max-height: 0; overflow: hidden; opacity: 0; transition: max-height 0.35s ease, opacity 0.25s ease, margin 0.35s ease;
}
.filter-panel.show { max-height: 220px; opacity: 1; margin-top: 12px; }
.filter-panel-inner {
    background: var(--white); border: 1px solid var(--border); border-radius: 50px;
    box-shadow: var(--shadow); padding: 10px 22px; display: flex; flex-wrap: wrap; align-items: center; gap: 18px;
}
.filter-field { display: flex; align-items: center; gap: 10px; }
.filter-field label { font-size: 12px; font-weight: 700; color: var(--text-light); white-space: nowrap; }
.filter-price-inputs { display: flex; align-items: center; gap: 8px; }
.filter-price-inputs input {
    width: 90px; padding: 8px 12px; border: 1.5px solid var(--border); border-radius: 50px;
    background: var(--bg); color: var(--text); font-family: 'Cairo', sans-serif; font-weight: 600; font-size: 14px; outline: none;
}
.filter-price-inputs input:focus { border-color: var(--primary); }
.filter-price-inputs span { color: var(--text-light); font-size: 13px; }
.filter-actions { display: flex; gap: 10px; margin-inline-start: auto; }
.filter-apply-btn, .filter-reset-btn {
    padding: 9px 18px; border-radius: 50px; font-weight: 700; font-size: 13px; transition: var(--transition);
}
.filter-apply-btn { background: var(--primary); color: #fff; }
.filter-apply-btn:hover { background: var(--primary-dark); }
.filter-reset-btn { background: var(--bg); color: var(--text-light); border: 1.5px solid var(--border); }
.filter-reset-btn:hover { color: var(--danger); border-color: var(--danger); }
.categories-wrapper { display: flex; gap: 24px; overflow-x: auto; padding: 18px 4px 12px; scrollbar-width: none; cursor: grab; user-select: none; }
.categories-wrapper::-webkit-scrollbar { display: none; }
.categories-wrapper.dragging { cursor: grabbing; scroll-behavior: auto; }
.cat-btn { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 0 0 auto; width: 76px; background: none; border: none; cursor: pointer; color: var(--text-light); font-weight: 500; font-size: 12px; }
.cat-avatar { position: relative; display: inline-flex; }
.cat-circle { width: 54px; height: 54px; border-radius: 50%; overflow: hidden; background: var(--white); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; transition: border-color 0.15s ease, filter 0.2s ease; }
.cat-circle img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(65%); transition: filter 0.2s ease; }
.cat-btn:hover .cat-circle img, .cat-btn.active .cat-circle img { filter: grayscale(0%); }
.cat-circle-all { background: var(--primary); color: #fff; border-color: var(--primary); }
.cat-circle-all svg { width: 24px; height: 24px; }
.cat-label { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-align: center; line-height: 1.25; max-width: 76px; transition: color 0.15s ease; }
.cat-btn:hover .cat-label { color: var(--primary); }
.cat-btn.active .cat-circle { border-color: var(--primary); border-width: 2px; }
.cat-btn.active .cat-circle-all { background: var(--primary); color: #fff; }
.cat-btn.active .cat-label { color: var(--primary); font-weight: 700; }

/* عدد المنتجات داخل كل تصنيف */
.cat-count {
    position: absolute; bottom: -1px; inset-inline-end: -1px; background: var(--text-light); color: #fff;
    font-size: 9px; font-weight: 700; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 50px;
    display: flex; align-items: center; justify-content: center; border: 2px solid var(--bg);
}
.cat-btn.active .cat-count { background: var(--primary); }

/* أنيميشن عند اختيار تصنيف */
@keyframes cat-pop {
    0% { transform: scale(1); }
    40% { transform: scale(0.88); }
    70% { transform: scale(1.08); }
    100% { transform: scale(1); }
}
.cat-btn.active .cat-circle.pop { animation: cat-pop 0.4s cubic-bezier(0.4, 0, 0.2, 1); }

/* ==================== PRODUCT GRID ==================== */
.products { max-width: 1100px; margin: 20px auto 40px; padding: 0 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 25px; }

/* بطاقات هيكلية (Skeleton) أثناء تحميل المنتجات */
.skeleton-card { background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--border); }
.skeleton-img, .skeleton-line {
    background: linear-gradient(90deg, var(--border) 25%, var(--bg) 37%, var(--border) 63%);
    background-size: 400% 100%; animation: skeleton-shimmer 1.4s ease infinite;
}
.skeleton-img { width: 100%; height: 200px; }
.skeleton-line { height: 14px; border-radius: 6px; margin: 14px 15px; }
.skeleton-line.short { width: 55%; }
.skeleton-line.btn { height: 40px; border-radius: 10px; }
@keyframes skeleton-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.product-card { background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: var(--transition); position: relative; display: flex; flex-direction: column; border: 1px solid var(--border); }
.product-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.product-img { height: 240px; overflow: hidden; position: relative; cursor: pointer; background: var(--bg); }
.product-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.product-card:hover .product-img img { transform: scale(1.05); }
.card-arrows { position: absolute; top: 50%; left: 0; right: 0; transform: translateY(-50%); display: flex; justify-content: space-between; padding: 0 10px; opacity: 0; transition: var(--transition); pointer-events: none; z-index: 5; }
.product-card:hover .card-arrows { opacity: 1; }
.card-arrows button { width: 32px; height: 32px; background: rgba(255, 255, 255, 0.9); border: 1px solid var(--border); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--primary); pointer-events: auto; box-shadow: 0 2px 5px rgba(0,0,0,0.15); transition: 0.2s; font-size: 12px; }
.card-arrows button:hover { background: var(--primary); color: white; border-color: var(--primary); }

.product-status-tag { position: absolute; top: 0; padding: 6px 14px; font-size: 13px; font-weight: 800; z-index: 10; display: flex; align-items: center; gap: 6px; color: #FFFFFF !important; box-shadow: 0 4px 10px rgba(0,0,0,0.15); border: none !important; }
html[dir="rtl"] .product-status-tag { left: 0; right: auto; border-radius: 0 0 16px 0; }
html[dir="ltr"] .product-status-tag { right: 0; left: auto; border-radius: 0 0 0 16px; }

.status-warning { background: #EAB308 !important; } 
.status-danger { background: #DC2626 !important; } 
.status-success { background: #16A34A !important; } 

.product-info { padding: 20px; flex: 1; display: flex; flex-direction: column; justify-content: space-between; }
.product-title { font-size: 16px; margin-bottom: 12px; cursor: pointer; font-weight: 800; line-height: 1.4; }
.product-prices { display: flex; gap: 10px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.product-prices .old { text-decoration: line-through; color: var(--text-light); font-size: 14px; font-weight: 600; }
.product-prices .new { font-size: 22px; font-weight: 900; color: var(--primary); }
.discount-badge { background: var(--danger); color: white; padding: 2px 8px; border-radius: 20px; font-size: 12px; font-weight: bold; margin-inline-start: 5px; white-space: nowrap; }

.add-to-cart-btn { width: 100%; padding: 12px; background: var(--primary-light); color: var(--primary); border-radius: 12px; font-weight: 800; font-size: 15px; transition: var(--transition); display: flex; align-items: center; justify-content: center; gap: 8px; }
.add-to-cart-btn:hover:not(:disabled) { background: var(--primary); color: white; }
.add-to-cart-btn:disabled { background: var(--bg); color: var(--text-light); cursor: not-allowed; }

/* ==================== RESPONSIVE (index-only: hero, grid, filters) ==================== */
@media (max-width: 768px) {
    .hero { padding: 30px 0 60px; }
    .carousel { padding: 0 40px; min-height: auto; }

    .slide-content { flex-direction: column !important; align-items: center; text-align: center; gap: 15px; }
    .slide-text { display: contents; }
    html[dir="rtl"] .slide-text, html[dir="ltr"] .slide-text { text-align: center !important; }
    .slide-content h2 { order: 1; font-size: 24px; margin-bottom: 0; width: 100%; }
    .hero-img-frame { order: 2; width: 220px; height: 220px; margin: 0 auto; }
    .slide-content .prices { order: 3; justify-content: center; margin-bottom: 10px; }
    .slide-content .btn-primary { order: 4; margin: 0 auto; width: max-content !important; padding: 12px 30px !important; }

    .products { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 15px; }
    .product-img { height: 180px; }
    
    .product-status-tag { padding: 4px 8px; font-size: 11px; gap: 4px; }
    .product-status-tag svg { width: 12px; height: 12px; }
    
    .product-info { padding: 15px; }
    .product-title { font-size: 14px; }
    
    .product-prices { gap: 5px; margin-bottom: 15px; }
    .product-prices .old { font-size: 12px; }
    .product-prices .new { font-size: 16px; }
    
    .add-to-cart-btn { font-size: 13px; padding: 10px; }
    .slider-arrow { width: 35px; height: 35px; font-size: 14px; }

    .filter-toggle-btn { padding: 8px 10px; font-size: 12px; }
    .filter-toggle-btn span:not(.filter-badge) { display: none; }
    .filter-panel-inner { border-radius: 18px; align-items: stretch; flex-direction: column; padding: 12px 14px; gap: 10px; }
    .filter-field { flex-direction: column; align-items: flex-start; gap: 8px; }
    .filter-price-inputs { width: 100%; }
    .filter-price-inputs input { flex: 1; width: auto; padding: 8px 10px; font-size: 13px; }
    .filter-actions { margin-inline-start: 0; justify-content: flex-end; }
    .filter-actions button { padding: 8px 14px; font-size: 12px; }
    .search-suggestions { max-height: 260px; border-radius: 14px; }

    .discount-badge { padding: 1px 6px; font-size: 10px; border-radius: 20px; }
}

@media (max-width: 380px) {
    .products { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
    .hero-img-frame { width: 170px; height: 170px; }
    .slide-text h2 { font-size: 20px; }
    .new-price { font-size: 24px; }
    
    .product-prices { gap: 4px; }
    .product-prices .old { font-size: 11px; }
    .product-prices .new { font-size: 14px; }

    .filter-panel-inner { padding: 10px 12px; gap: 8px; border-radius: 16px; }
    .filter-field { gap: 6px; }
    .filter-price-inputs input { width: 62px; padding: 6px 8px; font-size: 11px; }
    .filter-apply-btn, .filter-reset-btn { padding: 6px 12px; font-size: 11px; }

    .discount-badge { padding: 1px 5px; font-size: 9px; }
}

/* Default icon styling & smooth transition */
.cat-circle i,
.cat-circle svg {
    font-size: 25px;
    transition: color 0.25s ease, stroke 0.25s ease, transform 0.25s ease;
}

/* Hover state: turn blue (EXCLUDING the "All" button) */
.cat-btn:hover .cat-circle:not(.cat-circle-all) i {
    color: var(--primary, #007bff) !important;
}

.cat-btn:hover .cat-circle:not(.cat-circle-all) svg {
    stroke: var(--primary, #007bff) !important;
    color: var(--primary, #007bff) !important;
}

/* Slight pop scale on hover (EXCLUDING the "All" button) */
.cat-btn:hover .cat-circle:not(.cat-circle-all) i,
.cat-btn:hover .cat-circle:not(.cat-circle-all) svg {
    transform: scale(1.15);
}

/* Force the "All" button icon to always stay white on hover */
.cat-btn:hover .cat-circle-all svg {
    stroke: var(--text-color, #333) !important;
    color: var(--text-color, #333) !important;
}