/* header.css – финальная версия */

/* ===== ОСНОВНОЙ КОНТЕЙНЕР ШАПКИ ===== */
.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    background-color: #8b6b4d;
    color: #f9f1e0;
    flex-wrap: nowrap;
}

/* Десктоп версия (от 769px) — увеличенная высота шапки */
@media (min-width: 769px) {
    .header-content {
        padding-left: 48px;
        padding-right: 32px;
        padding-top: 12px;
        padding-bottom: 12px;
    }
}

/* Мобильная версия (до 768px) */
@media (max-width: 768px) {
    .header-content {
        padding: 8px 16px;
        gap: 12px;
    }
}

/* Логотип */
.logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
    gap: 8px;
}

.logo-img {
    height: 48px;
    width: auto;
    transition: none;
}

.logo-text {
    display: none;
}

@media (min-width: 768px) {
    .logo-text {
        display: inline-block;
        font-size: 1.3rem;
        font-weight: 600;
        font-family: 'Playfair Display', Georgia, serif;
        color: #f9f1e0;
        letter-spacing: 1px;
    }
    .logo-img {
        height: 48px;
    }
}

/* ===== ПОИСК ===== */
.header-search {
    flex: 1;
    position: relative;
    max-width: 700px;
    min-width: 250px;
}

.search-form {
    display: flex;
    background: white;
    border-radius: 12px;
    border: 1px solid #ddd;
    overflow: hidden;
    height: 42px;
}

.search-form input {
    flex: 1;
    padding: 0 16px;
    border: none;
    outline: none;
    font-size: 0.9rem;
    min-width: 0;
    height: 100%;
}

.search-form input:focus {
    outline: none;
}

.clear-search-btn {
    background: none;
    border: none;
    font-size: 0.9rem;
    cursor: pointer;
    color: #999;
    padding: 0 10px;
    flex-shrink: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clear-search-btn:hover {
    color: #333;
}

.search-submit-btn {
    background: #d4a574;
    border: none;
    padding: 0 18px;
    cursor: pointer;
    color: #2c1e0e;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    border-radius: 0 12px 12px 0;
    transition: background 0.2s;
}

.search-submit-btn i {
    font-size: 1rem;
}

.search-submit-btn:hover {
    background: #c49464;
}

/* ===== ПОДСКАЗКИ ПОИСКА ===== */
.search-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 12px;
    overflow: hidden;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.search-suggestions .suggestion-item {
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0e6d8;
    color: #3e2e1f;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.search-suggestions .suggestion-item:last-child {
    border-bottom: none;
}

.search-suggestions .suggestion-item:hover {
    background: #fef8f0;
}

.history-delete {
    background: none;
    border: none;
    font-size: 0.85rem;
    cursor: pointer;
    color: #999;
    padding: 0 5px;
    border-radius: 50%;
}

.history-delete:hover {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

/* ===== ПРАВАЯ ЧАСТЬ ===== */
.header-icons {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 42px;
    flex-shrink: 0;
    padding-bottom: 2px;
}

.icon-link {
    position: relative;
    color: #f9f1e0;
    font-size: 1.2rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 42px;
    transition: opacity 0.2s;
    padding-bottom: 12px;
}

.icon-link:hover {
    opacity: 0.8;
    color: #f9f1e0;
}

.cart-count {
    position: absolute;
    top: 0px;
    right: 2px;
    background: #d4a574;
    color: #2c1e0e;
    font-size: 0.6rem;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 20px;
    line-height: 1;
    min-width: 18px;
    text-align: center;
}

.language-selector {
    display: flex;
    gap: 4px;
    background: rgba(255,255,255,0.15);
    padding: 0 8px;
    border-radius: 40px;
    align-items: center;
    height: 34px;
    margin-bottom: 2px;
}

.lang-btn {
    text-decoration: none;
    color: #f9f1e0;
    font-size: 0.8rem;
    padding: 2px 6px;
    border-radius: 40px;
    transition: all 0.2s;
    line-height: 1;
}

.lang-btn.active {
    background: #ffd79c;
    color: #8b6b4d;
}

/* Бургер-кнопка */
.burger-btn {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: #f9f1e0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 42px;
    padding-bottom: 2px;
}

/* ===== МОДАЛЬНОЕ МЕНЮ ===== */
.menu-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    visibility: hidden;
    opacity: 0;
    transition: 0.2s;
}

.menu-modal.open {
    visibility: visible;
    opacity: 1;
}

.menu-modal-content {
    position: absolute;
    right: 0;
    top: 0;
    width: 80%;
    max-width: 320px;
    height: 100%;
    background: white;
    box-shadow: -2px 0 20px rgba(0,0,0,0.15);
    transform: translateX(100%);
    transition: transform 0.3s;
    display: flex;
    flex-direction: column;
}

.menu-modal.open .menu-modal-content {
    transform: translateX(0);
}

.menu-modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #f0e6d8;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.menu-modal-header h3 {
    margin: 0;
    font-size: 1rem;
}

.menu-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #5a3e2b;
}

.menu-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.menu-modal-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu-modal-links li {
    margin-bottom: 12px;
}

.menu-modal-links a {
    text-decoration: none;
    color: #3e2e1f;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
}

.menu-divider {
    height: 1px;
    background: #f0e6d8;
    margin: 12px 0;
}

.cart-count-mobile {
    background: #d4a574;
    color: #2c1e0e;
    font-size: 0.65rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 20px;
    margin-left: 8px;
}

.menu-language-mobile {
    margin: 15px 0 10px;
}

.menu-language-mobile span {
    display: block;
    font-size: 0.75rem;
    color: #7a6852;
    margin-bottom: 8px;
}

.mobile-lang-inner {
    background: rgba(139, 107, 77, 0.15);
    padding: 4px 8px;
    border-radius: 40px;
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.mobile-lang-inner .lang-btn {
    color: #3e2e1f;
    font-size: 0.75rem;
    padding: 3px 6px;
}

.mobile-lang-inner .lang-btn.active {
    background: #d4a574;
    color: white;
}

.vision-mobile-wrapper {
    margin-top: 15px;
}

.vision-btn-mobile {
    background: #2c3e50;
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 40px;
    cursor: pointer;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    pointer-events: auto;
}

.vision-btn-mobile:hover {
    background: #1e2a36;
}

/* ===== МОБИЛЬНАЯ АДАПТАЦИЯ (до 768px) ===== */
@media (max-width: 768px) {
    .header-content {
        padding: 8px 16px;
        gap: 12px;
    }
    
    .logo {
        order: 1;
        flex-shrink: 0;
    }
    
    .logo-img {
        height: 32px;
    }
    
    .logo-text {
        display: none;
    }
    
    .header-search {
        order: 2;
        flex: 1;
        min-width: 0;
        max-width: none;
        transition: all 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
        transform: translateZ(0);
        backface-visibility: hidden;
    }
    
    .search-form {
        height: 38px;
    }
    
    .search-form input {
        font-size: 0.8rem;
        padding: 0 12px;
    }
    
    .search-submit-btn {
        padding: 0 12px;
    }
    
    .search-submit-btn i {
        font-size: 0.85rem;
    }
    
    .header-icons {
        order: 3;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        gap: 8px;
        height: auto;
        padding-bottom: 0;
    }
    
    .language-selector.desktop-lang {
        display: flex !important;
        gap: 3px;
        background: rgba(255,255,255,0.15);
        padding: 2px 6px;
        border-radius: 40px;
        height: auto;
        margin-bottom: 0;
    }
    
    .language-selector.desktop-lang .lang-btn {
        font-size: 0.7rem;
        padding: 2px 5px;
    }
    
    .burger-btn {
        display: inline-flex !important;
        width: 32px;
        height: 34px;
        font-size: 1.3rem;
        padding-bottom: 0;
    }
    
    .desktop-icons .icon-link:not(.burger-btn) {
        display: none;
    }
    
    .desktop-icons .cart-link {
        display: none;
    }
    
    .cart-count {
        display: none;
    }
    
    .icon-link {
        padding-bottom: 0;
    }
    
    /* Фокус на поиске — плавное увеличение */
    body.search-focused::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
        animation: fadeIn 0.25s ease;
    }
    
    @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
    
    body.search-focused .logo,
    body.search-focused .language-selector.desktop-lang {
        display: none !important;
    }
    
    body.search-focused .burger-btn {
        display: inline-flex !important;
    }
    
    body.search-focused .header-search {
        position: fixed !important;
        top: 8px !important;
        left: 16px !important;
        right: 16px !important;
        width: calc(100% - 32px) !important;
        z-index: 1000 !important;
        max-width: none !important;
    }
    
    @keyframes searchExpand {
        0% {
            opacity: 0.8;
            transform: scale(0.98) translateY(-5px);
        }
        100% {
            opacity: 1;
            transform: scale(1) translateY(0);
        }
    }
    
    body.search-focused .search-form {
        height: 42px !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2) !important;
    }
    
    body.search-focused .search-form input {
        font-size: 1rem !important;
        padding: 0 16px !important;
    }
    
    body.search-focused .search-submit-btn {
        padding: 0 16px !important;
    }
    
    body.search-focused .search-submit-btn i {
        font-size: 1rem !important;
    }
    /* ПОДСКАЗКИ В МОБИЛЬНОМ РЕЖИМЕ ПОИСКА — прилипают к строке и на всю ширину с кнопкой */
    body.search-focused .search-suggestions {
        position: fixed !important;
        top: 50px !important;        /* отступ минимальный, почти вплотную */
        width: auto !important;
        max-height: 60vh;
        z-index: 1001;
        animation: slideDown 0.25s ease;
        box-shadow: 0 8px 20px rgba(0,0,0,0.2);
        border-radius: 16px;
    }
    
    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}