/* ===== МОДУЛЬ: ШАПКА ===== */
.header {
    display: flex;
    flex-direction: column;
    background: #1e1e1e;
    border-radius: 12px;
    margin: 16px auto 24px auto;
    max-width: 1200px;
    color: #e0e0e0;
    /* НЕТ overflow: hidden, чтобы не обрезать выпадающий список */
    position: relative;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    width: 100%;
    box-sizing: border-box;
}

.logo {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
    cursor: pointer;
    color: #fff;
    text-decoration: none;
}

.logo span { color: #fc3f1d; }

.header-icons {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
}

.city-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #333;
    border: 1px solid #444;
    color: #e0e0e0;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
    margin-right: 0;
}

.city-btn:hover { background: #444; }

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #333;
    border: 1px solid #444;
    border-radius: 8px;
    color: #e0e0e0;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.icon-btn:hover { background: #444; color: #fc3f1d; }

/* Тултипы */
.has-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1a;
    color: #fff;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    z-index: 100;
}

.has-tooltip:hover::after {
    opacity: 1;
    visibility: visible;
    bottom: -35px;
}

/* ===== BADGE НА ИКОНКЕ КОРЗИНЫ ===== */
.cart-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #fc3f1d;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border: 2px solid #1e1e1e;
    box-sizing: content-box;
    z-index: 10;
}

.cart-badge.active {
    display: inline-flex;
}

/* ===== НИЖНЯЯ СТРОКА С ПОИСКОМ ===== */
.header-bottom-search {
    width: 100%;
    padding: 12px 24px;
    background: rgba(255,255,255,0.06);
    border-top: 1px solid rgba(255,255,255,0.1);
    box-sizing: border-box;
    position: relative; /* Для позиционирования выпадающего списка */
}

/* Сам список результатов */
#header-search-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    margin-top: 8px;
    z-index: 9999;
    max-height: 400px;
    overflow-y: auto;
    color: #333; /* ВАЖНО: чтобы текст в списке был темным */
}

/* Поле ввода */
#header-search-input {
    flex: 1;
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    background: #fff;
    color: #333;
    outline: none;
}

/* Кнопка "Найти" */
#header-search-btn {
    padding: 10px 24px;
    background: #fc3f1d;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

#header-search-btn:hover {
    background: #e63516;
}

/* Прижимаем выбор города к правому краю (рядом с иконками) */
.header-icons #city-select {
    margin-left: auto;
}

/* Чтобы длинные названия не обрезались */
.header-icons #city-select option {
    max-width: 200px;
}

/* Жёстко прижимаем всё к правому краю */
.header-icons {
    justify-content: flex-end !important;
}
.header-icons #city-select {
    margin-left: auto !important;
    margin-right: 0 !important;
    max-width: 200px !important;
    width: auto !important;
}

/* Убираем gap между select и иконками */
.header-icons {
    gap: 8px !important;
}

/* Прижимаем весь блок иконок к правому краю (без отступа) */
.header-top {
    justify-content: space-between !important;
}
.header-icons {
    justify-content: flex-end !important;
    gap: 6px !important;
    margin-left: auto !important;
}
.header-icons #city-select {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* ===== МОДАЛКА ВЫБОРА ГОРОДА ===== */
.city-modal-item {
    display: block;
    width: 100%;
    padding: 12px 16px;
    background: #f5f5f5;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    text-align: left;
    color: #1a1a1a;
    transition: all 0.2s;
}
.city-modal-item:hover {
    background: #fff0ed;
    border-color: #fc3f1d;
}
.city-modal-item.active {
    background: #fc3f1d;
    color: #fff;
    border-color: #fc3f1d;
    font-weight: 600;
}

/* ===== ЕСЛИ СТИЛИ ШАПКИ ОТКЛЮЧЕНЫ (header-styles-disabled) ===== */
.header-styles-disabled {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
}

.header-styles-disabled .header-bottom-search {
    background: transparent !important;
    border-top: 1px solid rgba(0,0,0,0.05) !important;
}

.header-styles-disabled .logo {
    color: #1a1a1a !important;
}
.header-styles-disabled .logo span {
    color: #fc3f1d !important;
}

.header-styles-disabled .icon-btn {
    background: #f5f5f5 !important;
    border: 1px solid #e5e5e5 !important;
    color: #333 !important;
}
.header-styles-disabled .icon-btn:hover {
    background: #fff0ed !important;
    color: #fc3f1d !important;
}

.header-styles-disabled .city-btn {
    background: #f5f5f5 !important;
    border: 1px solid #e5e5e5 !important;
    color: #333 !important;
}
.header-styles-disabled .city-btn:hover {
    background: #fff0ed !important;
}

.header-styles-disabled #header-search-input {
    border: 1px solid #e5e5e5 !important;
    background: #fff !important;
}
