/* =========================================
   3. ШАПКА САЙТА
   ========================================= */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header__top {
    background: var(--text-main);
    color: #d1d5db;
    font-size: 16px;
    padding: 14px 0;
}

.header__top-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
}

.header__contacts {
    display: flex;
    gap: 28px;
    align-items: center;
    flex-wrap: wrap;
}

.header__contact-link {
    color: #e5e7eb;
    text-decoration: none;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 17px;
    letter-spacing: 0.2px;
}

.header__contact-link:hover {
    color: #fff;
    transform: translateY(-1px);
}

.header__contact-link--phone {
    color: #fff;
    font-size: 18px;
    font-weight: 700;
}

.header__contact-link--phone:hover {
    color: #ff8a9c;
}

/* WhatsApp */
.header__whatsapp {
    color: #25D366 !important;
    font-weight: 700;
}

.header__whatsapp:hover {
    color: #4ade80 !important;
    opacity: 1 !important;
}

.header__top-note {
    font-weight: 800;
    color: #fff;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 2px;
    padding: 6px 14px;
    background: var(--brand-red);
    border-radius: 4px;
    white-space: nowrap;
}

.header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 110px;
    gap: 24px;
    flex-wrap: nowrap;
}

.logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}

.logo__img {
    display: block;
    height: 85px;
    width: auto;
    max-width: 280px;
    object-fit: contain;
}

.nav {
    display: flex;
    gap: 24px;
    align-items: center;
    flex-shrink: 0;
}

.nav__link {
    color: var(--text-main);
    font-size: 16px;
    font-weight: 500;
    transition: 0.2s;
    text-decoration: none;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    padding: 10px 0;
}

.nav__link:hover {
    color: var(--brand-red);
}

.nav__link.active {
    color: var(--brand-red);
    font-weight: 700;
}

.header__actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.header__user {
    font-size: 15px;
    color: var(--text-muted);
    margin-right: 8px;
}

.header__actions .btn--sm {
    padding: 12px 24px;
    font-size: 15px;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* === КОРЗИНА === */
.header__cart-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    width: 52px;
    height: 52px;
    border-radius: 8px;
    background: #f3f4f6;
    transition: 0.2s;
    flex-shrink: 0;
}

.header__cart-btn:hover {
    background: #e5e7eb;
}

.header__cart-icon {
    font-size: 28px;
    line-height: 1;
}

.header__cart-btn .cart-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--brand-red);
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    display: none;
}

/* Поиск */
.header__search {
    display: flex;
    align-items: center;
    background: #f3f4f6;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    transition: 0.2s;
    height: 46px;
    width: 280px;
}

.header__search:focus-within {
    border-color: var(--text-main);
    background: #fff;
}

.header__search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0 14px;
    font-size: 15px;
    font-family: inherit;
    color: var(--text-main);
    outline: none;
    height: 100%;
    min-width: 0;
}

.header__search-input::placeholder {
    color: #9ca3af;
}

.header__search-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 0 14px;
    height: 100%;
    color: var(--text-muted);
    transition: 0.15s;
}

.header__search-btn:hover {
    color: var(--brand-red);
}

.header__search-toggle {
    display: none;
}

/* Мега-меню */
.nav-catalog {
    position: relative;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.nav-catalog__btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--text-main);
    color: #fff !important;
    padding: 12px 24px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 16px;
    transition: 0.2s;
    text-decoration: none;
    box-sizing: border-box;
    line-height: 1.2;
    white-space: nowrap;
}

.nav-catalog__btn:hover {
    background: var(--brand-red);
}

.nav-catalog__btn svg {
    transition: transform 0.2s;
}

.nav-catalog:hover .nav-catalog__btn svg {
    transform: rotate(180deg);
}

.mega-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
}

.nav-catalog:hover .mega-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mega-menu__inner {
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    min-width: 300px;
    padding: 14px;
    position: relative;
}

.mega-menu__list, .mega-menu__sub {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mega-menu__item {
    position: relative;
}

.mega-menu__link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    color: var(--text-main);
    font-size: 14px;
    border-radius: 4px;
    transition: 0.15s;
    text-decoration: none;
    white-space: nowrap;
}

.mega-menu__link:hover {
    background: #fef2f2;
    color: var(--brand-red);
}

.mega-menu__arrow {
    font-size: 12px;
    color: #9ca3af;
    margin-left: 12px;
}

.mega-menu__sub {
    position: absolute;
    top: -14px;
    left: 100%;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    min-width: 240px;
    padding: 14px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition: all 0.2s ease;
    margin-left: 4px;
}

.mega-menu__item.has-children:hover > .mega-menu__sub {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* Мобильная адаптация корзины в шапке (чтобы не ломала шапку) */
@media (max-width: 768px) {
    .header__cart-btn {
        width: 40px;
        height: 40px;
        border-radius: 4px;
        background: transparent;
    }
    .header__cart-icon {
        font-size: 24px;
    }
    .header__cart-btn .cart-badge {
        font-size: 10px;
        padding: 1px 4px;
        top: -2px;
        right: -2px;
    }
}