/**
 * Ganjeh Kala – Archive & Product Grid
 * بازطراحی کامل صفحه آرشیو فروشگاه + فیلترها
 * (نسخه اصلاح شده نهایی برای رفع مشکل اسکرول افقی و مدال سفید)
 */

/* =========================================================
   0. تنظیمات عمومی برای جلوگیری از اسکرول افقی
   ========================================================= */

html, body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

*, *::before, *::after {
    box-sizing: border-box;
}

/* =========================================================
   1. پایه و لِی‌آوت
   ========================================================= */

:root {
    --gk-archive-max-width: 1600px;
    --gk-archive-padding: 16px;
    --gk-archive-border: #e5e7eb;
    --gk-archive-radius: 0.75rem;
    --gk-archive-muted: #6b7280;
    --gk-archive-primary: #ef4056;

    --gk-archive-grid-gap: 1px;
    --gk-archive-grid-border: 1px solid #f0f0f1;
    --gk-archive-grid-bg: #f0f0f1;

    --gk-filter-bg: #ffffff;
    --gk-filter-border: #e5e7eb;
    --gk-filter-header-bg: #f9fafb;
}

.gk-archive {
    margin: 1rem 0 4rem;
}

.gk-archive__inner {
    max-width: var(--gk-archive-max-width);
    margin: 0 auto;
    padding: 0 var(--gk-archive-padding);
    width: 100%;
}

.gk-archive__layout {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 1.5rem;
    width: 100%;
}

.gk-archive__sidebar-col {
    flex: 0 0 260px;
    max-width: 260px;
    border: 1px solid #f3f4f6;
    border-radius: var(--gk-archive-radius);
    padding: 15px;
}

.gk-archive__main-col {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
}

/* هدر و توضیحات */

.gk-breadcrumb {
    font-size: 0.8rem;
    color: var(--gk-neutral-900);
    margin-bottom: 0.75rem;
}
.gk-breadcrumb a {
    text-decoration: none;
    color: var(--gk-archive-muted);
}

.gk-archive__header {
    margin-bottom: 1.5rem;
}

.gk-archive__title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.75rem;
}

.gk-archive__description {
    font-size: 0.92rem;
    color: #555;
    line-height: 1.7;
}

/* نوار ابزار بالا */

.gk-archive__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.gk-archive__toolbar-left,
.gk-archive__toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.gk-archive__count {
    font-size: 0.85rem;
    color: #666;
}

.gk-archive__filters-toggle {
    display: none;
    border: 1px solid #ddd;
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
    background: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
}

.gk-archive__sort-label {
    font-size: 0.82rem;
    color: var(--gk-archive-muted);
}

.gk-archive__sort-list {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-x: auto;
    padding-bottom: 5px;
}

.gk-archive__sort-item {
    position: relative;
    flex: 0 0 auto;
}

.gk-archive-toolbar__sort-link {
    text-decoration: none;
    color: var(--gk-archive-muted);
    font-size: 0.85rem;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.gk-archive__sort-item--active .gk-archive-toolbar__sort-link {
    color: var(--gk-archive-primary);
    font-weight: 600;
}

.gk-archive__sort-item--active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -6px;
    height: 2px;
    background: var(--gk-archive-primary);
    border-radius: 2px;
}

/* حالت در حال لود */

.gk-archive--loading {
    opacity: 0.6;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* حذف منوی کشویی و شمارنده پیش‌فرض ووکامرس در این صفحه */
.gk-archive .woocommerce-result-count,
.gk-archive .woocommerce-ordering {
    display: none !important;
}

/* =========================================================
   2. سایدبار فیلتر – استایل حرفه‌ای شبیه دیجی‌کالا
   ========================================================= */

.gk-archive__filters-wrapper {
    position: sticky;
    top: 1.25rem;
    background: var(--gk-filter-bg);
    max-height: calc(100vh - 2.5rem);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #d1d5db transparent;
}
/* استایل دکمه اعمال فیلتر با اولویت بالا */
.gk-archive__filters-wrapper .gk-archive__filters-footer .gk-archive__filters-apply {
    width: 100% !important;
    background-color: var(--gk-archive-primary) !important;
    color: #ffffff !important;
    border: 1px solid var(--gk-archive-primary) !important;
    padding: 12px !important; /* کمی ارتفاع بیشتر برای لمس راحت‌تر */
    border-radius: 8px !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    margin-top: 0 !important; /* چون در فوتر پدینگ دادیم */
    font-family: inherit !important;
    box-shadow: none !important;
    line-height: 1.5 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease !important;
}

.gk-archive__filters-wrapper .gk-archive__filters-footer .gk-archive__filters-apply:hover {
    opacity: 0.9 !important;
    background-color: var(--gk-archive-primary) !important;
    color: #fff !important;
}
/* هدر کلی فیلترها (عنوان "فیلترها" و ریست) */
.gk-archive__filters-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.gk-archive__filters-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.gk-archive__filters-reset {
    font-size: 0.8rem;
    color: var(--gk-archive-primary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: inherit;;
}
.gk-active-filter {
    border: none;
    font-family: inherit;
    border-radius: 5px;
    padding: 5px;
}
/* گروه فیلتر – حالت کارت‌مانند با هدر کلیک‌پذیر */

.gk-filter {
    border-radius: 0.75rem;
    border: 1px solid #f3f4f6;
    background: #fff;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.gk-filter:last-child {
    margin-bottom: 0;
}

.gk-filter__header {
    background: var(--gk-filter-header-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none; /* جلوگیری از انتخاب متن هنگام کلیک */
}

.gk-filter__title {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.6rem 0.75rem;
    color: #111827;
    background: var(--gk-filter-header-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gk-filter__toggle-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #6b7280;
    transition: transform 0.2s ease;
}

/* اگر JS کلاس gk-filter--collapsed را اضافه کند */
.gk-filter--collapsed .gk-filter__toggle-icon {
    transform: rotate(180deg);
}

/* +++ اضافه شده: مخفی کردن بادی وقتی بسته است +++ */
.gk-filter--collapsed .gk-filter__body {
    display: none;
}

.gk-filter__body {
    padding: 0.5rem 0.75rem 0.75rem;
    border-top: 1px solid #f3f4f6;
}

/* لیست آیتم‌های فیلتر (چک‌باکس‌ها) */
.gk-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: 210px;
    overflow-y: auto;
    padding-right: 2px;
}

.gk-list::-webkit-scrollbar {
    width: 4px;
}
.gk-list::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 999px;
}

/* چک‌باکس سفارشی */

.gk-check {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    cursor: pointer;
    color: #374151;
    margin: 0;
}

.gk-check input[type="checkbox"],
.gk-check input[type="radio"] {
    position: relative;
    width: 16px;
    height: 16px;
    margin: 0;
    flex: 0 0 16px;
    appearance: none;
    border-radius: 4px;
    border: 1px solid #d1d5db;
    background: #fff;
    cursor: pointer;
    transition: all 0.15s ease;
}

.gk-check input[type="checkbox"]:checked,
.gk-check input[type="radio"]:checked {
    border-color: var(--gk-archive-primary);
    background: var(--gk-archive-primary);
    box-shadow: 0 0 0 1px rgba(239, 64, 86, 0.2);
}

.gk-check input[type="checkbox"]:checked::after,
.gk-check input[type="radio"]:checked::after {
    content: "";
    position: absolute;
    inset: 3px;
    border-radius: 2px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* برچسب متنی کنار چک‌باکس */

.gk-label {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}

.gk-label-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gk-count {
    font-size: 0.78rem;
    color: #9ca3af;
}

/* فیلترهای خاص – مثل سوئیچ «ارسال سریع» */

.gk-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.gk-toggle-label {
    font-size: 0.85rem;
    color: #374151;
}

/* سوئیچ */

.gk-toggle-input {
    position: relative;
    width: 34px;
    height: 18px;
    appearance: none;
    border-radius: 999px;
    background: #e5e7eb;
    cursor: pointer;
    outline: none;
    transition: background 0.2s ease;
    margin: 0;
}

.gk-toggle-input::before {
    content: "";
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease;
}

.gk-toggle-input:checked {
    background: #10b981;
}

.gk-toggle-input:checked::before {
    transform: translateX(-16px);
}

/* فیلتر قیمت – نمایش رنج و ورودی‌ها */

.gk-price-range {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: #6b7280;
}

.gk-price-range__inputs {
    display: flex;
    gap: 0.4rem;
}

.gk-price-range__inputs input[type="number"],
.gk-price-range__inputs input[type="text"] {
    flex: 1;
    height: 32px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    padding: 0 0.4rem;
    font-size: 0.8rem;
    width: 100%;
}

/* =========================================================
   3. GRID SYSTEM (لیست محصولات)
   ========================================================= */

.gk-archive__main-col ul.products {
    --gk-archive-cols: 5;
    display: grid !important;
    grid-template-columns: repeat(var(--gk-archive-cols), 1fr);
    background-color: var(--gk-archive-grid-bg) !important;
    gap: var(--gk-archive-grid-gap) !important;
    border: var(--gk-archive-grid-border) !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding: 0 !important;
    margin: 0 !important;
    list-style: none !important;
    float: none !important;
}

.gk-archive__main-col ul.products::before,
.gk-archive__main-col ul.products::after {
    content: none !important;
    display: none !important;
}

.gk-archive__main-col ul.products > *:not(li.product) {
    display: none !important;
}

.gk-archive__main-col ul.products li.product {
    width: auto !important;
    float: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    border: none !important;
    clear: none !important;
}

/* =========================================================
   4. DIGIKALA CARD STYLES
   ========================================================= */

.gk-dk-card {
    background: #fff;
    position: relative;
    transition: all 0.2s ease-in-out;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    border-radius: 0 !important;
    width: 100% !important;
}

.gk-dk-card:hover {
    box-shadow: 0 2px 18px rgba(0, 0, 0, 0.15);
    z-index: 10;
    transform: translateY(0);
}

.gk-dk-card__inner {
    padding: 12px;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    box-sizing: border-box;
}

.gk-dk-card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    min-height: 24px;
    margin-bottom: 8px;
}

.gk-dk-card__special-txt {
    font-size: 11px;
    font-weight: 700;
    color: #ef394e;
}

.gk-dk-card__colors {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gk-dk-card__color {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.1);
    display: block;
}

.gk-dk-card__image {
    display: block;
    width: 100%;
    height: 200px;
    margin-bottom: 10px;
    text-align: center;
    position: relative;
}

.gk-dk-card__image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    margin: 0 !important;
    transition: transform 0.3s ease;
}

.gk-dk-card:hover .gk-dk-card__image img {
    transform: scale(1.03);
}

.gk-dk-card__title {
    font-size: 11px;
    font-weight: 700;
    line-height: 24px;
    color: #3f4064;
    margin: 0 0 4px;
    min-height: 48px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-align: right;
}

.gk-dk-card__title a {
    text-decoration: none;
    color: inherit;
}

.gk-dk-card__delivery-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.gk-dk-card__delivery-info {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #3f4064;
}

.gk-dk-icon-truck {
    fill: #19bfd3;
}

.gk-dk-card__delivery-info span {
    font-size: 10px;
    color: #555;
}

.gk-dk-card__rating {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-right: auto;
}

.gk-dk-card__rating-num {
    font-size: 11px;
    font-weight: 700;
    color: #3f4064;
}

.gk-dk-card__price-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: auto;
}

.gk-dk-card__badge-container {
    flex: 0 0 auto;
}

.gk-dk-card__badge {
    background: #ef394e;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 16px;
    display: inline-block;
    min-width: 24px;
    text-align: center;
}

.gk-dk-card__price-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding-right: 8px;
}

.gk-dk-card__price-current {
    font-size: 15px;
    font-weight: 700;
    color: #3f4064;
    display: flex;
    align-items: center;
    line-height: 1.2;
}

.gk-dk-card__price-current .woocommerce-Price-currencySymbol {
    font-size: 10px;
    margin-right: 4px;
    font-weight: 400;
}

.gk-dk-card__price-old {
    font-size: 11px;
    color: #c3c3ce;
    text-decoration: line-through;
    margin-top: 2px;
    line-height: 1;
}

.gk-dk-card__price-old .woocommerce-Price-currencySymbol {
    display: none;
}

.gk-dk-card__unavailable {
    font-size: 12px;
    color: #a1a3a8;
    font-weight: 700;
    background: #f2f2f2;
    padding: 4px 10px;
    border-radius: 4px;
    width: 100%;
    text-align: center;
}

/* =========================================================
   5. RESPONSIVE & APP-STYLE BOTTOM SHEET (FINAL FIX)
   ========================================================= */

/* مخفی کردن دکمه‌های پیش‌فرض قالب یا ووکامرس */
.woocommerce-filter-toggle,
.storefront-sorting + .filter-toggle {
    display: none !important;
}

/* تبلت و دسکتاپ کوچک */
@media (max-width: 1400px) {
    .gk-archive__main-col ul.products { --gk-archive-cols: 4; }
}
@media (max-width: 1100px) {
    .gk-archive__main-col ul.products { --gk-archive-cols: 3; }
}

/* --- شروع استایل موبایل (تبدیل به Bottom Sheet) --- */
@media (max-width: 991px) {

    /* چیدمان ستونی */
    .gk-archive__layout {
        flex-direction: column;
        gap: 0;
    }

    /* 1. فضای سایدبار را در جریان صفحه نگه می‌داریم اما ابعادش را صفر می‌کنیم */
    .gk-archive__sidebar-col {
        display: block !important;
        width: 0 !important;
        height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
        overflow: visible !important;
    }

    /* دکمه باز کردن فیلتر */
    .gk-archive__filters-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: #fff;
        color: #333;
        border: 1px solid #e5e7eb;
        padding: 8px 16px;
        border-radius: 8px;
        font-weight: 700;
        font-size: 14px;
        margin-bottom: 10px;
        width: auto; /* یا 100% بسته به سلیقه */
    }

    /* --- 2. کانتینر اصلی مدال (Wrapper) --- */
    .gk-archive__filters-wrapper {
        position: fixed !important;
        inset: auto 0 0 0 !important; /* چسبیدن به پایین */
        width: 100% !important;
        height: 85vh !important; /* ارتفاع ثابت */
        max-height: 85vh !important;

        background: #ffffff !important;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
        z-index: 999999 !important;

        /* انیمیشن */
        transform: translateY(105%);
        visibility: hidden;
        transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1), visibility 0.35s;

        /* لی‌اوت فلکس برای فرزند مستقیم (فرم) */
        display: flex !important;
        flex-direction: column !important;
    }

    /* کلاس باز شدن مدال */
    .gk-archive__filters-wrapper--open {
        transform: translateY(0) !important;
        visibility: visible !important;
    }

    /* --- 3. اصلاح فرم برای پر کردن ارتفاع --- */
    /* نکته حیاتی: فرم باید ارتفاع والد (Wrapper) را کامل بگیرد */
    .gk-archive__filters-wrapper form {
        display: flex !important;
        flex-direction: column !important;
        height: 100% !important;
        width: 100% !important;
        min-height: 0 !important; /* جلوگیری از باگ فلکس */
        background: #fff !important;
    }

    /* --- 4. هدر مدال (عنوان و دکمه حذف) --- */
    .gk-archive__filters-header {
        flex: 0 0 auto; /* ارتفاع ثابت بر اساس محتوا */
        padding: 18px 20px;
        border-bottom: 1px solid #f0f0f1;
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: #fff;
        border-radius: 20px 20px 0 0;
    }

    /* --- 5. بدنه اسکرول شونده (لیست فیلترها) --- */
    .gk-archive__filters-body {
        flex: 1 1 auto; /* پر کردن فضای باقی‌مانده */
        overflow-y: auto !important;
        overflow-x: hidden;
        padding: 20px;
        background: #fff;
        min-height: 0; /* حیاتی برای اسکرول در فلکس */
    }

    /* --- 6. فوتر (دکمه اعمال) --- */
    .gk-archive__filters-footer {
        flex: 0 0 auto; /* ارتفاع ثابت */
        padding: 16px 20px;
        border-top: 1px solid #f0f0f1;
        background: #fff;
        /* فاصله امن برای آیفون‌های بدون دکمه */
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }

    /* خط تیره بالای مدال (Drag Handle) */
    .gk-archive__filters-wrapper::before {
        content: "";
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 48px;
        height: 5px;
        background: #e5e7eb;
        border-radius: 100px;
        z-index: 100000;
        pointer-events: none;
    }

    /* استایل دکمه اعمال فیلتر با اولویت بالا */
    .gk-archive__filters-wrapper .gk-archive__filters-footer .gk-archive__filters-apply {
        width: 100% !important;
        background-color: var(--gk-archive-primary) !important;
        color: #ffffff !important;
        border: 1px solid var(--gk-archive-primary) !important;
        padding: 12px !important; /* کمی ارتفاع بیشتر برای لمس راحت‌تر */
        border-radius: 8px !important;
        font-size: 16px !important;
        font-weight: 700 !important;
        cursor: pointer !important;
        margin-top: 0 !important; /* چون در فوتر پدینگ دادیم */
        font-family: inherit !important;
        box-shadow: none !important;
        line-height: 1.5 !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        transition: opacity 0.2s ease !important;
    }

    .gk-archive__filters-wrapper .gk-archive__filters-footer .gk-archive__filters-apply:hover {
        opacity: 0.9 !important;
        background-color: var(--gk-archive-primary) !important;
        color: #fff !important;
    }

    /* بک‌دراپ (تاریک شدن پشت) */
    .gk-filters-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 99998 !important; /* زیر مدال */
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease;
        backdrop-filter: blur(3px);
    }

    .gk-filters-backdrop.is-visible {
        opacity: 1;
        visibility: visible;
    }

    /* اصلاح گرید محصولات در موبایل */
    .gk-archive__main-col ul.products {
        --gk-archive-cols: 2;
        gap: 1px !important;
    }

    /* رفع باگ احتمالی display:none روی فیلترها در CSS پایه */
    .gk-filter {
        display: block; /* اطمینان از نمایش */
    }
}

/* گوشی‌های کوچک */
@media (max-width: 480px) {
    .gk-dk-card__image { height: 150px; }
    .gk-dk-card__title { font-size: 11px; min-height: 38px; }
    .gk-dk-card__price-current { font-size: 14px; }
}

/* =========================================================
   7. استایل وضعیت خالی (Empty State)
   ========================================================= */

.woocommerce-info {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: var(--gk-archive-radius);
    padding: 40px 20px;
    text-align: center;
    color: #374151;
    font-size: 1rem;
    margin: 20px 0;
    list-style: none;
    width: 100%;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.woocommerce-info::before {
    content: "!";
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: #fee2e2;
    color: #ef4444;
    border-radius: 50%;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 10px;
}

.woocommerce-info a {
    display: inline-block;
    margin-top: 10px;
    color: var(--gk-archive-primary);
    text-decoration: none;
    border-bottom: 1px dashed;
}






/* =========================================================
   8. SUB-CATEGORIES CARDS (استایل زیر دسته‌بندی‌ها)
   ========================================================= */

.gk-subcats-section {
    margin-bottom: 2rem;
    width: 100%;
}

.gk-subcats-grid {
    display: grid;
    /* ایجاد ستون‌های واکنش‌گرا با حداقل عرض 140 پیکسل */
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

/* کارت تکی */
.gk-subcat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #f0f0f1; /* رنگ پس‌زمینه خاکستری */
    border-radius: 12px;
    padding: 20px 10px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s ease;
    min-height: 160px;
    text-align: center;
}

.gk-subcat-card:hover {
    background-color: #e0e0e2;
    transform: translateY(-3px);
}

/* تصویر کارت */
.gk-subcat-card__img {
    width: 80px;
    height: 80px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gk-subcat-card__img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    /* فیلتر برای هماهنگی عکس با پس‌زمینه خاکستری (اختیاری) */
    mix-blend-mode: multiply;
}

/* عنوان کارت */
.gk-subcat-card__title {
    font-size: 0.9rem;
    font-weight: 700;
    margin: 0;
    color: #424750;
    line-height: 1.4;
}

/* کارت "مشاهده بقیه" */
.gk-subcat-card--more {
    background-color: #f0f0f1;
    cursor: pointer;
    justify-content: center;
    gap: 5px;
}

.gk-subcat-card--more:hover {
    background-color: #e0e0e2;
}

.gk-subcat-card__more-txt {
    font-size: 0.85rem;
    color: #666;
}

.gk-subcat-card__more-count {
    font-size: 2.5rem;
    font-weight: 700;
    color: #666;
    line-height: 1;
}

.gk-subcat-card__more-label {
    font-size: 0.85rem;
    color: #666;
}

/* ریسپانسیو */
@media (max-width: 768px) {
    .gk-subcats-grid {
        /* در موبایل اسکرول افقی می‌خورد */
        display: flex;
        overflow-x: auto;
        padding-bottom: 10px;
        scroll-snap-type: x mandatory;
    }

    .gk-subcat-card {
        min-width: 130px;
        width: 130px;
        scroll-snap-align: start;
        flex-shrink: 0;
    }
}




/* =========================================================
   9. PRODUCT HOVER IMAGE (اصلاح شده)
   ========================================================= */

.gk-dk-card__image {
    position: relative;
    overflow: hidden;
    display: block; /* اطمینان از بلاک بودن */
}

/* تصویر اصلی */
.gk-dk-card__image .gk-img-main {
    transition: opacity 0.3s ease-in-out;
    opacity: 1;
    z-index: 1;
    display: block; /* حذف فضای اضافه پایین عکس */
}

/* تصویر دوم (هاور) */
.gk-dk-card__image .gk-img-hover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    opacity: 0;
    z-index: 2;
    transition: opacity 0.3s ease-in-out;
    backface-visibility: hidden;
}

/* --- منطق هوشمند --- */

/* فقط زمانی عکس دوم را نشان بده که موس روی کارت است */
.gk-has-hover:hover .gk-img-hover {
    opacity: 1;
}

/* فقط زمانی عکس اصلی را محو کن که کلاس gk-has-hover وجود داشته باشد */
/* یعنی اگر محصول عکس دوم نداشت، عکس اصلی سرجایش می‌ماند و محو نمی‌شود */
.gk-has-hover:hover .gk-img-main {
    opacity: 0;
}

/* غیرفعال کردن در موبایل */
@media (max-width: 991px) {
    .gk-dk-card__image .gk-img-hover {
        display: none !important;
    }
    .gk-dk-card__image .gk-img-main {
        opacity: 1 !important;
    }
}