/* =========================================================
   HEADER STYLES
   Структура: top-bar → site-header (лого/поиск/иконки) → nav (мегаменю) → mobile header
   ========================================================= */

:root {
    --header-height: 96px;
    --topbar-height: 36px;
    --color-primary: #f5a623;      /* акцентный цвет — замените под бренд */
    --color-brown: #36362a;
    --color-dark: #1a1a1a;
    --color-text: #333333;
    --color-muted: #777777;
    --color-border: #e5e5e5;
    --color-bg-light: #f7f7f7;
    --container-width: 1240px;
    --transition-fast: 0.2s ease;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* ===================== TOP BAR ===================== */

.top-bar {
    background: var(--color-brown);
    color: #fff;
    font-size: 13px;
    height: var(--topbar-height);
}

.top-bar__inner {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.top-bar__left a,
.top-bar__right a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.top-bar__left a:hover,
.top-bar__right a:hover {
    color: var(--color-primary);
}

.top-bar__right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.top-bar__city {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.top-bar__city::after {
    content: "";
    width: 6px;
    height: 6px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    margin-top: -3px;
}

.top-bar__phone {
    font-weight: 600;
    white-space: nowrap;
}

.top-bar__login {
    padding-left: 20px;
    border-left: 1px solid rgba(255, 255, 255, 0.25);
}

/* ===================== MAIN HEADER ===================== */

.site-header {
    border-bottom: 1px solid var(--color-border);
    background: #fff;
}

.site-header__row {
    display: flex;
    align-items: center;
    gap: 32px;
    height: var(--header-height);
}

.site-header__logo {
    flex-shrink: 0;
}

.site-header__logo img {
    display: block;
    height: 48px;
    width: auto;
}

/* ---- Search ---- */

.site-header__search {
    flex: 1 1 auto;
    max-width: 520px;
}

.site-header__search form {
    display: flex;
    position: relative;
}

.site-header__search input[type="text"],
.site-header__search input[type="search"] {
    width: 100%;
    height: 44px;
    border: 1px solid var(--color-border);
    border-radius: 22px;
    padding: 0 52px 0 20px;
    font-size: 14px;
    outline: none;
    transition: border-color var(--transition-fast);
}

.site-header__search input:focus {
    border-color: var(--color-primary);
}

.site-header__search button {
    position: absolute;
    right: 4px;
    top: 4px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
}

.site-header__search button:hover {
    background: #dd8f10;
}

.site-header__search button svg,
.site-header__search button i {
    width: 16px;
    height: 16px;
}

/* ---- Icons (favorites / user / cart) ---- */

.site-header__icons {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}

.header-icon {
    position: relative;
}

.header-icon__ico {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: var(--color-text);
    transition: background var(--transition-fast), color var(--transition-fast);
    cursor: pointer;
    text-decoration: none;
}

.header-icon__ico:hover {
    background: var(--color-bg-light);
    color: var(--color-primary);
}

/* Простейшие иконки на псевдоэлементах — замените на свои SVG/иконочный шрифт */
.header-icon--favorites .header-icon__ico::before {
    content: "♡";
    font-size: 20px;
}

.header-icon--user .header-icon__ico::before {
    content: "person";
    font-size: 0;
    width: 20px;
    height: 20px;
    border: 1.5px solid currentColor;
    border-radius: 50%;
}

.header-icon--search .header-icon__ico::before {
    content: "";
    width: 18px;
    height: 18px;
    border: 1.5px solid currentColor;
    border-radius: 50%;
}

/* ---- User dropdown ---- */

.header-icon--user {
    position: relative;
}

.header-icon--user .dropdown__body {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 260px;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity var(--transition-fast), transform var(--transition-fast), visibility var(--transition-fast);
    z-index: 50;
}

.header-icon--user:hover .dropdown__body,
.header-icon--user:focus-within .dropdown__body {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown__signin,
.dropdown__register {
    text-align: center;
}

.dropdown__signin p,
.dropdown__register p {
    font-size: 13px;
    color: var(--color-muted);
    margin: 0 0 10px;
}

.dropdown__register {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

.btn {
    display: inline-block;
    padding: 10px 22px;
    border-radius: 22px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.btn-outline {
    border-color: var(--color-dark);
    color: var(--color-dark);
    background: transparent;
}

.btn-outline:hover {
    background: var(--color-dark);
    color: #fff;
}

/* ===================== NAV / MEGA MENU ===================== */

.site-header__nav {
    background: var(--color-primary);
}

.site-header__nav .container {
    display: flex;
}

/* Стандартный вывод bitrix:menu (.default шаблон = <ul><li>) —
   приводим к горизонтальному виду под нашу структуру */
.site-header__nav ul {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
}

.site-header__nav > .container > ul > li {
    position: relative;
}

.site-header__nav > .container > ul > li > a {
    display: block;
    padding: 14px 18px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--transition-fast);
}

.site-header__nav > .container > ul > li:hover > a {
    background: rgba(0, 0, 0, 0.12);
}

/* Выпадающий подсписок (2-й уровень меню) */
.site-header__nav li ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    flex-direction: column;
    min-width: 240px;
    background: #fff;
    border: 1px solid var(--color-border);
    border-top: 2px solid var(--color-primary);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.12);
    padding: 8px 0;
    z-index: 40;
}

.site-header__nav li:hover > ul {
    display: flex;
}

.site-header__nav li ul li a {
    padding: 10px 20px;
    color: var(--color-text);
    font-size: 14px;
    font-weight: 400;
    text-transform: none;
}

.site-header__nav li ul li a:hover {
    background: var(--color-bg-light);
    color: var(--color-primary);
}

/* ===================== MOBILE HEADER ===================== */

.site-header-mobile {
    background: #fff;
    border-bottom: 1px solid var(--color-border);
}

.site-header-mobile__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.site-header-mobile__burger {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    padding: 0;
}

.site-header-mobile__burger span {
    display: block;
    height: 2px;
    background: var(--color-dark);
    border-radius: 2px;
}

.site-header-mobile__logo img {
    height: 32px;
    width: auto;
}

.site-header-mobile__icons {
    display: flex;
    align-items: center;
    gap: 12px;
}

.site-header-mobile__icons .header-icon__ico {
    width: 36px;
    height: 36px;
}

/* ===================== RESPONSIVE HELPERS ===================== */

.d-none {
    display: none;
}

@media (min-width: 1200px) {
    .d-xl-block {
        display: block;
    }
    .d-xl-none {
        display: none;
    }
}

@media (max-width: 1199.98px) {
    .d-xl-block {
        display: none;
    }
    .d-xl-none {
        display: block;
    }
}