/* =============================================================================
   xd-search-module
   ============================================================================= */

.xd-search-module {
    display: inline-flex;
    align-items: center;
    position: relative;
}

/* Form: position:relative so the absolute field-wrap is anchored here */
.xd-search-module__form {
    display: flex;
    align-items: center;
    position: relative;
}

/* Toggle button — always visible, never moves */
.xd-search-module__toggle {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    padding: 0;
    background: transparent !important;
    border: none !important;
    border-radius: 0;
    cursor: pointer;
    color: var(--xd-search-icon-color, #ffffff) !important;
    outline: none !important;
    box-shadow: none !important;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.xd-search-module__toggle:hover {
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    color: var(--xd-search-icon-color, #ffffff) !important;
    transform: scale(1.1);
}

.xd-search-module__toggle:focus,
.xd-search-module__toggle:focus-visible,
.xd-search-module__toggle:active,
.xd-search-module__toggle:visited {
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    color: var(--xd-search-icon-color, #ffffff) !important;
}

/* Icon SVG */
.xd-search-module__icon {
    width: var(--xd-search-icon-size, 34px);
    height: var(--xd-search-icon-size, 34px);
    display: block;
    flex-shrink: 0;
    fill: rgba(0, 0, 0, 0) !important;
}

/* Input wrapper — absolutely positioned, expands leftward from the toggle */
.xd-search-module__field-wrap {
    position: absolute;
    right: 54px; /* flush against the left edge of the 54px toggle */
    top: 50%;
    transform: translateY(-50%);
    overflow: hidden;
    width: 0;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    pointer-events: none;
}

.xd-search-module.is-open .xd-search-module__field-wrap {
    width: var(--xd-search-input-width, 280px);
    pointer-events: auto;
}

/* The input itself */
.xd-search-module__input {
    width: var(--xd-search-input-width, 280px);
    flex-shrink: 0;
    height: 44px;
    padding: 0 16px;
    border: 1.5px solid rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    background: var(--xd-search-input-bg, #ffffff);
    color: var(--xd-search-input-text, #333333);
    font-size: 15px;
    line-height: 1;
    outline: none;
    box-shadow: none;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color 0.2s ease;
}

.xd-search-module__input::placeholder {
    color: var(--xd-search-placeholder-color, #999999);
}

.xd-search-module__input:focus {
    border-color: rgba(0, 0, 0, 0.35);
}

/* Remove browser search cancel button */
.xd-search-module__input::-webkit-search-cancel-button,
.xd-search-module__input::-webkit-search-decoration {
    -webkit-appearance: none;
}

/* =============================================================================
   Responsive
   ============================================================================= */

@media (max-width: 767px) {
    .xd-search-module.is-open .xd-search-module__field-wrap {
        width: min(var(--xd-search-input-width, 280px), calc(100vw - 80px));
    }
}
