﻿/* ============================================================
   CATEGORY FILTER CONTAINERS
   ============================================================ */
.category-filter {
    background-color: var(--sa-card-bg);
    border: 1px solid var(--sa-border-color);
    border-radius: var(--sa-radius);
    margin-bottom: 1rem;
}

.category-filter-box-title h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--sa-heading-color);
}

.category-filter-box-title {
    padding: 10px 0;
}

.category-filter-box-desc {
    font-size: 0.9rem;
    color: var(--sa-text);
    background-color: var(--sa-card-bg) !important;
}

/* CHECKBOX ACCENT COLOR */
.form-check-input {
    accent-color: var(--sa-primary);
    background-color: var(--sa-text-third);
}

    .form-check-input:active {
        background-color: var(--sa-primary);
    }

    .form-check-input:checked {
        background-color: var(--sa-primary);
        border-color: var(--sa-success);
    }

    .form-check-input:focus {
        border-color: var(--sa-success);
        box-shadow: 0 0 0 .25rem rgba(var(--sa-btn-primary-shadow-rgb), .25);
    }

/* ============================================================
   COLOR FILTER ITEMS
   ============================================================ */
.color-filter-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border: 1px solid var(--bs-border-color);
    border-radius: 10px;
    cursor: pointer;
    margin-bottom: 8px;
    transition: 0.2s;
}

    .color-filter-item:hover {
        background: rgba(var(--bs-primary-rgb), 0.04);
    }

    .color-filter-item.active {
        border-color: var(--bs-primary);
        background: rgba(var(--bs-primary-rgb), 0.08);
    }

    .color-filter-item .color-thumb {
        width: 40px;
        height: 40px;
        border-radius: 8px;
        overflow: hidden;
        margin-left: 10px;
    }

    .color-filter-item img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.color-dot {
    width: 100%;
    height: 100%;
    border-radius: 8px;
}

.color-info .fw-bold {
    color: var(--bs-heading-color);
}

.color-info small {
    color: var(--bs-muted-text);
}

/* ============================================================
   SIZE FILTER PILLS
   ============================================================ */
.size-filter-item {
    border: 1px solid rgba(var(--sa-text-rgb), .2);
    padding: 6px 12px;
    border-radius: var(--sa-btn-radius);
    cursor: pointer;
    transition: 0.2s;
    font-size: 0.9rem;
    background-color: var(--sa-card-bg);
}

    .size-filter-item:hover {
        background-color: var(--sa-navbar-item-hover-color);
    }

    .size-filter-item.active {
        background: var(--sa-primary);
        color: var(--sa-text-third);
        border-color: var(--sa-success);
    }

/* ============================================================
   STICKY FILTER POSITIONING
   ============================================================ */
.category-filters {
    position: sticky;
    top: calc(var(--sa-header-h, 0px) + 1rem);
    z-index: 100;
    transition: top 0.3s ease;
}

/* ============================================================
   FILTER ACCORDION
   ============================================================ */
.filter-accordion .accordion-button.filter-accordion-btn {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    width: 100%;
    text-align: right;
    background-color: transparent;
    color: var(--sa-heading-color);
    font-weight: 700;
    font-size: 1rem;
    padding: 10px 0;
    box-shadow: none;
    border-bottom: 1px solid var(--sa-border-color);
    overflow: hidden;
}

.filter-accordion .accordion-item:has(.accordion-collapse.show) {
    position: relative;
    z-index: 2; /* open item stacks above sibling headers */
}
    .filter-accordion .accordion-button.filter-accordion-btn:not(.collapsed) {
        background-color: transparent;
    }

    .filter-accordion .accordion-button.filter-accordion-btn::after {
        margin-right: auto;
        margin-left: 0;
        flex: 0 0 auto;
        align-self: center;
    }

.filter-accordion .accordion-body {
    padding: 12px 0;
    gap : 6px;
}

/* ============================================================
   MOBILE FILTER DRAWER
   ============================================================ */
.mobile-filter-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 1040;
}

    .mobile-filter-overlay.active {
        display: block;
    }

.mobile-filter-drawer {
    position: fixed;
    bottom: -100%;
    right: 0;
    left: 0;
    width: 100%;
    max-height: 90vh;
    background: var(--sa-card-bg);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transition: bottom 0.3s ease;
    overflow: hidden;
    border-radius: 16px 16px 0 0;
}

    .mobile-filter-drawer.open {
        bottom: 0;
    }

.mobile-filter-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--sa-border-color);
}

.mobile-filter-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
}

.mobile-filter-drawer-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--sa-border-color);
}

.mobile-filter-overlay {
    z-index: 10100;
}

.mobile-filter-drawer {
    z-index: 10101;
}

/* Hide desktop sticky filter on mobile */
@media (max-width: 767.98px) {
    #desktop-filters {
        display: none !important;
    }
}

@media (max-width: 767.98px) {
    .mobile-filter-drawer,
    .mobile-filter-drawer-body,
    .mobile-filter-section,
    .mobile-filter-scroll-row,
    .color-filter-tile {
        overflow: visible !important;
    }

    .mobile-filter-section-title {
        position: relative;
        z-index: 1; /* keep low */
    }

    .mobile-filter-drawer .color-swatch-btn {
        position: relative;
        z-index: 2;
    }

        .mobile-filter-drawer .color-swatch-btn[data-tooltip]::before,
        .mobile-filter-drawer .color-swatch-btn[data-tooltip]::after {
            z-index: 9999;
        }
}

.mobile-filter-drawer-header,
.mobile-filter-drawer-footer {
    flex-shrink: 0;
}

.mobile-filter-drawer-body {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 14px;
}
/* ============================================================
   ACCORDION BUTTON & TITLE LAYOUT
   ============================================================ */
.acc-head {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1 1 auto;
}

.acc-head-row {
    display: flex;
    gap: 6px;
    min-width: 0;
    max-width: 100%;
    align-items: start;
}

.acc-title-text {
    flex: 0 0 auto;
}

.acc-title-count {
    display: none;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    font-size: 0.75rem;
    line-height: 1;
    font-weight: 700;
    border-radius: 999px;
    background-color: rgba(var(--sa-btn-primary-shadow-rgb), 0.12);
    white-space: nowrap;
}

    .acc-title-count:not(:empty) {
        display: inline-flex;
    }

.acc-title-names {
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.75;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    margin-top: 4px;
    padding-left: 0;
    padding-right: 0;
}

.filter-accordion .accordion-button.collapsed .acc-title-names:not(:empty) {
    display: block;
}

.filter-accordion .accordion-button:not(.collapsed) .acc-title-names {
    display: none;
}

@media (max-width: 991.98px) {
    .acc-title-names {
        max-width: 100%;
    }
}

@media (max-width: 575.98px) {
    .acc-title-names {
        max-width: 100%;
    }
}

[data-bs-theme=dark] .filter-accordion .accordion-button.filter-accordion-btn::after {
    --bs-accordion-btn-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23ffffff'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
    --bs-accordion-btn-active-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23ffffff'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
}
/* 1. Base Setup: Remove default borders */
.category-filter {
    border: none !important;
    border-bottom: 1px solid transparent !important; /* Invisible reserve */
}

/* 2. BUTTON: Closed State (The border is on the button) */
.filter-accordion .accordion-button.filter-accordion-btn {
    border-bottom: 1px solid var(--sa-border-color) !important;
    transition: border-bottom 0.2s ease;
}

    /* 3. BUTTON: Open State (Remove the border from button) */
    .filter-accordion .accordion-button.filter-accordion-btn:not(.collapsed) {
        border-bottom: 1px solid transparent !important;
        /* We add a slight delay so it disappears only when it starts opening */
        transition: border-bottom 0.1s ease;
    }

/* 4. CONTAINER: Open State (Add the border to the parent) */
.category-filter:has(.accordion-button:not(.collapsed)) {
    border-bottom: 1px solid var(--sa-border-color) !important;
    /* We add a delay to the border appearing so it waits for the accordion to open */
    transition: border-bottom 0.2s ease 0.1s;
}

/* 1. Ensure the row is stable and centered */
.acc-head-row {
    display: flex;
    gap: 6px;
    align-items: start; 
    line-height: 1.5; /* Force a predictable line height */
}

/* 2. Style the counter badge */
.acc-title-count {
    /* Reserve space even when empty so the layout doesn't jump */
    visibility: hidden;
    /* Add a minimum size to hold the layout shape */
    min-width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

    /* 3. ONLY show the badge when it has content */
    .acc-title-count:not(:empty) {
        visibility: visible; /* Show it only when it contains a number */
    }

/* 4. Fix font alignment to ensure vertical middle */
.acc-title-text {
    line-height: 1.5; /* Match the row height */
}

@media (max-width: 767.98px) {
    .category-products-sort {
        display: none !important;
    }

    .filter-items.d-flex.d-lg-none {
        display: none !important;
    }
}

/* Sort drawer only — compact height */
#mobile-sort-drawer {
    height: 25vh;
    max-height: 50vh;
}

.mobile-toolbar-btn {
    background: none;
    border: 1px solid var(--sa-border-color);
    border-radius: var(--sa-btn-radius);
    padding: 6px 12px;
    font-size: 0.85rem;
    color: var(--sa-text);
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
}

.mobile-active-filter-badge {
    display: none;
    background: var(--sa-primary);
    color: #fff;
    border-radius: 999px;
    font-size: 0.65rem;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: -6px;
    left: -6px;
}

.mobile-toolbar-count {
    font-size: 0.75rem;
    color: var(--sa-text-muted);
}

.sort-option-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0;
}

.sort-option-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--sa-border-color);
    border-radius: var(--sa-btn-radius);
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.15s;
    background: var(--sa-card-bg);
}

    .sort-option-item.active {
        background: var(--sa-primary);
        color: var(--sa-text-third);
        border-color: var(--sa-primary);
        font-weight: 600;
    }

    .sort-option-item:hover:not(.active) {
        background: rgba(var(--sa-btn-primary-shadow-rgb), 0.06);
    }

.sort-total-count{
font-size : 0.85rem;
font-weight : 500;
}

.mobile-filter-section {
    padding: 12px 16px 24px 16px;
    border-bottom: 1px solid var(--sa-border-color);
}

.mobile-filter-section-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 10px;
    color: var(--sa-text-primary);
}

.mobile-filter-scroll-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 10px;
    padding: 6px 0px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

    .mobile-filter-scroll-row::-webkit-scrollbar {
        display: none;
    }

.mobile-filter-drawer-footer {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--sa-border-color);
}

    .mobile-filter-drawer-footer .sa-btn-primary,
    .mobile-filter-drawer-footer .sa-btn-secondary {
        flex: 1;
    }

#btn-apply-mobile-filters{
    padding-block : 12px;
}

#mobile-filter-section-size{
    border-bottom : none;
}

/* ============================================================
   SHIMMER LOADER
   ============================================================ */
.product-card-shimmer {
    width: 100%;
    height: 260px;
    border-radius: var(--sa-radius);
    background: linear-gradient(90deg, #ffffff 25%, #f3f4f6 50%, #ffffff 75%);
    background-size: 200% 100%;
    animation: sa-card-shimmer 1.4s infinite;
    margin-bottom: 1rem;
}

[data-bs-theme="dark"] .product-card-shimmer {
    background: linear-gradient(90deg, #1f2933 25%, #111827 50%, #1f2933 75%);
}

@keyframes sa-card-shimmer {
    from {
        background-position: -200% 0;
    }

    to {
        background-position: 200% 0;
    }
}

/* ============================================================
   GENERIC SHIMMER UTILITIES
   ============================================================ */

/* Base shimmer block */
.shimmer-block {
    border-radius: 8px;
    background: linear-gradient(90deg, #ffffff 25%, #f3f4f6 50%, #ffffff 75%);
    background-size: 200% 100%;
    animation: sa-card-shimmer 1.4s infinite;
}

/* Dark mode shimmer */
[data-bs-theme="dark"] .shimmer-block {
    background: linear-gradient(90deg, #3a1820 25%, #4a202a 50%, #5b2934 75% );
    background-size: 200% 100%;
    animation: sa-card-shimmer 1.4s linear infinite;
}

/* Generic lines and shapes */
.category-shimmer-line {
    height: 10px;
    margin-bottom: 6px;
    border-radius: 999px;
}

.category-shimmer-line-lg {
    height: 14px;
    margin-bottom: 10px;
    border-radius: 999px;
}

.category-shimmer-circle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

/* Filter skeleton box */
.category-shimmer-filter-box {
    border-radius: var(--sa-radius);
    border: 1px solid var(--bs-border-color);
    padding: 0.9rem 1rem;
    margin-bottom: 0.75rem;
}

/* Product card skeleton */
.category-shimmer-card {
    height: 320px;
    border-radius: var(--sa-radius);
    margin-bottom: 0.75rem;
}

/* Sort bar skeleton container */
.category-shimmer-sort {
    border-radius: var(--sa-radius);
    padding: 0.75rem 1rem;
}


/* ============================================================
   PRODUCT GRID / CARDS
   ============================================================ */


/* Card wrapper */
.category-product-card {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    border-radius: var(--sa-radius);
    background: var(--sa-card-bg);
    border: 1px solid transparent;
    transition: 0.25s ease;
    text-align: right;
    direction: rtl;
    margin: auto auto 0px !important;
}

    /* Card hover – lift card ONLY */
    .category-product-card:hover {
        border-color: rgba(var(--sa-primary-rgb), 0.35);
        box-shadow: 0 0 0 1px rgba(var(--bs-primary-rgb), 0.06), 0 12px 24px rgba(15, 23, 42, 0.12);
        transform: translateY(-2px);
    }

/* ============================================================
   IMAGE BLOCK
   ============================================================ */
.category-product-img {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1; /* square — adjust to4/5 or 3/4 if you prefer portrait */
    padding-top: 40px;
    overflow: hidden;
    border-top-left-radius: var(--sa-radius);
    border-top-right-radius: var(--sa-radius);
    background: var(--bs-card-bg);
}

/* Base style for both images */
.category-product-image-primary,
.category-product-image-secondary {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    top: 40px; /* match container padding-top */
    width: 100%;
    height: calc(100% - 40px);
    object-fit: contain;
    object-position: center;
    transition: opacity 0.35s ease;
    z-index: 1;
}

/* Primary image always visible unless secondary exists */
.category-product-image-primary {
    opacity: 1;
    visibility: visible;
}

/* Secondary image starts hidden */
.category-product-image-secondary {
    opacity: 0;
    visibility: hidden;
    z-index: 2;
}

/* ------------------------------------------------------------
   HOVER BEHAVIOR — only fade if secondary exists
   ------------------------------------------------------------ */
.category-product-card:hover .category-product-image-primary.has-secondary {
    opacity: 0;
    visibility: hidden;
}

.category-product-card:hover .category-product-image-secondary.has-secondary {
    opacity: 1;
    visibility: visible;
}

/* Kill global transforms */
.category-product-card img,
.category-product-card:hover img {
    transform: none !important;
}


/* ============================================================
   CAMPAIGN BADGE
   ============================================================ */
.product-campaign-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--sa-primary) !important;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--sa-text-third);
    z-index: 10;
}

/* ============================================================
   CARD TEXT / DESCRIPTION
   ============================================================ */
.category-product-desc {
    flex: 1;
    min-width: 0; /* ✅ IMPORTANT */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0.2rem 1rem;
}

.category-product-title {
    min-width: 0; /* ✅ IMPORTANT */
}

    .category-product-title h6 {
        font-size: 0.95rem;
        margin-top: 8px;
        font-weight: 700;
        margin-bottom: 4px;
        line-height: 1.6;
        color: var(--sa-heading-color);
        /* --- 2 line ellipsis --- */
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2; /* max lines */
        overflow: hidden;
    }


    .category-product-title small {
        color: var(--sa-muted-text) !important;
        font-size: 0.8rem;
        /* --- 1 line ellipsis --- */
        display: block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        /* English text inside RTL card */
        direction: ltr;
        unicode-bidi: plaintext;
    }


/* ============================================================
   PRICE SECTION
   ============================================================ */
.category-product-price .old-price {
    font-size: 0.85rem;
    color: var(--bs-muted-text);
    text-decoration: line-through;
}

.category-product-price .new-price {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--sa-heading-color);
}

/* ============================================================
   VERTICAL PRODUCT COLOR DOTS
   ============================================================ */
.product-color-list {
    position: absolute;
    left: 10px;
    top: 48px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 12;
}

.product-color-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
}

.product-color-more {
    font-size: 12px;
    font-weight: bold;
    color: var(--bs-body-color);
    text-align: center;
}

/* HARD OVERRIDE: remove any hover transform on product images in category grid */
.category-products-grid .product-box-item-img img,
.category-products-grid .product-box-item:hover .product-box-item-img img,
.category-products-grid .category-product-card img,
.category-products-grid .category-product-card:hover img {
    transform: none !important;
    transition: opacity 0.35s ease !important; /* keep only fade effect */
}

/* Reserve space for discount column even when empty */
.category-product-price .discount-column {
    min-height: 42px; /* exact height of two lines: percent + label */
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

    .category-product-price .discount-column .text-danger {
        color: var(--sa-primary) !important
    }


.category-product-price .price-column {
    min-height: 42px; /* same height as discount column */
    display: flex;
    flex-direction: column;
    justify-content: flex-end; /* push price to bottom */
    align-items: flex-end;
}

/* Make checkbox and label clickable with pointer cursor */
.category-filter .form-check-input,
.category-filter .form-check-label {
    cursor: pointer;
}

.form-check-input,
.form-check-label {
    cursor: pointer;
}

.form-check-label {
    padding-top: 2px;
}

.shimmer-fade-out {
    opacity: 0;
    transition: opacity 0.25s ease-out;
}

/* Fade-in animation container */
.sa-fade {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.35s ease-out, transform 0.35s ease-out;
}

    .sa-fade.sa-show {
        opacity: 1;
        transform: translateY(0);
    }

.product-price-soldout {
    opacity: 0.8;
}

    .product-price-soldout .badge {
        font-size: 0.9rem;
    }

/* ============================================================
   COLOR FILTER - SWATCH ONLY SELECT + LABEL OUTSIDE
   ============================================================ */
.color-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 48px);
    gap: 12px 10px;
    justify-content: start;
}

@media (min-width: 421px) and (max-width: 767px) {
    .color-filter-grid {
        grid-template-columns: repeat(auto-fill, 52px);
        gap: 8px 6px;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .color-filter-grid {
        grid-template-columns: repeat(auto-fill, 55px);
        gap: 8px 6px;
    }
}

@media (min-width: 992px) {
    .color-filter-grid {
        grid-template-columns: repeat(auto-fill, 51px);
        gap: 8px 6px;
    }
}

.color-filter-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}


/* wrapper for each color */
.color-filter-tile {
    display: flex;
    flex-direction: column;
    position: relative;
}

/* clickable swatch (THIS is what becomes active) */
.color-swatch-btn {
    width: 52px;
    height: 52px;
    box-sizing: border-box;
    border-radius: var(--sa-btn-radius);
    /* 1. Set initial border to 2px (transparent) so size doesn't change on active */
    border: 2px solid transparent;
    /* 2. CRITICAL: Add hidden to clip children to the rounded corners */
    overflow: visible;
    padding: 0px;
    cursor: pointer;
    position: relative;
    transition: transform .12s ease, box-shadow .18s ease, border-color .18s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    background-clip: padding-box;
}

    /* Tooltip */
    .color-swatch-btn[data-tooltip]::before {
        z-index: 9999;
        content: attr(data-tooltip);
        position: absolute;
        bottom: calc(100% + 6px);
        left: 50%;
        transform: translateX(-50%) scale(0.85);
        background: var(--sa-primary);
        color: var(--sa-text-third);
        font-size: 0.72rem;
        font-weight: 600;
        white-space: nowrap;
        padding: 4px 8px;
        border-radius: 6px;
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.1s ease, transform 0.1s ease;
        backdrop-filter: blur(4px);
    }

    .color-swatch-btn[data-tooltip]:hover::before,
    .color-swatch-btn[data-tooltip]:focus::before,
    .color-swatch-btn[data-tooltip]:focus-visible::before {
        opacity: 1;
        visibility: visible;
        transform: translate(-50%, -8px);
    }

    .color-swatch-btn[data-tooltip].is-tooltip-open::before,
    .color-swatch-btn[data-tooltip].is-tooltip-open::after {
        opacity: 1;
        visibility: visible;
    }

/* Lift the accordion section above its siblings */
.color-filter-section {
    position: relative;
    z-index: 10;
}

/* Lift the open accordion item even higher */
.accordion-item.active,
.accordion-item:focus-within {
    z-index: 20;
}

/* Ensure tooltip clears everything */
.color-swatch-btn[data-tooltip]::before {
    z-index: 9999;
}

/* Let tooltip escape accordion body */
#acc-color .accordion-body,
#acc-color .color-filter-grid,
#acc-color .color-filter-tile {
    overflow: visible !important;
}

/* Make sure tooltip host is above nearby elements */
#acc-color .color-swatch-btn {
    position: relative;
    overflow: visible !important;
}

    /* Tooltip layer above accordion header/button */
    #acc-color .color-swatch-btn[data-tooltip]::before,
    #acc-color .color-swatch-btn[data-tooltip]::after {
        z-index: 9999;
        pointer-events: none;
    }


    #acc-color .color-swatch-btn[data-tooltip]::before {
        content: attr(data-tooltip);
        position: absolute;
        bottom: calc(100% + 8px);
        left: 50%;
        transform: translateX(-50%);
        opacity: 0;
        pointer-events: none;
        z-index: 99999;
        background: var(--sa-primary);
        color: var(--sa-text-third);
        font-size: .72rem;
        padding: 4px 8px;
        border-radius: 6px;
        white-space: nowrap;
    }

    #acc-color .color-swatch-btn[data-tooltip]:hover::before {
        opacity: 1;
    }

/* Tablet: Slightly larger swatches when filters are full-width */
@media (min-width: 768px) and (max-width: 991px) {
    .color-swatch-btn {
        width: 56px;
        height: 56px;
    }
}

/* Mobile: Smaller swatches */
@media (max-width: 420px) {
    .color-swatch-btn {
        width: 48px;
        height: 48px;
    }
}


    .color-swatch-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 10px 18px rgba(15,23,42,.10);
    }

/* inner fill MUST match rounded-square (no circle) */
.color-swatch-fill {
    width: 100%;
    height: 100%;
    display: block;
}

/* image also rounded-square */
.color-swatch-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.color-swatch-fill,
.color-swatch-img {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: calc(var(--sa-btn-radius) - 2px); /* Slightly smaller to fit inside the padding */
    object-fit: cover;
}

/* active highlight ONLY on swatch */
.color-swatch-btn.active {
    /* 3. Just change the color, border width remains 2px to prevent size shift */
    border-color: rgba(var(--sa-primary-rgb));
    box-shadow: 0 0 0 3px rgba(var(--sa-btn-primary-shadow-rgb), .18);
}

    /* optional checkmark for active */
    .color-swatch-btn.active::after {
        content: "✓";
        position: absolute;
        top: 4px;
        right: 6px;
        font-size: 14px;
        font-weight: 900;
        color: var(--sa-text-third);
        width: 18px;
        height: 18px;
        border-radius: 999px;
        background: var(--sa-primary);
        display: flex;
        align-items: center;
        justify-content: center;
    }

/* Color filter label - 2 line ellipsis */
.color-tile-label {
    display: none;
    margin-top: 6px;
    font-size: .82rem;
    font-weight: 700;
    color: var(--bs-heading-color);
    text-align: center;
    max-width: 100%; /* Allow full width within grid cell */
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    line-height: 1.25;
}

@media (max-width: 767.98px) {
    .mobile-filter-drawer .color-tile-label {
        display: none !important;
    }
}

/**/
/* ====== FORCE TITLE 2-LINE ELLIPSIS (put at end of file) ====== */
.category-product-card .category-product-title h6 {
    overflow: hidden !important;
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
    /* optional (helps with some fonts/edge cases) */
    word-break: break-word;
}
/* ====== FORCE ENGLISH NAME 1-LINE ELLIPSIS ====== */
.category-product-card .category-product-title small {
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    direction: ltr;
    unicode-bidi: plaintext;
}

/* ================================
   STICK PRICE TO BOTTOM (NO LAYOUT CHANGE)
   ================================ */

/* Make the TEXT link (below image) stretch in the card */
.category-product-card > a.category-product-link {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto; /* <-- key */
    min-height: 0;
    min-width: 0;
}

/* Ensure the desc can actually grow */
.category-product-card .category-product-desc {
    flex: 1 1 auto; /* <-- key */
    min-height: 0;
}

/* Push the price block to the bottom */
.category-product-card .category-product-price {
    margin-top: auto; /* <-- key */
}

#category-sort-select {
    color: var(--sa-heading-text);
    border-radius: var(--sa-btn-radius);
    border: 1px solid var(--sa-border-color);
    background-color: rgba(0,0,0,0.02) !important;
    cursor: pointer;
}

    #category-sort-select:focus {
        box-shadow: none !important;
    }

    #category-sort-select option {
        background-color: var(--sa-card-bg);
        color: var(--sa-text);
    }

        #category-sort-select option:enabled :hover {
            background-color: red !important;
        }


#product-sort-select {
    color: var(--sa-heading-text);
    border-radius: var(--sa-btn-radius);
    border: 1px solid var(--sa-border-color);
    background-color: rgba(0,0,0,0.02) !important;
    cursor: pointer;
}

    #product-sort-select:focus {
        box-shadow: none !important;
    }

    #product-sort-select option {
        background-color: var(--sa-card-bg);
        color: var(--sa-text);
    }

        #product-sort-select option:enabled :hover {
            background-color: red !important;
        }

.filter-chip {
    color: var(--sa-heading-text) !important;
    border-radius: var(--sa-btn-radius) !important;
    border: 1px solid var(--sa-border-color) !important;
    background-color: rgba(0,0,0,0.02) !important;
}

/* ============================================================
   RESPONSIVE FILTER ADJUSTMENTS
   ============================================================ */

/* Tablet and Mobile: Filters full-width */
@media (max-width: 991px) {
    .category-filters {
        display: grid;
        grid-template-columns: 1fr;
    }

    /* Make filter boxes more compact on mobile */
    .category-filter {
        padding: 0.65rem 0;
    }


}

/* Mobile: Stack filters vertically */
@media (max-width: 767px) {
    .category-filters {
        grid-template-columns: 1fr;
    }
    #product-filters-container{
        margin-bottom : 1rem;
    }
}

/* ============================================================
   TABLET: KEEP FILTERS AS SIDEBAR (768px-991px) - RTL
   ============================================================ */
@media (min-width: 768px) and (max-width: 991px) {
    /* Make the row a flex container */
    .category-products {
        flex-wrap: nowrap;
    }

        /* Filters: fixed width sidebar */
        .category-products > .col-lg-3 {
            flex: 0 0 240px;
            max-width: 240px;
            margin-right: 0; /* Remove default margin */
            padding-left: 6px; /* Bootstrap gutter */
        }

        /* Products: take remaining space */
        .category-products > .col-lg-9 {
            flex: 1;
            max-width: calc(100% - 240px);
            padding-right: 15px; /* Bootstrap gutter */
        }

    /* Remove the 2-column grid for filters on tablet */
    .category-filters {
        display: block !important;
        grid-template-columns: none !important;
    }
}

/* ============================================================
   FILTER HEADER (Title + Clear Button)
   ============================================================ */
.category-filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0.5rem;
    margin-bottom: 0.75rem;
}

.filters-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--sa-heading-color);
    margin: 0;
}

/* Clear filters button (hidden by default) */
.btn-clear-filters {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--sa-text, #e26390);
    background: rgba(226, 99, 144, 0.08);
    border: 1.5px solid rgba(226, 99, 144, 0.35);
    border-radius: var(--sa-btn-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

    .btn-clear-filters:hover {
        background-color: var(--sa-danger);
        color: var(--sa-text-third);
    }

    .btn-clear-filters i {
        font-size: 1rem;
    }

/* Mobile: Keep horizontal layout, adjust sizing */
@media (max-width: 575px) {
    .category-filters-header {
        padding: 0.85rem 0.75rem;
        gap: 8px;
    }

    .filters-title {
        font-size: 0.95rem;
        flex-shrink: 0;
    }

    .btn-clear-filters {
        font-size: 0.85rem;
        padding: 5px 10px;
        white-space: nowrap;
        flex-shrink: 0;
        width: 120px;
        justify-content: center;
    }

        .btn-clear-filters i {
            font-size: 0.85rem;
        }
}


/* Tablet: Keep horizontal layout */
@media (min-width: 576px) and (max-width: 991px) {
    .category-filters-header {
        padding: 0.85rem 0.5rem;
    }

    .filters-title {
        font-size: 1rem;
    }

    .btn-clear-filters {
        font-size: 0.85rem;
        padding: 5px 10px;
        width: 120px;
        justify-content: center;
    }
}

/* ============================================================
   FILTER COLUMN BACKGROUND
   ============================================================ */
.category-filters {
    background-color: var(--sa-card-bg);
    border: 1px solid var(--sa-border-color);
    border-radius: var(--sa-radius);
    padding: 0;
    overflow: visible; /* ensures child elements respect border-radius */
}

/* Adjust header padding since container now has background */
.category-filters-header {
    padding: 1rem 1rem;
    margin-bottom: 0;
}

/* Add padding to filter boxes container */
.category-filters > .category-filter:first-of-type {
    margin-top: 1rem;
}

.category-filters > .category-filter:last-of-type {
    margin-bottom: 1rem;
}

/* Adjust individual filter boxes - remove their borders since container has one */
.category-filters .category-filter {
    border: none;
    border-bottom: 1px solid var(--sa-border-color);
    border-radius: 0;
    margin-left: 1rem;
    margin-right: 1rem;
    margin-bottom: 0;
    padding: 0.65rem 0;
}

    .category-filters .category-filter:last-of-type {
        border-bottom: none;
    }


.btn-clear-filters.invisible-btn {
    visibility: hidden;
    pointer-events: none;
    opacity: 0;
}

.btn-clear-filters {
    visibility: visible;
    pointer-events: auto;
    opacity: 1;
    transition: opacity 0.2s ease;
}

/* ============================================================
   TABLET: KEEP FILTERS AS SIDEBAR (768px-991px) - RTL
   ============================================================ */
@media (min-width: 768px) and (max-width: 991px) {
    /* Make the row a flex container */
    .category-layout {
        display: flex;
        flex-wrap: nowrap;
    }

        /* Filters: fixed width sidebar */
        .category-layout > .col-lg-3 {
            flex: 0 0 240px;
            max-width: 240px;
            margin-right: 0;
            padding-left: 6px;
        }

        /* Products: take remaining space */
        .category-layout > .col-lg-9 {
            flex: 1;
            max-width: calc(100% - 240px);
        }

    /* Remove the 2-column grid for filters on tablet */
    .category-filters {
        display: block !important;
        grid-template-columns: none !important;
    }
}

/* ============================================================
   TABLET: SORT BAR - MATCH MOBILE LAYOUT (768px-991px)
   ============================================================ */
@media (min-width: 768px) and (max-width: 991px) {
    /* Force hide desktop sort links on tablet */
    .category-products-sort .link.d-md-block {
        display: none !important;
    }

    /* Force show mobile dropdown on tablet */
    .category-products-sort .link-responsive.d-md-none {
        display: block !important;
    }

    /* Keep items in a single row like mobile */
    .category-products-sort .items {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
    }
}


.campaign-banner {
    width: 100%;
    border-radius: var(--sa-radius);
    overflow: hidden; /* important: hide cropped sides */
}

    .campaign-banner img {
        display: block;
        width: 100%;
        height: 170px; /* fixed hero height on desktop */
        object-fit: cover; /* fills box, crops overflow */
        object-position: center; /* keep center part visible */
    }

/* Tablet */
@media (max-width: 991.98px) {
    .campaign-banner img {
        height: 140px;
    }
}

/* Mobile */
@media (max-width: 767.98px) {
    .campaign-banner img {
        height: 110px;
    }
}

/* Under 420px: one card per row */
@media (max-width: 380px) {
    .category-product-col {
        flex: 0 100%;
        max-width: 100%;
    }
}

@media (max-width: 380px) {
    #category-products-shimmer .col-6,
    #pagination-shimmer .col-6 {
        flex: 0 100%;
        max-width: 100%;
    }
}



