/* Форма поиска заказа СДЭК */

/* Подсказка для кнопки поиска - убрана, используется общий tooltip из header-new.css */
.search-btn {
    position: relative;
}

/* Убираем старые tooltips через ::after и ::before, так как теперь используется .header-icon-tooltip */
.search-btn:hover::after {
    display: none;
}

.search-btn:hover::before {
    display: none;
}

/* Строка поиска в хедере */
.order-search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 84px;
    justify-content: center;
    /* Скрываем по умолчанию */
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50px); /* Начинаем слева (от кнопки) */
    pointer-events: none;
    /* Анимация только при открытии */
    transition: none;
    position: relative;
    z-index: 10016; /* Выше бургер-меню (10015) */
    background: #ffffff; /* Белая подложка, чтобы бургер-меню не было видно */
}

.order-search-bar.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0); /* Выезжаем вправо */
    pointer-events: auto;
    /* Плавная анимация выезда слева направо при открытии */
    transition: opacity 0.4s ease, visibility 0.4s ease, transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Скрываем группу иконок и бургер меню когда активна форма поиска */
/* Мгновенное скрытие без анимации */
.header-right.search-active .header-icons-group {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    /* Убираем transition для мгновенного скрытия */
    transition: none !important;
}

/* Бургер-меню теперь вне header-right, поэтому оно всегда видно */
/* Это правило больше не нужно, но оставляем для совместимости */
.burger-menu-btn {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* Выравнивание формы поиска по центру хедера */
/* Убираем переопределение, чтобы не конфликтовать с header-new.css */
.header-right.search-active {
    align-items: center;
    justify-content: center;
    z-index: 10016; /* Выше бургер-меню (10015) */
    background: #ffffff; /* Белая подложка для header-right при активной форме поиска */
}

.order-search-bar form {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    /* Элементы формы уже видны, анимация на контейнере */
}

.order-search-bar__input {
    flex: 1;
    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);
    outline: none;
    transition: border-color 0.2s ease;
    min-width: 200px;
    box-sizing: border-box;
}

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

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

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

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

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

.order-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; /* Скрываем символ &times; */
    line-height: 0;
}

.order-search-bar__close:hover {
    color: #0C181A; /* Черный при hover как в шторке */
}

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

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

/* Убеждаемся, что стили применяются и к десктопной версии */
.header-right .order-search-bar__close,
.order-search-bar .order-search-bar__close {
    position: relative;
    width: 24px;
    height: 24px;
    color: #777777;
    font-size: 0;
    line-height: 0;
}

/* Отступ слева для десктопной версии */
.header-right .order-search-bar__close,
.order-search-bar .order-search-bar__close {
    margin-left: 15px;
}

.header-right .order-search-bar__close:hover,
.order-search-bar .order-search-bar__close:hover {
    color: #0C181A;
}

/* Модалка со статусом заказа */
.order-status-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10030;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.order-status-modal.active {
    display: flex;
    opacity: 1;
}

.order-status-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.order-status-modal__content {
    position: relative;
    margin: auto;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    background: var(--color-garda-white);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.order-status-modal.active .order-status-modal__content {
    transform: scale(1);
}

.order-status-modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--color-garda-gray-light);
}

.order-status-modal__header h3 {
    margin: 0;
    font-family: var(--font-montserrat);
    font-size: 20px;
    font-weight: 600;
    color: var(--color-garda-black);
}

.order-status-modal__close {
    background: none;
    border: none;
    font-size: 32px;
    line-height: 1;
    color: var(--color-garda-black);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.order-status-modal__close:hover {
    color: var(--color-garda-green);
}

.order-status-modal__body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.order-status-modal__result {
    min-height: 40px;
}

.order-status-modal__loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-garda-black);
    font-family: var(--font-montserrat);
    font-size: 14px;
}

.order-status-modal__error {
    padding: 16px;
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 4px;
    color: #c33;
    font-family: var(--font-montserrat);
    font-size: 14px;
}

.order-status-modal__success {
    padding: 0;
}

.order-status {
    margin-bottom: 20px;
}

.order-status__title {
    font-family: var(--font-montserrat);
    font-size: 14px;
    font-weight: 600;
    color: var(--color-garda-black);
    margin-bottom: 8px;
}

.order-status__value {
    font-family: var(--font-montserrat);
    font-size: 18px;
    font-weight: 600;
    color: var(--color-garda-black);
    margin-bottom: 4px;
}

.order-status__date {
    font-family: var(--font-montserrat);
    font-size: 12px;
    color: #666;
}

.order-packages {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--color-garda-gray-light);
}

.order-packages__title {
    font-family: var(--font-montserrat);
    font-size: 14px;
    font-weight: 600;
    color: var(--color-garda-black);
    margin-bottom: 8px;
}

.order-packages__info {
    font-family: var(--font-montserrat);
    font-size: 14px;
    color: var(--color-garda-black);
    line-height: 1.6;
}

.order-delivery {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--color-garda-gray-light);
}

.order-delivery__title {
    font-family: var(--font-montserrat);
    font-size: 14px;
    font-weight: 600;
    color: var(--color-garda-black);
    margin-bottom: 8px;
}

.order-delivery__address {
    font-family: var(--font-montserrat);
    font-size: 14px;
    color: var(--color-garda-black);
    line-height: 1.6;
}

.order-delay {
    margin-top: 20px;
    padding: 12px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
}

.order-delay__title {
    font-family: var(--font-montserrat);
    font-size: 14px;
    font-weight: 600;
    color: #856404;
    margin-bottom: 8px;
}

.order-delay__reason {
    font-family: var(--font-montserrat);
    font-size: 14px;
    color: #856404;
    line-height: 1.6;
}

.order-delivered {
    margin-top: 20px;
    padding: 16px;
    background: #d4edda;
    border: 1px solid #28a745;
    border-radius: 4px;
}

.order-delivered__text {
    font-family: var(--font-montserrat);
    font-size: 18px;
    font-weight: 600;
    color: #155724;
}

/* Мобильная форма поиска заказа */
.mobile-order-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-order-search-bar.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    pointer-events: auto;
}

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

.mobile-header-right.search-active {
    position: relative;
}

.mobile-header-right.search-active .mobile-header-icon-btn {
    display: none !important;
}

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

.mobile-order-search-bar .order-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-order-search-bar .order-search-bar__input:focus {
    /* Убираем outline, чтобы не было проблем с позиционированием */
    outline: none;
    /* Убеждаемся, что border виден */
    border-color: var(--color-garda-green);
    /* Предотвращаем автоматический скролл */
    scroll-margin-top: 0;
}

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

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

.mobile-order-search-bar .order-search-bar__close {
    flex-shrink: 0;
    margin-left: 15px;
}

/* Адаптивность */
@media screen and (max-width: 768px) {
    .order-search-bar {
        width: 100%;
    }

    .order-search-bar__input {
        min-width: 150px;
        height: 44px;
        font-size: 16px; /* Предотвращаем зум на iOS */
        padding: 0 12px;
    }

    .order-search-bar__submit {
        width: 44px;
        height: 44px;
        padding: 0;
    }
    
    .order-search-bar__submit svg {
        width: 18px;
        height: 18px;
    }

    .order-status-modal__content {
        width: 95%;
        max-height: 95vh;
    }

    .order-status-modal__header {
        padding: 16px 20px;
    }

    .order-status-modal__header h3 {
        font-size: 18px;
    }

    .order-status-modal__body {
        padding: 20px;
    }
}
