/* css/header.css - стили шапки */

.header {
    position: sticky;
    top: 0;
    background-color: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    padding: 1rem 0;
}

.header__container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative; /* Добавлено для правильного позиционирования */
}

.header__logo {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
}

.logo-link {
    display: flex;
    align-items: center;
    line-height: 0;
}

.logo-image {
    max-height: 60px;
    width: auto;
    transition: opacity 0.3s ease;
}

.logo-image:hover {
    opacity: 0.9;
}

.header__nav {
    flex: 1;
    display: flex;
    justify-content: center;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: var(--color-text);
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
}

.nav-link:hover {
    color: var(--color-primary);
}

.nav-link.active {
    color: var(--color-primary);
    font-weight: 600;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--color-cyan), var(--color-magenta));
}

.header__actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative; /* Добавлено */
    z-index: 1002; /* Убедимся, что кнопка поверх всего */
}

.btn-calc {
    background-color: var(--color-magenta);
    color: white;
}

.btn-calc:hover {
    background-color: #c2185b;
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    width: 30px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    position: relative; /* Добавлено */
    z-index: 1002; /* Поверх меню */
}

.mobile-menu-toggle span {
    width: 100%;
    height: 3px;
    background-color: var(--color-dark-graphite);
    margin: 3px 0;
    transition: 0.3s;
    display: block; /* Добавлено */
}

/* Адаптивность для планшетов */
@media (max-width: 992px) {
    .header__nav {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
}

@media (max-width: 576px) {
    .btn-calc {
        display: none;
    }
}

/* Мобильное меню - исправленная версия */
@media (max-width: 992px) {
    /* Делаем header__container позиционированным относительно */
    .header__container {
        position: relative;
        padding: 0 20px;
    }
    
    .header__nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 400px;
        height: 100vh;
        background-color: white;
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
        padding: 80px 30px 30px;
        transition: right 0.3s ease-in-out;
        z-index: 1001;
        overflow-y: auto;
        display: block;
    }
    
    .header__nav.mobile-active {
        right: 0;
    }
    
    .nav-list {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .nav-link {
        font-size: 1.2rem;
        display: block;
        padding: 0.5rem 0;
    }
    
    .nav-link.active::after {
        bottom: 0;
    }
    
    /* Блокируем прокрутку body при открытом меню */
    body.menu-open {
        overflow: hidden;
    }
    
    /* Стили для активного бургера - ИСПРАВЛЕНО */
    .header__actions {
        position: static; /* Сбрасываем позиционирование */
    }
    
    .mobile-menu-toggle {
        display: flex;
        position: fixed; /* Фиксируем относительно окна */
        right: 20px; /* Отступ от правого края окна */
        top: 20px; /* Отступ сверху */
        width: 40px;
        height: 40px;
        background-color: white;
        border-radius: 50%;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        align-items: center;
        justify-content: center;
        z-index: 1002;
        margin: 0; /* Сбрасываем все отступы */
    }
    
    .mobile-menu-toggle span {
        width: 20px; /* Чуть уже для красоты */
        height: 3px;
        background-color: var(--color-dark-graphite);
        margin: 3px 0;
        transition: all 0.3s ease;
        border-radius: 3px;
    }
    
    .mobile-menu-toggle.active span {
        background-color: var(--color-primary);
    }
    
    /* Анимация для пунктов меню */
    .header__nav.mobile-active .nav-list {
        animation: slideIn 0.3s ease-out;
    }
    
    @keyframes slideIn {
        from {
            opacity: 0;
            transform: translateX(20px);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }
    
    /* Стили для маленьких экранов */
    @media (max-width: 576px) {
        .header__nav {
            width: 100%;
            max-width: none;
        }
        
        .nav-link {
            font-size: 1.1rem;
            text-align: center;
        }
        
        .mobile-menu-toggle {
            right: 15px; /* Немного меньше отступ на маленьких экранах */
            top: 15px;
            width: 35px;
            height: 35px;
        }
    }

    /* Стили для контейнера действий в шапке на мобильных */
.header__actions {
    flex: 1; /* Занимаем все доступное место */
    display: flex;
    justify-content: space-between; /* Распределяем пространство */
    align-items: center;
    gap: 0.5rem;
}

/* Стили для номера телефона в мобильной версии */
.header-phone {
    display: block;
    font-size: 1rem;
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
    margin-left: 10px; /* Отступ от логотипа */
    /* Убираем margin-right: auto */
}

/* Контейнер для правых элементов (кнопка + бургер) */
.header__actions-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto; /* Прижимаем к правому краю */
}

/* Когда мобильное меню открыто - скрываем номер */
body.menu-open .header-phone {
    display: none;
}

/* Адаптация для совсем маленьких экранов (до 576px) */
@media (max-width: 576px) {
    .header-phone {
        font-size: 0.9rem;
        margin-left: 5px;
    }
    
    .btn-calc {
        display: none; /* Прячем кнопку на совсем маленьких */
    }
    
    .header__actions-right {
        gap: 0; /* Убираем отступы */
    }
}
}

.header-phone {
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.3s ease;
    white-space: nowrap; /* чтобы номер не переносился */
}

.header-phone:hover {
    color: var(--color-magenta);
    text-decoration: underline;
}

/* Стили для контактов в мобильном меню */
.mobile-contacts {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-gray);
}

.mobile-contact-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    color: var(--color-text);
    text-decoration: none;
    font-size: 1rem;
    transition: color 0.3s ease;
}

.mobile-contact-item:hover {
    color: var(--color-primary);
}

.mobile-contact-icon {
    font-size: 1.2rem;
    min-width: 24px;
    text-align: center;
}

.mobile-social {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    justify-content: flex-start;
}

.mobile-social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: var(--color-light-gray);
    color: var(--color-primary);
    transition: all 0.3s ease;
}

.mobile-social-link:hover {
    background-color: var(--color-primary);
    color: white;
    transform: translateY(-3px);
}

.mobile-social-link svg {
    width: 24px;
    height: 24px;
}

/* Адаптация для темной темы (если когда-нибудь добавите) */
@media (prefers-color-scheme: dark) {
    .mobile-social-link {
        background-color: #3a3a3a;
        color: #fff;
    }
}