/**
 * Rabbithole Timeline Editor Styles
 */

/* Editor Panel */
.timeline-editor {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    margin-bottom: 10px;
}

.editor-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #4a7c59;
}

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

/* Marker List */
.marker-list {
    max-height: 400px;
    overflow-y: auto;
}

.marker-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}

.marker-row:hover {
    background: #f5f5f5;
}

.marker-row.selected {
    background: rgba(74, 124, 89, 0.1);
    border-left: 3px solid #4a7c59;
    padding-left: 5px;
}

.marker-row.playing {
    background: rgba(74, 124, 89, 0.15);
}

.marker-row.selected.playing {
    background: rgba(74, 124, 89, 0.2);
}

/* Time Section */
.marker-time-section {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.btn-play-from {
    width: 20px;
    height: 20px;
    border: none;
    background: #4a7c59;
    color: white;
    border-radius: 3px;
    cursor: pointer;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.btn-play-from:hover {
    background: #3a6347;
}

.marker-time-input {
    width: 60px;
    padding: 3px 6px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 12px;
    text-align: center;
    background: #fafafa;
}

.marker-time-input:focus {
    outline: none;
    border-color: #4a7c59;
    background: white;
}

.marker-time-input:not([readonly]) {
    background: white;
    border-color: #4a7c59;
}

/* Marker Info */
.marker-info {
    flex: 1;
    color: #555;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Marker Row - restructured for expandable YAML */
.marker-row {
    display: flex;
    flex-direction: column;
    padding: 0;
    border-radius: 4px;
    transition: background 0.15s;
    border: 1px solid transparent;
    margin-bottom: 2px;
}

.marker-row:hover {
    background: #f5f5f5;
}

.marker-row.expanded {
    border-color: #4a7c59;
    background: #fafafa;
}

.marker-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    cursor: pointer;
}

/* Marker Actions */
.marker-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s;
}

.marker-row:hover .marker-actions,
.marker-row.expanded .marker-actions {
    opacity: 1;
}

.btn-toggle-yaml,
.btn-delete-marker {
    padding: 3px 8px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.15s;
}

.btn-toggle-yaml:hover {
    background: #4a7c59;
    color: white;
    border-color: #4a7c59;
}

.btn-delete-marker {
    color: #c00;
    border-color: #fcc;
}

.btn-delete-marker:hover {
    background: #c00;
    color: white;
    border-color: #c00;
}

/* YAML Editor */
.marker-yaml-editor {
    padding: 8px 12px 12px;
    border-top: 1px solid #e0e0e0;
    background: #f9f9f9;
}

.yaml-input {
    width: 100%;
    min-height: 80px;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.4;
    resize: vertical;
    background: white;
}

.yaml-input:focus {
    outline: none;
    border-color: #4a7c59;
    box-shadow: 0 0 0 2px rgba(74, 124, 89, 0.15);
}

.yaml-input::placeholder {
    color: #aaa;
}

.yaml-error {
    font-size: 11px;
    min-height: 16px;
    margin-top: 4px;
}

.yaml-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.btn-apply-yaml {
    padding: 5px 14px;
    background: #4a7c59;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
}

.btn-apply-yaml:hover {
    background: #3a6347;
}

.yaml-hint {
    font-size: 11px;
    color: #888;
}

/* Add Marker Button */
.btn-add-marker {
    padding: 5px 12px;
    background: #4a7c59;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: background 0.15s;
}

.btn-add-marker:hover {
    background: #3a6347;
}

/* Editor Footer */
.editor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid #eee;
    margin-top: 10px;
}

.dirty-indicator {
    font-size: 11px;
    color: #4a7c59;
    padding: 3px 8px;
    background: rgba(74, 124, 89, 0.1);
    border-radius: 3px;
}

.dirty-indicator.dirty {
    color: #c60;
    background: rgba(204, 102, 0, 0.1);
}

.editor-controls {
    display: flex;
    gap: 6px;
}

.btn-undo,
.btn-redo,
.btn-revert {
    padding: 4px 10px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.15s;
}

.btn-undo:hover:not(:disabled),
.btn-redo:hover:not(:disabled) {
    background: #f0f0f0;
}

.btn-revert:hover:not(:disabled) {
    background: #ffeee0;
    border-color: #c60;
    color: #c60;
}

.btn-undo:disabled,
.btn-redo:disabled,
.btn-revert:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Marker Editor Modal */
.marker-editor-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.marker-editor-dialog {
    background: white;
    border-radius: 8px;
    padding: 20px;
    min-width: 400px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.marker-editor-dialog h4 {
    margin: 0 0 15px 0;
    color: #4a7c59;
    font-size: 16px;
}

.editor-field {
    margin-bottom: 12px;
}

.editor-field label {
    display: block;
    font-weight: 500;
    margin-bottom: 4px;
    color: #333;
    font-size: 12px;
}

.editor-field select {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

.editor-field select:focus {
    outline: none;
    border-color: #4a7c59;
}

/* Musician Toggles */
.musician-toggles {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
    background: #fafafa;
    border-radius: 4px;
}

.musician-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.musician-toggle .musician-name {
    flex: 1;
    font-size: 12px;
}

.musician-toggle select {
    width: 120px;
    padding: 4px 8px;
    font-size: 11px;
}

/* Dialog Buttons */
.dialog-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.btn-cancel,
.btn-save {
    padding: 8px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.15s;
}

.btn-cancel {
    background: #f0f0f0;
    color: #333;
}

.btn-cancel:hover {
    background: #e0e0e0;
}

.btn-save {
    background: #4a7c59;
    color: white;
}

.btn-save:hover {
    background: #3a6347;
}

/* Save to Wiki Button */
.btn-save-wiki {
    padding: 6px 14px;
    background: linear-gradient(135deg, #4a7c59 0%, #3a6347 100%);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-save-wiki:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(74, 124, 89, 0.3);
}

.btn-save-wiki:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-save-wiki.saving {
    background: #999;
}

/* Editor Toggle Button */
.editor-toggle-btn {
    padding: 8px 14px;
    background: #4a7c59;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s;
}

.editor-toggle-btn:hover {
    background: #3a6347;
}

.editor-toggle-btn.active {
    background: #2d5016;
}

/* Editor Panel (side panel variant) */
.editor-panel {
    background: #fff;
    border-left: 2px solid #4a7c59;
    height: 100%;
    overflow-y: auto;
    transition: width 0.3s ease;
}

.editor-panel.collapsed {
    width: 0;
    overflow: hidden;
}

/* Keyboard Shortcut Help */
.keyboard-help {
    padding: 10px;
    background: #f5f5f5;
    border-radius: 4px;
    font-size: 11px;
    color: #666;
    margin-top: 10px;
}

.keyboard-help h5 {
    margin: 0 0 8px 0;
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

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

.keyboard-help kbd {
    display: inline-block;
    padding: 2px 5px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-family: monospace;
    font-size: 10px;
}

/* Raw YAML Mode */
.timeline-editor.raw-mode {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.raw-yaml-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 300px;
}

.raw-yaml-input {
    flex: 1;
    width: 100%;
    min-height: 400px;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
    background: #fefefe;
    tab-size: 2;
}

.raw-yaml-input:focus {
    outline: none;
    border-color: #4a7c59;
    box-shadow: 0 0 0 2px rgba(74, 124, 89, 0.15);
}

.raw-yaml-error {
    min-height: 20px;
    margin-top: 6px;
    font-size: 12px;
}

.raw-yaml-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 10px 0;
    flex-wrap: wrap;
}

.btn-apply-raw-yaml {
    padding: 8px 20px;
    background: #4a7c59;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}

.btn-apply-raw-yaml:hover {
    background: #3a6347;
}

.current-time-display {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 12px;
    color: #666;
    background: #f0f0f0;
    padding: 4px 10px;
    border-radius: 3px;
}

.btn-toggle-mode {
    padding: 5px 12px;
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s;
}

.btn-toggle-mode:hover {
    background: #e0e0e0;
    border-color: #999;
}

/* Responsive */
@media (max-width: 600px) {
    .marker-editor-dialog {
        min-width: auto;
        width: 95vw;
    }

    .marker-row {
        flex-wrap: wrap;
    }

    .marker-info {
        width: 100%;
        order: 3;
        margin-top: 4px;
    }
}
