/* ==========================================================================
   assets/css/header.css
   ФИНАЛЬНАЯ ВЕРСИЯ СТИЛЕЙ ШАПКИ И НАВИГАЦИИ (UTF-8, БЕЗ КОНФЛИКТОВ)
   ========================================================================== */

/* --- 1. Базовые стили шапки для компьютеров (Экран > 1150px) --- */
.site-header {
    background-color: #ffffff;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 90px;
    position: relative;
    gap: 20px;
}

/* Логотип */
.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    z-index: 1001;
    flex-shrink: 0;
}

.logo-img {
    width: 45px;
    height: 45px;
    object-fit: contain;
}

.logo-text {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.logo-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #0055b3;
    line-height: 1.1;
}

.logo-desc {
    font-size: 10px;
    letter-spacing: 1px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 3px;
}

/* Навигация (Меню) */
.header-nav {
    transition: all 0.3s ease;
    flex-grow: 1;
    display: flex;
    justify-content: center;
}

.header-nav ul {
    display: flex;
    list-style: none;
    gap: 22px;
    margin: 0;
    padding: 0;
    align-items: center;
}

.header-nav a {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    color: var(--text-main);
    transition: color 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.header-nav a:hover {
    color: var(--blue-primary);
}

/* Блок контактов/действий справа */
.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 1001;
    flex-shrink: 0;
}

.branch-select {
    background-color: var(--bg-dark);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    font-size: 12px;
    border-radius: 6px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.3s;
    width: 100%;
    max-width: 190px;
}

.branch-select:focus {
    border-color: var(--blue-primary);
}

.header-phone {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s;
}

.header-phone:hover {
    color: var(--blue-primary);
}

/* СКРЫВАЕМ ВСЕ МОБИЛЬНЫЕ ЭЛЕМЕНТЫ НА ДЕСКТОПЕ */
.mobile-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-controls,
.menu-toggle,
.mobile-only-user-badge,
.mobile-only-user-action {
    display: none !important; /* На ПК строго скрываем кнопки меню и трубки */
}

/* ==========================================================================
   2. АДАПТИВНОСТЬ ДЛЯ МОБИЛЬНЫХ И ПЛАНШЕТОВ (Экран менее 1150px)
   ========================================================================== */
@media (max-width: 1150px) {
    .header-container {
        height: 70px;
        flex-direction: row;
        justify-content: space-between;
        padding: 0 15px;
    }

    .logo-title { font-size: 18px; }
    .logo-desc { font-size: 8px; }

    /* Скрываем десктопный блок контактов и меню */
    .header-actions {
        display: none !important;
    }

    /* Скрываем меню по умолчанию на мобильных (БЕЗ флага !important!) */
    .header-nav {
        display: none;
    }

    /* Показываем мобильные кнопки (трубка + гамбургер) */
    .mobile-controls {
        display: flex !important;
        align-items: center;
        gap: 20px;
        z-index: 1002;
    }

    .mobile-phone-btn {
        color: var(--blue-primary);
        display: flex;
        align-items: center;
        justify-content: center;
        text-decoration: none;
    }

    /* Показываем сам Гамбургер */
    .menu-toggle {
        display: flex !important;
        flex-direction: column;
        justify-content: space-between;
        width: 26px;
        height: 18px;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0;
    }

    .menu-toggle span {
        width: 100%;
        height: 2px;
        background-color: var(--blue-primary);
        transition: all 0.3s ease;
    }

    /* Анимация складывания */
    .menu-toggle.open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
    .menu-toggle.open span:nth-child(2) { opacity: 0; }
    .menu-toggle.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

    /* Мобильное выпадающее меню */
    .header-nav {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: #ffffff;
        border-bottom: 1px solid var(--border-color);
        padding: 30px 20px;
        display: none !important;
        box-shadow: 0 15px 30px rgba(0,0,0,0.05);
        justify-content: flex-start;
    }

    .header-nav.open {
        display: flex !important; /* Показываем при клике */
    }

    .header-nav ul {
        flex-direction: column;
        align-items: center;
        gap: 22px;
        width: 100%;
    }

    .header-nav a {
        font-size: 16px;
        display: block;
        padding: 5px 0;
    }

    /* ПОКАЗЫВАЕМ МОБИЛЬНЫЕ БЛОКИ ПОЛЬЗОВАТЕЛЯ НА ТЕЛЕФОНАХ */
    .mobile-only-user-badge {
        display: block !important;
        text-align: center;
        padding-bottom: 20px;
        margin-bottom: 10px;
        border-bottom: 1px dashed var(--border-color);
        width: 100%;
    }

    .mobile-only-user-action {
        display: block !important;
        width: 100%;
        margin-top: 20px;
        border-top: 1px dashed var(--border-color);
        padding-top: 20px;
        text-align: center;
    }
}