/* ========================================
   ШАПКА САЙТА
   ======================================== */

.header {
    position: sticky;
    top: 0;
    z-index: 1200;
    background-color: var(--header-bg);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    overflow: visible;
    color: var(--text-on-dark);
}

.header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 0;
}

/* Логотип */
.header__logo a {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    transition: var(--transition);
}

.logo-text {
    font-size: 1.75rem;
    font-weight: 700;
    color: rgb(220, 220, 220);
    letter-spacing: 2px;
    display: inline-block;
    position: relative;
    /* Сглаживание для одинаковой отрисовки */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.logo-subtext {
    font-size: 0.75rem;
    color: var(--accent-blue);
    letter-spacing: 4px;
    margin-top: -5px;
}

/* ========================================
   Эффект блика на логотипе (без деформации букв)
   Идея: базовый цвет текста остаётся, а блик — это
   псевдоэлемент с градиентом, который пробегает
   справа налево и затухает в левой части.
   ======================================== */
.logo-shine {
    position: relative;
    display: inline-block;
    isolation: isolate; /* корректное смешивание слоёв */
}

.logo-shine::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    pointer-events: none;
    user-select: none;

    /* Наследуем типографику, чтобы совпали буквы */
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    -webkit-font-smoothing: inherit;
    -moz-osx-font-smoothing: inherit;

    /* Сам блик */
    color: transparent;
    background: linear-gradient(
        110deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0) 38%,
        rgba(255, 255, 255, 0.92) 50%,
        rgba(255, 255, 255, 0) 62%,
        rgba(255, 255, 255, 0) 100%
    );
    background-size: 220% 100%;
    background-position: 120% 0;
    -webkit-background-clip: text;
    background-clip: text;

    opacity: 0;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.16));
}

.logo-shine.shining::after {
    animation: logo-shine-run 1.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes logo-shine-run {
    0% {
        opacity: 0;
        background-position: 120% 0;
    }
    10% {
        opacity: 1;
    }
    82% {
        opacity: 1;
    }
    100% {
        /* Блик уходит налево и “гаснет” */
        opacity: 0;
        background-position: -45% 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .logo-shine.shining::after {
        animation: none;
    }
}

/* Навигация */
.header__nav {
    flex: 1;
    margin: 0 24px;
    position: relative;
    z-index: 1201;
}

.nav-list {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    list-style: none;
}

.nav-item {
    position: relative;
}

.nav-link {
    color: rgba(245, 245, 245, 0.82);
    font-size: 0.95rem;
    font-weight: 500;
    padding: 8px 0;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
    color: #ffffff;
    border-bottom-color: var(--accent-blue);
}

/* Dropdown меню */
.nav-item--dropdown {
    position: relative;
}

.nav-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: var(--header-bg);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    padding-top: 15px;
    padding-bottom: 10px;
    margin-top: -10px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(0);
    transition: all 0.3s ease;
    z-index: 2000;
    list-style: none;
    pointer-events: none;
}

.nav-item--dropdown:hover .nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(10px);
    pointer-events: auto;
}

/* Открытие по клику (класс .open) */
.nav-item--dropdown.open .nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.nav-dropdown li {
    margin: 0;
}

.nav-dropdown li:first-child {
    padding-top: 0;
}

.nav-dropdown a {
    display: block;
    padding: 10px 20px;
    color: rgba(245, 245, 245, 0.9);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.nav-dropdown a:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.nav-dropdown a.active {
    color: var(--accent-blue);
    font-weight: 600;
}

/* Подкатегории (submenu) */
.nav-dropdown li {
    position: relative;
}

.nav-dropdown li.has-submenu > a::after {
    content: '›';
    position: absolute;
    right: 15px;
    font-size: 1.2rem;
    font-weight: bold;
    transition: transform 0.2s ease;
}

.nav-dropdown .submenu {
    position: absolute;
    left: 100%;
    top: 0;
    min-width: 200px;
    background: var(--header-bg);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    padding: 10px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 1001;
}

.nav-dropdown li.has-submenu:hover > .submenu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    pointer-events: auto;
}

.nav-dropdown .submenu a {
    padding: 10px 20px;
}

/* Индикатор города */
.header__city {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-on-dark);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 12px;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
}

.header__city:hover {
    background: rgba(33, 150, 243, 0.12);
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

.header__city svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: var(--accent-blue);
}

.header__city span {
    font-weight: 600;
}

/* Контакты в шапке */
.header__contacts {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-right: 16px;
}

.header__phone,
.header__telegram {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-on-dark);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
    width: 160px;
}

.header__phone:hover {
    background: rgba(76, 175, 80, 0.15);
    border-color: #4caf50;
    color: #4caf50;
}

.header__telegram {
    padding: 4px 10px;
}

.header__telegram:hover {
    background: rgba(0, 136, 204, 0.15);
    border-color: #0088cc;
    color: #0088cc;
}

.header__phone svg,
.header__telegram svg {
    flex-shrink: 0;
}

/* Иконка корзины */
.header__cart {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: #ffffff;
}

.header__cart:hover {
    color: var(--accent-blue);
    transform: scale(1.1);
}

.header__cart svg {
    stroke-width: 2;
}

.header__cart-counter {
    position: absolute;
    top: 0;
    right: 0;
    background-color: var(--accent-blue);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2px;
    box-shadow: 0 0 0 2px var(--header-bg);
}

/* Мобильное меню (бургер) */
.header__burger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
}

.header__burger span {
    width: 25px;
    height: 3px;
    background-color: var(--text-primary);
    border-radius: 2px;
    transition: var(--transition);
}

.header__burger:hover span {
    background-color: var(--accent-blue);
}

/* Активное состояние бургера */
.header__burger.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.header__burger.active span:nth-child(2) {
    opacity: 0;
}

.header__burger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Адаптивность */
@media (max-width: 992px) {
    .nav-list {
        gap: 20px;
    }
    
    .nav-link {
        font-size: 0.9rem;
    }
}

@media (max-width: 768px) {
    .header__burger {
        display: flex;
    }
    
    .header__nav {
        position: fixed;
        top: 73px;
        left: 0;
        width: 100%;
        height: calc(100vh - 73px);
        background-color: var(--secondary-dark);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
        margin: 0;
        padding: 20px;
    }
    
    .header__nav.active {
        transform: translateX(0);
    }
    
    .nav-list {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
    }
    
    .nav-item {
        width: 100%;
        border-bottom: 1px solid var(--border-color);
    }
    
    .nav-link {
        display: block;
        padding: 15px 10px;
        font-size: 1rem;
        border-bottom: none;
    }
    
    /* Dropdown в мобильном меню */
    .nav-dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 0;
        padding: 0;
        margin: 0;
        background: var(--header-bg);
        display: none;
    }
    
    .nav-item--dropdown.open .nav-dropdown {
        display: block;
    }
    
    .nav-dropdown a {
        padding: 12px 10px 12px 30px;
        font-size: 0.95rem;
        color: rgba(245, 245, 245, 0.85);
    }
    
    /* Submenu в мобильном меню */
    .nav-dropdown .submenu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
        padding: 0;
        margin: 0;
        display: none;
    }
    
    .nav-dropdown li.has-submenu.open .submenu {
        display: block;
    }
    
    .nav-dropdown .submenu a {
        padding: 10px 10px 10px 50px;
        font-size: 0.9rem;
        color: rgba(245, 245, 245, 0.75);
    }
    
    .nav-dropdown li.has-submenu > a::after {
        content: ' ▼';
        right: auto;
        margin-left: 8px;
        position: relative;
    }
    
    .nav-item--dropdown > .nav-link::after {
        content: ' ▼';
        font-size: 0.7rem;
        margin-left: 8px;
        display: inline-block;
        transition: transform 0.2s ease;
    }
    
    .nav-item--dropdown.open > .nav-link::after {
        transform: rotate(180deg);
    }
    
    /* Индикатор города на мобильных */
    .header__city {
        font-size: 0.85rem;
        padding: 5px 10px;
        margin-right: 12px;
    }
    
    /* Контакты на планшетах - скрываем текст */
    .header__contacts {
        gap: 8px;
        margin-right: 12px;
    }
    
    .header__phone span,
    .header__telegram span {
        display: none;
    }
    
    .header__phone,
    .header__telegram {
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .header__inner {
        padding: 15px 0;
    }
    
    .logo-text {
        font-size: 1.5rem;
    }
    
    .logo-subtext {
        font-size: 0.65rem;
    }
    
    /* Индикатор города на малых экранах */
    .header__city {
        font-size: 0.8rem;
        padding: 4px 8px;
        margin-right: 8px;
    }
    
    .header__city svg {
        width: 14px;
        height: 14px;
    }
    
    /* Контакты на мобильных - только иконки */
    .header__contacts {
        gap: 6px;
        margin-right: 8px;
    }
    
    .header__phone,
    .header__telegram {
        padding: 6px;
    }
}


/* ========================================
   СТРОКА ПОИСКА
   ======================================== */

/* Строка поиска */
.header__search-row {
    background-color: var(--primary-dark);
    padding: 15px 0;
}

.header__search {
    position: relative;
    width: 100%;
}

/* Поле поиска */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background-color: var(--surface-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s ease;
    max-width: 600px;
}

.search-box:focus-within {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-box__icon--left {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    pointer-events: none;
    transition: color 0.3s ease;
}

.search-box:focus-within .search-box__icon--left {
    color: var(--accent-blue);
}

.search-box__input {
    width: 100%;
    padding: 12px 45px 12px 45px;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    color: var(--text-primary);
    outline: none;
}

.search-box__input::placeholder {
    color: var(--text-muted);
}

.search-box__clear {
    position: absolute;
    right: 10px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.search-box__clear:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

/* Результаты поиска */
.search-results {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    right: 0;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    max-height: 500px;
    overflow-y: auto;
    z-index: 1000;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-results__loader,
.search-results__error,
.search-results__empty {
    padding: 30px 20px;
    text-align: center;
    color: var(--text-muted);
}

.search-results__empty svg {
    margin-bottom: 12px;
    color: var(--text-muted);
    opacity: 0.5;
}

.search-results__empty p {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 8px 0 4px 0;
}

.search-results__empty span {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.search-results__list {
    padding: 8px;
}

/* Результат поиска */
.search-result {
    display: flex;
    gap: 12px;
    padding: 10px;
    border-radius: 6px;
    text-decoration: none;
    transition: background-color 0.2s ease, outline 0.2s ease;
}

.search-result:hover {
    outline: 2px solid var(--accent-blue);
    outline-offset: -2px;
}

.search-result--selected {
    outline: 2px solid var(--accent-blue);
    outline-offset: -2px;
}

.search-result__image {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 6px;
    background-color: var(--surface-alt);
    flex-shrink: 0;
}

.search-result__info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.search-result__name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    
    /* Ограничение 2 строки */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-result__name mark {
    background-color: rgba(37, 99, 235, 0.15);
    color: var(--accent-blue);
    font-weight: 700;
    padding: 0 2px;
    border-radius: 2px;
}

.search-result__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.search-result__category,
.search-result__sku,
.search-result__minprom {
    display: inline-block;
}

.search-result__sku mark,
.search-result__minprom mark {
    background-color: rgba(37, 99, 235, 0.15);
    color: var(--accent-blue);
    font-weight: 600;
    padding: 0 2px;
    border-radius: 2px;
}

.search-result__price {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.search-result__current-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.search-result__old-price {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-decoration: line-through;
}

/* Футер результатов */
.search-results__footer {
    padding: 12px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.search-results__show-all {
    display: inline-block;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-blue);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.search-results__show-all:hover {
    background-color: rgba(37, 99, 235, 0.1);
}

/* Адаптив для поиска */
@media (max-width: 992px) {
    .search-box {
        max-width: 500px;
    }
}

@media (max-width: 768px) {
    .header__search-row {
        padding: 10px 0;
    }
    
    .search-box {
        max-width: 100%;
    }
    
    .search-box__input {
        font-size: 0.9rem;
        padding: 10px 40px 10px 40px;
    }
    
    .search-result {
        padding: 8px;
    }
    
    .search-result__image {
        width: 60px;
        height: 60px;
    }
    
    .search-result__name {
        font-size: 0.9rem;
    }
}


