:root {
    --primary: #6a1b9a;
    --primary-light: #9c27b0;
    --secondary: #ffd700;
    --secondary-light: #ffeb3b;
    --dark: #1a1a1a;
    --light: #ffffff;
    --gray: #f5f5f5;
    --text: #333333;
    --radius: 12px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --transition: all 0.2s ease;
}

[hidden] {
    display: none !important;
}

[data-theme="dark"] {
    --gray: #0f1115;
    --text: #f1f1f1;
    --light: #171a20;
    --shadow: 0 6px 18px rgba(0, 0, 0, .7);
}

* {
    box-sizing: border-box;
    text-decoration: none;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    background-color: var(--gray);
    color: var(--text);
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.app-header {
    border-radius: 0px 0px 20px 20px;
    position: fixed;
    width: 100%;
    background: #6e00ff;
    color: #fff;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    box-shadow: var(--shadow);
    z-index: 1000;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.brand img {
    height: 26px;
}

.brand .back {
    color: #fff;
    text-decoration: none;
}

.icon-btn {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
}

[data-theme="dark"] .icon-btn {
    color: #fff;
}

.search-panel {
    position: fixed !important;
    top: 0px !important;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: var(--shadow);
    padding: 12px;
    z-index: 1000;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.search-panel:not([hidden]) {
    transform: translateY(0);
}

[data-theme="dark"] .search-panel {
    background: var(--light);
}

.search-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: 12px;
    padding: 4px 12px;
    background: #fff;
}

[data-theme="dark"] .search-input-wrap {
    border-color: rgba(255, 255, 255, .08);
    background: #0f1115;
}

.search-input-wrap input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    background: transparent;
    color: var(--text);
}

.search-input-wrap input,
input,
textarea,
select {
    font-size: 16px;
}

.search-input-wrap input::placeholder {
    color: #9aa0a6;
    opacity: .8;
}

.search-input-wrap .icon-btn {
    color: #888;
}

[data-theme="dark"] .search-input-wrap .icon-btn {
    color: #c3c6d1;
}

.content {
    flex: 1;
    padding: 12px 12px 84px;
    max-width: 1900px;
    width: 100%;
    margin: 0 auto;
}

.products-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.products-result-count {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.14), rgba(118, 75, 162, 0.08));
    border: 1px solid rgba(102, 126, 234, 0.22);
    color: var(--dark, #1e2030);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.35;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.1);
    animation: productsResultCountIn 0.28s ease;
}

.products-result-count[hidden] {
    display: none !important;
}

.products-result-count__icon {
    width: 14px;
    height: 14px;
    object-fit: contain;
    flex-shrink: 0;
    opacity: 0.92;
}

.products-result-count__value {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.products-result-count[data-loading="true"] .products-result-count__value {
    opacity: 0.55;
}

[data-theme="dark"] .products-result-count {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.22), rgba(118, 75, 162, 0.12));
    border-color: rgba(102, 126, 234, 0.35);
    color: #e8eaf3;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

@keyframes productsResultCountIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.btn {
    cursor: pointer;
    border: none;
    border-radius: 30px;
    padding: 10px 16px;
    transition: var(--transition);
}

.btn.pill {
    background: var(--secondary);
    color: var(--dark);
    font-weight: 600;
}

.btn.primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

/* ========== حالت گرید معمولی ========== */
.products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
    align-items: start;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.products.loading {
    opacity: 0.7;
}

/* ========== حالت گرید بزرگ ========== */
.products.view-large {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

@media (min-width: 1024px) {
    .products.view-large {
        grid-template-columns: repeat(4, 1fr);
        gap: 24px;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .products.view-large {
        grid-template-columns: repeat(2, 1fr);
        gap: 22px;
    }
}

@media (max-width: 767px) {
    .products.view-large {
        grid-template-columns: 1fr;
        gap: 18px;
    }
    
    .pic-nav {
        display: none !important;
    }
}

/* ========== حالت لیستی - اصلاح شده برای کلاس‌های product-card ========== */
.products--list {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
}

.products--list .product-card {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 12px !important;
    border-radius: var(--radius) !important;
    background: var(--light) !important;
    box-shadow: var(--shadow) !important;
}

/* تصویر محصول */
.products--list .product-card .product-image {
    width: 80px !important;
    min-width: 80px !important;
    max-width: 80px !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 10px !important;
    overflow: hidden !important;
}

.products--list .product-card .product-image img {
    width: 80px !important;
    height: 80px !important;
    object-fit: contain !important;
}

#products.products--list .product-card > .product-image.product__media > img.product__media-img {
    width: 80px !important;
    height: 80px !important;
    max-width: 80px !important;
    max-height: 80px !important;
    aspect-ratio: 1 / 1 !important;
    content-visibility: visible !important;
    contain: none !important;
}

/* مخفی کردن نقطه‌های pagination در حالت لیست */
.products--list .product-card .product-image-pagination {
    display: none !important;
}

/* مخفی کردن المان‌های اضافی */
.products--list .product-card .actions,
.products--list .product-card .meta,
.products--list .product-card .details,
.products--list .product-card .divider,
.products--list .product-card .more-toggle,
.products--list .product-card .more-content,
.products--list .product-card .detail-row,
.products--list .product-card .views,
.products--list .product-card .icon-group,
.products--list .product-card .add-carton,
.products--list .product-card .buy-row:last-child {
    display: none !important;
}

/* بخش اطلاعات محصول */
.products--list .product-card .product-info {
    flex: 1 !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
}

/* کد محصول */
.products--list .product-card .code {
    display: block !important;
    font-size: 11px !important;
    color: #666 !important;
    opacity: 0.7 !important;
}

/* عنوان محصول */
.products--list .product-card .title-row {
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
}

.products--list .product-card .title-row .code {
    display: none !important;
}

.products--list .product-card .title-row .name {
    white-space: normal !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 1.4 !important;
    color: var(--text) !important;
    margin: 0 !important;
}

.products--list .product-card .title-row .name.name-autofit {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: clip !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
}

.product-card .title-row .name.name-autofit {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: clip !important;
    display: block !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
}

/* قیمت */
.products--list .product-card .price {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: var(--primary) !important;
}

/* ردیف خرید */
.products--list .product-card .buy-row:first-child {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0 !important;
    margin: 4px 0 0 0 !important;
    gap: 8px !important;
}

.products--list .product-card .buy-left {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 6px !important;
}

/* باکس تعداد */
.products--list .product-card .qty-box {
    padding: 2px !important;
    gap: 2px !important;
    background: #f8fafc !important;
    border-radius: 6px !important;
    border: 1px solid #e0e0e0 !important;
}

.products--list .product-card .qty-box input {
    width: 35px !important;
    height: 26px !important;
    font-size: 11px !important;
    padding: 0 !important;
}

.products--list .product-card .qty-btn {
    width: 22px !important;
    height: 22px !important;
    font-size: 11px !important;
    border-radius: 5px !important;
}

/* دکمه افزودن به سبد */
.products--list .product-card .add-to-cart {
    padding: 4px 8px !important;
    font-size: 10px !important;
    white-space: nowrap !important;
    min-width: 55px !important;
    height: 28px !important;
}

/* ========== دسکتاپ ========== */
@media (min-width: 769px) {
    .products--list .product-card .product-image {
        width: 90px !important;
        min-width: 90px !important;
    }
    
    .products--list .product-card .product-image img {
        width: 90px !important;
        height: 90px !important;
    }
    
    .products--list .product-card .title-row .name {
        font-size: 15px !important;
    }
    
    .products--list .product-card .price {
        font-size: 14px !important;
    }
}

/* ========== موبایل ========== */
@media (max-width: 768px) {
    .products--list .product-card {
        gap: 2px !important;
        padding: 10px !important;
    }
    
    .products--list .product-card .product-image {
        width: 70px !important;
        min-width: 70px !important;
    }
    
    .products--list .product-card .product-image img {
        width: 70px !important;
        height: 70px !important;
    }
    
    .products--list .product-card .code {
        font-size: 10px !important;
    }
    
    .products--list .product-card .title-row .name {
        font-size: 13px !important;
    }
    
    .products--list .product-card .price {
        font-size: 12px !important;
    }
}

/* ========== موبایل خیلی کوچک ========== */
@media (max-width: 480px) {
    .products--list .product-card {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    
    .products--list .product-card .product-image {
        width: 80px !important;
        min-width: 80px !important;
        margin: 0 auto !important;
    }
    

    
    .products--list .product-card .title-row .name {
        text-align: center !important;
    }
    
    .products--list .product-card .buy-row:first-child {
        flex-direction: column !important;
        gap: 8px !important;
    }
    
    .products--list .product-card .buy-left {
        width: 100% !important;
        justify-content: space-between !important;
    }
    
    .products--list .product-card .add-to-cart {
        width: 100% !important;
    }
}

/* جلوگیری از اعمال view-large روی cart-list */
.cart-list.view-large {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
}

/* Minimal Product Card Design - بدون تغییر */
.product {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid rgba(0, 0, 0, 0.04);
    /* ایزوله‌سازی layout/paint: تغییرات داخلی هر کارت محبوس می‌شود و باعث reflow
       کل لیست نمی‌شود. این برای صفحه‌ی فید با صدها کارت تفاوت محسوسی در روان بودن
       اسکرول و جلوگیری از stutter هنگام append می‌سازد. */
    contain: layout paint style;
}

[data-theme="dark"] .product {
    background: var(--light);
    border-color: rgba(255, 255, 255, 0.04);
}

.product:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.product__media {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: white;
}

.product__media img:not(.shegeftangiz-badge) {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    border-radius: 0;
    background: #f8f9fa;
    backface-visibility: hidden;
    transform-style: preserve-3d;
    box-shadow: none;
    transition: none;
    will-change: auto;
    image-rendering: auto;
}

/* pagination تصاویر محصول (کلاس‌های Swiper) */
.product__media .product-image-pagination.swiper-pagination {
    position: absolute;
    bottom: 8px;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 4;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 0 8px;
    box-sizing: border-box;
    pointer-events: none;
    /* در صفحهٔ rtl، بدون این نقطه‌ها از راست به چپ مرتب می‌شوند */
    direction: ltr;
    unicode-bidi: isolate;
}

.product__media .product-image-pagination .swiper-pagination-bullet {
    pointer-events: auto;
    cursor: pointer;
    flex-shrink: 0;
}

[data-theme="dark"] .product__media .product-image-pagination .swiper-pagination-bullet {
    background: rgba(0, 0, 0, 0.45);
    opacity: 1;
}

[data-theme="dark"] .product__media .product-image-pagination .swiper-pagination-bullet-active {
    background: rgb(0, 0, 0);
}

/* لوگوی مینیمال شگفت‌انگیز در گوشه‌ی بالا-راست تصویر محصول */
.product__media img.shegeftangiz-badge,
.product-image.product__media img.shegeftangiz-badge,
.shegeftangiz-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    left: auto;
    bottom: auto;
    width: 44px;
    height: 44px;
    max-width: 22%;
    max-height: 22%;
    margin: 0;
    object-fit: contain;
    object-position: center;
    z-index: 3;
    pointer-events: none;
    user-select: none;
    opacity: 0.92;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
    background: transparent;
    display: block;
    cursor: default;
    transform: none;
}

@media (max-width: 480px) {
    .shegeftangiz-badge {
        width: 36px;
        height: 36px;
        top: 5px;
        right: 5px;
    }
}

/* در حالت لیست فشرده، نشان را مخفی کن (مشابه pagination) */
.products--list .product-card .shegeftangiz-badge {
    display: none !important;
}

.product__media img:not(.shegeftangiz-badge) {
    transition: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

#products.products--list .product__media img.product__media-img,
#products.view-large:not(.products--list) .product__media img.product__media-img,
#products:not(.products--list) .product__media img.product__media-img {
    content-visibility: visible;
    contain: none;
}

.product__media img.product__media-img {
    contain: layout style paint;
    content-visibility: auto;
}

/* iOS Safari: content-visibility باعث می‌شود IO و lazy-load تصاویر کار نکند */
@supports (-webkit-touch-callout: none) {
    .product__media img.product__media-img {
        content-visibility: visible;
        contain: none;
    }

    #products .product-card {
        content-visibility: visible;
    }
}

@media (min-width: 768px) {
    .product__media img:hover {
        cursor: pointer;
        transform: scale(1.01);
        box-shadow: none;
    }
}

@media (max-width: 767px) {
    .product__media img:not(.shegeftangiz-badge):active {
        transform: scale(0.98);
    }
}

.pic-nav {
    display: none !important;
}

.oos-overlay {
    position: absolute;
    inset: 0;
    background: rgba(26, 26, 26, 0.45);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
    letter-spacing: .5px;
    font-size: 1.05rem;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .18s ease, transform .18s ease;
    pointer-events: none;
}

.product.oos:hover .oos-overlay {
    opacity: 1;
    transform: translateY(0);
    animation: oos-in .18s ease-out forwards, oos-hide 1.5s ease .18s forwards;
}

@keyframes oos-hide {
    0% { opacity: 1; transform: translateY(0); }
    80% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(6px); }
}

@keyframes oos-in {
    0% { opacity: 0; transform: translateY(6px) scale(0.98); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.product__body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #fff;
}

[data-theme="dark"] .product__body {
    background: var(--light);
}

.product__title {
    font-weight: 600;
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    margin: 0;
    min-height: auto;
}

.product__meta {
    font-size: 13px;
    color: var(--text-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

[data-theme="dark"] .product__meta {
    color: #b6bbc6;
}

.product__info {
    font-size: 12px;
    color: #666;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
    margin: 8px 0;
}

[data-theme="dark"] .product__info {
    background: rgba(255, 255, 255, 0.05);
    color: #e0e0e0;
}

.product__info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.product__info-row:last-child {
    margin-bottom: 0;
}

.product__info-label {
    font-weight: 500;
}

.product__info-value {
    font-weight: 600;
}

.product__pricing {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    margin: 8px 0;
}

[data-theme="dark"] .product__pricing {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
}

.pricing-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.pricing-item:last-child {
    margin-bottom: 0;
    border-bottom: none;
}

.pricing-label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.pricing-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
}

.product__actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.action-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.action-input {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 8px;
    text-align: center;
    font-size: 13px;
    background: #fff;
}

.action-button {
    background: var(--secondary);
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-weight: 600;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    color: var(--dark);
}

.action-button:hover {
    background: var(--secondary-light);
    transform: translateY(-1px);
}

.action-button:disabled {
    background: #e0e0e0;
    cursor: not-allowed;
    transform: none;
}

.qty {
    display: flex;
    align-items: center;
    gap: 6px;
}

.qty button {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: none;
    background: var(--gray);
    cursor: pointer;
}

.qty input,
.qty-input {
    width: 70px !important;
    max-width: 100px;
    text-align: center;
    border: none !important;
    border-radius: 5px;
    padding: 4px;
    height: 25px;
    background: #f7f7f7;
}

.qty input[type="number"]::-webkit-outer-spin-button,
.qty input[type="number"]::-webkit-inner-spin-button,
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
    display: none;
}

.qty input[type="number"],
.qty-input {
    -moz-appearance: textfield;
    appearance: textfield;
}

.add-to-cart {
    max-width: 85px;
    font-family: unset;
    flex: 1;
    background: var(--secondary);
    border: none;
    border-radius: 10px;
    padding: 8px 10px;
    font-weight: 600;
    cursor: pointer;
}

.product .product__actions .add-to-cart {
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.product .product__actions .qty .qty-input,
.product .product__actions .qty-input {
    width: 100% !important;
    height: 28px !important;
    padding: 8px 10px !important;
    border-radius: 10px !important;
    text-align: center !important;
    justify-self: center;
}

.empty {
    text-align: center;
    color: #777;
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 20px;
}

.loader {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    padding: 16px;
    color: #666;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 3px solid #eee;
    border-top-color: var(--primary);
    border-radius: 50%;
    display: inline-block;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: #fff;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, .06);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    z-index: 1100;
}

[data-theme="dark"] .bottom-nav {
    background: #1a1b1f;
}

.nav-item {
    position: relative;
    background: transparent;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text);
    text-decoration: none;
}

.nav-item.active,
.nav-item:hover {
    color: var(--primary);
}

/* فیدبک لحظه‌ای هنگام ناوبری فوتر — بدون تغییر ظاهر عادی */
.bottom-nav.is-navigating {
    pointer-events: none;
}
.bottom-nav.is-navigating .nav-item.is-navigating {
    opacity: 0.72;
}

.badge {
    position: absolute;
    top: 6px;
    right: 36%;
    transform: translateX(50%);
    background: var(--primary);
    color: #fff;
    border-radius: 999px;
    font-size: .75rem;
    line-height: 1;
    padding: 4px 6px;
}

.toast-container {
    position: fixed;
    top: 80px;
    left: 0;
    right: 0;
    z-index: 100002;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    padding: 8px 12px;
}

.toast-container .toast {
    pointer-events: auto;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.toast-container .toast:hover {
    transform: translateY(-2px);
}

.toast {
    background: rgba(245, 245, 245, 0.98);
    color: #333;
    padding: 12px 18px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translate3d(0, -12px, 0) scale(0.96);
    animation: toast-in 0.26s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    max-width: 500px;
    width: calc(100% - 32px);
    text-align: center;
    border: 1px solid rgba(0, 0, 0, .1);
    font-weight: 600;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
    will-change: transform, opacity;
    contain: layout style paint;
}

.toast-stock-limit {
    color: #ff4d4f;
    font-weight: 800;
}

[data-theme="dark"] .toast {
    background: rgba(42, 42, 42, 0.98);
    color: #e0e0e0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, .1);
}

@keyframes toast-in {
    0% {
        opacity: 0;
        transform: translate3d(0, -14px, 0) scale(0.94);
    }
    65% {
        opacity: 1;
        transform: translate3d(0, 3px, 0) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

@keyframes toast-out {
    0% {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate3d(0, -10px, 0) scale(0.96);
    }
}

@media (prefers-reduced-motion: reduce) {
    .toast {
        animation: toast-in-reduced 0.01s linear forwards;
    }
}

@keyframes toast-in-reduced {
    from { opacity: 0; }
    to { opacity: 1; transform: none; }
}

.cart-list {
    display: grid;
    gap: 12px;
    padding-bottom: 170px;
}

[data-theme="dark"] .cart-item {
    color: var(--text);
}

.cart-item {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 12px;
    display: grid;
    grid-template-columns: 96px 1fr auto;
    gap: 12px;
    align-items: center;
}

[data-theme="dark"] .cart-item {
    background: var(--light);
}

.cart-item img {
    width: 96px;
    height: 96px;
    object-fit: cover;
    border-radius: 10px;
}

.cart-item .title {
    font-weight: 700;
    color: var(--primary);
    line-height: 1.4;
}

.cart-item .meta {
    color: #666;
    font-size: .9rem;
}

[data-theme="dark"] .cart-item .meta {
    color: #b6bbc6;
}

.cart-item .actions {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    align-items: center;
    gap: 20px;
}

.cart-item .line-total {
    color: #6a00ff !important;
    font-size: .9rem;
    margin-top: 4px;
}

[data-theme="dark"] .cart-item .line-total {
    color: #d7d9df;
}

.cart-item .remove-item {
    background: transparent;
    border: none;
    color: #c62828;
    cursor: pointer;
}

.cart-footer {
    position: fixed;
    bottom: 50px;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, .06);
    padding: 12px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
}

[data-theme="dark"] .cart-footer {
    background: var(--light);
    color: var(--text);
}

.cart-footer .btn.primary {
    padding: 12px 18px;
    border-radius: 12px;
    font-weight: 700;
}

.summary {
    display: grid;
    gap: 6px;
    color: #333;
}

[data-theme="dark"] .summary {
    color: var(--text);
}

.customer-info {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 12px;
    display: grid;
    gap: 12px;
    max-width: 900px;
    margin: 12px auto;
}

[data-theme="dark"] .customer-info {
    background: var(--light);
}

.customer-info>div:first-child {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
}

.customer-info input,
.customer-info textarea {
    font-family: unset;
    width: 100%;
    padding: 12px 14px !important;
    border: 1px solid rgba(0, 0, 0, .12) !important;
    border-radius: 10px !important;
    background: #fff !important;
    color: var(--text) !important;
    outline: none;
    box-shadow: none;
    transition: border-color .15s ease, box-shadow .15s ease;
    line-height: 1.4;
    min-height: 44px;
}

[data-theme="dark"] .customer-info input,
[data-theme="dark"] .customer-info textarea {
    background: transparent !important;
    border: 1px solid rgb(255 255 255 / 62%) !important;
    color: #fff !important;
}

[data-theme="dark"] .customer-info input::placeholder,
[data-theme="dark"] .customer-info textarea::placeholder {
    color: rgb(255 255 255 / 55%) !important;
}

.customer-info input:focus,
.customer-info textarea:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(106, 27, 154, 0.12);
}

.customer-info textarea {
    resize: vertical !important;
    min-height: 96px;
}

#confirmOrder {
    align-self: start;
    justify-self: start;
}

@media (max-width: 600px) {
    .customer-info>div:first-child {
        grid-template-columns: 1fr !important;
    }
    .customer-info {
        padding: 12px;
        margin: 8px 8px 12px;
    }
    .customer-info input,
    .customer-info textarea {
        font-size: 16px;
        min-height: 48px;
        padding: 12px 14px !important;
    }
    .customer-info textarea {
        min-height: 120px;
    }
    #confirmOrder {
        width: 100%;
        padding: 12px 16px;
        font-size: 16px;
        border-radius: 12px;
    }
}

@media (min-width: 600px) and (max-width: 991.98px) {
    .customer-info {
        max-width: 720px;
        padding: 16px;
        gap: 14px;
    }
    .customer-info input,
    .customer-info textarea {
        font-size: 17px;
        min-height: 50px;
        padding: 12px 16px !important;
    }
    .customer-info textarea {
        min-height: 140px;
    }
    #confirmOrder {
        padding: 12px 18px;
        font-size: 17px;
        border-radius: 12px;
    }
}

@media (min-width: 992px) {
    .customer-info {
        max-width: 960px;
        padding: 20px;
        gap: 16px;
    }
    .customer-info>div:first-child {
        gap: 16px !important;
    }
    .customer-info input,
    .customer-info textarea {
        font-size: 18px;
        min-height: 52px;
        padding: 14px 18px !important;
    }
    .customer-info textarea {
        min-height: 160px;
    }
    #confirmOrder {
        padding: 14px 22px;
        font-size: 18px;
        border-radius: 14px;
    }
}

.sentinel {
    height: 1px;
}

@media (min-width: 992px) {
    .products {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 768px) {
    .products {
        grid-template-columns: repeat(2, 1fr);
    }
    .cart-item {
        grid-template-columns: 80px 1fr auto;
        align-items: center;
    }
    .cart-item .actions {
        grid-column: 3;
        justify-content: center;
    }
    .cart-item img {
        width: 80px;
        height: 80px;
    }
    .cart-footer {
        grid-template-columns: 1fr auto;
        bottom: 35px;
    }
    .bottom-nav {
        grid-template-columns: repeat(4, 1fr);
    }
    .nav-item {
        font-size: 0.8rem;
    }
    .nav-item span {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .products {
        grid-template-columns: repeat(2, 1fr);
    }
    .cart-item {
        grid-template-columns: 100px 1fr;
        gap: 8px;
    }
    .cart-item .actions {
        grid-column: 1 / -1;
        justify-content: center;
        margin-top: 0px;
    }
    .cart-item img {
        width: 100px;
        height: 100px;
    }
    .cart-footer {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .bottom-nav {   
        grid-template-columns: repeat(4, 1fr);
        height: 40px;
    }
    .nav-item {
        font-size: 0.7rem;
        gap: 2px;
    }
    .nav-item span {
        font-size: 0.6rem;
    }
    .toast {
        width: 100%;
        border-radius: 8px;
        font-size: 12px;
        padding: 8px 12px;
        max-width: none;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    }
    .toast-container {
        top: 70px;
        padding: 4px 6px;
    }
}

html.theme-transition, html.theme-transition * {
    transition: background-color .35s ease, color .35s ease, border-color .35s ease, box-shadow .35s ease, fill .35s ease, stroke .35s ease !important;
}

html.theme-transition body {
    animation: theme-bloom .35s ease;
}

@keyframes theme-bloom {
    0% { filter: saturate(0.9) brightness(0.98); }
    50% { filter: saturate(1.05) brightness(1.02); }
    100% { filter: saturate(1) brightness(1); }
}

.preorder-section {
    background: linear-gradient(135deg, #f3e5f5, #e1bee7);
    border-radius: 12px;
    padding: 12px;
    border: 2px solid rgba(106, 27, 154, 0.2);
    box-shadow: 0 2px 8px rgba(106, 27, 154, 0.1);
}

.preorder-info {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(106, 27, 154, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(106, 27, 154, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(106, 27, 154, 0);
    }
}

.add-preorder {
    position: relative;
    overflow: hidden;
}

.add-preorder::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.add-preorder:hover::before {
    left: 100%;
}

.add-preorder:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(106, 27, 154, 0.4);
}

.qty-preorder {
    border: 2px solid #6a1b9a;
    background: rgba(106, 27, 154, 0.1);
}

.qty-preorder:focus {
    border-color: #9c27b0;
    box-shadow: 0 0 0 3px rgba(106, 27, 154, 0.2);
    outline: none;
}

  /* ========== مودال سبد خرید (ظاهر هم‌تراز با cart.php) ========== */
    .cart-modal {
      display: none;
      position: fixed;
      inset: 0;
      width: 100%;
      height: 100%;
      height: 100dvh;
      max-height: 100dvh;
      background-color: rgba(0, 0, 0, 0.5);
      z-index: 100000;
      backdrop-filter: blur(4px);
      overflow: hidden;
    }

    .cart-modal.is-open {
      display: block;
    }

    .cart-modal-container {
      --cart-modal-checkout-h: 0px;
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      max-height: 100%;
      background-color: #f5f5f7;
      color: #333;
      font-weight: bold;
      overflow: hidden;
      animation: cartModalSlideIn 0.28s cubic-bezier(0.4, 0, 0.2, 1);
      -webkit-tap-highlight-color: transparent;
    }

    @keyframes cartModalSlideIn {
      from { transform: translateX(100%); }
      to { transform: translateX(0); }
    }

    @media (min-width: 768px) {
      .cart-modal-container {
        width: 680px;
        right: 0;
        left: auto;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
      }
    }

    /* مثل .page در cart.php: کل محتوا با هم اسکرول می‌شود */
    .cart-modal-scroll {
      position: absolute;
      inset: 0;
      overflow-x: hidden;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      overscroll-behavior: contain;
      touch-action: pan-y;
      padding-bottom: calc(var(--cart-modal-checkout-h) + 16px + env(safe-area-inset-bottom, 0px));
      scroll-padding-bottom: calc(var(--cart-modal-checkout-h) + 16px + env(safe-area-inset-bottom, 0px));
    }

    .cart-modal-page-header {
      background: linear-gradient(180deg, #6d00ff 0%, #6a00ff 100%);
      border-radius: 0 0 28px 28px;
      padding: 1px 20px 2px;
      position: relative;
      text-align: center;
    }

    .cart-modal-page-header .header-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: -20px;
      direction: ltr;
    }

    .cart-modal-page-header .header-btn {
      width: 36px;
      height: 36px;
      display: flex;
      align-items: center;
      justify-content: center;
      color: #fff;
      font-size: 20px;
      cursor: pointer;
      background: none;
      border: none;
      text-decoration: none;
      padding: 0;
    }

    .cart-modal-page-header .header-btn--spacer {
      visibility: hidden;
      pointer-events: none;
    }

    .cart-modal-page-header .header-btn i {
      pointer-events: none;
    }

    .cart-modal-page-header .header-center {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 6px;
    }

    .cart-modal-page-header .header-cart-icon {
      font-size: 42px;
      color: #fff;
      line-height: 1;
    }

    .cart-modal-page-header .header-title {
      color: #fff;
      font-size: 17px;
      font-weight: bold;
      letter-spacing: -0.2px;
      margin: 0;
    }

    .cart-modal .cart-search-box {
      padding: 12px 16px 4px;
      background: transparent;
    }

    .cart-modal-filters {
      display: flex;
      gap: 8px;
      padding: 10px 16px 4px;
      background: transparent;
    }

    .cart-modal-filter-btn {
      flex: 1;
      padding: 10px 6px;
      border: 1.5px solid #6a00ff;
      border-radius: 50px;
      background: #fff;
      color: #6a00ff;
      font-family: inherit;
      font-size: 13px;
      font-weight: bold;
      cursor: pointer;
      transition: background 0.15s ease, color 0.15s ease;
      -webkit-tap-highlight-color: transparent;
      touch-action: manipulation;
    }

    .cart-modal-filter-btn.active {
      background: #6a00ff;
      color: #fff;
    }

    .cart-modal-filter-btn:focus-visible {
      outline: 2px solid #6a00ff;
      outline-offset: 2px;
    }

    .cart-modal .cart-search-input {
      width: 100%;
      padding: 10px 14px;
      border: 1.5px solid #e0e0e0;
      border-radius: 50px;
      font-size: 14px;
      font-family: inherit;
      font-weight: bold;
      background: #fff;
      color: #333;
      transition: border-color 0.2s, box-shadow 0.2s;
      box-sizing: border-box;
    }

    .cart-modal .cart-search-input:focus {
      outline: none;
      border-color: #6a00ff;
      box-shadow: 0 0 0 2px rgba(106, 0, 255, 0.12);
    }

    .cart-modal .cart-search-input::placeholder {
      color: #aaa;
      font-weight: normal;
    }

    .cart-modal-body {
      position: relative;
      min-height: 0;
      overflow: visible;
      padding: 0;
    }

    /* مثل checkout-wrap در cart.php — پایین ثابت */
    .cart-modal-footer {
      position: absolute;
      left: 0;
      right: 0;
      bottom: 0;
      z-index: 30;
      background: #fff;
      box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
    }

    .cart-modal-footer[hidden] {
      display: none !important;
    }

    .cart-modal-body::-webkit-scrollbar {
      width: 4px;
    }

    .cart-modal-body::-webkit-scrollbar-track {
      background: #f1f1f1;
    }

    .cart-modal-body::-webkit-scrollbar-thumb {
      background: #888;
      border-radius: 4px;
    }

    .cart-modal .cart-list {
      padding: 18px 16px 0;
      display: flex;
      flex-direction: column;
      gap: 14px;
    }

    .cart-modal .cart-list::after {
      content: '';
      display: block;
      height: 20px;
      flex-shrink: 0;
      pointer-events: none;
    }

    .cart-modal .cart-item {
      background: #fff;
      border-radius: 16px;
      box-shadow: 0 3px 18px rgba(0, 0, 0, 0.07);
      padding: 10px 14px 10px;
      display: grid;
      grid-template-columns: 1fr 125px;
      grid-template-rows: auto auto;
      gap: 0 12px;
      align-items: start;
      direction: ltr;
    }

    .cart-modal .cart-item .item-info {
      grid-column: 1;
      grid-row: 1;
      display: flex;
      flex-direction: column;
      min-height: 125px;
      direction: rtl;
      text-align: right;
    }

    .cart-modal .cart-item .item-image-wrap {
      grid-column: 2;
      grid-row: 1;
      width: 125px;
    }

    .cart-modal .cart-item .item-image {
      width: 115px;
      height: 115px;
      border-radius: 12px;
      object-fit: contain;
      display: block;
      background: #f0f0f2;
    }

    .cart-modal .cart-item .item-title {
      color: #6a00ff;
      font-size: 15px;
      font-weight: bold;
      margin: 0 0 6px;
      line-height: 1.4;
    }

    .cart-modal .cart-item .item-code {
      color: #888;
      font-size: 12px;
      margin: 0 0 4px;
      line-height: 1.4;
    }

    .cart-modal .cart-item .item-carton-qty {
      color: #666;
      font-size: 12px;
      margin: 0 0 8px;
      line-height: 1.4;
    }

    .cart-modal .cart-item .item-carton-qty span {
      font-weight: 600;
      font-variant-numeric: tabular-nums;
    }

    .cart-modal .cart-item .item-unit-price {
      color: #555;
      font-size: 13px;
      margin-bottom: 4px;
      line-height: 1.4;
    }

    .cart-modal .cart-item .item-tier-prices {
      display: flex;
      gap: 4px;
      margin-bottom: 6px;
    }

    .cart-modal .cart-item .item-tier-price {
      display: flex;
      flex-wrap: wrap;
      align-items: baseline;
      gap: 4px;
      font-size: 12.5px;
      line-height: 1.45;
      color: #555;
      opacity: 1;
      padding: 4px 4px;
      border-radius: 8px;
      background: transparent;
      transition: background 0.15s ease;
    }

    .cart-modal .cart-item .item-tier-price.is-active {
      background: #efe8ff;
      font-weight: 700;
    }

    .cart-modal .cart-item .item-tier-price__label {
      flex-shrink: 0;
    }

    .cart-modal .cart-item .item-total-price {
      color: #6a00ff;
      font-size: 15px;
      font-weight: bold;
      margin-top: 4px;
      line-height: 1.4;
    }

    .cart-modal .cart-item .price-label {
      color: #777;
      font-size: 11px;
      margin-bottom: 2px;
    }

    .cart-modal .cart-item .item-preorder-badge {
      display: none;
      color: #f900ff;
      font-size: 13px;
      font-weight: 700;
      margin-top: 4px;
      line-height: 1.4;
    }

    .cart-modal .cart-item[data-type="preorder"] .item-preorder-badge {
      display: inline-block;
    }

    .cart-modal .cart-item .item-total-price--preorder {
      color: #f900ff;
    }

    .cart-modal .cart-item .item-total-price--preorder .price-label,
    .cart-modal .cart-item .item-total-price--preorder .line-total {
      color: #f900ff;
    }

    [data-theme="dark"] .cart-modal .cart-item .item-total-price--preorder,
    [data-theme="dark"] .cart-modal .cart-item .item-total-price--preorder .price-label,
    [data-theme="dark"] .cart-modal .cart-item .item-total-price--preorder .line-total {
      color: #ff6bf5;
    }

    .cart-modal .cart-item .qty-control {
      grid-column: 2;
      grid-row: 2;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
    }

    .cart-modal .cart-item .qty-btn {
      width: 28px;
      height: 28px;
      border: none;
      background: none;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      padding: 0;
    }

    .cart-modal .cart-item .qty-btn.plus {
      color: #2ecc71;
      font-size: 20px;
    }

    .cart-modal .cart-item .qty-btn.minus,
    .cart-modal .cart-item .qty-btn.remove {
      color: #e53935;
      font-size: 17px;
    }

    .cart-modal .cart-item .qty-value {
      width: 32px;
      font-family: inherit;
      font-size: 15px;
      font-weight: bold;
      color: #222;
      text-align: center;
      border: none;
      background: transparent;
      outline: none;
      padding: 2px 0;
      -moz-appearance: textfield;
    }

    .cart-modal .cart-item .qty-value::-webkit-outer-spin-button,
    .cart-modal .cart-item .qty-value::-webkit-inner-spin-button {
      -webkit-appearance: none;
      margin: 0;
    }

    .cart-modal .cart-item .qty-value:focus {
      border-bottom: 1px solid #6a00ff;
    }

    .cart-modal .checkout-wrap {
      position: static;
      bottom: auto;
      z-index: auto;
      background: #fff;
      box-shadow: none;
      padding: 5px 16px calc(5px + env(safe-area-inset-bottom, 0px));
      box-sizing: border-box;
      margin-top: 0;
    }

    .cart-modal .cart-summary {
      display: flex;
      flex-direction: column;
      gap: 4px;
      margin-bottom: 10px;
      font-size: 14px;
      color: #555;
      text-align: right;
      direction: rtl;
    }

    .cart-modal .cart-summary strong {
      color: #6a00ff;
      font-weight: bold;
    }

    .cart-modal .checkout-btn {
      display: block;
      width: 100%;
      background: #6a00ff;
      color: #fff;
      border: none;
      border-radius: 50px;
      padding: 10px 20px;
      font-family: inherit;
      font-size: 14.5px;
      font-weight: bold;
      cursor: pointer;
      box-shadow: 0 4px 16px rgba(106, 0, 255, 0.35);
      transition: background 0.2s, transform 0.15s;
    }

    .cart-modal .checkout-btn:active {
      transform: scale(0.98);
      background: #5a00d9;
    }

    .cart-modal .cart-empty {
      text-align: center;
      padding: 40px 20px;
      color: #888;
      font-size: 14px;
      margin: 0;
    }

    .cart-modal .cart-item.removing {
      opacity: 0;
      transform: scale(0.95);
      transition: opacity 0.25s, transform 0.25s;
    }

    .spinner {
      display: inline-block;
      width: 40px;
      height: 40px;
      border: 3px solid #e0e0e0;
      border-top-color: #6a00ff;
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
    }

    @keyframes spin {
      to { transform: rotate(360deg); }
    }

    .cart-loading {
      text-align: center;
      padding: 60px 20px;
    }

    .cart-loading div {
      margin-top: 15px;
      color: #666;
    }

    .custom-toast {
      position: fixed;
      bottom: 100px;
      left: 50%;
      transform: translate3d(-50%, 12px, 0);
      background: #333;
      color: white;
      padding: 10px 20px;
      border-radius: 12px;
      font-size: 13px;
      z-index: 100001;
      opacity: 0;
      transition: opacity 0.18s ease, transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
      white-space: normal;
      max-width: min(420px, calc(100vw - 24px));
      width: max-content;
      text-align: center;
      line-height: 1.45;
      word-break: break-word;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
      will-change: transform, opacity;
    }

    .custom-toast .toast-stock-limit {
      color: #ffd6d6;
      font-weight: 800;
    }

    .custom-toast.show {
      opacity: 1;
      transform: translate3d(-50%, 0, 0);
    }

    @media (max-width: 480px) {
      .custom-toast {
        left: 12px;
        right: 12px;
        bottom: calc(72px + env(safe-area-inset-bottom, 0px));
        width: auto;
        max-width: none;
        transform: translate3d(0, 12px, 0);
        font-size: 12px;
        padding: 10px 14px;
        border-radius: 10px;
      }
      .custom-toast.show {
        transform: translate3d(0, 0, 0);
      }
      body.keyboard-open .custom-toast {
        bottom: calc(132px + env(safe-area-inset-bottom, 0px));
      }
    }

    /* دارک مود — مودال سبد خرید */
    [data-theme="dark"] .cart-modal-container {
      background-color: var(--gray, #0f1115);
      color: var(--text, #f1f1f1);
    }

    [data-theme="dark"] .cart-modal-footer,
    [data-theme="dark"] .cart-modal .checkout-wrap {
      background: var(--light, #171a20);
    }

    [data-theme="dark"] .cart-modal .cart-search-input {
      background: var(--light, #171a20);
      border-color: #3d4454;
      color: var(--text, #f1f1f1);
    }

    [data-theme="dark"] .cart-modal-filter-btn {
      background: var(--light, #171a20);
      color: #b794f6;
      border-color: #8b5cf6;
    }

    [data-theme="dark"] .cart-modal-filter-btn.active {
      background: #6a00ff;
      color: #fff;
      border-color: #6a00ff;
    }

    [data-theme="dark"] .cart-modal .cart-search-input::placeholder {
      color: #9ca3af;
    }

    [data-theme="dark"] .cart-modal .cart-search-input:focus {
      border-color: #8b5cf6;
      box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
    }

    [data-theme="dark"] .cart-modal-body::-webkit-scrollbar-track {
      background: #1a1d26;
    }

    [data-theme="dark"] .cart-loading div,
    [data-theme="dark"] .cart-modal .cart-empty {
      color: #9ca3af;
    }

    [data-theme="dark"] .cart-modal .cart-item {
      background: var(--light, #171a20);
      box-shadow: 0 3px 18px rgba(0, 0, 0, 0.35);
    }

    [data-theme="dark"] .cart-modal .cart-item .item-image {
      background: #2a2d35;
    }

    [data-theme="dark"] .cart-modal .cart-item .item-title {
      color: #b794f6;
    }

    [data-theme="dark"] .cart-modal .cart-item .item-code {
      color: #9ca3af;
    }

    [data-theme="dark"] .cart-modal .cart-item .item-carton-qty {
      color: #a1a1aa;
    }

    [data-theme="dark"] .cart-modal .cart-item .item-unit-price {
      color: #d1d5db;
    }

    [data-theme="dark"] .cart-modal .cart-item .item-tier-price {
      color: #d1d5db;
      background: transparent;
    }

    [data-theme="dark"] .cart-modal .cart-item .item-tier-price.is-active {
      background: rgba(106, 0, 255, 0.28);
      color: #e8e8e8;
    }

    [data-theme="dark"] .cart-modal .cart-item .item-total-price {
      color: #b794f6;
    }

    [data-theme="dark"] .cart-modal .cart-item .price-label {
      color: #9ca3af;
    }

    [data-theme="dark"] .cart-modal .cart-item .item-preorder-badge {
      color: #b794f6;
    }

    [data-theme="dark"] .cart-modal .cart-item .qty-value {
      color: var(--text, #f1f1f1);
    }

    [data-theme="dark"] .cart-modal .checkout-wrap {
      background: var(--light, #171a20);
      box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.35);
    }

    [data-theme="dark"] .cart-modal .cart-summary {
      color: #b6bbc6;
    }

    [data-theme="dark"] .cart-modal .cart-summary strong {
      color: #b794f6;
    }

    [data-theme="dark"] .spinner {
      border-color: #3d4454;
      border-top-color: #8b5cf6;
    }
  