/**
 * Get-a-quote product picker — match Matrik .form-inner / .nice-select.
 */

.wpcf7-form-control-wrap[data-name="products"] {
    position: relative;
    display: block;
    z-index: 3;

    > select,
    > .nice-select {
        display: none !important;
    }
}

.azytus-quote-select {
    --aqs-ink: var(--title-color, #000);
    --aqs-muted: var(--text-color, #00000099);
    --aqs-accent: var(--primary-color2, #14749b);
    --aqs-border: rgba(var(--black-color-opc, 0, 0, 0), 0.2);
    --aqs-font: var(--font-dmsans, "DM Sans", sans-serif);
    --aqs-label-font: var(--font-manrope, Manrope, sans-serif);
    position: relative;
    width: 100%;
    line-height: 1.3;

    &.is-open {
        z-index: 6;
    }

    button,
    .azytus-quote-select__toggle {
        all: unset;
        box-sizing: border-box;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        margin: 0 !important;
        padding: 0 !important;
        min-height: 0 !important;
        min-width: 0 !important;
        width: auto !important;
        height: auto !important;
        background: transparent !important;
        border: 0 !important;
        box-shadow: none !important;
        color: inherit;
        line-height: 1 !important;
        text-transform: none !important;
        letter-spacing: 0 !important;
        font: inherit;
    }

    .azytus-quote-select__control {
        position: relative;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px;
        width: 100%;
        min-height: 44px;
        padding: 7px 44px 7px 16px;
        background: transparent;
        border: 1px solid var(--aqs-border);
        border-radius: 5px;
        cursor: text;
        transition: border-color 0.2s ease, border-radius 0.15s ease;

        &:hover {
            border-color: rgba(var(--black-color-opc, 0, 0, 0), 0.35);
        }
    }

    &.is-open .azytus-quote-select__control,
    .azytus-quote-select__control:focus-within {
        border-color: var(--black-color, #000);
    }

    &.is-open .azytus-quote-select__control {
        border-radius: 5px 5px 0 0;
        border-bottom-color: transparent;
    }

    .azytus-quote-select__chips {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        max-width: 100%;
    }

    .azytus-quote-select__chip {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        max-width: 100%;
        padding: 4px 6px 4px 10px;
        background: rgba(20, 116, 155, 0.08);
        border: 0;
        border-radius: 4px;
        color: var(--aqs-accent);
        font-family: var(--aqs-font);
        font-size: 13px;
        font-weight: 500;
        line-height: 1.2;
    }

    .azytus-quote-select__chip-text {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .azytus-quote-select__chip-remove {
        width: 16px !important;
        height: 16px !important;
        border-radius: 3px;
        color: var(--aqs-accent);
        font-size: 16px;
        line-height: 1;

        &:hover {
            background: rgba(20, 116, 155, 0.16) !important;
            color: var(--aqs-ink);
        }
    }

    .azytus-quote-select__search {
        flex: 1 1 140px;
        min-width: 80px;
        height: 28px;
        margin: 0;
        padding: 0 4px;
        border: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        color: var(--aqs-ink);
        font-family: var(--aqs-font);
        font-size: 16px;
        font-weight: 500;
        line-height: 28px;

        &:focus {
            outline: none;
            border: 0 !important;
            box-shadow: none !important;
        }

        &::placeholder {
            color: #a0a0a0;
        }
    }

    .azytus-quote-select__caret {
        position: absolute;
        top: 50%;
        right: 20px;
        width: 10px;
        height: 7px;
        background-color: #dfdfdf;
        clip-path: polygon(100% 0, 0 0, 50% 100%);
        pointer-events: none;
        transform: translateY(-50%);
        transition: transform 0.2s ease;
    }

    &.is-open .azytus-quote-select__caret {
        transform: translateY(-50%) rotate(180deg);
    }

    .azytus-quote-select__dropdown {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        z-index: 20;
        max-height: min(340px, 60vh);
        overflow: auto;
        background: #fff;
        border: 1px solid var(--black-color, #000);
        border-top: 1px solid var(--aqs-border);
        border-radius: 0 0 5px 5px;
        box-shadow: none;
    }

    .azytus-quote-select__empty {
        padding: 16px 20px;
        color: var(--aqs-muted);
        font-family: var(--aqs-font);
        font-size: 14px;
        font-weight: 500;
        text-align: left;
    }

    .azytus-quote-select__tree {
        padding: 0;
    }

    .azytus-quote-select__row {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        min-height: 44px;
        padding: 10px 20px;
        border: 0;
        border-bottom: 1px solid var(--aqs-border);
        background: transparent;
        color: var(--aqs-ink);
        font-family: var(--aqs-font);
        font-size: 14px;
        font-weight: 500;
        text-align: left;
        cursor: pointer;

        &:hover,
        &.is-active {
            background: rgba(var(--black-color-opc, 0, 0, 0), 0.03);
        }
    }

    .azytus-quote-select__node:last-child > .azytus-quote-select__row {
        border-bottom: 0;
    }

    .azytus-quote-select__node.is-category > .azytus-quote-select__row {
        font-family: var(--aqs-label-font);
        font-size: 14px;
        font-weight: 600;
        color: var(--aqs-ink);
    }

    .azytus-quote-select__node.is-product > .azytus-quote-select__row {
        padding-left: 36px;
        font-size: 15px;
        font-weight: 500;
    }

    .azytus-quote-select__node.is-grade > .azytus-quote-select__row {
        padding-left: 52px;
        font-size: 14px;
        color: var(--aqs-ink);
    }

    .azytus-quote-select__node.is-pack > .azytus-quote-select__row {
        padding-left: 68px;
        font-size: 13px;
        color: var(--aqs-muted);
    }

    .azytus-quote-select__toggle {
        width: 16px !important;
        height: 16px !important;
        flex-shrink: 0;
        color: #c4c4c4;

        svg {
            display: block;
            width: 8px;
            height: 8px;
            fill: currentColor;
            transition: transform 0.15s ease;
        }

        &[aria-expanded="true"] svg {
            transform: rotate(90deg);
        }
    }

    .azytus-quote-select__toggle-spacer {
        width: 16px;
        flex-shrink: 0;
    }

    .azytus-quote-select__check {
        position: relative;
        flex-shrink: 0;
        width: 16px;
        height: 16px;
        border: 1px solid var(--aqs-border);
        border-radius: 4px;
        background: #fff;

        &.is-checked {
            background: var(--aqs-accent);
            border-color: var(--aqs-accent);

            &::after {
                content: "";
                position: absolute;
                left: 4px;
                top: 1px;
                width: 5px;
                height: 9px;
                border: solid #fff;
                border-width: 0 2px 2px 0;
                transform: rotate(45deg);
            }
        }
    }

    .azytus-quote-select__label {
        flex: 1 1 auto;
        min-width: 0;
        line-height: 1.35;
    }

    .azytus-quote-select__meta {
        flex-shrink: 0;
        color: var(--aqs-muted);
        font-family: var(--aqs-font);
        font-size: 12px;
        font-weight: 500;
        white-space: nowrap;
        word-break: keep-all;
        overflow-wrap: normal;
        hyphens: none;
    }

    .azytus-quote-select__count {
        flex-shrink: 0;
        color: var(--aqs-muted);
        font-family: var(--aqs-font);
        font-size: 13px;
        font-weight: 500;
    }

    .azytus-quote-select__children {
        display: none;
        background: #fafafa;
    }

    .azytus-quote-select__node.is-open > .azytus-quote-select__children {
        display: block;
    }

    .azytus-quote-select__node.is-product .azytus-quote-select__children,
    .azytus-quote-select__node.is-grade .azytus-quote-select__children {
        background: #f6f6f6;
    }

    mark {
        background: rgba(20, 116, 155, 0.16);
        color: inherit;
        padding: 0;
        border-radius: 2px;
    }
}

.contact-form-wrap .azytus-quote-select button,
.contact-form-wrap .azytus-quote-select .azytus-quote-select__toggle {
    margin: 0 !important;
    margin-top: 0 !important;
    padding: 0 !important;
}

.contact-form-wrap .form-inner .azytus-quote-select .azytus-quote-select__search,
.form-inner .azytus-quote-select .azytus-quote-select__search {
    flex: 1 1 140px;
    width: auto;
    min-width: 80px;
    height: 28px;
    padding: 0 4px;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

@media (max-width: 576px) {
    .azytus-quote-select {
        .azytus-quote-select__control {
            padding-left: 10px;
        }

        .azytus-quote-select__row {
            padding-left: 14px;
            padding-right: 14px;
        }

        .azytus-quote-select__node.is-product > .azytus-quote-select__row {
            padding-left: 28px;
        }

        .azytus-quote-select__node.is-grade > .azytus-quote-select__row {
            padding-left: 40px;
        }

        .azytus-quote-select__node.is-pack > .azytus-quote-select__row {
            padding-left: 52px;
        }
    }
}
