/* ============================================
   GRID LAYOUT
   ============================================ */

.goldika-products-wrapper {
    width: 100%;
    position: relative;
}

.goldika-products-wrapper ul.products {
    display: grid;
    grid-template-columns: repeat(var(--gk-cols, 4), 1fr);
    gap: 14px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.goldika-products-wrapper ul.products.columns-2 { --gk-cols: 2; }
.goldika-products-wrapper ul.products.columns-3 { --gk-cols: 3; }
.goldika-products-wrapper ul.products.columns-4 { --gk-cols: 4; }
.goldika-products-wrapper ul.products.columns-5 { --gk-cols: 5; }
.goldika-products-wrapper ul.products.columns-6 { --gk-cols: 6; }

/* ============================================
   PRODUCT CARD
   ============================================ */

.goldika-products-wrapper li.product {
    position: relative;
    background: #1E1F25;
    border-radius: 1em;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: background var(--gmf-transition, 0.3s ease),
                border-color var(--gmf-transition, 0.3s ease),
                box-shadow var(--gmf-transition, 0.3s ease);
    display: flex;
    flex-direction: column;
}

.goldika-products-wrapper li.product:hover {
    border-color: rgba(250, 175, 0, 0.2);
    box-shadow: 0 0 20px rgba(250, 175, 0, 0.06);
}

.goldika-products-wrapper li.product > a.woocommerce-loop-product__link {
    display: flex !important;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
    padding: 1em;
}

.goldika-products-wrapper .products > .product .woocommerce-loop-product__link img {
    padding: 0;
    margin: 0;
    width: 100%;
    aspect-ratio: 1;
    height: auto;
}

/* ============================================
   PRODUCT IMAGE — dual image crossfade
   ============================================ */

.gk-product-thumb {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1;
    background: #1E1F25;
    border-radius: var(--gmf-border-radius, 8px);
}

.gk-product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gk-product-thumb .gk-img-primary {
    position: relative;
    z-index: 1;
    transition: opacity 0.45s ease;
    padding: 1em !important;
    background: #1E1F25;
    box-sizing: border-box;
    object-fit: contain;
    border-radius: 0 !important;
}

.gk-product-thumb .gk-img-secondary {
    position: absolute;
    inset: 0;
    z-index: 0;
    opacity: 1;
    padding: 2px !important;
    border-radius: 8px !important;
}

li.product:hover .gk-product-thumb .gk-img-primary {
    opacity: 0;
}

li.product.gk-no-secondary:hover .gk-product-thumb .gk-img-primary {
    opacity: 1;
}

/* ============================================
   BADGES
   ============================================ */

.gk-badges {
    display: flex;
    position: absolute;
    top: 16px;
    right: 16px;
    flex-wrap: wrap;
    gap: 5px;
    z-index: 2;
    margin-top: 8px;
    margin-right: 8px;
    pointer-events: none;
    margin-bottom: 6px;
}

.gk-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 9px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: 0.2px;
    background: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    color: #fff;
}

.gk-badge-new        { color: rgba(255, 255, 255, 0.9); }
.gk-badge-economical { color: rgba(255, 255, 255, 0.9); }

/* ============================================
   SALE PERCENTAGE
   ============================================ */

.gk-sale-percent::after {
    content: '٪';
    font-size: 10px;
    opacity: 0.8;
}

/* ============================================
   OUT OF STOCK OVERLAY
   ============================================ */

.gk-oos-overlay {
    position: absolute;
    inset: 0;
    background: rgba(35, 40, 50, 0.45);
    z-index: 3;
    pointer-events: none;
    transition: background 0.3s;
}

li.product.gk-outofstock:hover .gk-oos-overlay {
    background: rgba(35, 40, 50, 0.3);
}

/* ============================================
   PRODUCT INFO
   ============================================ */

.gk-product-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 12px 0 0;
}

.gk-product-head {
    margin-bottom: 2px;
}

.goldika-products-wrapper li.product h2.woocommerce-loop-product__title {
    font-size: 13.5px;
    font-weight: 600;
    color: #e8e8e8;
    margin: 0 0 4px;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.25s;
}

li.product:hover h2.woocommerce-loop-product__title {
    color: var(--gmf-primary, #FAAF00);
}

.gk-sku {
    font-size: 11px;
    color: #777;
    font-family: 'SF Mono', 'Fira Code', monospace;
    letter-spacing: 0.6px;
    margin-bottom: 2px;
}

/* ============================================
   PRICE
   ============================================ */

.gk-price-wrap {
    padding: 10px 0 0;
    margin-top: auto;
}

.gk-price-row {
    display: flex;
    align-items: center;
    gap: 0;
    flex-wrap: wrap;
}

.gk-price-wrap .price {
    display: flex;
    flex-direction: column;
    gap: 1px;
    font-size: 14px;
    font-weight: 700;
    color: #e0e0e0;
    line-height: 1.5;
    flex: 1;
    min-width: 0;
}

.gk-price-wrap .price del {
    font-size: 11.5px;
    color: #666;
    font-weight: 400;
    text-decoration: line-through;
    order: -1;
}

.gk-price-wrap .price ins {
    text-decoration: none;
    color: var(--gmf-primary, #FAAF00);
    font-weight: 700;
}

.gk-price-wrap .price .woocommerce-Price-amount {
    font-variant-numeric: tabular-nums;
}

.relative-container {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0;
}

.gk-sale-percent {
    background-color: #d49e00de;
    color: #000000;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    padding-top: 0.25em;
    flex-direction: row-reverse;
    margin-bottom: 0.35em;
}

.price-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
}

.price {
    color: #fff;
    font-size: 1.2rem;
    font-weight: bold;
    margin: 0 !important;
}

.price-old {
    color: #888;
    text-decoration: line-through;
    font-size: 0.9rem;
}

.gk-unavailable {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.04);
    color: #666;
    font-size: 12.5px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: var(--gmf-border-radius, 8px);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    text-align: center;
    width: 100%;
    box-sizing: border-box;
}

.gk-unavailable svg {
    flex-shrink: 0;
    opacity: 0.5;
}

/* ============================================
   OUT OF STOCK CARD
   ============================================ */

li.product.gk-outofstock {
    opacity: 0.55;
    transition: opacity var(--gmf-transition, 0.3s ease),
                background var(--gmf-transition, 0.3s ease),
                border-color var(--gmf-transition, 0.3s ease),
                box-shadow var(--gmf-transition, 0.3s ease);
}

li.product.gk-outofstock:hover {
    opacity: 0.72;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: none;
}

li.product.gk-outofstock h2.woocommerce-loop-product__title {
    color: #777;
}

li.product.gk-outofstock:hover h2.woocommerce-loop-product__title {
    color: #999;
}

li.product.gk-outofstock .gk-product-thumb img {
    filter: grayscale(40%) brightness(0.85);
    transition: filter 0.4s ease;
}

li.product.gk-outofstock:hover .gk-product-thumb img {
    filter: grayscale(20%) brightness(0.9);
}

li.product.gk-outofstock .gk-sku {
    color: #555;
}

li.product.gk-outofstock .gk-badges {
    display: none;
}

li.product.stock-onbackorder .gk-price-wrap::after {
    content: 'ارسال سفارشی';
    display: block;
    font-size: 10px;
    color: #d97706;
    font-weight: 500;
    margin-top: 4px;
}

/* ============================================
   FILTER BAR
   ============================================ */

.gk-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0 14px;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-wrap: wrap;
    position: sticky;
    background: #232832cc;
    backdrop-filter: blur(3px);
    z-index: 3;
    top: 88px;
}

.gk-sorting {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    justify-content: space-between;
}

#gmf-filter-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--gmf-border-radius, 8px);
    padding: 8px 14px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #000;
    transition: all var(--gmf-transition, 0.3s ease);
    white-space: nowrap;
    line-height: 1.4;
    flex-shrink: 0;
}

#gmf-filter-trigger:hover {
    border-color: var(--gmf-primary, #FAAF00);
    color: var(--gmf-primary, #FAAF00);
}

#gmf-filter-trigger svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.gk-sort-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    flex: 1;
    min-width: 0;
    max-width: 250px;
}

.gk-sort-wrap i {
    display: none;
}

.gk-sort-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: #999;
}

.gk-sort-wrap select {
    appearance: none;
    -webkit-appearance: none;
    flex: 1;
    background-color: var(--bg-500);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--gmf-border-radius, 8px);
    padding: 8px 32px 8px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--gmf-transition, 0.3s ease);
    line-height: 1.4;
    width: 100%;
    margin-left: auto;
    max-width: 250px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='none' stroke='%23999' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 10px center;
}

.gk-sort-wrap select:hover,
.gk-sort-wrap select:focus {
    border-color: var(--gmf-primary, #FAAF00);
    outline: none;
}

.gk-sort-wrap select option {
    background: var(--gmf-bg-medium, #373943);
    color: #ccc;
}

.gk-filter-bar .bapf_sfilter {
    width: 100%;
}

/* ============================================
   PRODUCT COUNT
   ============================================ */

.gk-result-count {
    font-size: 12px;
    color: #666;
    padding: 0 0 8px;
}

.gk-result-count strong {
    color: #999;
    font-weight: 600;
}

/* ============================================
   LOADING & END
   ============================================ */

.gk-loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 13px;
}

.gk-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255, 255, 255, 0.08);
    border-top-color: var(--gmf-primary, #FAAF00);
    border-radius: 50%;
    animation: gk-spin 0.75s linear infinite;
    margin: 0 auto 12px;
}

@keyframes gk-spin {
    to { transform: rotate(360deg); }
}

.gk-no-more {
    text-align: center;
    padding: 28px 20px;
    display: none;
}

.gk-no-more.show {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 16px;
}

.gk-no-more hr {
    border: none;
    flex: 1;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin: 10px 0;
}

.gk-no-more p {
    color: #555;
    font-size: 12.5px;
    margin: 10px 0;
}

.gk-scroll-top {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: #888;
    cursor: pointer;
    transition: all 0.25s;
    margin: 6px 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.gk-scroll-top:hover {
    background: var(--gmf-primary, #FAAF00);
    color: var(--gmf-bg-dark, #232832);
    border-color: var(--gmf-primary, #FAAF00);
    box-shadow: 0 4px 16px rgba(250, 175, 0, 0.3);
}

.gk-error {
    color: #ef4444;
    font-weight: 500;
}

/* ============================================
   RESPONSIVE — Tablet
   ============================================ */

@media (max-width: 1024px) {
    .goldika-products-wrapper ul.products {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
}

/* ============================================
   RESPONSIVE — Mobile
   ============================================ */

@media (max-width: 767px) {
    .goldika-products-wrapper ul.products {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .goldika-products-wrapper li.product {
        border-radius: 12px;
    }

    .goldika-products-wrapper li.product > a.woocommerce-loop-product__link {
        flex-direction: row;
        padding: 10px;
        gap: 12px;
        align-items: stretch;
    }

    .gk-product-thumb {
        width: 110px;
        min-width: 110px;
        max-width: 110px;
        aspect-ratio: 1 / 1;
        border-radius: 8px;
        flex-shrink: 0;
        margin: auto;
    }

    .gk-product-thumb .gk-img-primary {
        padding: 8px;
    }

    .gk-product-body {
        padding: 2px 0 0;
        flex: 1;
        min-width: 0;
        justify-content: center;
    }

    .gk-product-head {
        margin-bottom: 0;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
    }

    .goldika-products-wrapper li.product h2.woocommerce-loop-product__title {
        font-size: 13px;
        line-height: 1.45;
        -webkit-line-clamp: 2;
        margin: 0 0 3px;
    }

    .gk-sku {
        font-size: 10px;
        margin-bottom: 0;
    }

    .gk-badges {
        margin: 0;
        position: relative;
        max-width: 120px;
        top: unset;
        right: unset;
        margin-bottom: 4px;
        gap: 4px;
        order: 1;
    }

    .gk-badge {
        font-size: 9.5px;
        padding: 2px 6px;
        border-radius: 4px;
    }

    .gk-price-wrap {
        padding: 6px 0 0;
        order: 2;
    }

    .gk-price-row {
        display: flex;
        align-items: flex-end;
        gap: 0;
        flex-wrap: wrap;
        flex-direction: row-reverse;
        justify-content: space-between;
    }

    .gk-price-wrap .price {
        font-size: 14px;
        flex-direction: row;
        align-items: center;
        gap: 6px;
        flex: 0 0 auto !important;
        display: flex !important;
        align-items: flex-end;
        flex-direction: column;
        margin: 0 !important;
    }

    .gk-price-wrap .price del {
        font-size: 11px;
        order: 0;
    }

    .gk-sale-percent {
        font-size: 11px;
    }

    .gk-unavailable {
        font-size: 11px;
        padding: 5px 10px;
        gap: 4px;
    }

    .gk-unavailable svg {
        width: 12px;
        height: 12px;
    }

    #gmf-filter-trigger {
        padding: 7px 12px;
        font-size: 12px;
    }

    #gmf-filter-trigger svg {
        width: 18px;
        height: 18px;
    }

    .gk-sort-wrap select {
        padding: 7px 28px 7px 10px;
        font-size: 12px;
    }
}

@media (max-width: 400px) {
    .goldika-products-wrapper ul.products {
        gap: 8px;
    }

    .goldika-products-wrapper li.product > a.woocommerce-loop-product__link {
        padding: 8px;
        gap: 10px;
    }

    .gk-product-thumb {
        width: 96px;
        min-width: 96px;
        max-width: 96px;
    }

    .gk-product-thumb .gk-img-primary {
        padding: 6px;
    }

    .goldika-products-wrapper li.product h2.woocommerce-loop-product__title {
        font-size: 12px;
    }

    .gk-price-wrap .price {
        font-size: 12px;
    }
}
