/* public/css/header.css */
html {
    scrollbar-gutter: stable;
}
/* --- БАЗА (без изменений) --- */
:root {
    --header-bg: #f5f5f5;
    --text-main: #111111;
    /* Чуть темнее, как у найк */
    --accent-color: #e74c3c;
    --hover-color: #757575;
    --border-color: #e5e7eb;
}

.site-header {
    background-color: var(--header-bg);
    border-bottom: 1px solid #d1d5db;
    padding: 0;
    /* Убираем паддинг у хедера, чтобы меню прилипало */
    position: relative;
    /* Важно для позиционирования мега-меню */
    z-index: 50;
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    /* Контроль отступов от краев экрана (слева от лого, справа от иконок) */
    padding: 0 1.5rem;

    display: flex;
    align-items: center;
    /* ВАЖНО: меняем на flex-start, чтобы элементы не разлетались сами по себе,
       а слушались наших margin-auto */
    justify-content: flex-start;

    height: 60px;
    position: static;
    z-index: 101;
}

/* --- ЛОГОТИП и ИКОНКИ (без изменений) --- */
.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-main);
    z-index: 52;
    flex-shrink: 0; /* Не сжимать логотип */
    margin-right: 0; /* Убираем лишние отступы если были */
}

.logo-icon {
    width: 40px;
    height: 40px;
    border: 2px solid #111;
    border-radius: 50%;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-name {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.actions-area { 
    display: flex; 
    gap: 20px; 
    align-items: center;
    flex-shrink: 0; /* Не сжимать иконки */
}

.icon-btn {
    position: relative;
    color: var(--text-main);
}

.badge {
    position: absolute;
    top: -5px;
    right: -8px;
    background-color: var(--accent-color);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- ПОИСК --- */
.search-area {
    position: relative;
    width: 300px;

    /* Убираем старые отступы и ставим маленький отступ справа до иконок */
    margin: 0 20px 0 0;

    z-index: 102;
}

/* Кнопка с лупой */
.search-submit {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);

    /* Размеры круга */
    width: 43px;
    height: 43px;
    border-radius: 50%;
    /* Делаем круг */

    /* Стили по умолчанию (прозрачный фон) */
    background-color: transparent;
    border: none;
    cursor: pointer;

    /* Центрирование иконки внутри круга */
    display: flex;
    align-items: center;
    justify-content: center;

    /* Цвет иконки */
    color: #6b7280;
    transition: all 0.2s ease;
}

/* Эффект при наведении (тот самый серый круг) */
.search-submit:hover {
    background-color: #e5e5e5;
    /* Цвет круга как на скрине */
    color: #111;
    /* Иконка становится чуть темнее */
}

/* Само поле ввода */
.search-input {
    width: 100%;
    /* Увеличиваем отступ слева (padding-left), чтобы текст не наезжал на кнопку */
    padding: 10px 16px 10px 46px;
    border-radius: 99px;
    border: 1px solid transparent;
    /* Прозрачная рамка */
    background-color: #f5f5f5;
    /* Светло-серый фон инпута */
    font-size: 0.95rem;
    outline: none;
    transition: background 0.2s;
}

/* При фокусе на поле можно сделать его белым */
.search-input:focus {
    background-color: white;
    border-color: #e5e5e5;
}

/* =========================================
   FULLSCREEN SEARCH OVERLAY
   ========================================= */

/* Затемнение на весь экран */
.search-overlay {
    background-color: #000000e6;
    /* Твой цвет: черный с прозрачностью */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 9999;
    /* ВАЖНО: Выше чем хедер (у хедера было 100) */

    display: flex;
    flex-direction: column;
    align-items: center;
    /* Центрируем всё по горизонтали */
    padding-top: 100px;
    /* Отступ сверху, чтобы поиск был не прилипшим */

    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(5px);
    /* Размытие фона заднего плана */
}

.search-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Контейнер внутри оверлея */
.search-back {
    width: 100%;
    max-width: 600px;
    /* Ширина контента поиска */
    position: relative;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    margin-bottom: 50px;
}

/* Кнопка закрытия (крестик) */
.close-button {
    position: fixed;
    top: 0px;
    /* Чуть выше поля поиска */
    right: 0;
    /* Справа от контента или экрана */
    background: none;
    border: none;
    color: white;
    font-size: 30px;
    cursor: pointer;
    line-height: 1;
    padding: 10px;
    transition: transform 0.2s;
}

.close-button:hover {
    transform: scale(1.1);
    color: #e74c3c;
}

/* Поле поиска (Белая полоса) */
.fullscreen-search-bar {
    position: relative;
    width: 100%;
}

.fullscreen-search-bar input {
    width: 100%;
    border-radius: 30px;
    /* Овальный */
    border: none;
    padding: 7px 60px 7px 30px;
    /* Отступы для текста и иконки */
    font-size: 1rem;
    outline: none;
    background: white;
    color: #111;
    font-weight: 500;
}

/* Кнопка поиска внутри инпута */
.fullscreen-search-bar button {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #111;
    padding: 5px;
}


/* ТЕКСТЫ И СПИСКИ */

/* Заголовки (История, Популярное) */
.search-history,
.popular-searches {
    color: #9ca3af;
    /* Серый цвет */
    font-size: 0.9rem;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 5px;
    margin-top: 25px;
}

/* Кнопка "Очистить историю" */
.search-history-clear {
    color: #6b7280;
    font-size: 0.8rem;
    cursor: pointer;
    align-self: flex-end;
    /* Прижать вправо */
    margin: 10px 0px 20px 0px;
}

.search-history-clear:hover {
    color: white;
}

/* Сами списки */
.search-history-list,
.popular-searches-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Элемент списка (результат) */
.search-result {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s;
    text-decoration: none;
}

.search-result:hover {
    color: #e74c3c;
    /* Красный при наведении */
}

/* ХЕДЕР (Оставляем как есть, только убираем z-index конфликт если был) */
.site-header {
    background-color: white;
    position: relative;
    z-index: 50;
    /* Хедер ниже оверлея (9999) */
}

/* Триггер поиска в хедере (маленький инпут) */
.search-input-trigger {
    cursor: text;
    /* Курсор текста, но клик откроет модалку */
}


/* =========================================
   MEGA MENU (СТИЛЬ КАК У NIKE)
   ========================================= */

/* Кнопка "Каталог" */
.catalog-trigger {
    height: 60px;
    /* На всю высоту хедера */
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0 15px;
    font-weight: 600;
    text-transform: uppercase;
    border-bottom: 2px solid transparent;
    transition: border-color 0.2s;
}

.catalog-trigger:hover {
    border-bottom-color: #111;
    /* Подчеркивание при наведении как у найк */
}

/* Сама панель меню */
/* --- 3. МЕГА МЕНЮ (ИСПРАВЛЕННОЕ) --- */
.mega-menu {
    position: absolute;
    
    /* Приклеиваем к низу хедера */
    top: 100%; 
    
    /* Растягиваем на всю ширину экрана (от левого края хедера) */
    left: 0;
    width: 100%; 
    display: flex;
    background-color: white;
    padding: 30px 0 50px 0;
    border-top: 1px solid #e5e5e5;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    
    /* Анимация */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease-in-out;
    pointer-events: none;
    z-index: 90;
}

/* Показываем меню при наведении на ТРИГГЕР или на САМО МЕНЮ */
/* Показываем меню при наведении на кнопку .catalog-wrapper */
.catalog-wrapper:hover .mega-menu,
.mega-menu:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Кнопка "Каталог" (обертка) */
/* --- 2. КНОПКА КАТАЛОГА (ОБЕРТКА) --- */
.catalog-wrapper {
    /* Центрируем кнопку */
    margin-left: auto;
    margin-right: auto;
    
    /* ВАЖНО: Ставим static, чтобы выпадающее меню НЕ зависело от ширины этой кнопки */
    position: static; 
    
    height: 100%; /* Чтобы hover работал на всю высоту */
    display: flex;
    align-items: center;
}

/* Контент внутри меню (ограничиваем ширину, чтобы текст не улетал к краям монитора) */
.mega-content {
    max-width: 1400px; /* Та же ширина, что и у контента сайта */
    margin: 0 auto;
    padding: 0 1.5rem;
    justify-content: center;
    display: grid;
    grid-template-columns: repeat(6, 100px); /* 5 колонок */
    gap: 40px;
}

/* Заголовок колонки (Родительская категория: Обувь, Одежда...) */
.mega-category-title {
    font-size: 1rem;
    font-weight: 700;
    color: #111;
    margin-bottom: 16px;
    display: block;
    text-decoration: none;
}

.mega-category-title:hover {
    color: #757575;
}

/* Список подкатегорий */
.mega-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mega-links li {
    margin-bottom: 8px;
}

.mega-links a {
    text-decoration: none;
    color: #757575;
    /* Серый цвет текста */
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s;
}

.mega-links a:hover {
    color: #111;
    /* Черный при наведении */
}