/* ============================
   Music AI Tools — MusicAI
   AI写歌 / 音频转谱 / 乐谱渲染
   ============================ */

.music-ai-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.music-ai-page .back-link {
    display: inline-block;
    color: #4a90d9;
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 16px;
    cursor: pointer;
    transition: color 0.2s;
}
.music-ai-page .back-link:hover {
    color: #357abd;
}

.music-ai-page h1 {
    font-size: 22px;
    font-weight: 600;
    color: #333;
    margin: 0 0 8px 0;
}

.music-ai-page > p {
    font-size: 14px;
    color: #888;
    margin: 0 0 20px 0;
}

/* 表单 */
.music-ai-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
    color: #555;
}

.form-group textarea,
.form-group input[type="text"],
.form-group select {
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    color: #333;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    font-family: inherit;
}

.form-group textarea:focus,
.form-group input[type="text"]:focus,
.form-group select:focus {
    border-color: #4a90d9;
    box-shadow: 0 0 0 2px rgba(74,144,217,0.15);
}

.form-group textarea::placeholder {
    color: #bbb;
}

/* 时长滑块 */
.form-group input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e8e8e8;
    outline: none;
    transition: background 0.2s;
    border: none;
    padding: 0;
}

.form-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4a90d9;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    transition: transform 0.15s;
}

.form-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.form-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4a90d9;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.form-group input[type="range"]::-ms-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4a90d9;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

#ma-duration-val {
    font-weight: 600;
    color: #4a90d9;
}

/* 风格标签（写歌用） */
.music-style-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.music-style-tag {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid #d9d9d9;
    font-size: 13px;
    color: #666;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.music-style-tag:hover {
    border-color: #4a90d9;
    color: #4a90d9;
}

.music-style-tag.selected {
    background: #4a90d9;
    color: #fff;
    border-color: #4a90d9;
}

/* 拖拽上传区 */
.music-upload-zone {
    border: 2px dashed #d9d9d9;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: #fafafa;
}

.music-upload-zone:hover {
    border-color: #4a90d9;
    background: #f0f7ff;
}

.music-upload-zone.dragover {
    border-color: #4a90d9;
    background: #e8f1fd;
}

.music-upload-zone .upload-icon {
    font-size: 40px;
    display: block;
    margin-bottom: 12px;
}

.music-upload-zone .upload-text {
    font-size: 15px;
    color: #666;
    margin-bottom: 4px;
}

.music-upload-zone .upload-hint {
    font-size: 12px;
    color: #aaa;
}

.music-upload-zone .file-info {
    margin-top: 12px;
    padding: 8px 12px;
    background: #e8f1fd;
    border-radius: 8px;
    font-size: 13px;
    color: #4a90d9;
    display: inline-block;
}

.music-upload-zone input[type="file"] {
    display: none;
}

/* 按钮 */
.btn-primary {
    background: #4a90d9;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 24px;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}

.btn-primary:hover {
    background: #357abd;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    background: #b0cfe8;
    cursor: not-allowed;
    transform: none;
}

/* 辅助按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    border: 1px solid #d9d9d9;
    background: #fff;
    color: #555;
    font-family: inherit;
}

.btn:hover {
    border-color: #4a90d9;
    color: #4a90d9;
}

/* 结果区域 */
.music-ai-result {
    margin-top: 8px;
}

.ma-success {
    padding: 12px 16px;
    background: #f0fff4;
    border: 1px solid #52c41a;
    border-radius: 8px;
    color: #389e0d;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 12px;
}

.ma-error {
    padding: 12px 16px;
    background: #fff2f0;
    border: 1px solid #ff4d4f;
    border-radius: 8px;
    color: #cf1322;
    font-size: 14px;
    font-weight: 500;
}

.ma-loading {
    padding: 16px;
    text-align: center;
    color: #888;
    font-size: 15px;
}

/* 音频播放器区 */
.ma-player {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 12px;
}

.ma-player audio {
    width: 100%;
    outline: none;
}

.ma-player audio::-webkit-media-controls-panel {
    background: #f5f5f5;
}

/* AI 解读区域 */
.ma-interpretation {
    padding: 12px 16px;
    background: #f0f5ff;
    border: 1px solid #adc6ff;
    border-radius: 8px;
    color: #1d39c4;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 12px;
}
.ma-interpretation::before {
    content: '🤖 ';
}

/* 图片预览区 */
.ma-image-preview {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    text-align: center;
}

.ma-image-preview img {
    max-width: 100%;
    max-height: 500px;
    border-radius: 6px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.1);
}

/* MIDI 信息 */
.ma-midi-info {
    display: flex;
    gap: 16px;
    margin-top: 8px;
    margin-bottom: 12px;
}

.ma-midi-info-item {
    padding: 8px 16px;
    background: #f0f7ff;
    border-radius: 8px;
    font-size: 13px;
    color: #4a90d9;
}

/* 粘贴区（乐谱渲染） */
.music-paste-zone {
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    padding: 12px;
}

.music-paste-zone textarea {
    width: 100%;
    border: none;
    outline: none;
    resize: vertical;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #333;
    background: #fafafa;
    padding: 8px;
    border-radius: 6px;
    min-height: 120px;
    box-sizing: border-box;
}

.music-paste-zone textarea:focus {
    background: #fff;
}

/* 表单底部操作栏 */
.form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

/* 结果区内的按钮行（下载MIDI/CSV 等） */
.ma-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

/* 时长/高级参数滑块：滑块 + 数值并排 */
.ma-slider-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.ma-slider-row input[type="range"] {
    flex: 1;
}
.ma-slider-val {
    min-width: 48px;
    text-align: right;
    font-weight: 600;
    color: #4a90d9;
    font-size: 14px;
}

/* 高级参数折叠面板（默认收起，点 summary 展开） */
.ma-advanced {
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 4px 12px;
    background: #fafafa;
}
.ma-advanced > summary {
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #555;
    padding: 8px 0;
    user-select: none;
    list-style: none;
}
.ma-advanced > summary::-webkit-details-marker {
    display: none;
}
.ma-advanced > summary::before {
    content: '▸ ';
    color: #4a90d9;
}
.ma-advanced[open] > summary::before {
    content: '▾ ';
}
.ma-advanced-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 8px 0 12px 0;
}

/* ERG / 开关组 */
.ma-toggles {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 4px 0;
}

/* 开关（复选框样式化为切换） */
.ma-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    font-size: 14px;
    color: #555;
}
.ma-toggle input {
    display: none;
}
.ma-toggle-track {
    position: relative;
    width: 44px;
    height: 24px;
    border-radius: 12px;
    background: #d9d9d9;
    flex: 0 0 auto;
    transition: background 0.2s;
}
.ma-toggle-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
}
.ma-toggle input:checked + .ma-toggle-track {
    background: #4a90d9;
}
.ma-toggle input:checked + .ma-toggle-track::after {
    transform: translateX(20px);
}

/* 生成结果元信息（时长/尺寸等） */
.ma-meta-row,
.ma-sheet-meta {
    margin: 8px 0 12px 0;
    padding: 8px 12px;
    background: #f0f7ff;
    border-radius: 8px;
    font-size: 13px;
    color: #4a90d9;
}

/* 音符明细表格（可滚动） */
.ma-notes-wrap {
    margin-top: 12px;
}
.ma-notes-title {
    font-size: 14px;
    font-weight: 500;
    color: #555;
    margin-bottom: 8px;
}
.ma-notes-scroll {
    max-height: 320px;
    overflow: auto;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
}
.ma-notes-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.ma-notes-table thead th {
    position: sticky;
    top: 0;
    background: #4a90d9;
    color: #fff;
    font-weight: 500;
    padding: 8px 10px;
    text-align: left;
    white-space: nowrap;
}
.ma-notes-table tbody td {
    padding: 6px 10px;
    border-top: 1px solid #f0f0f0;
    color: #333;
    font-family: 'Courier New', monospace;
    white-space: nowrap;
}
.ma-notes-table tbody tr:nth-child(even) {
    background: #fafafa;
}
.ma-notes-table tbody tr:hover {
    background: #e8f1fd;
}

/* v2.4：WAV→MP3 前端转码下载，WAV 原始格式链接轻量化 */
.ma-wav-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
}
.ma-wav-hint a {
    color: #999;
    text-decoration: underline;
}
.ma-wav-hint a:hover {
    color: #666;
}

/* ============================
   音乐参数 - 风格标签组
   ============================ */
.ma-tags-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.ma-tag {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 16px;
    border: 1px solid #d9d9d9;
    font-size: 13px;
    color: #666;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}
.ma-tag:hover {
    border-color: #4a90d9;
    color: #4a90d9;
}
.ma-tag.selected {
    background: #4a90d9;
    color: #fff;
    border-color: #4a90d9;
}

/* 音乐参数 - 乐器/调性/拍号 三列并排 */
.ma-select-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

/* BPM滑块数值 */
#ma-bpm-val {
    font-weight: 600;
    color: #4a90d9;
}

/* 作品保存成功提示 */
.ma-save-notice {
    padding: 10px 14px;
    background: #f0fff4;
    border: 1px solid #52c41a;
    border-radius: 8px;
    color: #389e0d;
    font-size: 13px;
    margin-bottom: 12px;
}
.ma-save-notice a {
    color: #4a90d9;
    text-decoration: underline;
    cursor: pointer;
    margin-left: 8px;
}
