/* ============================================================
   header.css - Шапка сайта
   Навигация: логотип | меню | кнопка "Подобрать решение" — в одну линию
   ============================================================ */

/* ===== БАЗОВЫЕ ПЕРЕМЕННЫЕ ===== */
:root {
    --header-height: 76px;
    --header-height-mobile: 64px;
    --header-bg: #ffffff;
    --header-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    --header-border: #e9ecef;
}

/* ===== ОСНОВНОЙ КОНТЕЙНЕР ХЕДЕРА ===== */
.header {
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    background: var(--header-bg);
    box-shadow: var(--header-shadow);
}

/* ===== ВЕРХНЯЯ СТРОКА С КОНТАКТАМИ ===== */
.header-top {
    background: #f8f9fa;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px solid var(--header-border);
    display: block;
}

.header-top-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 24px;
}

.header-top-phone,
.header-top-email,
.header-top-support {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    font-size: 13px;
}

.header-top-phone {
    color: #1a1a2e;
    font-weight: 600;
}

.header-top-email {
    color: #6c757d;
}

.header-top-support {
    color: #28a745;
    font-weight: 500;
}

.header-top svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke-width: 1.5;
}

.header-top-phone svg,
.header-top-email svg {
    stroke: #0066cc;
}

.header-top-support svg {
    stroke: #28a745;
}

/* ===== ОСНОВНАЯ НАВИГАЦИЯ ===== */
.header-main {
    background: var(--header-bg);
}

/* ГЛАВНЫЙ КОНТЕЙНЕР — ВСЕ ЭЛЕМЕНТЫ В ОДНУ ЛИНИЮ */
.header-main-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    height: var(--header-height);
}

/* ===== ЛОГОТИП ===== */
.header-logo {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

.header-logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.header-logo img {
    height: 50px;
    width: auto;
    display: block;
}

/* ===== НАВИГАЦИОННОЕ МЕНЮ ===== */
.header-nav {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.header-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 28px;
    align-items: center;
}

.header-menu-item {
    position: relative;
    white-space: nowrap;
}

.header-menu-link {
    color: #1a1a2e;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    padding: 8px 0;
    transition: color 0.2s ease;
    display: inline-block;
    position: relative;
}

.header-menu-link:hover {
    color: #0066cc;
}

.header-menu-link.active {
    color: #0066cc;
}

.header-menu-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #0066cc;
    border-radius: 2px;
}

/* ===== ВЫПАДАЮЩИЕ МЕНЮ ===== */
.header-menu-item.dropdown > .header-menu-link {
    display: flex;
    align-items: center;
    gap: 4px;
}

.dropdown-arrow {
    font-size: 10px;
    transition: transform 0.25s ease;
    display: inline-block;
}

.header-menu-item.dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    min-width: 220px;
    background: #ffffff;
    border: 1px solid var(--header-border);
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    padding: 8px 0;
    list-style: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    z-index: 1001;
}

.header-menu-item.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.dropdown-menu li {
    margin: 0;
}

.dropdown-menu .dropdown-link {
    display: block;
    padding: 10px 20px;
    color: #4a4a5a;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
    border-radius: 0;
}

.dropdown-menu .dropdown-link:hover {
    background: #f0f4f8;
    color: #0066cc;
}

.dropdown-menu li:first-child .dropdown-link {
    border-radius: 10px 10px 0 0;
}

.dropdown-menu li:last-child .dropdown-link {
    border-radius: 0 0 10px 10px;
}

/* ===== КНОПКА "ПОДОБРАТЬ РЕШЕНИЕ" ===== */
.header-cta {
    flex: 0 0 auto;
}

.header-cta .button {
    display: inline-block;
    padding: 10px 28px;
    background: #0066cc;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.15s ease;
    white-space: nowrap;
}

.header-cta .button:hover {
    background: #0052a3;
    transform: translateY(-1px);
}

.header-cta .button:active {
    transform: translateY(0);
}

/* ===== БУРГЕР-КНОПКА (скрыта на десктопе) ===== */
.header-burger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 20px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    z-index: 1002;
}

.header-burger span {
    display: block;
    width: 100%;
    height: 2.5px;
    background: #1a1a2e;
    border-radius: 2px;
    transition: all 0.25s ease;
    transform-origin: center;
}

/* Анимация бургера в крестик */
.header-burger.open span:nth-child(1) {
    transform: translateY(8.5px) rotate(45deg);
}

.header-burger.open span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.header-burger.open span:nth-child(3) {
    transform: translateY(-8.5px) rotate(-45deg);
}

/* ===== МОБИЛЬНОЕ МЕНЮ (оверлей + сайдбар) ===== */
.header-mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.header-mobile-overlay.open {
    opacity: 1;
    visibility: visible;
}

.header-mobile-menu {
    position: fixed;
    top: 0;
    right: -340px;
    width: 320px;
    max-width: 85%;
    height: 100%;
    background: #ffffff;
    z-index: 1000;
    transition: right 0.35s ease;
    padding: 24px 20px 40px;
    overflow-y: auto;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.15);
}

.header-mobile-menu.open {
    right: 0;
}

/* Закрытие мобильного меню */
.header-mobile-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #1a1a2e;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.header-mobile-close:hover {
    background: #f0f0f0;
}

/* Мобильное меню — список */
.header-mobile-menu .header-menu {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    margin-top: 60px;
}

.header-mobile-menu .header-menu-item {
    white-space: normal;
}

.header-mobile-menu .header-menu-link {
    display: block;
    padding: 12px 0;
    font-size: 17px;
    font-weight: 500;
    border-bottom: 1px solid #f0f0f0;
}

.header-mobile-menu .header-menu-link.active {
    border-bottom-color: #0066cc;
}

/* Мобильные выпадающие списки */
.header-mobile-menu .dropdown-menu {
    position: static;
    transform: none;
    box-shadow: none;
    border: none;
    border-radius: 0;
    padding: 0 0 0 16px;
    margin: 0;
    opacity: 1;
    visibility: visible;
    background: transparent;
    display: none;
    transition: none;
}

.header-mobile-menu .dropdown-menu.open {
    display: block;
}

.header-mobile-menu .dropdown-menu .dropdown-link {
    padding: 10px 0 10px 16px;
    font-size: 15px;
    border-bottom: 1px solid #f5f5f5;
}

.header-mobile-menu .dropdown-menu .dropdown-link:hover {
    background: transparent;
    color: #0066cc;
}

.header-mobile-menu .dropdown-arrow {
    transition: transform 0.25s ease;
}

.header-mobile-menu .dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

/* ============================================================
   АДАПТИВНОСТЬ
   ============================================================ */

/* Планшеты и мобильные — скрываем десктопное меню, показываем бургер */
@media (max-width: 1024px) {
    .header-nav {
        display: none !important;
    }

    .header-burger {
        display: flex !important;
    }

    .header-main-container {
        height: var(--header-height-mobile);
        gap: 12px;
    }

    .header-logo img {
        height: 40px;
    }

    .header-cta .button {
        padding: 8px 16px;
        font-size: 13px;
    }
}

/* Маленькие телефоны */
@media (max-width: 480px) {
    .header-main-container {
        padding: 0 12px;
        height: 58px;
        gap: 8px;
    }

    .header-logo img {
        height: 34px;
    }

    .header-cta .button {
        padding: 6px 12px;
        font-size: 12px;
        border-radius: 6px;
    }

    .header-burger {
        width: 24px;
        height: 18px;
    }

    .header-burger.open span:nth-child(1) {
        transform: translateY(7.5px) rotate(45deg);
    }

    .header-burger.open span:nth-child(3) {
        transform: translateY(-7.5px) rotate(-45deg);
    }

    .header-mobile-menu {
        width: 280px;
        padding: 16px 16px 30px;
    }

    .header-mobile-menu .header-menu-link {
        font-size: 16px;
        padding: 10px 0;
    }
}

/* Скрываем верхнюю строку на маленьких экранах */
@media (max-width: 720px) {
    .header-top {
        display: none;
    }
}

/* ============================================================
   ДОПОЛНИТЕЛЬНЫЕ ФИКСЫ ДЛЯ СТАБИЛЬНОСТИ
   ============================================================ */

/* Запрещаем перенос элементов в навигации */
.header-menu-item {
    white-space: nowrap;
}

/* Обеспечиваем, чтобы контейнер не ломался */
.header-main-container,
.header-nav,
.header-menu {
    flex-wrap: nowrap;
}

/* Для очень узких экранов — уменьшаем отступы между пунктами меню */
@media (min-width: 1025px) and (max-width: 1200px) {
    .header-menu {
        gap: 18px;
    }

    .header-menu-link {
        font-size: 14px;
    }
}

@media (min-width: 1201px) and (max-width: 1400px) {
    .header-menu {
        gap: 24px;
    }
}