.imbs-header-search-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 320px;
    width: 100%;
}

.imbs-header-search__title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #a6a6ac;
}

.imbs-header-search {
    display: flex;
    align-items: center;
    gap: 0;
    max-width: 320px;
    width: 100%;
    perspective: 500px;
}

.imbs-header-search__back-gutter {
    flex: 0 0 auto;
    width: 0;
    overflow: hidden;
    transition: width 0.16s ease;
    transform: translateZ(0);
}

.imbs-header-search__back {
    flex: 0 0 auto;
    width: 100%;
    height: 36px;
    border: none !important;
    background-color: transparent !important;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23cfcfd4'%3E%3Cpath d='M12.5 4l-6 6 6 6' stroke='%23cfcfd4' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 12px 12px !important;
    cursor: pointer;
    padding: 0 !important;
    box-shadow: none !important;
    /* Forces this element onto its own compositor layer. Without this,
       Chrome can fail to paint this background-image at all the first
       time, specifically because it sits inside a flex container that
       has `perspective` set (for the flip animation) — a known class of
       Chrome repaint bug with 3D-transform contexts and sibling
       elements. Zooming forces a full repaint, which is why the arrow
       "appears" only after zooming without this fix. */
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
}

.imbs-header-search__back:hover {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23ffffff'%3E%3Cpath d='M12.5 4l-6 6 6 6' stroke='%23ffffff' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
}

.imbs-header-search__slot {
    flex: 1 1 auto;
    min-width: 0;
    transform-origin: center;
    transition: transform 0.16s ease, opacity 0.16s ease;
    transform: rotateX(0deg);
    opacity: 1;
}

.imbs-header-search__slot.is-flipping {
    transform: rotateX(85deg);
    opacity: 0;
}

.imbs-header-search__select {
    display: block;
    width: 100%;
    box-sizing: border-box;
    height: 36px;
    padding: 0 30px 0 12px;
    font-size: 13px;
    line-height: 36px;
    border: 1px solid #34343a;
    border-radius: 999px;
    background-color: #101012;
    color: #e6e6e8;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23999999'%3E%3Cpath d='M5.5 7.5l4.5 5 4.5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
}

.imbs-header-search__select:focus {
    outline: none;
    border-color: #3b63e8;
}

.imbs-header-search__select option {
    background-color: #101012;
    color: #e6e6e8;
}

/* Custom dropdown — replaces the native <select> for this widget so a
   single tap picks an option immediately. A real <select> forces a
   native OS picker on mobile (radio list / wheel + a separate "Done"
   confirm button), which added an extra required tap we can't remove
   for a genuine <select> element. */
.imbs-header-search__dropdown {
    position: relative;
    width: 100%;
}

.imbs-header-search__trigger {
    display: block;
    width: 100%;
    box-sizing: border-box;
    height: 36px;
    padding: 0 30px 0 12px;
    font-size: 13px;
    line-height: 34px;
    text-align: left;
    border: 1px solid #34343a;
    border-radius: 999px;
    background-color: #101012;
    color: #e6e6e8;
    cursor: pointer;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23999999'%3E%3Cpath d='M5.5 7.5l4.5 5 4.5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.imbs-header-search__trigger:focus,
.imbs-header-search__trigger.is-open {
    outline: none;
    border-color: #3b63e8;
}

/* Same pulsing glow used on the category-filter plugin's active label
   (icf-label-glow) — reused here with the same accent color and timing
   so the two widgets feel like part of one visual language. */
@keyframes imbs-trigger-glow {
    0%, 100% {
        text-shadow: 0 0 0 rgba(59, 99, 232, 0);
        color: #e6e6e8;
    }
    50% {
        text-shadow: 0 0 8px rgba(59, 99, 232, 0.85);
        color: #b9c8ff;
    }
}

.imbs-header-search__trigger {
    animation: imbs-trigger-glow 1.8s ease-in-out infinite;
}

/* 4x slower/rarer pulse specifically before the first choice is made
   (i.e. only on the Automerkki step) — once the customer has picked
   something, the glow speeds back up to the normal rhythm. */
.imbs-header-search__trigger--slow-glow {
    animation-duration: 7.2s;
}

.imbs-header-search__options {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 260px;
    overflow-y: auto;
    background-color: #101012;
    border: 1px solid #34343a;
    border-radius: 12px;
    padding: 6px;
    z-index: 9999;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.imbs-header-search__option {
    display: block;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    background: transparent;
    border: none;
    color: #e6e6e8;
    font-size: 14px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
}

.imbs-header-search__option:hover,
.imbs-header-search__option:focus {
    background-color: #1c1c20;
    outline: none;
}

.imbs-header-search.is-loading .imbs-header-search__select {
    opacity: 0.5;
    pointer-events: none;
}

@media (max-width: 480px) {
    .imbs-header-search {
        max-width: 100%;
    }
    .imbs-header-search-wrap {
        align-items: center;
        text-align: center;
    }
    .imbs-header-search__title {
        text-align: center;
        width: 100%;
    }
}
