/* 全局搜索样式 */
.global-search-container {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.global-search-form {
    width: 100%;
}

.global-search-box {
    display: flex;
    align-items: center;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 30px;
    padding: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.global-search-box:focus-within {
    border-color: #4CAF50;
    box-shadow: 0 2px 15px rgba(76, 175, 80, 0.2);
}

.global-search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 15px 20px;
    font-size: 16px;
    background: transparent;
}

.global-search-input::placeholder {
    color: #999;
}

.global-search-btn {
    background: #4CAF50;
    border: none;
    border-radius: 25px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    font-size: 14px;
    font-weight: 500;
    min-width: 80px;
}

.global-search-btn:hover {
    background: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.global-search-btn:active {
    transform: translateY(0);
}

.global-search-btn .icon {
    width: 18px;
    height: 18px;
    fill: white;
}

.global-search-btn .btn-text {
    font-weight: 500;
}

.global-search-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.global-search-btn.loading .icon {
    animation: spin 1s linear infinite;
}

.global-search-btn:disabled:hover {
    background: #4CAF50;
    transform: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* 搜索结果容器 */
.global-search-results {
    position: absolute;
    top: 100%;
    left: 20px;
    right: 20px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 500px;
    overflow-y: auto;
}

.search-results-content {
    padding: 10px 0;
}

/* 加载状态 */
.search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    color: #666;
}

/* 当有搜索结果时，loading 显示边框 */
.search-results-list:not(:empty) + .search-loading {
    border-top: 1px solid #f0f0f0;
    margin-top: 10px;
    padding: 20px 30px;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* 搜索结果项 */
.search-result-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
    gap: 12px;
}

.search-result-item:hover {
    background-color: #f8f9fa;
}

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

/* 封面图 */
.result-cover {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    background-size: cover;
    background-position: center;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
}

.result-cover.no-cover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.play-overlay.show {
    opacity: 1;
}

.result-cover:hover .play-overlay {
    background: rgba(0, 0, 0, 0.6);
}

.play-icon {
    width: 20px;
    height: 20px;
    fill: white;
}

/* 结果信息 */
.result-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.result-main {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.result-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    min-width: 0;
    flex-shrink: 1;
}

.result-artist {
    font-size: 14px;
    color: #666;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex-shrink: 1;
}

.result-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 13px;
    color: #888;
    flex-shrink: 0;
}

.result-duration {
    background: #f0f0f0;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.result-secondary {
    display: flex;
    align-items: center;
    gap: 12px;
}

.result-stats {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #888;
}

.stat-icon {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.play-icon-small {
    fill: #4CAF50;
}

.download-icon-small {
    fill: #2196F3;
}

/* 操作按钮 */
.result-actions {
    display: flex;
    gap: 8px;
}

.download-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #2196F3;
    color: white;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.download-btn:hover {
    background: #1976D2;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.btn-icon {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* 无结果和错误状态 */
.no-results,
.search-error {
    text-align: center;
    padding: 30px;
    color: #666;
}

.search-error {
    color: #f44336;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .global-search-container {
        padding: 15px;
    }

    .global-search-input {
        padding: 12px 15px;
        font-size: 15px;
    }

    .global-search-btn {
        padding: 10px 15px;
        font-size: 13px;
        min-width: 70px;
    }

    .global-search-btn .icon {
        width: 16px;
        height: 16px;
    }

    .search-result-item {
        padding: 10px 15px;
        gap: 10px;
    }

    .result-cover {
        width: 40px;
        height: 40px;
    }

    /* 手机屏幕下的特殊布局 */
    .result-info {
        flex-direction: column;
        align-items: stretch;
        gap: 3px;
    }

    .result-main {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        justify-content: space-between;
    }

    .result-title {
        flex: 1;
        min-width: 0;
        font-size: 14px;
    }

    .result-duration {
        flex-shrink: 0;
        white-space: nowrap;
        font-size: 11px;
    }

    /* 手机屏幕下作者在第二行 */
    .result-artist {
        font-size: 12px;
        color: #666;
        font-weight: 500;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        min-width: 0;
        flex-shrink: 1;
    }

    .result-secondary {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 6px;
    }

    .result-stats {
        gap: 8px;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
    }

    .stat-item {
        font-size: 11px;
    }

    .stat-icon {
        width: 12px;
        height: 12px;
    }

    .play-icon {
        width: 16px;
        height: 16px;
    }

    .download-btn {
        padding: 6px 12px;
        font-size: 12px;
        gap: 4px;
    }

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

/* 大屏幕布局 - 所有元素在一行 */
@media (min-width: 769px) {
    .result-info {
        flex-direction: row;
        align-items: center;
        gap: 15px;
    }

    .result-main {
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }

    .result-secondary {
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }

    .result-stats {
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }

    /* 大屏幕下作者样式 */
    .result-artist {
        font-size: 14px;
        color: #666;
        font-weight: 500;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        min-width: 0;
        flex-shrink: 1;
    }
}

/* 中等屏幕优化 */
@media (min-width: 769px) and (max-width: 1024px) {
    .result-main {
        gap: 10px;
    }

    .result-meta {
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .global-search-btn .btn-text {
        display: none;
    }

    .global-search-btn {
        min-width: 50px;
        padding: 12px;
        border-radius: 50%;
    }

    /* 极小屏幕下进一步压缩 */
    .result-cover {
        width: 36px;
        height: 36px;
    }

    .search-result-item {
        padding: 8px 12px;
        gap: 8px;
    }

    .result-stats {
        gap: 6px;
    }

    .stat-item {
        font-size: 10px;
    }

    .stat-icon {
        width: 10px;
        height: 10px;
    }

    .play-icon {
        width: 14px;
        height: 14px;
    }

    .result-title {
        font-size: 13px;
    }

    .result-artist {
        font-size: 11px;
    }
}