/* HEADER MODULE - Фиксированная шапка сайта (ИСПРАВЛЕННАЯ ВЕРСИЯ) */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: var(--bg-white);
    box-shadow: var(--shadow-sm);
    z-index: 1000;
}

/* ОДНА строка: Лого + Название + Корзина + Меню */
.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
}

/* Левый блок: логотип и название */
.header-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
    flex-shrink: 0;
}

.header-logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.header-title-main {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.header-title-sub {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

.header-logo {
    height: 40px;
    width: 40px;
    object-fit: contain;
}

/* Правый блок: корзина и меню */
.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Корзина - только иконка */
.header-cart {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background-color: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s;
}

.header-cart:hover {
    transform: scale(1.1);
}

.cart-icon {
    font-size: 1.75rem;
    color: var(--text-primary);
}

.cart-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background-color: var(--danger-color);
    color: white;
    font-size: var(--font-size-xs);
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid white;
}

/* Меню навигации - всегда видно на ПК */
.nav-menu {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
}

.nav-item {
    position: relative;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 0;
    transition: color 0.2s;
    font-size: var(--font-size-base);
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--primary-color);
}

.nav-link.active {
    color: var(--primary-color);
    font-weight: 600;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--primary-color);
}

/* Кнопка меню для мобильных - СКРЫТА НА ПК */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
    transition: background-color 0.2s;
}

.menu-toggle:hover {
    background-color: var(--bg-gray);
}

/* Кнопка "Вызвать замерщика" - ОСНОВНЫЕ СТИЛИ */
.header-measurer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    font-size: var(--font-size-sm);
    white-space: nowrap;
}

.header-measurer:hover {
    background-color: #0da271;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* Убираем CSS-иконку, оставляем только ту, что в HTML */
.header-measurer .measurer-icon::before {
    display: none;
}

/* Иконка из HTML */
.header-measurer .measurer-icon {
    font-size: 1.2rem;
    display: inline-block;
}

.header-measurer .measurer-text {
    display: inline;
}

/* Responsive */
@media (max-width: 992px) {
    .nav-menu {
        gap: 1rem;
    }
    
    .header-title-main {
        font-size: var(--font-size-base);
    }
    
    .header-title-sub {
        font-size: var(--font-size-xs);
    }
    
    /* На планшетах прячем текст кнопки */
    .header-measurer .measurer-text {
        display: none;
    }
    
    .header-measurer {
        padding: 0.5rem;
    }
    
    .header-measurer .measurer-icon {
        font-size: 1.4rem;
    }
}

@media (max-width: 768px) {
    /* Показываем кнопку меню на мобильных */
    .menu-toggle {
        display: flex;
        order: 3;
    }
    
    /* Скрываем обычное меню на мобильных */
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--bg-white);
        box-shadow: var(--shadow-md);
        padding: 1rem;
        gap: 0.75rem;
        z-index: 1000;
        flex-direction: column;
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .nav-item {
        width: 100%;
    }
    
    .nav-link {
        display: block;
        padding: 0.75rem;
        border-radius: var(--border-radius);
        transition: background-color 0.2s;
    }
    
    .nav-link:hover {
        background-color: var(--bg-light);
    }
    
    .nav-link.active::after {
        display: none;
    }
    
    .nav-link.active {
        background-color: rgba(26, 86, 219, 0.1);
    }
    
    /* На мобильных скрываем подзаголовок */
    .header-title-sub {
        display: none;
    }
    
    /* Корректируем отступы */
    .header-container {
        padding: 0.5rem 0;
    }
    
    .header-right {
        gap: 0.75rem;
    }
    
    /* Мобильная версия кнопки замерщика - с лёгким фоном */
    .header-measurer {
        order: 2;
        background-color: rgba(16, 185, 129, 0.1);  /* Полупрозрачный зелёный */
        color: var(--accent-color);                  /* Зелёный текст/иконка */
        padding: 0.5rem;
        border-radius: 50%;
        width: 44px;
        height: 44px;
        justify-content: center;
        border: 1px solid rgba(16, 185, 129, 0.3);   /* Лёгкая обводка */
    }
    
    .header-measurer:hover {
        background-color: rgba(16, 185, 129, 0.2);  /* Чуть темнее при наведении */
        transform: none;
        box-shadow: none;
    }
    
    .header-measurer .measurer-icon {
        font-size: 1.5rem;
    }
    
    /* Иконка в HTML уже правильная, ничего не меняем */
    
    .header-cart {
        order: 1;
    }
}

@media (max-width: 480px) {
    .header-logo {
        height: 32px;
        width: 32px;
    }
    
    .header-title-main {
        font-size: 0.9rem;
    }
    
    .cart-icon {
        font-size: 1.5rem;
    }
    
    .header-cart {
        width: 40px;
        height: 40px;
    }
    
    .menu-toggle {
        width: 40px;
        height: 40px;
    }
    
    /* Кнопка замерщика на очень маленьких экранах */
    .header-measurer {
        width: 40px;
        height: 40px;
    }
    
    .header-measurer .measurer-icon {
        font-size: 1.3rem;
    }
}

@media (max-width: 768px) {
    /* Показываем кнопку меню на мобильных */
    .menu-toggle {
        display: flex;
        order: 3; /* После корзины и замерщика */
    }
    
    /* Скрываем обычное меню на мобильных */
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--bg-white);
        box-shadow: var(--shadow-md);
        padding: 1rem;
        gap: 0.75rem;
        z-index: 1000;
        flex-direction: column;
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .nav-item {
        width: 100%;
    }
    
    .nav-link {
        display: block;
        padding: 0.75rem;
        border-radius: var(--border-radius);
        transition: background-color 0.2s;
    }
    
    .nav-link:hover {
        background-color: var(--bg-light);
    }
    
    .nav-link.active::after {
        display: none;
    }
    
    .nav-link.active {
        background-color: rgba(26, 86, 219, 0.1);
    }
    
    /* На мобильных скрываем подзаголовок */
    .header-title-sub {
        display: none;
    }
    
    /* Корректируем отступы */
    .header-container {
        padding: 0.5rem 0;
    }
    
    .header-right {
        gap: 0.75rem;
    }
    
    /* Мобильная версия кнопки замерщика */
    .header-measurer {
        order: 2;
        background-color: transparent;  /* Прозрачный фон */
        color: var(--text-primary);     /* Тёмный текст */
        padding: 0.5rem;
        border-radius: 50%;
        width: 44px;
        height: 44px;
        justify-content: center;
    }
    
    .header-measurer:hover {
        background-color: var(--bg-gray);  /* Серый фон при наведении */
        transform: none;
        box-shadow: none;
    }
    
    .header-measurer .measurer-icon {
        font-size: 1.5rem;
    }
    
    /* Меняем иконку на рулетку для мобильных */
    .header-measurer .measurer-icon::before {
        content: "📐";
    }
    
    .header-cart {
        order: 1;
    }
}

@media (max-width: 480px) {
    .header-logo {
        height: 32px;
        width: 32px;
    }
    
    .header-title-main {
        font-size: 0.9rem;
    }
    
    .cart-icon {
        font-size: 1.5rem;
    }
    
    .header-cart {
        width: 40px;
        height: 40px;
    }
    
    .menu-toggle {
        width: 40px;
        height: 40px;
    }
    
    /* Кнопка замерщика на очень маленьких экранах */
    .header-measurer {
        width: 40px;
        height: 40px;
    }
    
    .header-measurer .measurer-icon {
        font-size: 1.3rem;
    }
}

/* Блок с городом */
.header-city {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 1.5rem;
    white-space: nowrap;
}

.city-icon {
    width: 22px;
    height: 22px;
    opacity: 0.85;
}

.city-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: var(--font-size-sm);
}

/* Сдвигаем логотип левее */
.header-brand {
    margin-left: 0;
    margin-right: 1.5rem;
}

/* На мобильных скрываем город */
@media (max-width: 768px) {
    .header-city {
        display: none;
    }
}

/* Кнопка переключения темы */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background-color: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    transition: background-color 0.2s;
    margin-right: 0.5rem;
    color: var(--text-primary);
}

.theme-toggle:hover {
    background-color: var(--bg-gray);
}

@media (max-width: 768px) {
    .theme-toggle {
        order: 2;
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
        margin-right: 0.25rem;
    }
}