/**
 * 音效库页面专属样式
 * 与场景库保持一致的设计风格
 */

/* ===== 变量定义 ===== */
:root {
    --sound-accent: #f59e0b;
    --sound-accent-light: rgba(245, 158, 11, 0.15);
    --sound-accent-glow: rgba(245, 158, 11, 0.4);
    --sound-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    /* 兼容边框变量 */
    --border: #2a2d34;
    --border-light: #3a3d46;
}

/* ===== 主内容区布局 ===== */
.sound-main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* ===== 左侧分类导航 ===== */
.sound-sidebar {
    width: 280px;
    flex-shrink: 0;
    background: var(--bg-dark, var(--bg-secondary));
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 16px;
    overflow-y: auto;
}

.sound-sidebar .sidebar-section {
    margin-bottom: 16px;
}

.sound-sidebar .sidebar-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary, white);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sound-sidebar .sidebar-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sound-sidebar .sidebar-filter-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: transparent;
    border: none;
    color: var(--text-secondary, rgba(255, 255, 255, 0.7));
    border-radius: 6px;
    text-align: left;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s ease;
}

.sound-sidebar .sidebar-filter-btn:hover {
    background: var(--bg-hover, rgba(255, 255, 255, 0.05));
    color: var(--text-primary, white);
}

.sound-sidebar .sidebar-filter-btn.active {
    background: var(--sound-accent-light);
    color: var(--sound-accent);
}

/* ===== 右侧内容区 ===== */
.sound-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 24px;
}

.sound-content__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.sound-content__header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 600;
    color: white;
}

.sound-content__header h2 svg {
    color: var(--sound-accent);
}

.sound-content__actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ===== 搜索框 ===== */
.sound-content .search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 14px;
    min-width: 240px;
}

.sound-content .search-box svg {
    color: rgba(255, 255, 255, 0.4);
}

.sound-content .search-box input {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    font-size: 14px;
    outline: none;
}

.sound-content .search-box input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* ===== Tab筛选 ===== */
.sound-tabs {
    display: flex;
    gap: 0;
    background: var(--bg-dark, var(--bg-secondary));
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.sound-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary, rgba(255, 255, 255, 0.6));
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sound-tab:hover {
    color: var(--text-primary, white);
}

.sound-tab.active {
    color: var(--sound-accent);
    border-bottom-color: var(--sound-accent);
}

.sound-tab__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--bg-input, rgba(255, 255, 255, 0.1));
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted, rgba(255, 255, 255, 0.5));
}

.sound-tab.active .sound-tab__count {
    background: var(--sound-accent);
    color: white;
}

/* ===== 内容滚动区域 ===== */
.sound-content-wrapper {
    flex: 1;
    overflow-y: auto;
}

/* ===== 音效网格 ===== */
.sound-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

/* ===== 创建音效卡片 ===== */
.sound-card.sound-card--create {
    background: transparent;
    border: 2px dashed var(--border-color) !important;
    border-radius: 12px;
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.sound-card.sound-card--create:hover {
    border: 2px dashed var(--sound-accent) !important;
    background: var(--sound-accent-light);
    transform: none;
    box-shadow: none;
}

.sound-card__create-content {
    text-align: center;
}

.sound-card__create-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--sound-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    color: white;
    transition: transform 0.3s;
}

.sound-card--create:hover .sound-card__create-icon {
    transform: scale(1.1);
}

.sound-card__create-text {
    color: var(--sound-accent);
    font-size: 14px;
    font-weight: 600;
}

/* ===== 音效卡片 ===== */
.sound-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.sound-card:not(.sound-card--create):hover {
    border-color: var(--sound-accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.sound-card.playing {
    border-color: var(--sound-accent);
}

.sound-card.playing:hover {
    border-color: var(--sound-accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* 音效封面区 */
.sound-card__cover {
    height: 100px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(217, 119, 6, 0.05) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    border-radius: 11px 11px 0 0;
}

.sound-card__waveform {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 40px;
}

.sound-card__waveform span {
    width: 3px;
    background: var(--sound-accent);
    border-radius: 2px;
    opacity: 0.5;
    animation: wave 1s ease-in-out infinite;
}

.sound-card__waveform span:nth-child(1) { height: 20%; animation-delay: 0s; }
.sound-card__waveform span:nth-child(2) { height: 40%; animation-delay: 0.1s; }
.sound-card__waveform span:nth-child(3) { height: 60%; animation-delay: 0.2s; }
.sound-card__waveform span:nth-child(4) { height: 80%; animation-delay: 0.3s; }
.sound-card__waveform span:nth-child(5) { height: 100%; animation-delay: 0.4s; }
.sound-card__waveform span:nth-child(6) { height: 80%; animation-delay: 0.5s; }
.sound-card__waveform span:nth-child(7) { height: 60%; animation-delay: 0.6s; }
.sound-card__waveform span:nth-child(8) { height: 40%; animation-delay: 0.7s; }
.sound-card__waveform span:nth-child(9) { height: 20%; animation-delay: 0.8s; }

@keyframes wave {
    0%, 100% { transform: scaleY(0.5); opacity: 0.3; }
    50% { transform: scaleY(1); opacity: 0.7; }
}

.sound-card.playing .sound-card__waveform span {
    opacity: 1;
    animation: waveActive 0.5s ease-in-out infinite;
}

@keyframes waveActive {
    0%, 100% { transform: scaleY(0.3); }
    50% { transform: scaleY(1); }
}

/* 播放按钮覆盖 */
.sound-card__play-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.sound-card:hover .sound-card__play-overlay {
    opacity: 1;
}

.sound-card__play-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--sound-gradient);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.sound-card__play-btn:hover {
    transform: scale(1.1);
}

/* 标签 */
.sound-card__badges {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    gap: 4px;
}

.sound-card .badge {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
}

.sound-card .badge--official {
    background: var(--sound-accent);
    color: white;
}

/* 卡片信息 */
.sound-card__info {
    padding: 12px;
}

.sound-card__name {
    font-size: 14px;
    font-weight: 600;
    color: white;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sound-card__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.sound-card__tag {
    font-size: 11px;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.6);
    border-radius: 4px;
}

.sound-card__duration {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 卡片操作 */
.sound-card__actions {
    padding: 8px 12px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 4px;
}

.sound-card .btn-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.sound-card .btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.sound-card .btn-icon--danger:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* ===== 弹窗样式 ===== */
.sound-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.sound-modal {
    background: #1a1c23;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
}

.sound-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.02);
}

.sound-modal__header h2 {
    font-size: 18px;
    font-weight: 600;
    color: white;
}

.sound-modal__close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.sound-modal__close:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.sound-modal__body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.sound-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

/* ===== 表单样式 ===== */
.sound-form-group {
    margin-bottom: 20px;
}

.sound-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 8px;
}

.sound-form-group label .required {
    color: #ef4444;
}

.sound-form-group input,
.sound-form-group textarea,
.sound-form-group select {
    width: 100%;
    padding: 12px 14px;
    font-size: 14px;
    color: white;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    transition: all 0.2s;
}

.sound-form-group input:focus,
.sound-form-group textarea:focus,
.sound-form-group select:focus {
    outline: none;
    border-color: var(--sound-accent);
    box-shadow: 0 0 0 3px var(--sound-accent-light);
    background: rgba(0, 0, 0, 0.4);
}

.sound-form-group input::placeholder,
.sound-form-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.sound-form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.sound-form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.5)' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.sound-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ===== 按钮样式 ===== */
.sound-btn {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.sound-btn--primary {
    background: var(--sound-gradient);
    color: white;
    border: none;
}

.sound-btn--primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--sound-accent-glow);
}

.sound-btn--primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.sound-btn--secondary {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.sound-btn--secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: white;
}

/* ===== AI生成状态 ===== */
.sound-ai-status {
    margin-top: 16px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
}

.sound-ai-status__progress {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sound-ai-status__icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--sound-accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sound-accent);
}

.sound-ai-status__icon.success {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.sound-ai-status__icon.error {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.sound-ai-status__text {
    flex: 1;
}

.sound-ai-status__message {
    font-size: 14px;
    color: white;
}

.sound-ai-progress-bar {
    margin-top: 12px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.sound-ai-progress-bar__fill {
    height: 100%;
    background: var(--sound-accent);
    transition: width 0.3s;
}

/* ===== 生成结果 ===== */
.sound-ai-result {
    margin-top: 20px;
    padding: 16px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 8px;
}

.sound-ai-result__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.sound-ai-result__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--sound-accent);
}

.sound-ai-result__player {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sound-result-play-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--sound-gradient);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.sound-result-play-btn:hover {
    transform: scale(1.05);
}

.sound-result-progress {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.sound-result-progress__fill {
    height: 100%;
    background: var(--sound-accent);
    border-radius: 2px;
}

.sound-result-time {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

/* ===== 加载和空状态 ===== */
.sound-loading,
.sound-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: rgba(255, 255, 255, 0.4);
}

.sound-empty svg {
    margin-bottom: 16px;
    opacity: 0.3;
}

.sound-empty h3 {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 8px;
}

/* ===== 加载更多 ===== */
.sound-load-more {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
}

.sound-load-more__hint {
    color: rgba(255, 255, 255, 0.3);
}

/* ===== 动画 ===== */
.spin {
    animation: spin 1s linear infinite;
}

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

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--sound-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
}

.spinner--small {
    width: 16px;
    height: 16px;
}

/* ===== 响应式 ===== */
@media (max-width: 1200px) {
    .sound-sidebar {
        width: 240px;
    }
}

@media (max-width: 1024px) {
    .sound-sidebar {
        width: 200px;
    }
    
    .sound-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

@media (max-width: 768px) {
    .sound-main {
        flex-direction: column;
    }
    
    .sound-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 16px;
    }
    
    .sound-content {
        padding: 16px;
    }
    
    .sound-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
    
    .sound-form-row {
        grid-template-columns: 1fr;
    }
    
    .sound-modal {
        width: 95%;
        max-width: none;
    }
}

