/* header.css */
/* Header Base Container */
.header {
    position: fixed;
    z-index: 10;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #333;
    display: flex;
    align-items: center;
    padding: 0 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ДЕСКТОПНАЯ СЕТКА: 1fr (Лево) - auto (Центр) - 1fr (Право)
   Это гарантирует, что левая и правая зоны имеют РАВНУЮ ширину, 
   а инпут встаёт ИДЕАЛЬНО ПО ЦЕНТРУ МОНИТОРА */
.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    /* Жёсткая симметрия центрирования */
    align-items: center;
    gap: 20px;
}

/* 1. Логотип слева */
.logo {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    /* Прижат к левому краю своей зоны */
    text-decoration: none;
}

.logo-rhombus {
    height: 30px;
}

.logo-text {
    margin-left: 8px;
    width: 80px;
}

/* 2. Поисковый контейнер (по центру) */
.search-bar {
    position: relative;
    display: flex;
    align-items: center;
    width: 880px;
    /* Фиксированная ширина на десктопе для совпадения с сеткой */
    max-width: 100%;
}

.search-bar input {
    width: 100%;
    height: 44px;
    padding: 0 40px 0 40px;
    /* Слева отступ под лупу, справа — под крестик */
    border-radius: 20px;
    border: 1px solid #444;
    background-color: #2a2a2a;
    color: #fff;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.search-bar input:focus {
    border-color: #666;
    background-color: #333;
}

/* Иконка лупы */
.search-icon {
    position: absolute;
    left: 16px;
    width: 16px;
    pointer-events: none;
    display: flex;
    align-items: center;
}

/* Крестик очистки */
.clear-btn {
    display: none;
    position: absolute;
    right: 16px;
    background: none;
    border: none;
    color: #888;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    z-index: 2;
}

.clear-btn:hover {
    color: #fff;
}

.search-bar.has-text .clear-btn {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Аватарка внутри инпута на десктопе скрыта */
.login-mobile-btn {
    display: none;
}

/* 3. Десктопная кнопка входа справа */
.login-desktop {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    /* Прижата к правому краю своей зоны */
    cursor: pointer;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
}

.login-desktop .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-left: 10px;
    object-fit: cover;
}

/* === АДАПТИВНОСТЬ ДЛЯ МЕНЬШИХ ЭКРАНОВ И МОБИЛОК === */

/* Если экран меньше 1200px, но больше 767px (планшеты) */
@media (max-width: 1199px) and (min-width: 768px) {
    .search-bar {
        width: 100%;
        max-width: 600px;
    }
}

/* Мобильная версия (до 767px) */
@media (max-width: 767px) {
    .header {
        padding: 0 10px;
    }

    .search-icon {
        left: 12px;
    }

    /* На мобилке меняем сетку: инпут растягивается во всю доступную ширину */
    .header-inner {
        display: block;
    }

    .logo,
    .login-desktop {
        display: none;
    }

    .search-bar {
        width: 100%;
        max-width: 100%;
    }

    .search-bar input {
        padding: 0 65px 0 35px;
        /* Выделяем место под крестик и встроенную аватарку */
    }

    .clear-btn {
        right: 40px;
    }

    /* Включаем встроенную аватарку справа */
    .login-mobile-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        right: 6px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 0;
        z-index: 2;
    }

    .login-mobile-btn img {
        width: 28px;
        height: 28px;
        border-radius: 50%;
        object-fit: cover;
    }
}



/* Выпадающий список городов */
/* --------------------------------------------------------------------------------------------------------------- */
.city-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 12px;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    /* Скрыт по умолчанию */
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.city-dropdown.active {
    display: block;
    /* Показываем, когда есть результаты */
}

.city-item {
    padding: 10px 15px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    border-bottom: 1px solid #333;
    transition: background 0.2s;
}

.city-item:last-child {
    border-bottom: none;
}

.city-item:hover {
    background: #3a3a3a;
}