/* 弹窗样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
}

.modal-container {
    background: white;
    border-radius: 20px;
    max-width: 95vw;
    max-height: 95vh;
    width: 1200px;
    height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25);
    animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem 1rem;
    border-bottom: 1px solid #f0f2f5;
    background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
    flex-shrink: 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #1a1a1a;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-header h2::before {
    content: "🎵";
    font-size: 1.25rem;
}

.modal-close {
    background: #f5f5f7;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #666;
}

.modal-close:hover {
    background: #e8e8ea;
    color: #333;
    transform: scale(1.05);
}

.modal-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
    z-index: 1;
}

.modal-footer {
    padding: 1rem 2rem 1.5rem;
    border-top: 1px solid #f0f2f5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafbfc;
    flex-shrink: 0;
}

.modal-footer .btn-secondary {
    background: #f3f4f6;
    color: #6b7280;
    border: 2px solid #e5e7eb;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
}

.modal-footer .btn-secondary:hover {
    background: #e5e7eb;
    color: #374151;
    transform: translateY(-1px);
}

.modal-footer .btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    border: 2px solid #3b82f6;
    padding: 0.75rem 2rem;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    cursor: pointer;
}

.modal-footer .btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.modal-footer .btn-primary:disabled {
    background: #d1d5db;
    border-color: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
    box-shadow: none;
}

/* 多音字弹窗 */
.phoneme-modal {
    width: 500px;
}

.phoneme-editor {
    text-align: center;
}

.phoneme-word {
    font-size: 2rem;
    font-weight: 500;
    color: #333;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 12px;
}

.phoneme-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
}

.phoneme-option {
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    text-align: center;
}

.phoneme-option:hover {
    border-color: #1976d2;
    background: rgba(25, 118, 210, 0.05);
}

.phoneme-option.selected {
    border-color: #1976d2;
    background: #1976d2;
    color: white;
}

.phoneme-pinyin {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.phoneme-example {
    font-size: 0.8rem;
    color: #666;
}

.phoneme-option.selected .phoneme-example {
    color: rgba(255, 255, 255, 0.8);
}

/* 加载指示器样式 */
.loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e3f2fd;
    border-top: 3px solid #1976d2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    color: #666;
    font-size: 0.9rem;
    text-align: center;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .modal-container {
        width: 95vw;
        height: 90vh;
    }
    
    .voice-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 0.75rem;
        padding: 1rem;
    }
}

@media (max-width: 768px) {
    .search-favorites-row {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }
    
    .filter-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .voice-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        padding: 0.75rem;
    }
    
    .voice-filters {
        padding: 0.75rem 1rem;
    }
}

@media (max-width: 640px) {
    .modal-container {
        width: 98vw;
        height: 95vh;
        border-radius: 12px;
    }
    
    .voice-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 0.5rem;
        padding: 0.5rem;
    }
    
    .filter-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.75rem;
    }
}