* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
}

ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.page {
    
    margin: 0 auto;
    padding: 28px 96px 60px;
}

.breadcrumb {
    font-size: 14px;
    color: #73737A;
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 14px;
}

    .breadcrumb a {
        color: var(--text-500);
    }

        .breadcrumb a:hover {
            color: var(--primary);
        }

    .breadcrumb .sep {
        color: var(--text-400);
    }

    .breadcrumb .current {
        color: var(--text-700);
    }

.page-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 20px;
    color: #000;
}

.layout {
    display: grid;
    grid-template-columns: 297px 1fr;
    gap: 20px;
    align-items: start;
}

.toolbar {
    background: #F8F8F8;
    border-radius: 10px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    flex-direction: row-reverse;
}

.result-count {
    font-size: 14px;
    color: #464646;
    font-weight: 400;
    white-space: nowrap;
}

.sort-group {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    gap: 22px;
    flex-wrap: wrap;
}

.sort-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #464646;
    font-weight: 500;
}

.sort-tabs {
    display: flex;
    align-items: center;
    gap: 45px;
    flex-wrap: wrap;
}

    .sort-tabs button {
        background: none;
        border: none;
        font-family: inherit;
        font-size: 14px;
        color: #464646;
        font-weight: 400;
        padding: 4px 0;
        position: relative;
    }

        .sort-tabs button.active {
            color: #0F0A95;
            font-weight: 700;
            font-size: 14px;
            line-height: 100%;
            letter-spacing: 0%;
            text-align: right;
        }

/* .sort-tabs button.active::after {
    content: "";
    position: absolute;
    right: 0;
    left: 0;
    bottom: -13px;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
} */

/* Product grid */
.grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.card {
    background: #FFFFFF;
    border: 1px solid #F0F0F0;
    border-radius: 10PX;
    display: flex;
    flex-direction: column;
    transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}

    .card:hover {
        box-shadow: var(--shadow);
        border-color: #dbe2ee;
        transform: translateY(-2px);
    }

.card-media {
    width: 100%;
    height: 334px;
    margin: 0 auto 12px auto;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .card-media img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
        display: block;
    }

.card-footer {
    border-top: none;
    background: transparent;
}

.card-title {
    font-size: 13.5px;
    font-weight: 600;
    color: #000000;
    line-height: 1.6;
    margin: 0 0 10px;
    min-height: 42px;
    padding: 0 1rem;
}

.swatches {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: flex-end;
    margin-bottom: 10px;
    padding: 0 1rem;
}

.swatch-dot {
    width: 9.27px;
    height: 9.27px;
    border-radius: 50%;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: row-reverse;
    margin-top: auto;
}

.price {
    font-size: 14px;
    font-weight: 700;
    color: #000000;
}

.price-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.old-price {
    font-weight: 400;
    font-style: normal;
    font-size: 14px;
    line-height: 100%;
    letter-spacing: 0;
    text-decoration: line-through;
    color: #AFAFAF;
}

.rating {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-700);
}

    .rating svg {
        width: 14px;
        height: 14px;
        fill: #F1C21B;
    }

.sidebar {
    border: 1px solid #F0F0F0;
    border-radius: 10px;
    overflow: hidden;
    position: sticky;
    top: 20px;
}

.sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-soft);
}

    .sidebar-head h3 {
        margin: 0;
        font-size: 15px;
        font-weight: 700;
        display: flex;
        align-items: center;
        gap: 8px;
    }

        .sidebar-head h3 svg {
            width: 18px;
            height: 18px;
            color: var(--text-700);
        }

.clear-btn {
    background: none;
    border: none;
    font-size: 12.5px;
    color: var(--primary);
    font-weight: 600;
}

.stock-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-soft);
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-700);
    flex-direction: row-reverse;
}

.switch {
    position: relative;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}

    .switch input {
        opacity: 0;
        width: 0;
        height: 0;
        position: absolute;
    }

    .switch .track {
        position: absolute;
        inset: 0;
        background: #dfe3ea;
        border-radius: 999px;
        transition: .2s;
    }

        .switch .track::before {
            content: "";
            position: absolute;
            width: 16px;
            height: 16px;
            left: 3px;
            top: 3px;
            border: 1px solid #0F0A95;
            background: #0F0A95;
            border-radius: 50%;
            transition: .2s;
            box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
        }

    .switch input:checked + .track::before {
        transform: translateX(16px);
    }

.accordion-item {
    border-bottom: 1px solid var(--border-soft);
}

    .accordion-item:last-child {
        border-bottom: none;
    }

.accordion-trigger {
    width: 100%;
    background: none;
    border: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 18px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-900);
}

    .accordion-trigger .chev {
        width: 16px;
        height: 16px;
        color: #0F0A95;
        transition: transform .2s ease;
        flex-shrink: 0;
    }

.accordion-item.open .accordion-trigger .chev {
    transform: rotate(180deg);
}

.accordion-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height .28s ease;
}

.accordion-panel-inner {
    padding: 2px 18px 18px;
}

.opt-list {
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.opt {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    font-size: 14px;
    color: #464646;
    cursor: pointer;
    font-weight: 400;
}

    .opt input[type="checkbox"],
    .opt input[type="radio"] {
        appearance: none;
        -webkit-appearance: none;
        width: 17px;
        height: 17px;
        border: 1.5px solid #cbd2db;
        border-radius: 5px;
        position: relative;
        flex-shrink: 0;
        cursor: pointer;
        order: 2;
    }

    .opt input[type="radio"] {
        border-radius: 50%;
    }

        .opt input[type="checkbox"]:checked,
        .opt input[type="radio"]:checked {
            background: #0F0A95;
            border: 1px solid #0F0A95
        }

            .opt input[type="checkbox"]:checked::after {
                content: "";
                position: absolute;
                right: 5px;
                top: 2px;
                width: 5px;
                height: 9px;
                border: solid #fff;
                border-width: 0 2px 2px 0;
                transform: rotate(38deg);
            }

            .opt input[type="radio"]:checked::after {
                content: "";
                position: absolute;
                inset: 4px;
                background: #fff;
                border-radius: 50%;
            }

    .opt span {
        order: 1;
    }

/* Search inside brand */
.mini-search {
    position: relative;
    margin-bottom: 14px;
}

    .mini-search input {
        width: 100%;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        padding: 9px 12px;
        font-family: inherit;
        font-size: 13px;
        background: #f8f9fb;
        outline: none;
    }

        .mini-search input:focus {
            border-color: var(--primary);
            background: #fff;
        }

/* Price range */
.price-fields {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.price-field {
    flex: 1;
}

    .price-field label {
        display: block;
        font-size: 11.5px;
        color: var(--text-500);
        margin-bottom: 6px;
    }

    .price-field .box {
        border: 1px solid #E0E0E0;
        border-radius: 8px;
        padding: 8px 10px;
        font-size: 13px;
        background: #F8F8F8;
        display: flex;
        align-items: center;
        gap: 4px;
    }

    .price-field input {
        border: none;
        background: none;
        outline: none;
        width: 100%;
        font-size: 14px;
        font-weight: 500;
        font-family: inherit;
        font-size: 13px;
        color: #171717;
        text-align: center;
    }

    .price-field .unit {
        font-size: 11px;
        color: var(--text-400);
        white-space: nowrap;
    }

.range-wrap {
    position: relative;
    height: 20px;
    margin: 8px 2px 4px;
}

.range-track {
    position: absolute;
    top: 9px;
    left: 0;
    right: 0;
    height: 3px;
    background: #e3e6ec;
    border-radius: 3px;
}

.range-fill {
    position: absolute;
    top: 9px;
    height: 3px;
    background: #0F0A95;
    border-radius: 3px;
}

.range-wrap input[type="range"] {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    margin: 0;
    background: none;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
    height: 20px;
}

    .range-wrap input[type="range"]::-webkit-slider-thumb {
        pointer-events: auto;
        -webkit-appearance: none;
        appearance: none;
        width: 17px;
        height: 17px;
        border-radius: 50%;
        background: #fff;
        border: 3px solid #0F0A95;
        box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
        cursor: pointer;
        margin-top: 0;
    }

    .range-wrap input[type="range"]::-moz-range-thumb {
        pointer-events: auto;
        width: 15px;
        height: 15px;
        border-radius: 50%;
        background: #fff;
        border: 2px solid var(--primary);
        cursor: pointer;
    }

    .range-wrap input[type="range"]::-webkit-slider-runnable-track {
        background: transparent;
    }

    .range-wrap input[type="range"]::-moz-range-track {
        background: transparent;
    }

/* Color swatches grid */
.color-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px 8px;
}

.color-opt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

    .color-opt .dot {
        width: 30px;
        height: 30px;
        border-radius: 50%;
        border: 2px solid transparent;
        box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
        position: relative;
        transition: .15s;
    }

    .color-opt input {
        display: none;
    }

        .color-opt input:checked + .dot {
            border-color: var(--primary);
            box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--primary);
        }

    .color-opt span {
        font-size: 11px;
        color: var(--text-500);
    }

/* Star radio */
.star-opt {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 2px 0;
}

    .star-opt .stars {
        display: flex;
        order: 1;
        gap: 2px;
    }

        .star-opt .stars svg {
            width: 14px;
            height: 14px;
            fill: #e3e6ec;
        }

    .star-opt.filled-1 .stars svg:nth-child(1),
    .star-opt.filled-2 .stars svg:nth-child(-n+2),
    .star-opt.filled-3 .stars svg:nth-child(-n+3),
    .star-opt.filled-4 .stars svg:nth-child(-n+4),
    .star-opt.filled-5 .stars svg:nth-child(-n+5) {
        fill: var(--star);
    }

    .star-opt label {
        font-size: 13px;
        color: var(--text-700);
        order: 2;
        flex: 1;
        text-align: right;
        cursor: pointer;
    }

    .star-opt input {
        order: 3;
    }

.scroll-list {
    max-height: 220px;
    overflow-y: auto;
    padding-left: 4px;
}

    .scroll-list::-webkit-scrollbar {
        width: 5px;
    }

    .scroll-list::-webkit-scrollbar-thumb {
        background: #dfe3ea;
        border-radius: 4px;
    }

@media (max-width:1080px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        order: -1;
    }

    .grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .page {
        margin: 0 auto;
        padding: 28px 20px 60px;
    }
}

@media (max-width:720px) {
    .grid {
        grid-template-columns: repeat(1, 1fr);
    }

    .card {
        display: grid;
        grid-template-columns: 148.5px minmax(0, 1fr);
        grid-template-areas:
            "media title"
            "media footer"
            "swatches .";
        column-gap: 12px;
        row-gap: 8px;
        padding: 12px;
        direction: ltr;
    }

    .card-media {
        grid-area: media;
        width: 148.5px;
        height: 165px;
        aspect-ratio: auto;
        margin: 0;
        overflow: hidden;
        display: flex;
        align-items: center;
        justify-content: center;
    }

        .card-media img {
            display: block;
            width: 100%;
            height: 100%;
            object-fit: contain;
            object-position: center;
        }

    .card-title {
        grid-area: title;
        margin: 0;
        direction: rtl;
        text-align: right;
        font-size: 12px;
        font-weight: 700;
        line-height: 1.9;
        color: #222;
    }

    .card-footer {
        grid-area: footer;
        display: flex;
        align-items: center;
        justify-content: space-between;
        direction: rtl;
        margin-top: auto;
    }

        .card-footer .price {
            font-size: 14px;
            font-weight: 700;
            white-space: nowrap;
        }

        .card-footer .rating {
            display: inline-flex;
            align-items: center;
            gap: 3px;
            font-size: 13px;
            white-space: nowrap;
        }

    .swatches {
        grid-area: swatches;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
        width: 148.5px;
        margin: 0;
        padding-top: 2px;
    }

    .swatch-dot {
        width: 12px;
        height: 12px;
        border-radius: 50%;
        border: 1px solid #e0e0e0;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .sort-tabs {
        gap: 14px;
    }

    .sidebar .stock-toggle,
    .sidebar #accordion,
    .sidebar .clear-btn {
        display: none !important;
    }

    .sort-tabs {
        display: none !important;
    }

    .sidebar {
        display: block;
        margin-bottom: 0;
        padding-bottom: 0;
        border-bottom: none;
    }

    .sidebar-head {
        margin-bottom: 4px;
    }

        .sidebar-head h3 {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            font-size: 15px;
            margin: 0;
            cursor: pointer;
        }

    .toolbar {
        display: none;
        
    }

    .sort-group {
        display: flex;
        align-items: center;
    }

    .sort-label {
        display: inline-flex !important;
        align-items: center;
        gap: 6px;
        font-size: 15px;
        color: #464646;
        font-weight: 700;
        cursor: pointer;
    }

        .sort-label svg {
            width: 18px;
            height: 18px;
        }

    .result-count {
        font-size: 12px;
        color: #717171;
        margin-top: 2px;
    }
}

/* =========================================================
   Mobile-only combined filter/sort bar + side drawers
   (phone sizes only, same breakpoint as the rest of the
   mobile layout above)
   ========================================================= */

.mobile-toolbar,
.drawer-backdrop,
.mobile-drawer {
    display: none;
}

@media (max-width:720px) {

    /* The real sidebar only lives inside the filters drawer now */
    .sidebar {
        display: none;
    }

    .mobile-toolbar {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-bottom: 16px;
    }

    .mobile-actions {
        display: flex;
        align-items: center;
        justify-content: right;
        gap: 22px;
        background: #F8F8F8;
        border-radius: 10px;
        padding: 14px 20px;
    }

    .mobile-actions-sep {
        width: 1px;
        height: 18px;
        background: #E4E4E4;
    }

    .mobile-action-btn {
        display: flex;
        align-items: center;
        gap: 8px;
        background: none;
        border: none;
        font-family: inherit;
        font-size: 14px;
        font-weight: 600;
        color: #464646;
        padding: 0;
    }

    .mobile-result-count {
        font-size: 13px;
        color: #646464;
        padding: 0 4px;
    }

        .mobile-result-count b {
            font-weight: 700;
            color: #464646;
        }

    .drawer-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .4);
        opacity: 0;
        pointer-events: none;
        transition: opacity .25s ease;
        z-index: 60;
        visibility: hidden;
    }

        .drawer-backdrop.open {
            opacity: 1;
            visibility: visible;
        }


    .mobile-drawer {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 86%;
        max-width: 360px;
        background: #fff;
        z-index: 61;
        transform: translateX(100%);
        transition: transform .28s ease;
        box-shadow: -6px 0 24px rgba(0, 0, 0, .12);
    }

        .mobile-drawer.open {
            transform: translateX(0);
        }

    .drawer-close {
        position: absolute;
        top: 14px;
        left: 14px;
        width: 30px;
        height: 30px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #F5F5F5;
        border: none;
        border-radius: 50%;
        z-index: 1;
    }

    .drawer-title {
        font-size: 15px;
        font-weight: 700;
        color: #171717;
        padding: 18px 18px 6px;
    }

    .drawer-body {
        flex: 1;
        overflow-y: auto;
        padding-top: 4px;
    }

    .drawer-footer {
        padding: 14px 18px;
        border-top: 1px solid #F0F0F0;
    }

    .drawer-apply-btn {
        width: 100%;
        background: #0F0A95;
        color: #fff;
        border: none;
        border-radius: 8px;
        padding: 13px;
        font-family: inherit;
        font-size: 14px;
        font-weight: 700;
    }

    body.drawer-lock {
        overflow: hidden;
    }

    .mobile-drawer .sidebar {
        display: block !important;
        position: static;
        border: none;
        border-radius: 0;
        overflow: visible;
    }

        .mobile-drawer .sidebar .stock-toggle,
        .mobile-drawer .sidebar #accordion,
        .mobile-drawer .sidebar .clear-btn {
            display: flex !important;
        }

        .mobile-drawer .sidebar #accordion {
            display: block !important;
        }

    #sortDrawerBody .sort-tabs {
        display: flex !important;
        flex-direction: column;
        gap: 0;
        padding: 33px 18px 18px;
    }

        #sortDrawerBody .sort-tabs button {
            width: 100%;
            text-align: right;
            padding: 15px 0;
            border-bottom: 1px solid #F0F0F0;
            font-size: 14.5px;
        }

            #sortDrawerBody .sort-tabs button.active {
                color: #0F0A95;
                font-weight: 700;
            }

                #sortDrawerBody .sort-tabs button.active::after {
                    content: "✓";
                    float: left;
                }
}
