/*
 * Mobile WooCommerce archive filters — Figma implementation.
 *
 * The legacy archive markup remains the authoritative data/query source. This
 * layer presents it as the full-screen mobile filter flow from Figma while the
 * desktop implementation remains untouched.
 */

@media (max-width: 1024px) {
    body.kaman-mobile-filter-v2-ready .kaman-archive__filters {
        display: none !important;
    }

    body.kaman-mobile-filter-open {
        overflow: hidden !important;
        overscroll-behavior: none;
    }

    .kaman-mobile-filter,
    .kaman-mobile-filter * {
        box-sizing: border-box;
    }

    .kaman-mobile-filter {
        position: fixed;
        inset: 0;
        z-index: 999999;
        display: none;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        grid-template-rows: 60px minmax(0, 1fr) minmax(86px, auto);
        direction: rtl;
        color: var(--kaman-color-text, #121212);
        background: var(--kaman-color-surface, #ffffff);
        font-family: var(--kaman-font-family, "Dana2", "Dana", sans-serif);
    }

    .kaman-mobile-filter.is-open {
        display: grid;
    }

    .kaman-mobile-filter button,
    .kaman-mobile-filter input {
        font: inherit;
    }

    .kaman-mobile-filter button {
        -webkit-appearance: none;
        appearance: none;
        border: 0;
        outline: 0;
        cursor: pointer;
    }

    .kaman-mobile-filter button:focus-visible,
    .kaman-mobile-filter input:focus-visible {
        outline: 2px solid rgba(170, 0, 2, 0.32);
        outline-offset: 2px;
    }

    .kaman-mobile-filter__header {
        position: relative;
        z-index: 2;
        min-width: 0;
        height: 60px;
        padding: 14px 16px;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 8px;
        background: #ffffff;
        border-bottom: 1px solid var(--kaman-color-border, #ebebeb);
    }

    .kaman-mobile-filter__header-icon {
        flex: 0 0 20px;
        width: 20px;
        height: 20px;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        color: var(--kaman-color-text-muted, #898989);
        background: transparent;
        font-size: 16px;
        line-height: 1;
    }

    .kaman-mobile-filter__header-icon .fa-arrow-right {
        color: var(--kaman-color-text-secondary, #696969);
        font-size: 15px;
    }

    .kaman-mobile-filter__title {
        margin: 0;
        padding: 0;
        color: var(--kaman-color-text, #121212);
        font-family: var(--kaman-font-family, "Dana2", "Dana", sans-serif);
        font-size: 16px;
        font-weight: 600;
        line-height: 1;
        text-align: right;
        white-space: nowrap;
    }

    .kaman-mobile-filter__body {
        position: relative;
        min-width: 0;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        background: #ffffff;
    }

    .kaman-mobile-filter__body::-webkit-scrollbar {
        display: none;
    }

    .kaman-mobile-filter__body--main {
        padding: 20px 16px 24px;
    }

    .kaman-mobile-filter__main-list {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    .kaman-mobile-filter__row {
        width: 100%;
        min-height: 60px;
        margin: 0;
        padding: 20px 12px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        color: var(--kaman-color-text-secondary, #4d4d4d);
        background: transparent;
        border-bottom: 1px solid var(--kaman-color-border, #ebebeb) !important;
        border-radius: 0;
        text-align: right;
    }

    .kaman-mobile-filter__row-label {
        min-width: 0;
        color: #4d4d4d;
        font-family: var(--kaman-font-family, "Dana2", "Dana", sans-serif);
        font-size: 14px;
        font-weight: 400;
        line-height: 1;
        text-align: right;
    }

    .kaman-mobile-filter__row-arrow {
        flex: 0 0 18px;
        width: 18px;
        height: 18px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        color: var(--kaman-color-text-secondary, #696969);
        font-size: 12px;
    }

    .kaman-mobile-filter__toggle {
        position: relative;
        flex: 0 0 44px;
        width: 44px;
        height: 24px;
        border-radius: 999px;
        background: #dedede;
        transition: background-color 160ms ease;
    }

    .kaman-mobile-filter__toggle::after {
        content: "";
        position: absolute;
        top: 2px;
        left: 2px;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background: #ffffff;
        transition: left 160ms ease;
    }

    .kaman-mobile-filter__toggle.is-active {
        background: var(--kaman-color-primary, #aa0002);
    }

    .kaman-mobile-filter__toggle.is-active::after {
        left: 22px;
    }

    .kaman-mobile-filter__footer {
        position: relative;
        z-index: 3;
        min-width: 0;
        min-height: 86px;
        padding: 20px 16px max(20px, env(safe-area-inset-bottom));
        display: flex;
        align-items: flex-start;
        gap: 20px;
        direction: rtl;
        background: #ffffff;
        box-shadow: 0 -4px 8px rgba(0, 0, 0, 0.08);
    }

    .kaman-mobile-filter__apply,
    .kaman-mobile-filter__clear {
        height: 46px;
        margin: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 10px;
        font-family: var(--kaman-font-family, "Dana2", "Dana", sans-serif);
        font-size: 15px;
        font-weight: 600;
        line-height: 1;
        white-space: nowrap;
    }

    .kaman-mobile-filter__apply {
        flex: 1 1 auto;
        min-width: 0;
        padding: 11px 23px;
        color: #ffffff;
        background: var(--kaman-color-primary, #aa0002);
    }

    .kaman-mobile-filter__apply:disabled {
        color: #898989;
        background: #cecece;
        border: 1px solid #b3b3b3;
        cursor: default;
    }

    .kaman-mobile-filter__clear {
        flex: 0 0 auto;
        min-width: 118px;
        padding: 13px 8px;
        color: #303030;
        background: transparent;
    }

    .kaman-mobile-filter__clear:disabled {
        color: #898989;
        cursor: default;
    }

    .kaman-mobile-filter__body--attribute,
    .kaman-mobile-filter__body--price {
        padding: 20px 16px 28px;
    }

    .kaman-mobile-filter__search {
        position: relative;
        width: 100%;
        height: 40px;
        margin: 0 0 20px;
        display: flex;
        align-items: center;
        background: #ffffff;
        border: 1px solid var(--kaman-color-border, #ebebeb);
        border-radius: 8px;
        overflow: hidden;
    }

    .kaman-mobile-filter__search input {
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 8px 42px 8px 16px;
        color: var(--kaman-color-text, #121212);
        background: transparent;
        border: 0;
        outline: 0;
        box-shadow: none;
        font-size: 14px;
        font-weight: 400;
        line-height: 32px;
        text-align: right;
    }

    .kaman-mobile-filter__search input::placeholder {
        color: #a4a4a4;
        opacity: 1;
    }

    .kaman-mobile-filter__search-icon {
        position: absolute;
        top: 50%;
        right: 16px;
        width: 18px;
        height: 18px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        color: #a4a4a4;
        font-size: 15px;
        transform: translateY(-50%);
        pointer-events: none;
    }

    .kaman-mobile-filter__brand-options {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .kaman-mobile-filter__brand-option {
        width: 100%;
        min-height: 24px;
        padding: 0;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas: "latin main";
        align-items: center;
        column-gap: 8px;
        direction: ltr;
        color: #696969;
        background: transparent;
    }

    .kaman-mobile-filter__brand-option[hidden] {
        display: none !important;
    }

    .kaman-mobile-filter__brand-latin {
        grid-area: latin;
        justify-self: start;
        min-width: 0;
        overflow: hidden;
        color: #898989;
        font-size: 12px;
        font-weight: 400;
        line-height: 1;
        text-align: left;
        text-overflow: ellipsis;
        white-space: nowrap;
        direction: ltr;
    }

    .kaman-mobile-filter__brand-main {
        grid-area: main;
        justify-self: end;
        min-width: 0;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        direction: ltr;
    }

    .kaman-mobile-filter__brand-primary {
        min-width: 0;
        overflow: hidden;
        color: #696969;
        font-size: 14px;
        font-weight: 500;
        line-height: 1;
        text-align: right;
        text-overflow: ellipsis;
        white-space: nowrap;
        direction: rtl;
    }

    .kaman-mobile-filter__check {
        flex: 0 0 18px;
        width: 18px;
        height: 18px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        color: transparent;
        background: #ffffff;
        border: 1.2px solid #303030;
        border-radius: 1px;
        font-size: 10px;
        line-height: 1;
    }

    .kaman-mobile-filter__check.is-selected {
        color: #ffffff;
        background: var(--kaman-color-primary, #aa0002);
        border-color: var(--kaman-color-primary, #aa0002);
    }

    .kaman-mobile-filter__color-grid {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 12px 8px;
        align-items: start;
    }

    .kaman-mobile-filter__color-option {
        min-width: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        color: #696969;
        background: transparent;
        text-align: center;
    }

    .kaman-mobile-filter__color-swatch {
        width: 73px;
        height: 73px;
        padding: 4px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: #ffffff;
        border: 1px solid var(--kaman-color-border, #ebebeb);
        border-radius: 8px;
    }

    .kaman-mobile-filter__color-option.is-selected .kaman-mobile-filter__color-swatch {
        padding: 3px;
        border: 2px solid var(--kaman-color-primary, #aa0002);
    }

    .kaman-mobile-filter__color-swatch-inner {
        width: 63px;
        height: 63px;
        border-radius: 5px;
        box-shadow: inset 0 0 0 1px rgba(18, 18, 18, 0.04);
    }

    .kaman-mobile-filter__color-label {
        width: 100%;
        overflow: hidden;
        color: #696969;
        font-size: 12px;
        font-weight: 400;
        line-height: 1;
        text-align: center;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .kaman-mobile-filter__generic-options {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .kaman-mobile-filter__generic-option {
        width: 100%;
        min-height: 32px;
        padding: 4px 0;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 8px;
        direction: ltr;
        color: #696969;
        background: transparent;
        font-size: 14px;
        font-weight: 500;
        line-height: 1;
        text-align: right;
    }

    .kaman-mobile-filter__generic-option > span:first-child {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        direction: rtl;
    }

    .kaman-mobile-filter__price-content {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    .kaman-mobile-filter__price-field {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .kaman-mobile-filter__price-label {
        width: 100%;
        color: #303030;
        font-size: 14px;
        font-weight: 500;
        line-height: 1;
        text-align: right;
    }

    .kaman-mobile-filter__price-input-wrap {
        width: 100%;
        height: 48px;
        padding: 10px 16px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        background: #ffffff;
        border: 1px solid var(--kaman-color-border, #ebebeb);
        border-radius: 8px;
    }

    .kaman-mobile-filter__price-input-wrap:focus-within {
        border-color: var(--kaman-color-primary, #aa0002);
        box-shadow: 0 0 0 3px rgba(170, 0, 2, 0.07);
    }

    .kaman-mobile-filter__price-input-wrap input {
        flex: 1 1 auto;
        min-width: 0;
        height: 100%;
        margin: 0;
        padding: 0;
        color: #212121;
        background: transparent;
        border: 0;
        outline: 0;
        box-shadow: none;
        font-size: 14px;
        font-weight: 400;
        line-height: 1;
        text-align: right;
        direction: rtl;
    }

    .kaman-mobile-filter__price-unit {
        flex: 0 0 auto;
        color: #696969;
        font-size: 13px;
        font-weight: 400;
        line-height: 1;
    }

    .kaman-mobile-filter__price-slider-wrap {
        width: 100%;
        margin-top: 2px;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .kaman-mobile-filter__dual-range {
        position: relative;
        width: 100%;
        height: 20px;
        direction: rtl;
    }

    .kaman-mobile-filter__range-track {
        position: absolute;
        top: 8px;
        right: 0;
        left: 0;
        height: 4px;
        border-radius: 2px;
        background: var(--kaman-color-primary, #aa0002);
        pointer-events: none;
    }

    .kaman-mobile-filter__range-input {
        -webkit-appearance: none;
        appearance: none;
        position: absolute;
        inset: 0;
        z-index: 2;
        width: 100%;
        height: 20px;
        margin: 0;
        padding: 0;
        background: transparent;
        border: 0;
        outline: 0;
        pointer-events: none;
        direction: rtl;
    }

    .kaman-mobile-filter__range-input--max {
        z-index: 3;
    }

    .kaman-mobile-filter__range-input::-webkit-slider-runnable-track {
        width: 100%;
        height: 4px;
        background: transparent;
        border: 0;
    }

    .kaman-mobile-filter__range-input::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: 20px;
        height: 20px;
        margin-top: -8px;
        border: 2px solid #ffffff;
        border-radius: 50%;
        background: var(--kaman-color-primary, #aa0002);
        box-shadow: none;
        pointer-events: auto;
        cursor: grab;
    }

    .kaman-mobile-filter__range-input::-moz-range-track {
        width: 100%;
        height: 4px;
        background: transparent;
        border: 0;
    }

    .kaman-mobile-filter__range-input::-moz-range-thumb {
        width: 16px;
        height: 16px;
        border: 2px solid #ffffff;
        border-radius: 50%;
        background: var(--kaman-color-primary, #aa0002);
        box-shadow: none;
        pointer-events: auto;
        cursor: grab;
    }

    .kaman-mobile-filter__range-labels {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        color: var(--kaman-color-text-secondary, #696969);
        font-size: 12px;
        font-weight: 400;
        line-height: 1;
        direction: ltr;
    }

    .kaman-mobile-filter__range-labels > span {
        direction: rtl;
    }
}

@media (max-width: 360px) {
    .kaman-mobile-filter__color-swatch {
        width: 64px;
        height: 64px;
    }

    .kaman-mobile-filter__color-swatch-inner {
        width: 54px;
        height: 54px;
    }

    .kaman-mobile-filter__footer {
        gap: 12px;
    }

    .kaman-mobile-filter__clear {
        min-width: 102px;
    }
}
