/* ===================================== */
/*         SEARCH OVERLAY EXTENDED       */
/* ===================================== */

/* Затемнение фона при открытом поиске */
body.search-open {
    overflow: hidden;
}

body.search-open .sidebar,
body.search-open .main-content,
body.search-open .player-bar {
    filter: blur(2px);
    transition: filter 0.3s ease;
}

body.search-open .search-overlay {
    filter: none;
}

/* Анимация появления */
@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

.search-overlay.active .search-header {
    animation: slideDown 0.3s ease;
}

.search-overlay.active .mobile-search-wrapper {
    animation: slideDown 0.3s ease 0.1s both;
}

.search-overlay.active #searchResults {
    animation: fadeIn 0.3s ease 0.2s both;
}

/* Скелетон загрузки */
.search-loading {
    padding: 20px;
}

.search-loading-section {
    margin-bottom: 30px;
}

.search-loading-title {
    width: 100px;
    height: 20px;
    background: linear-gradient(90deg, #222, #333, #222);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 15px;
}

.search-loading-scroll {
    display: flex;
    gap: 15px;
}

.search-loading-card {
    min-width: 100px;
}

.search-loading-image {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(90deg, #222, #333, #222);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    margin: 0 auto 8px;
}

.search-loading-text {
    width: 80px;
    height: 12px;
    background: linear-gradient(90deg, #222, #333, #222);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
    margin: 0 auto;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* История поиска */
.search-history {
    margin-top: 30px;
    padding: 0 20px;
}

.search-history-title {
    font-size: 16px;
    color: var(--accent);
    margin-bottom: 15px;
    padding-left: 5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-history-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.search-history-item {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-main);
    padding: 10px 18px;
    border-radius: 30px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(5px);
}

.search-history-item:hover {
    background: rgba(255,215,0,0.1);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255,215,0,0.2);
}

.search-history-item .history-query {
    flex: 1;
    font-weight: 500;
}

.search-history-item .history-remove {
    opacity: 0.5;
    transition: opacity 0.2s ease;
    font-size: 16px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.search-history-item:hover .history-remove {
    opacity: 1;
    background: rgba(255,75,75,0.2);
    color: #ff6b6b;
}

.search-history-clear {
    background: rgba(255,75,75,0.1);
    border: 1px solid rgba(255,75,75,0.2);
    color: #ff6b6b;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 20px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.search-history-clear:hover {
    background: rgba(255,75,75,0.2);
    border-color: #ff6b6b;
    transform: translateY(-2px);
}

/* Популярные запросы */
.search-popular {
    margin-top: 30px;
    padding: 0 20px;
}

.search-popular-title {
    font-size: 16px;
    color: var(--accent);
    margin-bottom: 15px;
    padding-left: 5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-popular-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.search-popular-tag {
    background: rgba(255,215,0,0.1);
    border: 1px solid rgba(255,215,0,0.2);
    color: var(--accent);
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.search-popular-tag:hover {
    background: rgba(255,215,0,0.2);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255,215,0,0.2);
}

/* Подсветка совпадений */
.search-highlight {
    background: rgba(255,215,0,0.2);
    color: var(--accent);
    padding: 0 2px;
    border-radius: 2px;
}

/* Клавиатурная навигация */
.search-track-row.selected {
    background: rgba(255,215,0,0.15);
    border-left: 2px solid var(--accent);
}

.search-track-row.selected .track-name {
    color: var(--accent);
}

/* Подсказка для поиска */
.search-hint {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,215,0,0.2);
    color: var(--text-dim);
    padding: 10px 16px;
    border-radius: 30px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 10001;
    animation: fadeInUp 0.3s ease;
}

.search-hint kbd {
    background: var(--accent);
    color: #000;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

/* Адаптив для подсказки */
@media (max-width: 768px) {
    .search-hint {
        display: none;
    }
}

/* Темная тема */
@media (prefers-color-scheme: dark) {
    .search-history-item {
        background: rgba(255,255,255,0.03);
    }
    
    .search-popular-tag {
        background: rgba(255,215,0,0.05);
    }
}

/* Уменьшение анимации */
@media (prefers-reduced-motion: reduce) {
    .search-overlay.active .search-header,
    .search-overlay.active .mobile-search-wrapper,
    .search-overlay.active #searchResults,
    .search-loading-title,
    .search-loading-image,
    .search-loading-text {
        animation: none;
    }
    
    body.search-open .sidebar,
    body.search-open .main-content,
    body.search-open .player-bar {
        filter: none;
    }
}

/* В открытом поиске бургер не должен перекрывать заголовок */
body.search-open .menu-toggle {
    display: none !important;
}
