/* Форма поиска товаров - перекрывает хедер (десктоп) */

.product-search-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 84px; /* Высота хедера */
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 clamp(20px, 2.5vw, 40px); /* Такие же отступы как у хедера */
    background: #ffffff;
    z-index: 10016; /* Выше хедера */
    box-sizing: border-box;
    /* Скрываем по умолчанию */
    opacity: 0;
    visibility: hidden;
    transform: translateX(-100%);
    pointer-events: none;
    transition: opacity 0.4s ease, visibility 0.4s ease, transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.product-search-bar.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    pointer-events: auto;
}

/* Контейнер хедера должен быть relative для позиционирования формы */
.header-right {
    position: relative;
}

.header-right.product-search-active {
    align-items: center;
    justify-content: center;
    z-index: 10016;
    background: #ffffff;
}

.header-right.product-search-active .header-icons-group {
    display: none !important;
}

.product-search-bar__form {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.product-search-bar__input {
    flex: 1;
    min-width: 200px;
    height: 48px;
    padding: 0 16px;
    border: 1px solid var(--color-garda-gray-light);
    border-radius: 4px;
    font-family: var(--font-montserrat);
    font-size: 16px;
    color: var(--color-garda-black);
    background-color: #ffffff;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
    outline: none;
}

.product-search-bar__input:focus {
    outline: none;
    border-color: var(--color-garda-green);
}

.product-search-bar__input::placeholder {
    color: #999999;
}

.product-search-bar__submit {
    width: 48px;
    height: 48px;
    padding: 0;
    border: none;
    background-color: var(--color-garda-green);
    color: #ffffff;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
    font-family: var(--font-montserrat);
    font-size: 14px;
    font-weight: 600;
}

.product-search-bar__submit:hover {
    background-color: #4a959f;
}

.product-search-bar__submit svg {
    width: 20px;
    height: 20px;
}

.product-search-bar__submit svg path {
    fill: #ffffff;
}

.product-search-bar__close {
    position: relative;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #777777;
    transition: color 0.2s ease;
    flex-shrink: 0;
    font-size: 0;
    line-height: 0;
    margin-left: 15px;
}

.product-search-bar__close:hover {
    color: #0C181A;
}

/* Создаем крестик через псевдоэлементы */
.product-search-bar__close::before,
.product-search-bar__close::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 24px;
    background: currentColor;
    transform: translate(-50%, -50%) rotate(45deg);
}

.product-search-bar__close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

/* Мобильная форма поиска товаров - перекрывает хедер */
.mobile-product-search-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 70px; /* Высота мобильного хедера */
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    background: #ffffff;
    z-index: 10016;
    box-sizing: border-box;
    /* Скрываем по умолчанию */
    opacity: 0;
    visibility: hidden;
    transform: translateX(-100%);
    pointer-events: none;
    transition: opacity 0.4s ease, visibility 0.4s ease, transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    /* Предотвращаем проблемы с позиционированием при фокусе */
    will-change: transform;
}

.mobile-product-search-bar.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    pointer-events: auto;
}

.mobile-product-search-bar .product-search-bar__form {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.mobile-product-search-bar .product-search-bar__input {
    flex: 1;
    min-width: 0;
    height: 44px;
    font-size: 16px !important; /* Предотвращаем зум на iOS */
    padding: 0 12px;
    box-sizing: border-box;
    /* Предотвращаем зум при фокусе на iOS */
    -webkit-appearance: none;
    appearance: none;
    border-radius: 4px;
    -webkit-border-radius: 4px;
    line-height: 1.5;
    transform: scale(1);
    -webkit-transform: scale(1);
    -webkit-user-select: text;
    user-select: text;
    position: relative;
    z-index: 1;
}

.mobile-product-search-bar .product-search-bar__input:focus {
    outline: none;
    border-color: var(--color-garda-green);
    scroll-margin-top: 0;
}

.mobile-product-search-bar .product-search-bar__submit {
    width: 44px;
    height: 44px;
    padding: 0;
}

.mobile-product-search-bar .product-search-bar__submit svg {
    width: 18px;
    height: 18px;
}

.mobile-product-search-bar .product-search-bar__close {
    position: relative;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #777777;
    transition: color 0.2s ease;
    flex-shrink: 0;
    font-size: 0;
    line-height: 0;
    margin-left: 15px;
}

.mobile-product-search-bar .product-search-bar__close:hover {
    color: #0C181A;
}

/* Создаем крестик через псевдоэлементы */
.mobile-product-search-bar .product-search-bar__close::before,
.mobile-product-search-bar .product-search-bar__close::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 24px;
    background: currentColor;
    transform: translate(-50%, -50%) rotate(45deg);
}

.mobile-product-search-bar .product-search-bar__close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

/* Скрываем иконки при активном поиске товаров */
.mobile-header-right.product-search-active .mobile-header-icon-btn {
    display: none !important;
}

/* Убираем сдвиг контента - поиск перекрывает хедер */
