/* ===================================
   HEADER.CSS - ШАПКА САЙТА
   =================================== */

/* ===================================
   1. ОСНОВНАЯ ШАПКА
   =================================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: var(--z-fixed);
    transition: var(--transition-smooth);
}

.header__main {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: var(--backdrop-blur);
    border-bottom: 1px solid var(--color-border);
    transition: var(--transition-smooth);
}

/* Состояние при скролле */
.header--scrolled .header__main {
    background: rgba(15, 23, 42, 0.98);
    box-shadow: var(--shadow-lg);
    border-bottom-color: rgba(0, 166, 232, 0.2);
}

/* ===================================
   2. КОНТЕЙНЕР ШАПКИ
   =================================== */
.header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-lg);
    padding: 20px 0;
    transition: padding 0.3s ease;
}

.header--scrolled .header__inner {
    padding: 12px 0;
}

/* ===================================
   4. НАВИГАЦИЯ
   =================================== */
.navigation {
    flex: 1;
    display: flex;
    justify-content: center;
}

.nav-list {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-list li {
    position: relative;
}

.nav-list a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--color-text-secondary);
    font-weight: 600;
    font-size: 15px;
    border-radius: var(--radius-md);
    transition: var(--transition-base);
    position: relative;
    white-space: nowrap;
}

/* Эффект подчёркивания */
.nav-list a::before {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 20px;
    right: 20px;
    height: 2px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
    border-radius: 1px;
}

.nav-list a:hover {
    color: var(--color-primary);
    background: rgba(0, 166, 232, 0.1);
}

.nav-list a:hover::before {
    transform: scaleX(1);
}

/* Активная ссылка */
.nav-list a.active {
    color: var(--color-text-primary);
    background: rgba(0, 166, 232, 0.15);
    box-shadow: inset 0 0 0 1px rgba(0, 166, 232, 0.3);
}

.nav-list a.active::before {
    transform: scaleX(1);
    background: var(--gradient-gold);
}

/* ===================================
   5. КОНТАКТЫ В ШАПКЕ
   =================================== */
.header__contacts {
    display: flex;
    align-items: center;
    gap: 24px;
}

.header__phone-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: right;
}

.header__phone-block .phone {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text-primary);
    transition: var(--transition-base);
    letter-spacing: 0.5px;
}

.header__phone-block .phone:hover {
    color: var(--color-primary);
}

.header__phone-note {
    font-size: 12px;
    color: var(--color-text-tertiary);
    font-weight: 500;
}

/* ===================================
   6. БУРГЕР-МЕНЮ
   =================================== */
.burger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 32px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    position: relative;
}

.burger-menu span {
    display: block;
    width: 100%;
    height: 3px;
    background: var(--color-text-primary);
    border-radius: 2px;
    transition: var(--transition-smooth);
    transform-origin: center;
}

/* Анимация бургера */
.burger-menu.active span:nth-child(1) {
    transform: translateY(10.5px) rotate(45deg);
}

.burger-menu.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(-20px);
}

.burger-menu.active span:nth-child(3) {
    transform: translateY(-10.5px) rotate(-45deg);
}

.burger-menu:hover span {
    background: var(--color-primary);
}

/* ===================================
   7. МОБИЛЬНОЕ МЕНЮ
   =================================== */
@media (max-width: 992px) {
    .burger-menu {
        display: flex;
    }

    .navigation {
        position: fixed;
        top: 0;
        right: -100%;
        width: 320px;
        height: 100vh;
        background: var(--color-bg-dark-secondary);
        box-shadow: var(--shadow-xl);
        padding: 100px 32px 40px;
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        z-index: 1000;
    }

    .navigation.active {
        right: 0;
    }

    /* Оверлей для мобильного меню */
    .navigation::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(15, 23, 42, 0.9);
        backdrop-filter: var(--backdrop-blur);
        opacity: 0;
        visibility: hidden;
        transition: var(--transition-smooth);
        z-index: -1;
        pointer-events: none;
    }

    .navigation.active::before {
        opacity: 1;
        visibility: visible;
        left: -100vw;
        pointer-events: auto;
    }

    .nav-list {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }

    .nav-list a {
        padding: 16px 20px;
        font-size: 16px;
        justify-content: space-between;
    }

    /* Иконка стрелки в мобильном меню */
    .nav-list a::after {
        content: '→';
        font-size: 18px;
        opacity: 0;
        transform: translateX(-10px);
        transition: var(--transition-base);
    }

    .nav-list a:hover::after,
    .nav-list a.active::after {
        opacity: 1;
        transform: translateX(0);
    }

    .nav-list a::before {
        display: none;
    }

    /* Контакты в мобильном меню */
    .header__contacts {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }

    .header__phone-block {
        text-align: center;
        padding: 20px;
        background: rgba(0, 166, 232, 0.1);
        border-radius: var(--radius-md);
        border: 1px solid rgba(0, 166, 232, 0.2);
    }

    .header__contacts .btn {
        width: 100%;
    }
}

/* ===================================
   8. АДАПТИВНОСТЬ
   =================================== */

/* Планшеты */
@media (max-width: 1200px) {
    .header__inner {
        gap: var(--spacing-md);
    }

    .nav-list {
        gap: 4px;
    }

    .nav-list a {
        padding: 10px 16px;
        font-size: 14px;
    }

    .header__phone-block .phone {
        font-size: 16px;
    }

    .header__contacts {
        gap: 16px;
    }
}

@media (max-width: 992px) {
    .header__inner {
        padding: 16px 0;
    }

    .header--scrolled .header__inner {
        padding: 12px 0;
    }

    .logo__img {
        height: 40px;
    }

    .header--scrolled .logo__img {
        height: 36px;
    }
}

/* Мобильные устройства */
@media (max-width: 768px) {
    .header__contacts {
        display: none;
    }

    .header__inner {
        gap: var(--spacing-sm);
    }

    .navigation {
        width: 100%;
        max-width: 320px;
        padding: 80px 24px 32px;
    }
}

@media (max-width: 576px) {
    .logo__img {
        height: 36px;
        width: auto;
        object-fit: contain;
    }

    .header--scrolled .logo__img {
        height: 32px;
    }

    .logo__tagline {
        font-size: 10px;
    }

    .burger-menu {
        width: 28px;
        height: 20px;
    }

    .burger-menu span {
        height: 3px;
    }

    .burger-menu.active span:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }

    .burger-menu.active span:nth-child(3) {
        transform: translateY(-8.75px) rotate(-45deg);
    }
}

/* ===================================
   9. ДОПОЛНИТЕЛЬНЫЕ ЭЛЕМЕНТЫ
   =================================== */

/* Индикатор прогресса скролла */
.header__progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--gradient-primary);
    width: 0;
    transition: width 0.1s linear;
    z-index: 2;
}

/* Топ-бар (опционально) */
.header__topbar {
    background: var(--color-bg-dark-secondary);
    border-bottom: 1px solid var(--color-border);
    padding: 8px 0;
    font-size: 13px;
}

.header__topbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header__topbar-info {
    display: flex;
    gap: 24px;
    color: var(--color-text-tertiary);
}

.header__topbar-info a {
    color: var(--color-text-secondary);
    transition: var(--transition-base);
}

.header__topbar-info a:hover {
    color: var(--color-primary);
}

.header__topbar-socials {
    display: flex;
    gap: 12px;
}

.header__social {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: var(--color-text-secondary);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    transition: var(--transition-base);
}

.header__social:hover {
    color: white;
    background: var(--color-primary);
    transform: translateY(-2px);
}

/* ===================================
   10. АНИМАЦИИ
   =================================== */

/* Плавное появление шапки */
@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.header {
    animation: slideDown 0.6s ease-out;
}

/* Анимация пунктов меню */
@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.navigation.active .nav-list li {
    animation: fadeInRight 0.4s ease-out backwards;
}

.navigation.active .nav-list li:nth-child(1) { animation-delay: 0.1s; }
.navigation.active .nav-list li:nth-child(2) { animation-delay: 0.15s; }
.navigation.active .nav-list li:nth-child(3) { animation-delay: 0.2s; }
.navigation.active .nav-list li:nth-child(4) { animation-delay: 0.25s; }
.navigation.active .nav-list li:nth-child(5) { animation-delay: 0.3s; }

/* ===================================
   11. ACCESSIBILITY
   =================================== */

/* Улучшенная видимость фокуса */
.nav-list a:focus-visible,
.header__phone-block .phone:focus-visible,
.burger-menu:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 4px;
    border-radius: var(--radius-sm);
}

/* Высокая контрастность */
@media (prefers-contrast: more) {
    .header__main {
        background: rgba(15, 23, 42, 1);
        border-bottom-width: 2px;
    }

    .nav-list a {
        border: 1px solid transparent;
    }

    .nav-list a:hover,
    .nav-list a.active {
        border-color: var(--color-primary);
    }
}

/* Уменьшение движения */
@media (prefers-reduced-motion: reduce) {
    .header,
    .navigation,
    .burger-menu span,
    .nav-list a,
    .logo {
        animation: none !important;
        transition: none !important;
    }
}

/* ===================================
   12. ПЕЧАТЬ
   =================================== */
@media print {
    .header {
        position: static;
        box-shadow: none;
    }

    .burger-menu,
    .header__contacts .btn {
        display: none;
    }

    .navigation {
        display: block;
        position: static;
        width: auto;
        height: auto;
        padding: 0;
    }

    .nav-list {
        flex-direction: row;
        gap: 16px;
    }
}

/* ===================================
   13. СОСТОЯНИЯ ЗАГРУЗКИ
   =================================== */

/* Skeleton для шапки при загрузке */
.header--loading .logo__img,
.header--loading .nav-list a,
.header--loading .phone {
    background: linear-gradient(
            90deg,
            var(--color-surface) 0%,
            var(--color-surface-elevated) 50%,
            var(--color-surface) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    color: transparent;
}

/* ===================================
   14. STICKY HEADER ВАРИАНТЫ
   =================================== */

/* Автоскрытие при скролле вниз */
.header--autohide {
    transform: translateY(-100%);
}

.header--show {
    transform: translateY(0);
}

/* Прозрачная шапка для Hero */
.header--transparent .header__main {
    background: transparent;
    border-bottom-color: transparent;
}

.header--transparent.header--scrolled .header__main {
    background: rgba(15, 23, 42, 0.98);
    border-bottom-color: rgba(0, 166, 232, 0.2);
}

/* ===================================
   15. DARK/LIGHT THEME
   =================================== */

[data-theme="light"] .header__main {
    background: rgba(255, 255, 255, 0.95);
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .nav-list a {
    color: rgba(15, 23, 42, 0.7);
}

[data-theme="light"] .nav-list a:hover,
[data-theme="light"] .nav-list a.active {
    color: var(--color-primary);
}

/* ===================================
   16. МИКРОВЗАИМОДЕЙСТВИЯ
   =================================== */

/* Ripple эффект при клике */
.nav-list a {
    position: relative;
    overflow: hidden;
}

.nav-list a::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(0, 166, 232, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.nav-list a:active::after {
    width: 300px;
    height: 300px;
}

/* ===================================
   17. ОПТИМИЗАЦИЯ ПРОИЗВОДИТЕЛЬНОСТИ
   =================================== */

/* GPU-ускорение */
.header,
.navigation,
.burger-menu span,
.nav-list a::before,
.nav-list a::after {
    will-change: transform;
}

/* Отключение will-change после анимации */
.header--loaded {
    will-change: auto;
}

/* ===================================
   КОНЕЦ HEADER.CSS
   =================================== */
