/* Стили для поиска в шапке */
.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

/* Кнопка переключения поиска (закрытое состояние) */
.search-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.search-toggle-btn:hover {
    opacity: 0.7;
}

/* Контейнер с инпутом (открытое состояние) */
.search-input-container {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 368px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 100;
}

.search-input-container.active {
    opacity: 1;
    visibility: visible;
}

.search-input {
    width: 100%;
    height: 44px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 0 44px 0 24px;
    font-family: 'e-Ukraine Head', sans-serif;
    font-size: 15px;
    color: #333333;
    box-shadow: 0px 20px 54px -10px rgba(0,0,0,0.1);
    outline: none;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    border-color: #333333;
}

.search-input::placeholder {
    color: #333333;
    opacity: 1;
}

/* Кнопка закрытия поиска */
.search-close-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.search-close-btn:hover {
    opacity: 0.7;
}

/* Скрытие кнопки переключения когда поиск открыт */
.search-container.search-open .search-toggle-btn {
    opacity: 0;
    visibility: hidden;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0px 20px 54px -10px rgba(0,0,0,0.1);
    padding: 24px 16px;
    margin-top: 8px;
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    display: none;
}

.search-results.show {
    display: block;
}

.search-result-item {
    display: flex;
    gap: 16px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background-color: #f8f8f8;
    border-radius: 4px;
    margin: 0 -8px;
    padding: 12px 8px;
}

.search-result-photo {
    width: 64px;
    height: 64px;
    border-radius: 4px;
    background-size: cover;
    background-position: center;
    background-color: #f0f0f0;
    flex-shrink: 0;
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-name {
    font-family: 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 16px;
    color: #333333;
    margin: 0 0 4px 0;
    line-height: 1.2;
}

.search-result-name .highlight {
    color: #dc0909;
}

.search-result-description {
    font-family: 'Manrope', sans-serif;
    font-weight: 500;
    font-size: 14px;
    color: #898989;
    opacity: 0.7;
    margin: 0;
    line-height: 1.3;
    letter-spacing: 0.28px;
}

.search-more-btn {
    background: #323131;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 16px;
    width: 100%;
    height: 48px;
    font-family: 'Manrope', sans-serif;
    font-weight: 500;
    font-size: 16px;
    letter-spacing: 0.32px;
    cursor: pointer;
    margin-top: 16px;
    transition: background-color 0.3s ease;
}

.search-more-btn:hover {
    background: #2a2929;
}

.no-results {
    text-align: center;
    color: #898989;
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    padding: 20px;
}

/* Мобильные стили */
.mobile-search-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background-color 0.3s ease;
}

.mobile-search-toggle:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.mobile-search-text {
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    color: #333333;
}

.mobile-search .search-input-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 9999;
    padding: 20px;
    display: flex;
    flex-direction: column;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.mobile-search .search-input-container.active {
    transform: translateY(0);
}

.mobile-search .search-input {
    width: 100%;
    margin-bottom: 20px;
}

.mobile-search .search-close-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
}

@media (max-width: 768px) {
    .search-container:not(.mobile-search) .search-input-container {
        width: 280px;
    }
    
    .search-results {
        left: -16px;
        right: -16px;
        width: calc(100% + 32px);
    }
}

/* Анимация загрузки */
.search-loading {
    text-align: center;
    padding: 20px;
    color: #898989;
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
}

.search-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 50%;
    border-top-color: #333333;
    animation: spin 1s ease-in-out infinite;
    margin-left: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
