/**
 * 音乐乐谱编辑器 - 前端样式
 */

/* 容器 */
.mse-score-container,
.mse-editor-container,
.mse-score-list {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    max-width: 1000px;
    margin: 0 auto;
}

/* 消息提示 */
.mse-message {
    padding: 12px 16px;
    border-radius: 4px;
    margin-top: 16px;
    display: none;
}

.mse-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.mse-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.mse-error,
.mse-notice {
    padding: 16px;
    border-radius: 4px;
    text-align: center;
}

.mse-error {
    background: #f8d7da;
    color: #721c24;
}

.mse-notice {
    background: #fff3cd;
    color: #856404;
}

/* 乐谱头部 */
.mse-score-header {
    margin-bottom: 16px;
}

.mse-score-title {
    font-size: 24px;
    margin: 0 0 8px 0;
    color: #333;
}

.mse-score-meta {
    font-size: 14px;
    color: #666;
}

.mse-score-meta span {
    margin-right: 16px;
}

.mse-score-meta span::before {
    content: '';
}

/* 工具栏 */
.mse-score-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 12px;
    background: #f5f5f5;
    border-radius: 4px;
    margin-bottom: 16px;
}

.mse-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.mse-btn-primary {
    background: #007bff;
    color: #fff;
}

.mse-btn-primary:hover {
    background: #0056b3;
}

.mse-btn-secondary {
    background: #6c757d;
    color: #fff;
}

.mse-btn-secondary:hover {
    background: #545b62;
}

.mse-btn-danger {
    background: #dc3545;
    color: #fff;
}

.mse-btn-danger:hover {
    background: #c82333;
}

.mse-btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

.mse-btn-play {
    background: #28a745;
    color: #fff;
}

.mse-btn-play:hover {
    background: #218838;
}

.mse-btn-like.liked {
    color: #dc3545;
}

.mse-btn-like.liked .dashicons {
    color: #dc3545;
}

/* 速度控制 */
.mse-speed-control {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.mse-speed-control select {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* 乐谱输出区域 */
.mse-score-output {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 16px;
    overflow-x: auto;
}

.mse-score-output svg {
    max-width: 100%;
    height: auto;
}

.mse-abc-display {
    font-family: monospace;
    white-space: pre-wrap;
    line-height: 1.6;
}

/* 音频控制 */
.mse-score-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 16px;
}

.mse-tempo-control,
.mse-volume-control {
    flex: 1;
    min-width: 200px;
}

.mse-tempo-control label,
.mse-volume-control label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.mse-tempo,
.mse-volume {
    width: 100%;
    cursor: pointer;
}

/* ABC 源码 */
.mse-abc-source {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #ddd;
}

.mse-abc-source h3 {
    font-size: 16px;
    margin: 0 0 8px 0;
}

.mse-abc-source pre {
    background: #f5f5f5;
    padding: 16px;
    border-radius: 4px;
    overflow-x: auto;
    font-family: monospace;
    font-size: 13px;
    line-height: 1.6;
}

/* 编辑器样式 */
.mse-editor-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 16px 0;
}

@media (max-width: 768px) {
    .mse-editor-main {
        grid-template-columns: 1fr;
    }
}

.mse-abc-panel,
.mse-preview-panel {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.mse-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
}

.mse-panel-header h3 {
    margin: 0;
    font-size: 14px;
}

.mse-toolbar {
    display: flex;
    gap: 4px;
}

#mse-abc-editor {
    width: 100%;
    min-height: 300px;
    padding: 16px;
    font-family: monospace;
    font-size: 14px;
    line-height: 1.6;
    border: none;
    resize: vertical;
}

.mse-editor-help {
    padding: 12px 16px;
    background: #f8f9fa;
    border-top: 1px solid #ddd;
    font-size: 12px;
}

.mse-editor-help h4 {
    margin: 0 0 8px 0;
    font-size: 12px;
}

.mse-editor-help ul {
    margin: 0;
    padding-left: 16px;
}

.mse-editor-help li {
    margin-bottom: 4px;
}

.mse-editor-help code {
    background: #e9ecef;
    padding: 2px 4px;
    border-radius: 2px;
}

.mse-preview-output {
    min-height: 200px;
    padding: 16px;
    overflow-x: auto;
}

.mse-preview-controls {
    display: flex;
    gap: 8px;
}

/* 音频播放控制 */
.mse-audio-control {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-top: 1px solid #ddd;
}

.mse-progress-bar {
    flex: 1;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    overflow: hidden;
}

.mse-progress {
    height: 100%;
    width: 0;
    background: #007bff;
    transition: width 0.1s;
}

.mse-time {
    font-size: 12px;
    color: #666;
}

/* 乐谱列表 */
.mse-score-list {
    display: grid;
    gap: 16px;
}

.mse-empty {
    text-align: center;
    padding: 40px;
    color: #999;
}

.mse-score-item {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.mse-score-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.mse-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
}

.mse-item-title {
    margin: 0;
    font-size: 16px;
}

.mse-item-title a {
    color: #333;
    text-decoration: none;
}

.mse-item-title a:hover {
    color: #007bff;
}

.mse-item-category {
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: #666;
}

.mse-item-meta {
    display: flex;
    gap: 16px;
    padding: 8px 16px;
    background: #f8f9fa;
    font-size: 12px;
    color: #666;
}

.mse-item-preview {
    padding: 16px;
    min-height: 80px;
    background: #fff;
}

/* 响应式 */
@media (max-width: 600px) {
    .mse-score-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .mse-speed-control {
        margin-left: 0;
    }
    
    .mse-score-controls {
        flex-direction: column;
    }
    
    .mse-item-meta {
        flex-wrap: wrap;
        gap: 8px;
    }
}

/* 动画 */
@keyframes mse-fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mse-score-container,
.mse-editor-container {
    animation: mse-fadeIn 0.3s ease;
}

/* 选项卡 */
.mse-editor-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 2px solid #eee;
}

.mse-tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    transition: all 0.2s;
}

.mse-tab-btn:hover {
    color: #007bff;
}

.mse-tab-btn.active {
    color: #007bff;
    border-bottom-color: #007bff;
}

.mse-tab-content {
    display: none;
}

.mse-tab-content.active {
    display: block;
}

/* 可视化打谱界面 */
.mse-pianoroll {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.mse-pianoroll-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 12px 16px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
}

.mse-pr-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mse-pr-group label {
    font-size: 12px;
    font-weight: 600;
    color: #666;
}

.mse-pr-btn {
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.mse-pr-btn:hover {
    background: #e9ecef;
}

.mse-pr-btn.active {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

.mse-dot-indicator {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: currentColor;
    border-radius: 50%;
    margin-right: 4px;
}

/* 五线谱和钢琴 */
.mse-pianoroll-main {
    overflow-x: auto;
    padding: 20px;
}

.mse-staff-container {
    display: flex;
    min-height: 200px;
}

.mse-staff {
    flex: 1;
    position: relative;
    min-width: 600px;
    height: 160px;
    background: #fff;
    border-left: 1px solid #ddd;
    margin-left: 40px;
}

.mse-staff-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: #333;
}

.mse-staff-line.line-0 { top: 120px; }
.mse-staff-line.line-1 { top: 100px; }
.mse-staff-line.line-2 { top: 80px; }
.mse-staff-line.line-3 { top: 60px; }
.mse-staff-line.line-4 { top: 40px; }

.mse-staff-treble-clef {
    position: absolute;
    left: 8px;
    top: 40px;
    font-size: 48px;
    color: #333;
}

/* 钢琴键盘 */
.mse-piano-keys {
    display: flex;
    width: 800px;
    height: 100px;
    margin-left: 40px;
}

.mse-piano-key {
    position: relative;
    height: 100%;
    border: 1px solid #333;
    border-radius: 0 0 4px 4px;
    cursor: pointer;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 4px;
    transition: all 0.1s;
}

.mse-piano-key.white {
    width: 30px;
    background: linear-gradient(180deg, #fff 0%, #f5f5f5 100%);
    border-bottom: 4px solid #ddd;
}

.mse-piano-key.black {
    width: 20px;
    height: 60%;
    background: linear-gradient(180deg, #333 0%, #1a1a1a 100%);
    border-bottom: 4px solid #000;
    margin-left: -10px;
    margin-right: -10px;
    z-index: 1;
}

.mse-piano-key:hover {
    background: #e3f2fd;
}

.mse-piano-key.black:hover {
    background: #555;
}

.mse-piano-key.playing {
    background: #c8e6c9;
}

.mse-piano-key.black.playing {
    background: #4caf50;
}

.mse-key-label {
    font-size: 10px;
    color: #666;
}

.mse-piano-key.black .mse-key-label {
    color: #999;
}

/* 音符显示 */
.mse-note-item {
    position: absolute;
    top: 80px;
    cursor: pointer;
    user-select: none;
}

.mse-note-head {
    display: inline-block;
    width: 14px;
    height: 10px;
    background: #333;
    border-radius: 50%;
    transform: rotate(-15deg);
}

.mse-note-item.rest .mse-note-head {
    display: none;
}

.mse-note-item.rest::before {
    content: '𝄽';
    font-size: 20px;
    position: absolute;
    top: -5px;
    left: 0;
}

.mse-note-delete {
    display: none;
    position: absolute;
    top: -8px;
    right: -8px;
    width: 16px;
    height: 16px;
    background: #dc3545;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    line-height: 16px;
    cursor: pointer;
}

.mse-note-item:hover .mse-note-delete {
    display: block;
}

.mse-note-dot {
    position: absolute;
    top: 2px;
    right: -6px;
    width: 4px;
    height: 4px;
    background: #333;
    border-radius: 50%;
}

.mse-accidental {
    font-size: 14px;
    margin-right: 2px;
}

/* 底部信息栏 */
.mse-pianoroll-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f5f5f5;
    border-top: 1px solid #ddd;
}

.mse-pr-info {
    display: flex;
    gap: 24px;
    font-size: 13px;
    color: #666;
}

.mse-pr-actions {
    display: flex;
    gap: 8px;
}

/* 导入导出界面 */
.mse-import-export {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    padding: 16px;
}

.mse-import-section,
.mse-export-section,
.mse-sample-section {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
}

.mse-import-section h3,
.mse-export-section h3,
.mse-sample-section h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
}

.mse-import-section p,
.mse-export-section p,
.mse-sample-section p {
    margin: 0 0 16px 0;
    color: #666;
    font-size: 13px;
}

.mse-file-upload {
    margin-bottom: 16px;
}

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

.mse-file-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #f5f5f5;
    border: 2px dashed #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.mse-file-label:hover {
    border-color: #007bff;
    background: #e3f2fd;
}

.mse-file-name {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: #666;
}

.mse-import-result {
    margin-top: 16px;
}

.mse-import-result .mse-success {
    padding: 12px;
    background: #d4edda;
    color: #155724;
    border-radius: 4px;
}

.mse-import-result .mse-error {
    padding: 12px;
    background: #f8d7da;
    color: #721c24;
    border-radius: 4px;
}

.mse-sample-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mse-sample-btn {
    padding: 8px 16px;
    background: #e9ecef;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.mse-sample-btn:hover {
    background: #007bff;
    color: #fff;
}

.mse-hint {
    margin-top: 8px;
    font-size: 12px;
    color: #666;
}
