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

.header {
    position: sticky;
    top: 0;
    z-index: 200;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 13px 0;
}

.header::before {
    display: block;
    content: '';
    left: 0;
    position: absolute;
    top: 100%;
    height: 2px;
    width: 60%;
    background-color: var(--accent);
}

.header::after {
    display: block;
    content: '';
    left: 60%;
    bottom: -4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent);
    position: absolute;
}

.header__inner {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    grid-template-areas:
        "logo top"
        "logo bottom";
}

/* ---- Лого ---- */

.header__logo {
    grid-area: logo;
    display: flex;
    align-items: center;
    margin-right: 56px;
    align-self: stretch;
}

.header__logo-img { display: block; max-height: 80px; width: auto; }
.header__logo-img--light        { display: none; }
.header__logo-img--mobile-dark  { display: none; }
.header__logo-img--mobile-light { display: none; }

/* ---- Строка 1: телефоны + CTA ---- */

.header__top {
    grid-area: top;
    display: flex;
    align-items: center;
    gap: 24px;
    padding-bottom: 8px;
    border-bottom: 1px solid #D1D5DC;
}

.header__phones {
    display: flex;
    align-items: center;
    gap: 32px;
    flex: 1;
}

.header__phone {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-main);
    white-space: nowrap;
    transition: color 0.2s;
}

.header__phone:hover { color: var(--accent); }

.header__phone-icon { flex-shrink: 0; color: var(--accent); }

.header__cta { padding: 0 24px; white-space: nowrap; flex-shrink: 0; height: 34px; }

/* ---- Строка 2: навигация + корзина ---- */

.header__bottom {
    grid-area: bottom;
    display: flex;
    align-items: center;
    gap: 32px;
    padding: 8px 0 0;
}

.header__nav { flex: 1; }

.header__menu {
    display: flex;
    align-items: center;
    gap: 24px;
    justify-content: space-between;
    width: 100%;
}

.header__menu > li > a {
    font-size: 16px;
    font-weight: 400;
    color: var(--text-main);
    transition: color 0.2s;
}

.header__menu > li > a:hover { color: var(--accent); }

/* ---- Корзина ---- */

.header__cart {
    position: relative;
    display: flex;
    align-items: center;
    color: var(--text-main);
    flex-shrink: 0;
    transition: color 0.2s;
}

.header__cart:hover { color: var(--accent); }

.header__cart-count {
    position: absolute;
    top: -7px;
    right: -9px;
    background: var(--accent);
    color: var(--text-main);
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
}

/* ---- Мобильные контролы (скрыты на десктопе) ---- */

.header__mobile-controls { display: none; }

.header__icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    background: var(--accent);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
}

.header__icon-btn:hover { background: var(--accent-hover); }

.header__burger-icon { display: block; }
.header__close-icon  { display: none; }

/* ---- Мобильное меню (скрыто на десктопе) ---- */

.header__mobile-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    display: none;
    z-index: 190;
}

.header__mobile-nav-inner {
    display: flex;
    flex-direction: column;
    padding-top: 12px;
    padding-bottom: 12px;
    align-items: center;
}

.header__mobile-menu {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.header__mobile-menu > li > a {
    display: block;
    padding: 10px 0;
    text-align: center;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-main);
    transition: color 0.2s;
}

.header__mobile-menu > li:last-child > a { border-bottom: none; }

.header__mobile-menu > li > a:hover { color: var(--accent); }

/* ---- Мобильная панель телефонов ---- */

.header__mobile-phones {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    display: none;
    z-index: 190;
}

.header__mobile-phones .container {
    display: flex;
    flex-direction: column;
    padding-top: 12px;
    padding-bottom: 12px;
    align-items: center;
}

.header__mobile-phones .header__phone {
    padding: 10px 0;
    font-size: 16px;
}

.header__mobile-phones .header__phone:last-child { border-bottom: none; }

.header__mobile-phones-cta { margin: 12px auto 0; }

/* ============================================
   ПЛАНШЕТ / МОБАЙЛ  ≤ 1080px
   ============================================ */

@media (max-width: 1080px) {
    .header {
        padding: 0;
    }

    .header__inner {
        grid-template-columns: auto 1fr;
        grid-template-rows: var(--header-h);
        grid-template-areas: "logo controls";
        align-items: center;
    }

    .header__logo {
        border-right: none;
        margin-right: 0;
        padding-right: 0;
        align-self: center;
    }

    .header__logo-img { max-height: 44px; }

    .header__logo--has-mobile .header__logo-img--dark,
    .header__logo--has-mobile .header__logo-img--light { display: none; }

    .header__logo--has-mobile .header__logo-img--mobile-dark  { display: block; }
    .header__logo--has-mobile .header__logo-img--mobile-light { display: none; }

    .header__top    { display: none; }
    .header__bottom { display: none; }

    .header__mobile-controls {
        grid-area: controls;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 16px;
    }

    .header__mobile-controls .header__cart { display: flex; margin-right: 4px; }

    .header__mobile-nav.open    { display: block; }
    .header__mobile-phones.open { display: block; }

    .nav-open .header__burger-icon { display: none; }
    .nav-open .header__close-icon  { display: block; }
}
