/* === Header: гибкая строка === */
/* === Поддержка тем === */
:root {
    --bg-primary: #f8f9ff;
    --bg-secondary: #f9f9ff;
    --text-primary: #333;
    --border-color: #d0d0e0;
    --btn-hover-bg: #f0f0ff;
    --accent-color: #5829a9;
    --text-on-accent: #fff;
    --input-bg: #fff;
}

.dark-theme {
    --bg-primary: #1e1e1e;
    --bg-secondary: #2a2a2a;
    --text-primary: #f0f0f0;
    --border-color: #444;
    --accent-color: #a777e3;
    --text-on-accent: #fff;
    --input-bg: #252525;
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Поисковая строка — теперь адаптивная */
.search-form {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    overflow: hidden;
    background: var(--bg-primary);
    width: 240px; /* Для десктопа */
    transition: width 0.3s ease;
}

.search-input {
    border: none;
    padding: 8px 12px;
    font-size: 14px;
    outline: none;
    flex-grow: 1;
    background: transparent;
    color: var(--text-primary);
}

.search-input::placeholder {
    color: var(--text-primary);
    opacity: 0.6;
}

.search-btn {
    background: var(--btn-gradient-start);
    color: white;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    transition: opacity 0.2s;
}

.search-btn:hover {
    opacity: 0.9;
}

/* Иконки-кнопки: Избранное, Уведомления */
.icon-btn {
    background: none;
    border: 1px solid var(--border-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s ease;
    position: relative;
}

.icon-btn:hover {
    background-color: var(--border-color);
    transform: translateY(-2px);
}

.icon-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(106, 17, 203, 0.3);
}


/* === Иконка поиска в хедере === */
.search-icon-btn {
    background: none;
    border: 1px solid var(--border-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.search-icon-btn:hover {
    background-color: var(--border-color);
    transform: translateY(-2px);
}

/* === Полная форма поиска (отдельно) === */
.search-form-full {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    overflow: hidden;
    background: var(--bg-primary);
    width: 240px;
    transition: width 0.3s ease;
}

.search-input {
    border: none;
    padding: 8px 12px;
    font-size: 14px;
    outline: none;
    flex-grow: 1;
    background: transparent;
    color: var(--text-primary);
}

.search-input::placeholder {
    color: var(--text-primary);
    opacity: 0.6;
}

.search-btn {
    background: var(--btn-gradient-start);
    color: white;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    transition: opacity 0.2s;
}

.search-btn:hover {
    opacity: 0.9;
}
/* === Модальное окно поиска === */
.search-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: flex-start; /* теперь выравнивание сверху */
    padding-top: 80px; /* отступ от верха */
    z-index: 1000;
}

.search-modal .search-form-full {
    width: 100%;
    max-width: 500px;
    background: var(--bg-primary);
    border-radius: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.close-search {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 36px;
    color: white;
    cursor: pointer;
    opacity: 0.8;
}

.close-search:hover {
    opacity: 1;
}
/* === Кнопка фильтрации === */
.filter-icon-btn {
   background: none;
    border: 1px solid var(--border-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s ease;
    font-size: 1.1em;
}

.filter-icon-btn:hover {
    background-color: var(--border-color);
    transform: translateY(-2px);
}

/* Скрыть на мобильных */
@media (max-width: 768px) {
    .filter-icon-btn {
        display: none;
    }
}




/* Адаптивность */
@media (max-width: 768px) {
    .search-form-full {
        width: 180px;
    }
}

@media (max-width: 480px) {
    .search-form-full {
        width: 100%;
        max-width: 160px;
    }

    .search-input {
        font-size: 13px;
        padding: 6px 8px;
    }
}
/* === Адаптивность для экранов меньше 768px === */
@media (max-width: 768px) {
    .search-form {
        width: 180px; /* Уменьшаем на планшетах */
    }

    .header-left,
    .header-right {
        gap: 8px;
    }

    .icon-btn {
        width: 36px;
        height: 36px;
    }

    .search-input {
        font-size: 13px;
        padding: 6px 10px;
    }

    .search-btn {
        padding: 6px 10px;
        font-size: 13px;
    }
}

/* Скрываем mobile-блок на десктопе */
.desktop-actions {
    display: flex;
    gap: 8px;
}

.mobile-actions {
    display: none;
}



/* === Адаптивность для экранов меньше 480px (мобильные) === */
@media (max-width: 480px) {
    .search-form {
        width: 100%; /* Занимает всю доступную ширину */
        max-width: 120px; /* Но не больше разумного */
    }

    .header-left,
    .header-right {
        position: relative;
        flex-wrap: nowrap;
        gap: 6px;
        margin-left: 43px;
    }

    .icon-btn {
        width: 32px;
        height: 32px;
    }

    .search-input {
        font-size: 12px;
        padding: 5px 8px;
    }

    .search-btn {
        padding: 5px 8px;
        font-size: 12px;
    }
    .desktop-actions {
        display: none;
    }

    .mobile-actions {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .cart-icon {
        background: none;
        border: none;
        font-size: 1.4em;
        cursor: pointer;
        padding: 6px;
    }

    .avatar-btn {
        background: none;
        border: 1px solid #5829a9;
        padding: 0;
        cursor: pointer;
        border-radius: 50%;
        overflow: hidden;
        width: 30px;
        height: 30px;
        margin-left: 4px;
    }

    .mini-avatar {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 50%;
    }
}