/* Professional independently scrolling shop filters. */
@media (min-width: 768px) {
    .catalog-layout {
        grid-template-columns: 272px minmax(0, 1fr);
        gap: 34px;
        align-items: start;
    }

    .catalog-filters {
        position: sticky;
        top: 142px;
        max-height: calc(100dvh - 158px);
        overflow-x: hidden;
        overflow-y: auto;
        padding: 0 14px 12px;
        border: 1px solid var(--shop-line);
        border-radius: 16px;
        background: #fff;
        box-shadow: 0 12px 34px rgba(13, 17, 40, .055);
        overscroll-behavior: contain;
        scrollbar-color: var(--shop-accent-soft) #eef0f3;
        scrollbar-width: thin;
    }

    .catalog-filters::-webkit-scrollbar { width: 8px; }
    .catalog-filters::-webkit-scrollbar-track { background: #eef0f3; }
    .catalog-filters::-webkit-scrollbar-thumb {
        border: 2px solid #eef0f3;
        border-radius: 99px;
        background: var(--shop-accent-soft);
    }

    .catalog-filters .filter-heading {
        position: sticky;
        z-index: 4;
        top: 0;
        min-height: 62px;
        margin-inline: -14px;
        padding: 0 16px;
        border-bottom: 1px solid var(--shop-line);
        background: rgba(255, 255, 255, .96);
        box-shadow: 0 7px 16px rgba(13, 17, 40, .035);
        backdrop-filter: blur(12px);
    }

    .catalog-filters .filter-heading h2 {
        display: flex;
        gap: 8px;
        align-items: center;
        font-size: 16px;
    }

    .catalog-filters .filter-heading h2 small {
        display: grid;
        min-width: 21px;
        height: 21px;
        padding-inline: 5px;
        border-radius: 99px;
        color: #fff;
        background: var(--shop-accent);
        font-size: 8px;
        place-items: center;
    }

    .catalog-filters .filter-heading a {
        padding: 6px 8px;
        border-radius: 7px;
        color: var(--shop-muted);
        background: var(--shop-soft);
        font-size: 9px;
        font-weight: 750;
        text-decoration: none;
    }

    .catalog-filter-desktop-footer {
        position: sticky;
        z-index: 3;
        bottom: -12px;
        min-height: 52px;
        gap: 8px;
        align-items: center;
        justify-content: space-between;
        margin: 0 -14px -12px;
        padding: 9px 14px;
        border-top: 1px solid var(--shop-line);
        background: rgba(255, 255, 255, .97);
        box-shadow: 0 -8px 18px rgba(13, 17, 40, .04);
        backdrop-filter: blur(12px);
    }

    .catalog-filter-desktop-footer span {
        display: flex;
        gap: 6px;
        align-items: center;
        color: var(--shop-muted);
        font-size: 8px;
    }

    .catalog-filter-desktop-footer span i { color: var(--shop-warm); }
    .catalog-filter-desktop-footer strong { color: var(--shop-accent); font-size: 9px; }
}

/* Keep catalog product tools usable on touch screens. */
@media (max-width: 767px) {
    .catalog-page .quick-view-button,
    .catalog-page .compare-product-button {
        display: grid;
        right: 8px;
        width: 36px;
        height: 36px;
        place-items: center;
        opacity: 1;
        transform: none;
    }

    .catalog-page .quick-view-button {
        top: 96px;
    }

    .catalog-page .compare-product-button {
        top: 140px;
    }

    html[dir="rtl"] .catalog-page .quick-view-button,
    html[dir="rtl"] .catalog-page .compare-product-button {
        right: auto;
        left: 8px;
    }
}

/* Shop dialogs always stay inside the visible browser viewport. */
.quick-view-modal,
.comparison-modal {
    padding-inline: 12px;
}

.quick-view-modal .modal-dialog,
.comparison-modal .modal-dialog {
    min-height: calc(100% - 24px);
    margin: 12px auto;
}

.quick-view-modal .modal-content,
.comparison-modal .modal-content {
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

@media (max-width: 767px) {
    .quick-view-modal,
    .comparison-modal {
        padding-inline: 6px;
    }

    .quick-view-modal .modal-dialog,
    .comparison-modal .modal-dialog {
        min-height: calc(100% - 12px);
        align-items: flex-start;
        margin: 6px auto;
    }

    .quick-view-modal .modal-content,
    .comparison-modal .modal-content {
        max-height: calc(100dvh - 12px);
        border-radius: 14px;
    }
}

.catalog-filters .filter-group {
    padding: 20px 2px;
}

.catalog-filters .filter-group h3 {
    display: flex;
    align-items: center;
    margin-bottom: 13px;
    color: var(--shop-ink);
    font-size: 11px;
    letter-spacing: .025em;
}

.catalog-filters .filter-group h3::after {
    height: 1px;
    flex: 1;
    margin-inline-start: 10px;
    content: "";
    background: var(--shop-line);
}

.filter-category-list > a,
.filter-category > a,
.filter-check {
    min-height: 38px;
    padding-inline: 9px;
    border-radius: 8px;
    transition: color .18s ease, background .18s ease, transform .18s ease;
}

.filter-category-list a:hover,
.filter-category-list a.active,
.filter-check:hover {
    background: var(--shop-soft);
}

.filter-category-list > a.active,
.filter-category > a.active {
    box-shadow: inset 3px 0 var(--shop-accent);
}

html[dir="rtl"] .filter-category-list > a.active,
html[dir="rtl"] .filter-category > a.active {
    box-shadow: inset -3px 0 var(--shop-accent);
}

.filter-subcategories {
    margin-left: 0;
    margin-inline-start: 12px;
    padding-left: 0;
    padding-inline-start: 14px;
    border-left: 0;
    border-inline-start: 1px solid var(--shop-line);
}

.filter-subcategories a {
    min-width: 0;
    padding: 4px 8px;
    line-height: 1.45;
}

.filter-subcategories a.active {
    box-shadow: none;
}

/* Clear, readable catalog pricing in both grid and list views. */
.catalog-page .home-product-price {
    gap: 8px;
}

.catalog-page .home-product-price del {
    display: inline;
    color: #747987;
    font-size: 11px;
    font-weight: 650;
    line-height: 1.2;
    text-decoration-color: #b4424d;
    text-decoration-thickness: 1.5px;
}

.catalog-list-actions {
    display: none;
}

/* Professional desktop list view: compact media with a calm information panel. */
@media (min-width: 768px) {
    .catalog-product-grid.list-view {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }

    .catalog-product-grid.list-view .product-result-item {
        display: grid;
        height: 286px;
        min-height: 286px;
        grid-template-columns: 220px minmax(0, 1fr);
        margin: 0;
        padding: 0;
        overflow: hidden;
        border: 1px solid #e1e4ea;
        border-radius: 18px;
        background: #fff;
        box-shadow: 0 10px 30px rgba(17, 23, 53, .065);
        transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
    }

    .catalog-product-grid.list-view .product-result-item:hover,
    .catalog-product-grid.list-view .product-result-item:focus-within {
        border-color: rgba(21, 26, 56, .24);
        box-shadow: 0 18px 44px rgba(17, 23, 53, .11);
        transform: translateY(-2px);
    }

    .catalog-product-grid.list-view .home-product-media {
        position: relative;
        width: 220px;
        height: 286px;
        min-height: 286px;
        aspect-ratio: auto;
        border: 0;
        border-inline-end: 1px solid #dfe3e9;
        background:
            radial-gradient(circle at 50% 42%, rgba(255, 255, 255, .98) 0 34%, rgba(245, 247, 249, .96) 66%, #eceff3 100%);
    }

    .catalog-product-grid.list-view .home-product-media::before {
        position: absolute;
        z-index: 1;
        inset: 14px;
        border: 1px solid rgba(21, 26, 56, .075);
        border-radius: 13px;
        content: "";
        pointer-events: none;
    }

    .catalog-product-grid.list-view .home-product-media::after {
        position: absolute;
        z-index: 1;
        top: 22px;
        right: 0;
        bottom: 22px;
        left: auto;
        width: 2px;
        content: "";
        opacity: 1;
        background: linear-gradient(180deg, transparent, var(--shop-warm), transparent);
        pointer-events: none;
    }

    html[dir="rtl"] .catalog-product-grid.list-view .home-product-media::after {
        right: auto;
        left: 0;
    }

    .catalog-product-grid.list-view .home-product-media > a:first-child {
        position: relative;
        z-index: 2;
        display: grid;
        width: 100%;
        height: 286px;
        aspect-ratio: auto;
        padding: 24px;
        place-items: center;
        overflow: hidden;
    }

    .catalog-product-grid.list-view .home-product-media img {
        width: 100%;
        height: 100%;
        max-height: 238px;
        padding: 0;
        object-fit: contain;
        object-position: center;
        filter: drop-shadow(0 12px 14px rgba(17, 23, 53, .13));
        transform: scale(.96);
        transition: filter .3s ease, transform .35s ease;
    }

    .catalog-product-grid.list-view .product-result-item:hover .home-product-media img,
    .catalog-product-grid.list-view .product-result-item:focus-within .home-product-media img {
        filter: drop-shadow(0 16px 18px rgba(17, 23, 53, .18));
        transform: scale(1);
    }

    .catalog-product-grid.list-view .home-product-media .home-product-badge:not(.badge-stock) {
        z-index: 3;
        top: 18px;
        left: 18px;
    }

    .catalog-product-grid.list-view .home-product-media .home-product-badge.badge-stock {
        z-index: 3;
        top: 56px;
        left: 18px;
    }

    html[dir="rtl"] .catalog-product-grid.list-view .home-product-media .home-product-badge {
        right: 18px;
        left: auto;
    }

    .catalog-product-grid.list-view .home-product-media > .product-wishlist-button,
    .catalog-product-grid.list-view .home-product-media > .product-whatsapp-button,
    .catalog-product-grid.list-view .home-product-media > .quick-view-button,
    .catalog-product-grid.list-view .home-product-media > .compare-product-button,
    .catalog-product-grid.list-view .home-product-media > .quick-add-button {
        display: none;
    }

    .catalog-product-grid.list-view .home-product-info {
        display: grid;
        height: 286px;
        min-height: 286px;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-rows: auto auto 1fr auto;
        gap: 10px 26px;
        align-content: center;
        align-items: start;
        padding: 34px 38px;
        color: #fff;
        background: linear-gradient(145deg, var(--shop-accent) 0%, var(--shop-accent-dark) 100%);
    }

    .catalog-product-grid.list-view .home-product-info::before {
        display: block;
        top: 34px;
        right: auto;
        left: 0;
        width: 3px;
        height: 54px;
        border-radius: 0 4px 4px 0;
        background: var(--shop-warm);
    }

    html[dir="rtl"] .catalog-product-grid.list-view .home-product-info::before {
        right: 0;
        left: auto;
        border-radius: 4px 0 0 4px;
    }

    .catalog-product-grid.list-view .home-product-meta {
        display: flex;
        min-height: 24px;
        grid-row: 1;
        grid-column: 1;
        gap: 12px;
        align-items: center;
        justify-content: flex-start;
        margin: 0;
    }

    .catalog-product-grid.list-view .home-product-meta > span:first-child {
        color: var(--shop-warm);
        font-size: 9px;
    }

    .catalog-product-grid.list-view .home-product-rating {
        color: rgba(255, 255, 255, .72);
        background: transparent;
    }

    .catalog-product-grid.list-view .product-card-title,
    .catalog-product-grid.list-view .product-card-title > a,
    .catalog-product-grid.list-view .product-card-title > a:hover {
        min-height: 0;
        grid-row: 2;
        grid-column: 1;
        margin: 0;
        color: #fff;
        font-size: clamp(19px, 2vw, 24px);
        line-height: 1.3;
        text-align: start;
    }

    .catalog-product-grid.list-view .product-card-title > a:hover {
        color: var(--shop-warm);
    }

    .catalog-product-grid.list-view .catalog-product-description {
        display: -webkit-box;
        max-width: 620px;
        grid-row: 3;
        grid-column: 1 / -1;
        align-self: start;
        margin: 0;
        overflow: hidden;
        color: rgba(255, 255, 255, .64);
        font-size: 13px;
        line-height: 1.7;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    .catalog-product-grid.list-view .home-product-price {
        display: flex;
        min-height: 42px;
        grid-row: 1 / 3;
        grid-column: 2;
        gap: 9px;
        align-items: baseline;
        align-self: center;
        justify-self: end;
        margin: 0;
        padding: 10px 14px;
        border: 1px solid rgba(255, 255, 255, .14);
        border-radius: 10px;
        background: rgba(255, 255, 255, .07);
    }

    .catalog-product-grid.list-view .home-product-price strong {
        color: #fff;
        font-size: 20px;
    }

    .catalog-product-grid.list-view .home-product-price del {
        color: rgba(255, 255, 255, .56);
        font-size: 13px;
    }

    .catalog-product-grid.list-view .catalog-list-actions {
        display: flex;
        min-width: 0;
        grid-row: 4;
        grid-column: 1 / -1;
        gap: 8px;
        align-items: center;
        margin-top: 4px;
    }

    .catalog-product-grid.list-view .catalog-list-actions .list-product-action,
    .catalog-product-grid.list-view .catalog-list-actions .list-product-cart {
        position: static;
        display: inline-flex;
        width: auto;
        min-width: 0;
        min-height: 40px;
        height: 40px;
        gap: 7px;
        align-items: center;
        justify-content: center;
        padding: 0 13px;
        border: 1px solid rgba(255, 255, 255, .16);
        border-radius: 9px;
        opacity: 1;
        color: rgba(255, 255, 255, .82);
        background: rgba(255, 255, 255, .07);
        box-shadow: none;
        font-size: 9px;
        font-weight: 800;
        line-height: 1;
        transform: none;
    }

    .catalog-product-grid.list-view .catalog-list-actions .list-product-action:hover,
    .catalog-product-grid.list-view .catalog-list-actions .list-product-action.is-selected {
        border-color: rgba(233, 178, 27, .56);
        color: var(--shop-warm);
        background: rgba(233, 178, 27, .1);
    }

    .catalog-product-grid.list-view .catalog-list-actions .is-whatsapp:hover {
        border-color: #30c77b;
        color: #fff;
        background: #168f59;
    }

    .catalog-product-grid.list-view .catalog-list-actions .list-product-cart {
        min-width: 132px;
        margin-inline-start: auto;
        border-color: var(--shop-warm);
        color: var(--shop-accent-dark);
        background: var(--shop-warm);
    }

    .catalog-product-grid.list-view .catalog-list-actions .list-product-cart:hover {
        background: #f4c83f;
    }

    .catalog-product-grid.list-view .catalog-list-actions .list-product-cart.is-disabled {
        opacity: .55;
    }
}

@media (max-width: 767px) {
    .catalog-page .home-product-price del {
        display: inline;
        font-size: 9px;
    }
}

@media (min-width: 768px) and (max-width: 1199px) {
    .catalog-product-grid.list-view .product-result-item {
        height: 264px;
        min-height: 264px;
        grid-template-columns: 184px minmax(0, 1fr);
    }

    .catalog-product-grid.list-view .home-product-media {
        width: 184px;
        height: 264px;
        min-height: 264px;
    }

    .catalog-product-grid.list-view .home-product-media > a:first-child {
        height: 264px;
        padding: 19px;
    }

    .catalog-product-grid.list-view .home-product-media::before {
        inset: 10px;
    }

    .catalog-product-grid.list-view .home-product-media .home-product-badge:not(.badge-stock) {
        top: 13px;
        left: 13px;
    }

    .catalog-product-grid.list-view .home-product-media .home-product-badge.badge-stock {
        top: 49px;
        left: 13px;
    }

    html[dir="rtl"] .catalog-product-grid.list-view .home-product-media .home-product-badge {
        right: 13px;
        left: auto;
    }

    .catalog-product-grid.list-view .home-product-info {
        height: 264px;
        min-height: 264px;
        gap: 8px 14px;
        padding: 22px 20px;
    }

    .catalog-product-grid.list-view .home-product-price {
        grid-row: 3;
        grid-column: 1 / -1;
        justify-self: start;
    }

    .catalog-product-grid.list-view .catalog-product-description {
        display: none;
    }

    .catalog-product-grid.list-view .catalog-list-actions {
        gap: 5px;
    }

    .catalog-product-grid.list-view .catalog-list-actions .list-product-action {
        width: 38px;
        flex: 0 0 38px;
        padding: 0;
    }

    .catalog-product-grid.list-view .catalog-list-actions .list-product-action span {
        display: none;
    }
}

.filter-check input {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
}

.filter-check:has(input:checked) {
    color: var(--shop-accent);
    background: rgba(21, 26, 56, .055);
    font-weight: 700;
}

.filter-list-search {
    position: relative;
    display: block;
    margin-bottom: 12px;
}

.filter-list-search > i {
    position: absolute;
    top: 13px;
    inset-inline-start: 12px;
    color: var(--shop-muted);
    font-size: 9px;
    pointer-events: none;
}

.filter-list-search input {
    width: 100%;
    height: 36px;
    padding-inline: 34px 32px;
    border: 1px solid var(--shop-line);
    border-radius: 9px;
    outline: 0;
    color: var(--shop-ink);
    background: var(--shop-soft);
    font-size: 10px;
}

.filter-list-search input:focus {
    border-color: var(--shop-accent);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(21, 26, 56, .08);
}

.clear-brand-filter-search {
    position: absolute;
    top: 5px;
    inset-inline-end: 5px;
    display: none;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 0;
    border-radius: 7px;
    color: var(--shop-muted);
    background: transparent;
    font-size: 8px;
}

.filter-list-search:focus-within .clear-brand-filter-search,
.filter-list-search.has-value .clear-brand-filter-search { display: grid; place-items: center; }
.brand-filter-empty { margin: 12px 0 0; color: var(--shop-muted); font-size: 9px; text-align: center; }

@media (max-width: 767px) {
    .mobile-filter-toggle {
        position: relative;
        border-radius: 11px;
        color: #fff;
        border-color: var(--shop-accent);
        background: var(--shop-accent);
        box-shadow: 0 9px 22px rgba(21, 26, 56, .14);
    }

    .catalog-filters {
        position: fixed !important;
        z-index: 1200;
        top: 0;
        right: auto;
        bottom: 0;
        left: 0;
        display: grid !important;
        width: min(390px, calc(100vw - 20px));
        height: 100vh;
        height: 100dvh;
        max-height: none;
        grid-template-rows: auto minmax(0, 1fr) auto;
        margin: 0;
        padding: 0;
        overflow: hidden;
        border: 0;
        border-radius: 0 18px 18px 0;
        background: #fff;
        box-shadow: 18px 0 50px rgba(10, 20, 17, .24);
        overscroll-behavior: contain;
        scrollbar-color: var(--shop-accent-soft) #eef0f3;
        scrollbar-width: thin;
        transform: translate3d(-105%, 0, 0);
        transition: transform .24s ease, visibility .24s ease;
        visibility: hidden;
        isolation: isolate;
    }

    body.filter-drawer-open .catalog-filters {
        transform: translate3d(0, 0, 0);
        visibility: visible;
    }

    .catalog-filter-scroll {
        min-width: 0;
        min-height: 0;
        padding: 0 20px 28px;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-color: var(--shop-accent-soft) #eef0f3;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }

    .catalog-filter-scroll::-webkit-scrollbar {
        width: 5px;
    }

    .catalog-filter-scroll::-webkit-scrollbar-track {
        background: #eef0f3;
    }

    .catalog-filter-scroll::-webkit-scrollbar-thumb {
        border-radius: 99px;
        background: var(--shop-accent-soft);
    }

    html[dir="rtl"] .catalog-filters {
        right: 0;
        left: auto;
        border-radius: 18px 0 0 18px;
        box-shadow: -18px 0 50px rgba(10, 20, 17, .18);
        transform: translate3d(105%, 0, 0);
    }

    html[dir="rtl"] body.filter-drawer-open .catalog-filters { transform: translate3d(0, 0, 0); }

    .catalog-filter-mobile-head {
        position: relative;
        z-index: 2;
        top: auto;
        min-height: calc(68px + env(safe-area-inset-top));
        margin: 0;
        padding: env(safe-area-inset-top) 20px 0;
        border-bottom: 1px solid var(--shop-line);
        background: rgba(255, 255, 255, .97);
        box-shadow: 0 8px 22px rgba(17, 23, 53, .05);
        backdrop-filter: blur(14px);
    }

    .catalog-filter-mobile-head strong {
        color: var(--shop-ink);
        font-size: 19px;
        line-height: 1.2;
    }

    .catalog-filter-mobile-head button {
        display: grid;
        width: 40px;
        height: 40px;
        flex: 0 0 40px;
        border-radius: 10px;
        place-items: center;
    }

    .catalog-filters .filter-heading {
        min-height: 46px;
        padding: 10px 0 0;
    }

    .catalog-filters .filter-group {
        padding: 18px 2px;
    }

    .catalog-filters .price-filter-group {
        min-height: 132px;
        padding-bottom: 28px;
    }

    .catalog-filters .price-filter-group .irs {
        width: calc(100% - 16px);
        margin-inline: 8px;
    }

    .catalog-filter-mobile-footer {
        position: relative;
        z-index: 2;
        right: auto;
        bottom: auto;
        left: auto;
        width: auto;
        padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
        border-top: 1px solid var(--shop-line);
        background: rgba(255, 255, 255, .98);
        box-shadow: 0 -10px 24px rgba(17, 23, 53, .06);
        backdrop-filter: blur(14px);
    }

    .catalog-filter-mobile-footer button {
        width: 100%;
        min-height: 50px;
        border: 0;
        border-radius: 10px;
        color: #fff;
        background: var(--shop-accent);
        font-size: 11px;
        font-weight: 800;
    }

    .filter-drawer-backdrop {
        position: fixed;
        z-index: 1190;
        inset: 0;
        background: rgba(8, 12, 28, .58);
        backdrop-filter: blur(2px);
    }

    body.filter-drawer-open {
        overflow: hidden;
        overscroll-behavior: none;
        touch-action: none;
    }

    body.filter-drawer-open .catalog-filter-scroll {
        touch-action: pan-y;
    }
}

@media (max-width: 374px) {
    .catalog-filters {
        width: calc(100vw - 12px);
        border-radius: 0 14px 14px 0;
    }

    html[dir="rtl"] .catalog-filters {
        border-radius: 14px 0 0 14px;
    }

    .catalog-filter-scroll,
    .catalog-filter-mobile-head,
    .catalog-filter-mobile-footer {
        padding-inline: 16px;
    }
}

/* Keep product actions together so RTL mirroring and compact cards cannot split them. */
.catalog-page .catalog-card-tools {
    position: absolute;
    z-index: 7;
    top: 13px;
    right: 13px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    direction: inherit;
}

html[dir="rtl"] .catalog-page .catalog-card-tools {
    right: auto;
    left: 13px;
}

.catalog-page .catalog-card-tools > .product-wishlist-button,
.catalog-page .catalog-card-tools > .product-whatsapp-button,
.catalog-page .catalog-card-tools > .quick-view-button,
.catalog-page .catalog-card-tools > .compare-product-button {
    position: static;
    inset: auto;
    margin: 0;
}

.catalog-page .catalog-card-tools > .quick-view-button,
.catalog-page .catalog-card-tools > .compare-product-button {
    display: grid;
}

@media (min-width: 768px) {
    .catalog-product-grid.list-view .catalog-card-tools {
        display: none;
    }
}

@media (max-width: 767px) {
    .catalog-page .catalog-card-tools {
        top: 9px;
        right: 8px;
        display: grid;
        grid-template-columns: repeat(2, 36px);
        gap: 7px;
    }

    html[dir="rtl"] .catalog-page .catalog-card-tools {
        right: auto;
        left: 8px;
    }

    .catalog-page .catalog-card-tools > .product-wishlist-button,
    .catalog-page .catalog-card-tools > .product-whatsapp-button,
    .catalog-page .catalog-card-tools > .quick-view-button,
    .catalog-page .catalog-card-tools > .compare-product-button {
        display: grid;
        width: 36px;
        height: 36px;
        opacity: 1;
        transform: none;
    }
}

/* Dialogs are rendered beside <main>; keep their controls reachable above the sticky header. */
.quick-view-modal,
.comparison-modal {
    z-index: 1305;
}

body.modal-open .modal-backdrop {
    z-index: 1300;
}

.quick-view-close {
    right: auto;
    inset-inline-end: 16px;
}

.comparison-table th,
.comparison-table td {
    text-align: start;
}

@media (max-width: 767px) {
    .quick-view-close {
        top: 10px;
        inset-inline-end: 10px;
        width: 44px;
        height: 44px;
        box-shadow: 0 7px 20px rgba(10, 20, 17, .2);
    }

    .quick-view-modal {
        padding: max(6px, env(safe-area-inset-top, 0px)) 6px max(6px, env(safe-area-inset-bottom, 0px));
    }

    .quick-view-modal .modal-dialog {
        width: min(100%, 430px);
        min-height: 0;
        height: 100%;
        margin: 0 auto;
        align-items: center;
    }

    .quick-view-modal .modal-content {
        display: block;
        max-height: 100%;
        overflow: hidden;
        border: 1px solid rgba(17, 23, 53, .08);
        border-radius: 18px;
        background: #fff;
        box-shadow: 0 22px 60px rgba(8, 13, 35, .28);
    }

    #quickViewContent {
        max-height: calc(100dvh - max(12px, env(safe-area-inset-top, 0px)) - max(12px, env(safe-area-inset-bottom, 0px)));
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-width: thin;
    }

    .quick-view-layout {
        display: flex;
        min-height: 0;
        flex-direction: column;
    }

    .quick-view-media {
        width: 100%;
        height: clamp(230px, 39dvh, 320px);
        min-height: 0;
        max-height: none;
        flex: 0 0 auto;
        aspect-ratio: auto;
        background: linear-gradient(145deg, #f7f7f4, #eef0ec);
    }

    .quick-view-media img {
        width: 100%;
        height: 100%;
        padding: 12px;
        object-fit: contain;
    }

    .quick-view-media .home-product-badge {
        top: 14px;
        right: auto;
        left: auto;
        inset-inline-start: 14px;
    }

    .quick-view-summary {
        display: flex;
        align-items: stretch;
        justify-content: flex-start;
        padding: 21px 20px 20px;
        text-align: start;
    }

    .quick-view-summary .section-kicker {
        margin: 0 0 5px;
        font-size: 9px;
    }

    .quick-view-summary h2 {
        margin: 0 0 9px;
        padding: 0;
        font-size: clamp(22px, 6.3vw, 27px);
        line-height: 1.3;
        text-align: start;
    }

    .quick-view-rating {
        justify-content: flex-start;
        font-size: 11px;
    }

    .quick-view-price {
        margin: 13px 0 11px;
    }

    .quick-view-price strong {
        font-size: 22px;
    }

    .quick-view-summary > p {
        display: -webkit-box;
        overflow: hidden;
        margin-bottom: 13px;
        font-size: 12px;
        line-height: 1.75;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
    }

    .quick-view-stock {
        margin-bottom: 14px;
        font-size: 10px;
    }

    .quick-view-actions {
        grid-template-columns: minmax(0, 1fr) 48px;
        gap: 8px;
    }

    .quick-view-actions .product-add-button,
    .quick-view-actions .product-save-button {
        min-height: 48px;
    }

    .quick-view-details {
        align-self: center;
        justify-content: center;
        margin-top: 15px;
        font-size: 11px;
    }

    html[dir="rtl"] .quick-view-summary,
    html[dir="rtl"] .quick-view-summary h2 {
        text-align: right;
    }

    .compare-tray {
        z-index: 1290;
        right: 8px;
        bottom: max(8px, env(safe-area-inset-bottom, 0px));
        left: 8px;
        overflow: hidden;
        border: 1px solid rgba(255, 255, 255, .12);
        border-radius: 18px;
        box-shadow: 0 -8px 38px rgba(5, 11, 28, .35);
    }

    .compare-tray-inner {
        display: grid;
        width: 100%;
        min-height: 0;
        max-height: min(42dvh, 330px);
        grid-template-columns: minmax(0, 1fr);
        gap: 9px;
        padding: 12px;
    }

    .compare-tray-title {
        display: flex;
        gap: 9px;
        align-items: center;
        padding-inline: 2px;
    }

    .compare-tray-title > i {
        display: grid;
        width: 34px;
        height: 34px;
        flex: 0 0 34px;
        place-items: center;
        border-radius: 10px;
        color: var(--shop-ink);
        background: var(--shop-warm);
        font-size: 14px;
    }

    .compare-tray-title strong {
        font-size: 11px;
    }

    .compare-tray-title small {
        margin-top: 1px;
        font-size: 8px;
    }

    .compare-tray-products {
        display: flex;
        width: 100%;
        gap: 8px;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 1px 1px 5px;
        scroll-snap-type: inline mandatory;
        scrollbar-width: thin;
        overscroll-behavior-inline: contain;
    }

    .compare-tray-product {
        display: grid;
        width: min(74vw, 245px);
        min-height: 66px;
        flex: 0 0 min(74vw, 245px);
        grid-template-columns: 52px minmax(0, 1fr) 32px;
        gap: 10px;
        padding: 7px;
        border: 1px solid rgba(255, 255, 255, .1);
        border-radius: 12px;
        background: rgba(255, 255, 255, .08);
        scroll-snap-align: start;
    }

    .compare-tray-product img {
        width: 52px;
        height: 52px;
        border-radius: 8px;
        object-fit: contain;
        background: #fff;
    }

    .compare-tray-product strong {
        font-size: 10px;
        line-height: 1.45;
    }

    .compare-tray-product small {
        color: var(--shop-warm);
        font-size: 9px;
    }

    .compare-tray-product button {
        display: grid;
        width: 32px;
        height: 32px;
        place-items: center;
        border-radius: 8px;
        color: #fff;
        background: rgba(255, 255, 255, .08);
    }

    .compare-tray-actions {
        display: grid;
        grid-template-columns: minmax(82px, .7fr) minmax(0, 1.3fr);
        gap: 8px;
    }

    .compare-clear {
        display: block;
        width: 100%;
        min-height: 42px;
        padding-inline: 10px;
        border-radius: 10px;
    }

    .compare-open {
        width: 100%;
        min-height: 42px;
        padding-inline: 10px;
        border-radius: 10px;
    }

    .comparison-modal .modal-dialog {
        width: min(100%, 520px);
        height: 100%;
        min-height: 0;
        margin: 0 auto;
        align-items: center;
    }

    .comparison-modal .modal-content {
        max-height: calc(100dvh - 12px);
        overflow: hidden;
        border-radius: 18px;
    }

    .comparison-header {
        position: relative;
        z-index: 2;
        flex: 0 0 auto;
        align-items: center;
        padding: 17px 16px 14px;
        background: #fff;
    }

    .comparison-header h2 {
        margin-top: 3px;
        font-size: 21px;
    }

    .comparison-header > button {
        width: 42px;
        height: 42px;
        flex: 0 0 42px;
        border-radius: 10px;
    }

    .comparison-body {
        min-height: 0;
        overflow: auto;
        padding: 0 12px 16px;
        overscroll-behavior: contain;
    }

    .comparison-table-wrap {
        overflow: visible;
    }

    .comparison-table {
        width: max-content;
        min-width: 100%;
        table-layout: auto;
    }

    .comparison-table thead th:not(:first-child),
    .comparison-table td {
        width: 170px;
        min-width: 170px;
    }

    .comparison-table th,
    .comparison-table td {
        padding: 12px 10px;
        font-size: 11px;
    }

    .comparison-table thead th:first-child,
    .comparison-table tbody th {
        position: sticky;
        z-index: 1;
        inset-inline-start: 0;
        width: 92px;
        min-width: 92px;
        background: #fff;
        box-shadow: 1px 0 0 var(--shop-line);
    }

    html[dir="rtl"] .comparison-table thead th:first-child,
    html[dir="rtl"] .comparison-table tbody th {
        box-shadow: -1px 0 0 var(--shop-line);
    }

    .comparison-table thead th:first-child {
        z-index: 2;
    }

    .comparison-table thead img {
        width: 100%;
        height: 120px;
        margin-bottom: 8px;
        object-fit: contain;
        background: var(--shop-soft);
    }
}
