/* Основные CSS-переменные для темы и размеров */
:root {
    --header-bg: #0450A0;
    /* Цвет фона шапки */
    --header-text: #fff;
    /* Цвет текста в шапке */
    --header-height: 60px;
    /* Высота шапки для десктопа */
    --header-height-mobile: 60px;
    /* Высота шапки для мобильных */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    /* Кривая анимации по умолчанию */
    --total-header-height: var(--header-height);
    --utilities-bar-height: 50px;
    --search-form-width: 300px;
    --utilities-bar-height-mobile: 20px;
}

/* Основная структура шапки */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--total-header-height);
    z-index: 1000;
    background: var(--header-bg);
    color: var(--header-text);
}

/* Добавьте спейсер для контента */
.header-spacer {
    height: var(--total-header-height);
    width: 100%;
}

/* Контейнер для центрирования контента */
.header__container {
    width: 100%;
    max-width: 1280px;
    /* Максимальная ширина контента */
    margin: 0 auto;
    /* Центрирование по горизонтали */
    padding: 0 20px;
    /* Боковые отступы */
    height: 100%;
    /* Наследование высоты от родителя */
}

/* Внутренняя часть шапки (лого + навигация) */
.header__inner {
    display: flex;
    justify-content: space-between;
    /* Распределение пространства между элементами */
    align-items: center;
    height: 100%;
    /* Заполнение всей высоты шапки */
}

/* Стили логотипа */
.header__logo {
    display: flex;
    align-items: center;
    height: 100%;
    z-index: 1100;
}

/* Изображение логотипа */
.header__logo-image {
    height: 60px;
    /* Фиксированная высота */
    width: auto;
    /* Сохранение пропорций */
    object-fit: contain;
    /* Без искажений */
    filter: brightness(0) invert(1);
    /* Конвертация в белый цвет */
}

/* Кнопка бургер-меню для мобильных */
.nav__toggle {
    --toggle-size: 40px;
    position: relative;
    width: var(--toggle-size);
    height: var(--toggle-size);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1100;
}

/* Внутренние элементы бургер-иконки */
.nav__toggle-inner {
    position: relative;
    display: block;
    width: 24px;
    height: 24px;
    /* Рабочая область иконки */
}

/* Анимация бургер-иконки в крестик */
.nav__toggle-inner::before,
.nav__toggle-inner::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--header-text);
    transition: all 0.4s var(--ease);
    transform-origin: center;
    /* Точка вращения для анимации */
}

.nav__toggle-inner::before {
    top: 11px;
    /* Центр при высоте 24px (24/2 - 1px) */
    box-shadow: 0 6px 0 var(--header-text);
    /* Точное расстояние */
    transition:
        box-shadow 0.2s ease-in-out,
        transform 0.4s var(--ease);
}

.nav__toggle-inner::after {
    top: 11px;
    /* Центр при высоте 24px */
    bottom: auto;
    /* Создание средней линии через тень.  Не задалось пока 2 линии*/
}

/* Состояние активного меню (крестик) */
.nav--active .nav__toggle-inner::before {
    box-shadow: 0 0 0 transparent;
    transform:
        translateY(-1px) rotate(45deg);
    /* Первая часть крестика */
}

.nav--active .nav__toggle-inner::after {
    transform:
        translateY(-1px) rotate(-45deg);
    /* Вторая часть крестика */
}

/* Menu List */
.nav__list {
    position: fixed;
    top: var(--total-header-height);
    /* Используем общую высоту */
    right: 20px;
    /* Отступ от правого края */
    left: 20px;
    /* Отступ от левого края */
    width: calc(100% - 40px);
    /* Компенсируем отступы */
    height: calc(100dvh - var(--total-header-height));
    /* Используем динамический viewport */
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s var(--ease);
    background: var(--header-bg);
    /* Фон меню */
    border-radius: 12px;
    /* Опционально скругление углов */
    overflow-y: auto;
    /* Добавляем скролл при необходимости */
    padding: 20px 0;
    /* Внутренние отступы */
    transform: translateY(-20px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    pointer-events: none;
    /* Блокируем клики когда меню скрыто */
}

/* Пункты меню с анимацией появления */
.nav__list>li {
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.4s ease;
}

.nav__list a {
    color: var(--header-text);
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 500;
    display: block;
    padding: 15px 30px;
    position: relative;
}

/* Активированное состояние меню */
.nav--active .nav__list {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
    /* Разрешаем клики при активации */
}

.nav--active .nav__list>li {
    opacity: 1;
    transform: translateY(0);
}

/* Стили для утилит в шапке */
.header__utilities {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-left: auto;
    padding-right: 20px;
}

/* Стили для кнопки доступности */
.accessibility-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: currentColor;
    transition: opacity 0.3s ease;
}

.accessibility-btn:hover {
    opacity: 0.8;
}

/* Стили для поиска */
.search-container {
    position: relative;
}

.search-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: currentColor;
    transition: opacity 0.3s ease;
}

.search-toggle:hover {
    opacity: 0.8;
}

.search-form-wrapper {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #fff;
    padding: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.search-form-wrapper.active {
    display: block;
}

/* Стили для контейнера иконок */
.header__icons {
    display: flex;
    align-items: center;
    gap: 15px;
    /* Расстояние между иконками */
}

/* Стили для ссылок с иконками */
.header__icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: currentColor;
    transition: opacity 0.3s ease;
}

.header__icon-link:hover {
    opacity: 0.8;
}

/* Стили для SVG-иконок */
.header__icon {
    width: 48px;
    /* Размер иконки */
    height: 48px;
    fill: currentColor;
    /* Цвет иконки наследуется от текста */
    filter: brightness(0) invert(1);
    /* Если нужно сделать белыми */
}

/* Новая строка с иконками */
.header__utilities-bar {
    display: block;
    /* По умолчанию скрыто */
    background: #fff;
    /*padding: 10px 0;*/
    width: 100%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.header__utilities-bar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;

}

.header__utilities-bar-icons {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header__utilities-icon {
    width: 34px;
    height: 34px;
    transition: transform 0.3s ease;
}

/* Обновленные стили для иконок в основном хедере */
.header__inner .header__utilities {
    margin-left: auto;
    padding-right: 20px;
}

/* Убираем фильтр для иконок в новой строке */
.header__utilities-bar .header__utilities-icon {
    filter: none;
}

/* Цвет иконок в новой строке */
.header__utilities-bar .header__utilities-icon {
    filter: brightness(0) saturate(100%) invert(16%) sepia(99%) saturate(1891%) hue-rotate(197deg) brightness(95%) contrast(101%);
}

.header__utilities-icon:hover {
    transform: scale(1.1);
}

/* Контейнер для поиска */
.header__search-container {
    position: relative;
    display: flex;
    align-items: center;
}

/* Скрываем форму по умолчанию */
.header__search-form {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 300px;
    background: #fff;
    padding: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    z-index: 1100;
}

/* Показываем форму при добавлении класса active */
.header__search-form.active {
    display: block;
}

/* Стили для формы поиска */
.search-form {
    display: flex;
    gap: 10px;
}

.search-form input[type="search"] {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.search-form input[type="submit"] {
    background: var(--header-bg);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.search-form input[type="submit"]:hover {
    background: #033a7a;
}


.search-toggle:focus,
.search-toggle-desktop:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(4, 80, 160, 0.5);
    /* Альтернатива для доступности */
}

.header__icon,
.header__utilities-icon {
    border: none !important;
    /* Уберите возможные рамки */
}

/* Замените сложный фильтр на более простой */
.header__utilities-bar .header__utilities-icon {
    filter: none;
    fill: #0450A0;
    /* Используйте прямое задание цвета */
}

/* Явно задайте стили для состояний */
.search-toggle,
.search-toggle-desktop {
    background: transparent;
    border: 0;
    padding: 5px;
}

/* Добавляем адаптивные медиа-запросы
@media (max-width: 1280px) {
    .header__container {
        max-width: 90%;
    }
}*/

/* Адаптив для десктопа */
@media (min-width: 1025px) {

    :root {
        --total-header-height: calc(var(--header-height) + var(--utilities-bar-height));
    }

    .nav__toggle {
        display: none;
        /* Скрываем бургер на десктопе */
    }

    .nav__list {
        /* Горизонтальное меню */
        position: static;
        /* Горизонтальное меню */
        display: flex;
        opacity: 1;
        visibility: visible;
        width: auto;
        height: auto;
        background: transparent;
        transform: none;
        flex-direction: row;
        /* Расстояние между пунктами */
        gap: 15px;
        padding: 0;
        box-shadow: none;
        text-decoration: none;
        list-style-type: none;
    }

    .nav__list>li {
        opacity: 1;
        transform: none;
    }

    .nav__list a {
        padding: 0px;
        color: var(--header-text);
        text-decoration: none;
        font-size: 1.2rem;
        font-weight: 500;
        display: block;
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        pointer-events: auto;
        position: relative;
    }

    .header__utilities-bar {
        display: block;
    }

    .header__utilities-bar {
        display: block;
    }

    /* Скрываем иконки в основном хедере */
    .header__inner .header__utilities {
        display: none;
    }

    /* Увеличиваем высоту шапки */
    .header {
        height: calc(var(--header-height) + var(--utilities-bar-height));
    }

    .header-spacer {
        height: calc(var(--header-height) + var(--utilities-bar-height));
    }

}

/* Стили для иконок в новой строке */
.header__utilities-bar .header__utilities-icon {
    filter: brightness(0) saturate(100%) invert(16%) sepia(99%) saturate(1891%) hue-rotate(197deg) brightness(95%) contrast(101%);
}

/* Улучшаем мобильное меню */
@media (max-width: 1024px) {
    .nav__list {
        right: 0;
        left: 0;
        width: 100%;
        border-radius: 0;
        padding-top: 40px;
        display: none;
        /* Скрываем обычное меню на мобильных */
    }

    .nav__toggle {
        display: block;
        /* Показываем бургер */
    }

    .nav--active .nav__list {
        display: block;
        /* Показываем меню при активации */
    }

    .nav__list a {
        font-size: 1.25rem;
        padding: 15px 25px;
        transition: transform 0.3s ease;
    }

    .nav__list a:hover {
        transform: translateX(10px);
    }

    .header__logo-image {
        height: 45px;
    }


    .header__search-form {
        width: 280px;
        right: -20px;
    }

    .header__inner .header__utilities {
        display: none;
    }

    /* Стили для текста "Поиск" */
    .search-text {
        display: inline-block;
        margin-left: 5px;
        color: #0450A0;
        font-size: 14px;
        font-weight: 500;
    }

}


@media (max-width: 480px) {
    .header {
        height: 70px;
    }

    .nav__list {
        /* Позиционирование под шапкой */
        top: 70px;
        /* Учитываем динамический viewport */
        height: calc(100dvh - 70px);
        /* Уменьшенный верхний отступ */
        padding-top: 30px;
    }

    .nav__list a {
        font-size: 1.1rem;
        padding: 12px 20px;
    }

    .header__logo-image {
        height: 35px;
    }
}