/* CSS Custom Properties - Design System */
:root {
    /* Colors */
    --primary-900: #1e293b;
    --primary-800: #334155;
    --primary-700: #475569;
    --primary-600: #64748b;
    --primary-500: #94a3b8;
    --primary-400: #cbd5e1;
    --primary-300: #e2e8f0;
    --primary-200: #f1f5f9;
    --primary-100: #f8fafc;
    --primary-50: #fefefe;

    --accent-700: #1d4ed8;
    --accent-600: #2563eb;
    --accent-500: #3b82f6;
    --accent-400: #60a5fa;
    --accent-300: #93c5fd;

    --success-700: #047857;
    --success-600: #059669;
    --success-500: #10b981;
    --success-400: #34d399;

    --warning-600: #d97706;
    --warning-500: #f59e0b;

    --error-600: #dc2626;
    --error-500: #ef4444;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;

    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-normal: 250ms ease-in-out;
    --transition-slow: 350ms ease-in-out;
}

/* Dark Theme Variables */
[data-theme="dark"] {
    /* Dark Colors */
    --primary-900: #f8fafc;
    --primary-800: #f1f5f9;
    --primary-700: #e2e8f0;
    --primary-600: #cbd5e1;
    --primary-500: #94a3b8;
    --primary-400: #64748b;
    --primary-300: #475569;
    --primary-200: #334155;
    --primary-100: #1e293b;
    --primary-50: #0f172a;

    /* Dark theme specific colors */
    --dark-900: #0f172a;
    --dark-800: #1e293b;
    --dark-700: #334155;
    --dark-600: #475569;
    --dark-500: #64748b;

    /* Shadows for dark mode */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.3);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.5), 0 8px 10px -6px rgb(0 0 0 / 0.4);
}

/* Base Styles & Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--primary-900);
    background: linear-gradient(135deg, var(--primary-100) 0%, var(--primary-200) 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: var(--space-4);
    overflow-x: hidden;
    gap: var(--space-4);
    transition: background var(--transition-normal), color var(--transition-normal);
}

[data-theme="dark"] body {
    background: linear-gradient(135deg, var(--dark-900) 0%, var(--dark-800) 100%);
}

/* Typography */
h1 {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--primary-900);
    margin-bottom: 0;
    text-align: center;
    letter-spacing: -0.025em;
    transition: color var(--transition-normal);
}

h3 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--primary-800);
    margin-bottom: var(--space-4);
    letter-spacing: -0.025em;
    transition: color var(--transition-normal);
}

label {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--primary-700);
    display: block;
    margin-bottom: var(--space-3);
    transition: color var(--transition-normal);
}

/* Piano Styling */
.piano-container {
    width: 100%;
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: var(--space-6);
    overflow-x: auto;
    position: relative;
    transition: background var(--transition-normal), box-shadow var(--transition-normal);
}

[data-theme="dark"] .piano-container {
    background: var(--dark-800);
    border: 1px solid var(--dark-600);
}

.piano {
    display: flex;
    width: max-content;
    margin: 0 auto;
    position: relative;
}

.key {
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    user-select: none;
}

.white {
    width: 60px;
    height: 240px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid var(--primary-300);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.8),
        0 2px 4px rgba(0, 0, 0, 0.1),
        0 1px 2px rgba(0, 0, 0, 0.05);
    z-index: 1;
    transition: all var(--transition-fast);
}

[data-theme="dark"] .white {
    background: linear-gradient(180deg, var(--dark-600) 0%, var(--dark-700) 100%);
    border: 1px solid var(--dark-500);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 2px 4px rgba(0, 0, 0, 0.3),
        0 1px 2px rgba(0, 0, 0, 0.2);
}

.white:hover {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    transform: translateY(1px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.8),
        0 1px 2px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .white:hover {
    background: linear-gradient(180deg, var(--dark-500) 0%, var(--dark-600) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        0 1px 2px rgba(0, 0, 0, 0.3);
}

.white.active {
    background: linear-gradient(180deg, var(--accent-400) 0%, var(--accent-500) 100%);
    color: white;
    transform: translateY(2px);
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.2),
        0 1px 2px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .white.active {
    background: linear-gradient(180deg, var(--accent-500) 0%, var(--accent-600) 100%);
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.4),
        0 1px 2px rgba(0, 0, 0, 0.3);
}

.black {
    width: 40px;
    height: 160px;
    background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    margin-left: -20px;
    margin-right: -20px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 4px 8px rgba(0, 0, 0, 0.3),
        0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 2;
    transition: all var(--transition-fast);
}

[data-theme="dark"] .black {
    background: linear-gradient(180deg, var(--dark-900) 0%, #0c1017 100%);
    border: 1px solid var(--dark-800);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 4px 8px rgba(0, 0, 0, 0.6),
        0 2px 4px rgba(0, 0, 0, 0.4);
}

.black:hover {
    background: linear-gradient(180deg, #374151 0%, #1f2937 100%);
    transform: translateY(1px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 2px 4px rgba(0, 0, 0, 0.3),
        0 1px 2px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .black:hover {
    background: linear-gradient(180deg, var(--dark-800) 0%, var(--dark-900) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 2px 4px rgba(0, 0, 0, 0.6),
        0 1px 2px rgba(0, 0, 0, 0.4);
}

.black.active {
    background: linear-gradient(180deg, var(--accent-500) 0%, var(--accent-600) 100%);
    transform: translateY(2px);
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.3),
        0 1px 2px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .black.active {
    background: linear-gradient(180deg, var(--accent-400) 0%, var(--accent-500) 100%);
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.5),
        0 1px 2px rgba(0, 0, 0, 0.4);
}

/* Controls Container */
.controls-container {
    display: grid;
    grid-template-columns: 1.8fr 1fr;
    /* Flexible layout instead of fixed 600px 400px */
    gap: var(--space-4);
    justify-content: start;
    width: 100%;
}

/* Control Groups (Cards) */
.control-group {
    background: white;
    border-radius: var(--radius-md);
    padding: var(--space-4);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--primary-200);
    transition: all var(--transition-normal);
}


[data-theme="dark"] .control-group {
    background: var(--dark-800);
    border: 1px solid var(--dark-600);
}

[data-theme="dark"] .transport-controls-main {
    background: var(--dark-800);
    border: 1px solid var(--dark-600);
}

[data-theme="dark"] .progression-search-simple input {
    background: var(--dark-700);
    border: 1px solid var(--dark-500);
    color: var(--primary-100);
}

[data-theme="dark"] .progression-card {
    background: var(--dark-800);
    color: var(--primary-100);
}

[data-theme="dark"] .progression-card:hover {
    background: var(--dark-700);
}

[data-theme="dark"] .progression-card.selected {
    background: var(--dark-600);
}

[data-theme="dark"] .piano-roll-keyboard {
    background: var(--dark-700);
    border: 1px solid var(--dark-500);
}

[data-theme="dark"] .keyboard-label {
    color: var(--primary-200);
    border-bottom-color: var(--dark-500);
}

[data-theme="dark"] .piano-key.white {
    background: var(--dark-600);
    color: var(--primary-200);
    border-color: var(--dark-400);
}

[data-theme="dark"] .piano-key.black {
    background: var(--dark-900);
    color: var(--primary-300);
}

[data-theme="dark"] .current-progression {
    background: var(--dark-700);
    border: 1px solid var(--dark-500);
}

[data-theme="dark"] .current-label {
    color: var(--accent-400);
}

[data-theme="dark"] .current-name {
    color: var(--accent-300);
}

[data-theme="dark"] .progression-list {
    background: var(--dark-800);
    border: 1px solid var(--dark-500);
}

[data-theme="dark"] .progression-item {
    color: var(--primary-200);
    border-bottom-color: var(--dark-600);
}

[data-theme="dark"] .progression-item:hover:not(.current) {
    background: var(--dark-700);
    color: var(--primary-100);
}

[data-theme="dark"] .progression-item.current {
    background: var(--dark-600);
    color: var(--accent-300);
    border-left: 3px solid var(--accent-500);
}

[data-theme="dark"] .progression-item.current:hover {
    background: var(--dark-500);
    color: var(--accent-200);
}

[data-theme="dark"] .progression-details-panel {
    background: var(--dark-700);
    border: 1px solid var(--dark-500);
}

[data-theme="dark"] .progression-details-panel h4 {
    color: var(--accent-300);
}

[data-theme="dark"] .detail-label {
    color: var(--accent-400);
}

[data-theme="dark"] .detail-value {
    color: var(--primary-200);
}

[data-theme="dark"] .close-details-btn {
    color: var(--accent-400);
}

[data-theme="dark"] .close-details-btn:hover {
    background: var(--dark-600);
    color: var(--accent-300);
}

[data-theme="dark"] .progression-card-beautiful {
    background: var(--dark-800);
    border: 1px solid var(--dark-600);
}

[data-theme="dark"] .progression-card-title-beautiful {
    color: var(--primary-100);
}

[data-theme="dark"] .progression-card-description-beautiful {
    color: var(--primary-300);
}

[data-theme="dark"] .progression-card-chords-beautiful {
    background: var(--dark-700);
    border: 1px solid var(--dark-500);
}

[data-theme="dark"] .chord-symbol {
    background: var(--dark-600);
    color: var(--accent-300);
    border: 1px solid var(--dark-400);
}

[data-theme="dark"] .chord-arrow {
    color: var(--primary-400);
}

[data-theme="dark"] .progression-card-clean {
    background: var(--dark-800);
    border: 1px solid var(--dark-600);
    color: var(--primary-100);
}

[data-theme="dark"] .progression-card-clean:hover {
    border-color: var(--dark-500);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .progression-card-title-clean {
    color: var(--primary-100);
}

[data-theme="dark"] .progression-card-description-clean {
    color: var(--primary-300);
}

[data-theme="dark"] .progression-card-details-clean {
    color: var(--primary-400);
}

[data-theme="dark"] .progression-card-chords-clean {
    background: var(--dark-700);
    border: 1px solid var(--dark-500);
    color: var(--primary-100);
}

.control-group:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* Form Groups */
.form-group {
    margin-bottom: var(--space-3);
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group-spaced {
    margin-top: var(--space-4);
}

.form-group-extra-spaced {
    margin-top: var(--space-6);
}

/* Select Styling */
select {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--primary-300);
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    background: white;
    color: var(--primary-900);
    transition: all var(--transition-fast);
    cursor: pointer;
}

select:hover {
    border-color: var(--primary-400);
}

select:focus {
    outline: none;
    border-color: var(--accent-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Button Styling */
button {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

.primary-button {
    background: linear-gradient(135deg, var(--accent-500) 0%, var(--accent-600) 100%);
    color: white;
    padding: var(--space-4) var(--space-6);
    font-weight: 600;
    font-size: var(--font-size-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--space-5);
    width: 100%;
}

.primary-button:hover {
    background: linear-gradient(135deg, var(--accent-600) 0%, var(--accent-700) 100%);
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

.primary-button:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.secondary-button {
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
    color: white;
    padding: var(--space-3) var(--space-5);
    font-weight: 500;
    font-size: var(--font-size-base);
    box-shadow: var(--shadow-sm);
    margin-left: var(--space-2);
}

.secondary-button:hover {
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.secondary-button:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

/* Playback Controls */
.playback-buttons {
    display: flex;
    align-items: center;
    margin-bottom: var(--space-4);
}

.playback-buttons .primary-button {
    margin-bottom: 0;
    flex: 1;
}

.repeat-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
    padding: var(--space-3);
    background: var(--primary-100);
    border-radius: var(--radius-md);
    border: 1px solid var(--primary-200);
}

.loop-counter {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--accent-600);
    background: var(--accent-100);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-sm);
    border: 1px solid var(--accent-200);
}

/* Tempo Controls */
.tempo-controls {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin: var(--space-4) 0;
}

.tempo-slider-container {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
}

#tempo-slider {
    flex: 1;
    min-width: 80px;
    height: 6px;
    background: var(--primary-300);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

#tempo-slider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--accent-500);
    border-radius: 50%;
    cursor: pointer;
}

#tempo-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--accent-500);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.tempo-display {
    min-width: 70px;
    text-align: center;
    font-weight: 600;
    color: var(--accent-600);
    font-size: var(--font-size-sm);
}

/* Octave Controls */
.octave-controls {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.octave-buttons {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    justify-content: center;
}

.octave-btn {
    width: 32px;
    height: 32px;
    background: var(--primary-100);
    color: var(--primary-700);
    border: 1px solid var(--primary-300);
    font-size: var(--font-size-lg);
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.octave-btn:hover {
    background: var(--primary-200);
    border-color: var(--primary-400);
}

.octave-btn:active {
    background: var(--primary-300);
    transform: scale(0.95);
}

.octave-display {
    background: var(--primary-100);
    border: 1px solid var(--primary-300);
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-4);
    font-weight: 600;
    color: var(--primary-800);
    min-width: 60px;
    text-align: center;
}

/* Scrubber Controls */
.scrubber-controls {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

#chord-scrubber {
    width: 100%;
    height: 8px;
    border-radius: var(--radius-md);
    background: var(--primary-200);
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

#chord-scrubber::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-500) 0%, var(--accent-600) 100%);
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-fast);
}

#chord-scrubber::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

#chord-scrubber::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-500) 0%, var(--accent-600) 100%);
    cursor: pointer;
    border: none;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-fast);
}

#chord-scrubber::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

#chord-position-display {
    font-weight: 600;
    color: var(--primary-800);
    text-align: center;
    background: var(--primary-100);
    border: 1px solid var(--primary-300);
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-4);
}

/* Progression Editing Controls */
.progression-selector {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}

.progression-selector select {
    flex: 1;
}

.edit-btn {
    width: 40px;
    height: 40px;
    background: var(--primary-100);
    color: var(--primary-700);
    border: 1px solid var(--primary-300);
    font-size: var(--font-size-base);
    padding: 0;
    flex-shrink: 0;
}

.edit-btn:hover {
    background: var(--primary-200);
    border-color: var(--primary-400);
}

.edit-btn:active {
    background: var(--primary-300);
    transform: scale(0.95);
}

.name-editor {
    margin-top: var(--space-3);
    padding: var(--space-4);
    background: var(--primary-50);
    border: 1px solid var(--primary-300);
    border-radius: var(--radius-md);
}

.name-editor input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--primary-300);
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    background: white;
    color: var(--primary-900);
    margin-bottom: var(--space-3);
}

.name-editor input:focus {
    outline: none;
    border-color: var(--accent-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.editor-buttons {
    display: flex;
    gap: var(--space-2);
}

.save-btn {
    background: linear-gradient(135deg, var(--success-500) 0%, var(--success-600) 100%);
    color: white;
    padding: var(--space-2) var(--space-4);
    font-size: var(--font-size-sm);
    font-weight: 600;
}

.save-btn:hover {
    background: linear-gradient(135deg, var(--success-600) 0%, var(--success-700) 100%);
    transform: translateY(-1px);
}

.cancel-btn {
    background: var(--primary-100);
    color: var(--primary-700);
    border: 1px solid var(--primary-300);
    padding: var(--space-2) var(--space-4);
    font-size: var(--font-size-sm);
}

.cancel-btn:hover {
    background: var(--primary-200);
    border-color: var(--primary-400);
}

.cancel-btn:active {
    background: var(--primary-300);
}

/* Category tabs styles */
.category-tabs {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
    border-bottom: 2px solid var(--primary-200);
    padding-bottom: var(--space-2);
}

.category-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    background: var(--primary-100);
    border: 1px solid var(--primary-200);
    border-bottom: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    min-width: 60px;
}

.category-tab:hover {
    background: var(--primary-200);
    transform: translateY(-2px);
}

.category-tab.active {
    background: var(--accent-500);
    color: white;
    box-shadow: var(--shadow-md);
}

.category-icon {
    font-size: var(--font-size-lg);
    margin-bottom: var(--space-1);
}

.category-name {
    font-size: var(--font-size-sm);
    font-weight: 500;
    text-align: center;
}

/* Search and filters */
.progression-search {
    margin-bottom: var(--space-4);
}

#progression-search-input {
    width: 100%;
    padding: var(--space-3);
    border: 1px solid var(--primary-300);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    margin-bottom: var(--space-2);
    transition: border-color var(--transition-fast);
}

#progression-search-input:focus {
    outline: none;
    border-color: var(--accent-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-filters {
    display: flex;
    gap: var(--space-2);
}

#difficulty-filter {
    flex: 1;
    min-width: 120px;
}

/* Toggle switch styles */
.toggle-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: var(--space-3);
    margin-bottom: var(--space-2);
}

.toggle-checkbox {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 50px;
    height: 24px;
    background: var(--primary-300);
    border-radius: 24px;
    transition: all var(--transition-normal);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
}

.toggle-checkbox:checked+.toggle-slider {
    background: var(--accent-500);
}

.toggle-checkbox:checked+.toggle-slider::before {
    transform: translateX(26px);
}

.toggle-checkbox:focus+.toggle-slider {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.toggle-text {
    font-weight: 500;
    color: var(--primary-900);
    user-select: none;
}

.toggle-description {
    display: block;
    margin-top: var(--space-2);
    margin-bottom: var(--space-2);
    color: var(--primary-600);
    font-size: 12px;
    line-height: 1.3;
}

/* Extension toggles layout */
.extension-group-label {
    display: block;
    font-weight: 500;
    color: var(--primary-900);
    margin-bottom: var(--space-2);
    font-size: var(--font-size-base);
}

.extension-toggles {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
    flex-wrap: wrap;
    justify-content: space-between;
}

.extension-toggles .toggle-label {
    margin-bottom: 0;
    min-width: 0;
    flex-shrink: 0;
}

.extension-toggles .toggle-text {
    font-size: var(--font-size-sm);
    font-weight: 600;
    min-width: 35px;
    text-align: center;
}

/* Smaller toggle sliders for extensions */
.extension-toggles .toggle-slider {
    width: 42px;
    height: 20px;
}

.extension-toggles .toggle-slider::before {
    width: 16px;
    height: 16px;
    top: 2px;
    left: 2px;
}

.extension-toggles .toggle-checkbox:checked+.toggle-slider::before {
    transform: translateX(22px);
}

/* Main Transport Controls - Top Level */
.transport-controls-main {
    margin-bottom: var(--space-4);
    padding: var(--space-3);
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--primary-200);
}

.transport-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.piano-roll-zoom-controls {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}

.piano-roll-zoom-controls .control-btn {
    padding: var(--space-1) var(--space-2);
    background: var(--primary-100);
    border: 1px solid var(--primary-300);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.piano-roll-zoom-controls .control-btn:hover {
    background: var(--primary-200);
    border-color: var(--primary-400);
}

.transport-buttons {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.transport-scrubber {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-sm);
}

.transport-scrubber label {
    font-weight: 500;
    color: var(--primary-700);
    min-width: 60px;
}

.transport-scrubber input[type="range"] {
    flex: 1;
    min-width: 100px;
}

.transport-scrubber span {
    font-size: var(--font-size-sm);
    color: var(--primary-600);
    white-space: nowrap;
}

/* Simplified Search */
.progression-search-simple {
    margin-bottom: var(--space-2);
}

.progression-search-simple input {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--primary-300);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    background: white;
    transition: border-color var(--transition-fast);
}

.progression-search-simple input:focus {
    outline: none;
    border-color: var(--accent-500);
    box-shadow: 0 0 0 2px var(--accent-500-alpha);
}

/* Compact horizontal layouts for settings */
.settings-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.settings-row-three {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.settings-compact {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.settings-compact label {
    font-size: var(--font-size-sm);
    font-weight: 500;
    margin-bottom: var(--space-1);
}

.settings-compact select {
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-size-sm);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Current Progression Display */
.current-progression {
    background: var(--accent-50);
    border: 1px solid var(--accent-200);
    border-radius: var(--radius-md);
    padding: var(--space-2);
    margin-bottom: var(--space-2);
    font-size: var(--font-size-sm);
}

.current-label {
    color: var(--accent-600);
    font-weight: 500;
}

.current-name {
    color: var(--accent-800);
    font-weight: 600;
    margin-left: var(--space-1);
}

/* Progression Library Layout */
.progression-library-content {
    display: flex;
    gap: var(--space-4);
    height: 100%;
    width: 100%;
}

.progression-list-container {
    min-width: 280px;
    width: 320px;
    flex-shrink: 0;
}

.progression-card-display {
    flex: 1;
    min-width: 0;
    /* Allow flex item to shrink */
    display: flex;
    align-items: flex-start;
}

/* Simple Progression List */
.progression-list {
    max-height: 200px;
    overflow-y: auto;
    background: var(--primary-50);
    border: 1px solid var(--primary-200);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2);
}

.progression-item {
    padding: var(--space-2);
    border-bottom: 1px solid var(--primary-100);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: var(--font-size-sm);
    color: var(--primary-800);
}

.progression-item:last-child {
    border-bottom: none;
}

.progression-item:hover:not(.current) {
    background: var(--primary-100);
    color: var(--primary-900);
}

.progression-item.current {
    background: var(--accent-100);
    color: var(--accent-800);
    font-weight: 600;
    border-left: 3px solid var(--accent-500);
}

.progression-item.current:hover {
    background: var(--accent-200);
    color: var(--accent-900);
}

.progression-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-1);
}

.progression-item-name {
    font-weight: 500;
    font-size: var(--font-size-sm);
}

.progression-item-difficulty {
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 8px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.progression-item-difficulty.difficulty-beginner {
    background: #10b981;
    color: white;
}

.progression-item-difficulty.difficulty-intermediate {
    background: #f59e0b;
    color: white;
}

.progression-item-difficulty.difficulty-advanced {
    background: #ef4444;
    color: white;
}

.progression-item-chords {
    font-size: 0.75rem;
    color: var(--primary-600);
    margin-top: var(--space-1);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

/* ============================================
   PROGRESSION LIST HEADER
   Search + Create button layout
   ============================================ */

.progression-list-header {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    align-items: stretch;
}

.progression-list-header .progression-search-simple {
    flex: 1;
    margin-bottom: 0;
}

.create-custom-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--primary-300);
    background: white;
    color: var(--primary-700);
    transition: all var(--transition-fast);
    cursor: pointer;
    flex-shrink: 0;
}

.create-custom-btn:hover {
    background: var(--primary-100);
    border-color: var(--primary-400);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.create-custom-btn:active {
    transform: translateY(0);
}

.create-custom-btn svg {
    opacity: 0.7;
}

.create-custom-btn:hover svg {
    opacity: 1;
}

[data-theme="dark"] .create-custom-btn {
    background: var(--dark-700);
    border-color: var(--dark-500);
    color: var(--primary-300);
}

[data-theme="dark"] .create-custom-btn:hover {
    background: var(--dark-600);
    border-color: var(--dark-400);
}

/* ============================================
   PROGRESSION EDIT/DELETE BUTTONS
   Neutral, minimal, professional
   ============================================ */

.edit-progression-btn,
.delete-progression-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: var(--radius-sm);
    font-size: 16px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    background: transparent;
    color: var(--primary-600);
    transition: all var(--transition-fast);
    cursor: pointer;
    opacity: 0.5;
}

.edit-progression-btn:hover,
.delete-progression-btn:hover {
    opacity: 1;
    background: var(--primary-100);
    border-color: var(--primary-300);
    transform: translateY(-1px);
}

.edit-progression-btn:active,
.delete-progression-btn:active {
    transform: translateY(0);
    background: var(--primary-200);
}

/* Dark theme - same neutral approach */
[data-theme="dark"] .edit-progression-btn,
[data-theme="dark"] .delete-progression-btn {
    color: var(--primary-400);
}

[data-theme="dark"] .edit-progression-btn:hover,
[data-theme="dark"] .delete-progression-btn:hover {
    background: var(--dark-600);
    border-color: var(--dark-500);
}

[data-theme="dark"] .edit-progression-btn:active,
[data-theme="dark"] .delete-progression-btn:active {
    background: var(--dark-500);
}

/* Progression Details Panel */
.progression-details-panel {
    background: var(--accent-50);
    border: 1px solid var(--accent-200);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    margin-bottom: var(--space-3);
    position: relative;
}

.progression-details-panel h4 {
    margin: 0 0 var(--space-2) 0;
    color: var(--accent-800);
    font-size: var(--font-size-base);
}

.progression-detail-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.detail-row {
    display: flex;
    gap: var(--space-2);
    font-size: var(--font-size-sm);
}

.detail-label {
    color: var(--accent-600);
    font-weight: 500;
    min-width: 80px;
}

.detail-value {
    color: var(--accent-800);
    flex: 1;
}

.close-details-btn {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    background: none;
    border: none;
    font-size: var(--font-size-lg);
    color: var(--accent-600);
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.close-details-btn:hover {
    background: var(--accent-200);
    color: var(--accent-800);
}

/* Beautiful Progression Card Display - Original Clean Design */
.progression-card-clean {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 100%;
}

.progression-card-clean:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    border-color: #d1d5db;
}

.progression-card-header-clean {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.progression-card-title-clean {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
    line-height: 1.2;
}

.progression-card-difficulty-clean {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 16px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.difficulty-beginner {
    background: #10b981;
    color: white;
}

.difficulty-intermediate {
    background: #f59e0b;
    color: white;
}

.difficulty-advanced {
    background: #ef4444;
    color: white;
}

.progression-card-description-clean {
    color: #6b7280;
    font-size: 0.875rem;
    line-height: 1.4;
    margin-bottom: 1rem;
}

.progression-card-details-clean {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.75rem;
    color: #9ca3af;
    align-items: center;
}

.progression-card-chords-clean {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.75rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    color: #1f2937;
    font-weight: 600;
    text-align: center;
}

/* Compact Custom Progression Button */
.custom-progression-section-compact {
    margin-top: var(--space-2);
    padding-top: var(--space-2);
    border-top: 1px solid var(--primary-200);
}

.custom-progression-button-compact {
    width: 100%;
    padding: var(--space-2);
    background: var(--accent-500);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.custom-progression-button-compact:hover {
    background: var(--accent-600);
    transform: translateY(-1px);
}

[data-theme="dark"] .custom-progression-section-compact {
    border-top: 1px solid var(--dark-500);
}

/* Scrollbar styling for progression cards */
.progression-cards::-webkit-scrollbar {
    width: 6px;
}

.progression-cards::-webkit-scrollbar-track {
    background: var(--primary-100);
    border-radius: var(--radius-sm);
}

.progression-cards::-webkit-scrollbar-thumb {
    background: var(--primary-400);
    border-radius: var(--radius-sm);
}

.progression-cards::-webkit-scrollbar-thumb:hover {
    background: var(--primary-500);
}

/* Theme Toggle FAB Styling */
.theme-toggle-fab {
    position: fixed;
    top: var(--space-4);
    right: var(--space-4);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: white;
    border: 1px solid var(--primary-300);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    z-index: 1000;
    font-size: 1.5rem;
}

.theme-toggle-fab:hover {
    background: var(--primary-50);
    box-shadow: var(--shadow-xl);
    transform: translateY(-2px) scale(1.05);
}

.theme-toggle-fab:active {
    transform: translateY(0) scale(0.95);
    box-shadow: var(--shadow-md);
}

[data-theme="dark"] .theme-toggle-fab {
    background: var(--dark-800);
    border: 1px solid var(--dark-600);
    color: var(--primary-200);
}

[data-theme="dark"] .theme-toggle-fab:hover {
    background: var(--dark-700);
    border-color: var(--dark-500);
}

.theme-toggle-fab .theme-icon {
    font-size: 1.2em;
    transition: transform var(--transition-fast);
}

.theme-toggle-fab:hover .theme-icon {
    transform: rotate(20deg);
}

/* Dark mode styles for form elements */
[data-theme="dark"] select {
    background: var(--dark-700);
    color: var(--primary-200);
    border: 1px solid var(--dark-500);
}

[data-theme="dark"] select:hover {
    border-color: var(--dark-400);
}

[data-theme="dark"] select:focus {
    border-color: var(--accent-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

[data-theme="dark"] .octave-btn {
    background: var(--dark-700);
    color: var(--primary-200);
    border: 1px solid var(--dark-500);
}

[data-theme="dark"] .octave-btn:hover {
    background: var(--dark-600);
    border-color: var(--dark-400);
}

[data-theme="dark"] .octave-display {
    background: var(--dark-700);
    border: 1px solid var(--dark-500);
    color: var(--primary-200);
}

[data-theme="dark"] #chord-position-display {
    background: var(--dark-700);
    border: 1px solid var(--dark-500);
    color: var(--primary-200);
}

[data-theme="dark"] .edit-btn {
    background: var(--dark-700);
    color: var(--primary-200);
    border: 1px solid var(--dark-500);
}

[data-theme="dark"] .edit-btn:hover {
    background: var(--dark-600);
    border-color: var(--dark-400);
}

[data-theme="dark"] .name-editor {
    background: var(--dark-900);
    border: 1px solid var(--dark-600);
}

[data-theme="dark"] .name-editor input {
    background: var(--dark-700);
    color: var(--primary-200);
    border: 1px solid var(--dark-500);
}

[data-theme="dark"] .name-editor input:focus {
    border-color: var(--accent-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

[data-theme="dark"] .cancel-btn {
    background: var(--dark-700);
    color: var(--primary-200);
    border: 1px solid var(--dark-500);
}

[data-theme="dark"] .cancel-btn:hover {
    background: var(--dark-600);
    border-color: var(--dark-400);
}

/* Additional dark mode text fixes - using explicit light colors */
[data-theme="dark"] .progression-selector select {
    color: #f1f5f9;
}

[data-theme="dark"] .progression-selector label {
    color: #e2e8f0;
}

[data-theme="dark"] .scrubber-controls label {
    color: #e2e8f0;
}

[data-theme="dark"] .octave-controls label {
    color: #e2e8f0;
}

[data-theme="dark"] .form-group label {
    color: #e2e8f0;
}

[data-theme="dark"] h3 {
    color: #f1f5f9;
}

[data-theme="dark"] label {
    color: #e2e8f0 !important;
}

/* Fix ALL remaining dark mode text visibility issues */
[data-theme="dark"] select option {
    color: #f1f5f9;
    background: var(--dark-700);
}

[data-theme="dark"] .octave-display span {
    color: #f1f5f9 !important;
}

[data-theme="dark"] #chord-position-display {
    color: #f1f5f9 !important;
    background: var(--dark-700);
}

[data-theme="dark"] .primary-button {
    color: white !important;
}

[data-theme="dark"] .save-btn {
    color: white !important;
}

[data-theme="dark"] .cancel-btn {
    color: #f1f5f9 !important;
}

[data-theme="dark"] .edit-btn {
    color: #f1f5f9 !important;
}

[data-theme="dark"] .octave-btn {
    color: #f1f5f9 !important;
}

[data-theme="dark"] .theme-toggle-fab {
    color: #f1f5f9 !important;
}

/* NUCLEAR OPTION - Override ALL text in dark mode */
[data-theme="dark"] * {
    color: #f1f5f9 !important;
}

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 {
    color: #f8fafc !important;
}

[data-theme="dark"] label,
[data-theme="dark"] span,
[data-theme="dark"] div,
[data-theme="dark"] p {
    color: #e2e8f0 !important;
}

[data-theme="dark"] select,
[data-theme="dark"] input,
[data-theme="dark"] button {
    color: #f1f5f9 !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: var(--space-2);
        gap: var(--space-2);
    }

    h1 {
        font-size: var(--font-size-2xl);
    }

    .controls-container {
        grid-template-columns: 1fr;
        gap: var(--space-3);
    }

    .progression-library {
        width: auto;
        min-width: auto;
    }

    .transport-section {
        flex-direction: column;
        gap: var(--space-3);
        align-items: stretch;
    }

    .settings-row,
    .settings-row-three {
        grid-template-columns: 1fr;
        gap: var(--space-2);
    }

    .control-group {
        padding: var(--space-4);
    }

    .piano-container {
        padding: var(--space-4);
    }

    .white {
        width: 45px;
        height: 180px;
    }

    .black {
        width: 30px;
        height: 120px;
        margin-left: -15px;
        margin-right: -15px;
    }

    /* Theme toggle mobile adjustments */
    .theme-toggle-fab {
        top: var(--space-2);
        right: var(--space-2);
        width: 44px;
        height: 44px;
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .white {
        width: 35px;
        height: 140px;
    }

    .black {
        width: 25px;
        height: 90px;
        margin-left: -12.5px;
        margin-right: -12.5px;
    }
}

/* Loading and Animation States */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 2s infinite;
}

/* Focus Indicators for Accessibility */
select:focus-visible,
button:focus-visible,
#chord-scrubber:focus-visible {
    outline: 2px solid var(--accent-500);
    outline-offset: 2px;
}

/* Dark theme styles for categorized progression UI */
[data-theme="dark"] .category-tab {
    background: var(--dark-700);
    border-color: var(--dark-600);
    color: var(--primary-300);
}

[data-theme="dark"] .category-tab:hover {
    background: var(--dark-600);
}

[data-theme="dark"] .category-tab.active {
    background: var(--accent-600);
    color: white;
}

[data-theme="dark"] .category-tabs {
    border-bottom-color: var(--dark-600);
}

[data-theme="dark"] #progression-search-input {
    background: var(--dark-700);
    border-color: var(--dark-600);
    color: var(--primary-300);
}

[data-theme="dark"] #progression-search-input:focus {
    border-color: var(--accent-500);
    background: var(--dark-600);
}

/* Removed messy progression card overrides - using clean component instead */

[data-theme="dark"] .progression-cards::-webkit-scrollbar-track {
    background: var(--dark-700);
}

[data-theme="dark"] .progression-cards::-webkit-scrollbar-thumb {
    background: var(--dark-500);
}

[data-theme="dark"] .progression-cards::-webkit-scrollbar-thumb:hover {
    background: var(--dark-400);
}

/* Dark theme toggle styles */
[data-theme="dark"] .toggle-slider {
    background: var(--dark-600);
}

[data-theme="dark"] .toggle-slider::before {
    background: var(--primary-100);
}

[data-theme="dark"] .toggle-checkbox:checked+.toggle-slider {
    background: var(--accent-600);
}

[data-theme="dark"] .toggle-text {
    color: var(--primary-100);
}

[data-theme="dark"] .toggle-description {
    color: var(--primary-400);
}

[data-theme="dark"] .extension-group-label {
    color: var(--primary-100);
}

/* Custom Progression Input */
.custom-progression-section {
    background: var(--primary-50);
    border: 1px solid var(--primary-200);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    margin: var(--space-3) 0;
    transition: all var(--transition-normal);
    text-align: center;
}

.custom-progression-section:hover {
    border-color: var(--accent-400);
    background: var(--primary-100);
}

.custom-progression-button {
    background: var(--primary-600);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-4);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition-fast);
    font-family: var(--font-family);
}

.custom-progression-button:hover {
    background: var(--primary-700);
}

[data-theme="dark"] .custom-progression-section {
    background: var(--dark-700);
    border-color: var(--dark-500);
}

[data-theme="dark"] .custom-progression-section:hover {
    border-color: var(--accent-400);
    background: var(--dark-600);
}

[data-theme="dark"] .custom-progression-button {
    background: var(--primary-500);
    color: white;
}

[data-theme="dark"] .custom-progression-button:hover {
    background: var(--primary-400);
}

.custom-progression-section h4 {
    margin: 0 0 var(--space-4) 0;
    color: var(--primary-800);
    font-size: var(--font-size-lg);
    font-weight: 600;
}

[data-theme="dark"] .custom-progression-section h4 {
    color: var(--primary-100);
}

.custom-progression-input .input-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.custom-progression-input label {
    font-weight: 500;
    color: var(--primary-700);
    margin-bottom: var(--space-2);
}

[data-theme="dark"] .custom-progression-input label {
    color: var(--primary-200);
}

.progression-input {
    width: 100%;
    padding: var(--space-4) var(--space-4);
    border: 2px solid var(--primary-300);
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    background: white;
    color: var(--primary-900);
    transition: all var(--transition-fast);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.progression-input:focus {
    outline: none;
    border-color: var(--accent-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: var(--primary-50);
}

.progression-input::placeholder {
    color: var(--primary-500);
    font-style: italic;
}

[data-theme="dark"] .progression-input {
    background: var(--dark-800);
    border-color: var(--dark-500);
    color: var(--primary-100);
}

[data-theme="dark"] .progression-input:focus {
    background: var(--dark-700);
    border-color: var(--accent-400);
}

[data-theme="dark"] .progression-input::placeholder {
    color: var(--primary-400);
}

.input-buttons {
    display: flex;
    gap: var(--space-3);
    align-items: center;
    flex-wrap: wrap;
}

.input-buttons .primary-button {
    margin-bottom: 0;
    width: auto;
    flex: 1;
    min-width: 150px;
}

.input-buttons .secondary-button {
    background: var(--primary-500);
    color: white;
    padding: var(--space-3) var(--space-5);
    font-weight: 500;
    width: auto;
    min-width: 100px;
}

.input-buttons .secondary-button:hover {
    background: var(--primary-600);
}

/* Examples Panel */
.examples-panel {
    background: var(--primary-100);
    border: 1px solid var(--primary-300);
    border-radius: var(--radius-md);
    margin-top: var(--space-4);
    overflow: hidden;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

[data-theme="dark"] .examples-panel {
    background: var(--dark-700);
    border-color: var(--dark-500);
}

.examples-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4);
    background: var(--primary-200);
    border-bottom: 1px solid var(--primary-300);
}

[data-theme="dark"] .examples-header {
    background: var(--dark-600);
    border-bottom-color: var(--dark-500);
}

.examples-header h5 {
    margin: 0;
    color: var(--primary-800);
    font-size: var(--font-size-base);
    font-weight: 600;
}

[data-theme="dark"] .examples-header h5 {
    color: var(--primary-100);
}

.close-btn {
    background: none;
    border: none;
    font-size: var(--font-size-xl);
    color: var(--primary-600);
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.close-btn:hover {
    background: var(--primary-300);
    color: var(--primary-800);
}

[data-theme="dark"] .close-btn {
    color: var(--primary-300);
}

[data-theme="dark"] .close-btn:hover {
    background: var(--dark-500);
    color: var(--primary-100);
}

.examples-list {
    padding: var(--space-4);
}

.example-item {
    margin-bottom: var(--space-4);
    padding: var(--space-3);
    background: white;
    border: 1px solid var(--primary-200);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.example-item:hover {
    border-color: var(--accent-400);
    background: var(--accent-50);
    transform: translateY(-1px);
}

[data-theme="dark"] .example-item {
    background: var(--dark-800);
    border-color: var(--dark-500);
}

[data-theme="dark"] .example-item:hover {
    border-color: var(--accent-400);
    background: var(--dark-600);
}

.example-format {
    font-weight: 600;
    color: var(--primary-800);
    margin-bottom: var(--space-1);
}

[data-theme="dark"] .example-format {
    color: var(--primary-100);
}

.example-code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    background: var(--primary-100);
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    margin: var(--space-1) 0;
    color: var(--accent-700);
    font-size: var(--font-size-sm);
    border: 1px solid var(--primary-200);
}

[data-theme="dark"] .example-code {
    background: var(--dark-700);
    border-color: var(--dark-500);
    color: var(--accent-300);
}

.example-description {
    font-size: var(--font-size-sm);
    color: var(--primary-600);
    margin-top: var(--space-2);
}

[data-theme="dark"] .example-description {
    color: var(--primary-300);
}

/* Progression Status */
.progression-status {
    margin-top: var(--space-4);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.progression-status.success {
    background: var(--success-500);
    color: white;
    border: 1px solid var(--success-600);
}

.progression-status.error {
    background: var(--error-500);
    color: white;
    border: 1px solid var(--error-600);
}

.progression-status.info {
    background: var(--accent-500);
    color: white;
    border: 1px solid var(--accent-600);
}

/* Responsive Design */
@media (max-width: 768px) {
    .input-buttons {
        flex-direction: column;
    }

    .input-buttons .primary-button,
    .input-buttons .secondary-button {
        width: 100%;
        min-width: auto;
    }

    .examples-header {
        padding: var(--space-3);
    }

    .progression-input {
        font-size: var(--font-size-sm);
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --primary-900: #000000;
        --primary-100: #ffffff;
        --accent-500: #0000ff;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================
   PROGRESSION CARDS STYLES
   ========================================== */


.category-header {
    margin-bottom: 0.5rem;
    padding: 0.75rem;
    background: var(--accent-100);
    border-radius: 6px;
    border-left: 4px solid var(--accent-500);
}

.category-header h4 {
    margin: 0 0 0.25rem 0;
    color: var(--accent-700);
    font-size: 1.1rem;
    font-weight: 600;
}

.category-header p {
    margin: 0;
    color: var(--primary-600);
    font-size: 0.9rem;
}



.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.card-header h5 {
    margin: 0;
    color: var(--primary-900);
    font-size: 1rem;
    font-weight: 600;
}

.difficulty-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    color: white;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-description {
    margin: 0 0 0.75rem 0;
    color: var(--primary-600);
    font-size: 0.9rem;
    line-height: 1.4;
}

.card-details {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    color: var(--primary-500);
}

.chord-count,
.original-key {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.card-chords {
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: var(--primary-50);
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--primary-700);
    text-align: center;
}

.chord-symbol {
    font-weight: 600;
    color: var(--accent-600);
}

.card-select-btn {
    width: 100%;
    padding: 0.5rem 1rem;
    background: var(--accent-500);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.card-select-btn:hover {
    background: var(--accent-600);
}

.progression-card.selected .card-select-btn {
    background: var(--success-500);
}

.progression-card.selected .card-select-btn:hover {
    background: var(--success-600);
}

/* ==========================================
   MODAL STYLES
   ========================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}

[data-theme="dark"] .modal {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(3px);
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem 1rem 2rem;
    border-bottom: 1px solid var(--primary-200);
}

.modal-header h4 {
    margin: 0;
    color: var(--primary-900);
    font-size: 1.3rem;
    font-weight: 600;
}

.close-modal-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--primary-500);
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    transition: color 0.2s ease;
}

.close-modal-btn:hover {
    color: var(--primary-700);
}

.modal-body {
    padding: 2rem;
}

/* Dark Theme Modal */
[data-theme="dark"] .modal-content {
    background: var(--dark-800);
    color: var(--primary-100);
    border: 1px solid var(--dark-600);
}

[data-theme="dark"] .modal-header {
    border-bottom-color: var(--dark-600);
}

[data-theme="dark"] .modal-header h4 {
    color: var(--primary-100);
}

[data-theme="dark"] .close-modal-btn {
    color: var(--primary-400);
}

[data-theme="dark"] .close-modal-btn:hover {
    color: var(--primary-200);
}

/* Dark Theme Progression Cards */
[data-theme="dark"] .progression-cards {
    background: transparent;
}

/* ===========================================
   PIANO ROLL STYLES
   =========================================== */

/* Piano Section - Container for keyboard and piano roll */
.piano-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

/* Piano Roll Container */
.piano-roll-container {
    width: 100%;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--primary-200);
    overflow: hidden;
    transition: all var(--transition-normal);
}

[data-theme="dark"] .piano-roll-container {
    background: var(--dark-800);
    border: 1px solid var(--dark-600);
}

/* Piano Roll Header */
.piano-roll-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4) var(--space-6);
    background: var(--primary-50);
    border-bottom: 1px solid var(--primary-200);
    transition: all var(--transition-normal);
}

[data-theme="dark"] .piano-roll-header {
    background: var(--dark-700);
    border-bottom: 1px solid var(--dark-600);
}

.piano-roll-header h3 {
    margin: 0;
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--primary-800);
}

[data-theme="dark"] .piano-roll-header h3 {
    color: var(--primary-200);
}

/* Piano Roll Controls */
.piano-roll-controls {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.control-btn {
    padding: var(--space-2) var(--space-3);
    background: var(--primary-100);
    border: 1px solid var(--primary-300);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    color: var(--primary-700);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.control-btn:hover {
    background: var(--primary-200);
    border-color: var(--primary-400);
    transform: translateY(-1px);
}

.control-btn:active {
    transform: translateY(0);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .control-btn {
    background: var(--dark-600);
    border: 1px solid var(--dark-500);
    color: var(--primary-300);
}

[data-theme="dark"] .control-btn:hover {
    background: var(--dark-500);
    border-color: var(--dark-400);
}

/* Piano Roll Toggle */
.piano-roll-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    font-size: var(--font-size-sm);
    color: var(--primary-700);
    margin: 0;
}

.toggle-label.compact {
    font-size: var(--font-size-sm);
}

.toggle-checkbox {
    display: none;
}

.toggle-slider {
    width: 44px;
    height: 24px;
    background: var(--primary-300);
    border-radius: 12px;
    position: relative;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.toggle-slider.small {
    width: 32px;
    height: 18px;
    border-radius: 9px;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: all var(--transition-fast);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.toggle-slider.small::before {
    width: 12px;
    height: 12px;
    top: 3px;
    left: 3px;
}

.toggle-checkbox:checked+.toggle-slider {
    background: var(--accent-500);
}

.toggle-checkbox:checked+.toggle-slider::before {
    transform: translateX(20px);
}

.toggle-checkbox:checked+.toggle-slider.small::before {
    transform: translateX(14px);
}

.toggle-text {
    font-size: var(--font-size-sm);
    color: var(--primary-700);
    font-weight: 500;
}

[data-theme="dark"] .toggle-label {
    color: var(--primary-300);
}

[data-theme="dark"] .toggle-slider {
    background: var(--dark-600);
}

[data-theme="dark"] .toggle-slider::before {
    background: var(--primary-200);
}

[data-theme="dark"] .toggle-text {
    color: var(--primary-300);
}

/* Piano Roll Content */
.piano-roll-content {
    position: relative;
    height: 350px;
    overflow: hidden;
    display: flex;
    gap: var(--space-3);
}

.piano-roll-main {
    flex: 1;
    position: relative;
}

.piano-roll-keyboard {
    width: 120px;
    background: var(--primary-50);
    border: 1px solid var(--primary-200);
    border-radius: var(--radius-md);
    padding: var(--space-2);
    display: flex;
    flex-direction: column;
}

.keyboard-label {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--primary-700);
    text-align: center;
    margin-bottom: var(--space-2);
    padding-bottom: var(--space-1);
    border-bottom: 1px solid var(--primary-200);
}

.vertical-piano {
    flex: 1;
    display: flex;
    flex-direction: column-reverse;
    gap: 1px;
}

.piano-key {
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.piano-key.white {
    background: white;
    color: var(--primary-700);
    border-color: var(--primary-300);
}

.piano-key.black {
    background: var(--primary-800);
    color: white;
    margin-left: var(--space-2);
    margin-right: var(--space-2);
    height: 18px;
}

.piano-key:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-sm);
}

.piano-key.active {
    background: var(--accent-500) !important;
    color: white !important;
    box-shadow: var(--shadow-md);
    transform: scale(1.05);
}

.piano-roll-content canvas {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--primary-50);
    cursor: crosshair;
    transition: background var(--transition-normal);
}

[data-theme="dark"] .piano-roll-content canvas {
    background: var(--dark-800);
}

/* Piano Roll Ruler */
.piano-roll-ruler {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 20px;
    background: var(--primary-100);
    border-bottom: 1px solid var(--primary-200);
    pointer-events: none;
    z-index: 1;
}

[data-theme="dark"] .piano-roll-ruler {
    background: var(--dark-700);
    border-bottom: 1px solid var(--dark-600);
}

.time-ruler {
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(to right,
            var(--primary-300) 0px,
            var(--primary-300) 1px,
            transparent 1px,
            transparent 50px);
}

[data-theme="dark"] .time-ruler {
    background: repeating-linear-gradient(to right,
            var(--dark-600) 0px,
            var(--dark-600) 1px,
            transparent 1px,
            transparent 50px);
}

/* Compact Playback Controls */
.compact-playback-controls {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.play-btn-compact,
.stop-btn-compact {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-500);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-lg);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.play-btn-compact:hover,
.stop-btn-compact:hover {
    background: var(--accent-600);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.play-btn-compact:active,
.stop-btn-compact:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.stop-btn-compact {
    background: var(--error-500);
}

.stop-btn-compact:hover {
    background: var(--error-600);
}

/* Section Header with Integrated Controls */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
}

.section-header h3 {
    margin: 0;
}

/* Scrubber Controls Compact */
.scrubber-controls.compact {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    background: var(--primary-50);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    margin-top: var(--space-4);
}

[data-theme="dark"] .scrubber-controls.compact {
    background: var(--dark-700);
}

.scrubber-controls.compact label {
    margin: 0;
    font-size: var(--font-size-sm);
    color: var(--primary-600);
    white-space: nowrap;
}

.scrubber-controls.compact input[type="range"] {
    flex: 1;
    min-width: 120px;
}

.scrubber-controls.compact span {
    font-size: var(--font-size-sm);
    color: var(--primary-700);
    white-space: nowrap;
}

[data-theme="dark"] .scrubber-controls.compact label {
    color: var(--primary-400);
}

[data-theme="dark"] .scrubber-controls.compact span {
    color: var(--primary-300);
}

/* Responsive Design for Piano Roll */
@media (max-width: 768px) {
    .piano-roll-header {
        flex-direction: column;
        gap: var(--space-3);
        align-items: flex-start;
    }

    .piano-roll-controls {
        align-self: stretch;
        justify-content: space-between;
    }

    .piano-roll-content {
        height: 250px;
    }

    .compact-playback-controls {
        flex-wrap: wrap;
        gap: var(--space-2);
    }

    .play-btn-compact,
    .stop-btn-compact {
        width: 32px;
        height: 32px;
        font-size: var(--font-size-base);
    }
}

/* Removed messy category and card overrides - using clean component instead */
/* ===========================================
   PROGRESSION EDITOR STYLES
   =========================================== */

/* Editor Modal */
.editor-modal {
    max-width: 700px;
    max-height: 90vh;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: 1rem 2rem 1.5rem 2rem;
    border-top: 1px solid var(--primary-200);
}

[data-theme="dark"] .modal-footer {
    border-top-color: var(--dark-600);
}

.modal-footer button {
    margin: 0;
    padding: var(--space-3) var(--space-6);
    min-width: 120px;
}

/* Editor Controls */
.editor-controls {
    margin-bottom: var(--space-6);
}

.editor-controls .input-group {
    margin-bottom: var(--space-4);
}

.editor-controls label {
    display: block;
    font-weight: 600;
    color: var(--primary-800);
    margin-bottom: var(--space-2);
    font-size: var(--font-size-sm);
}

[data-theme="dark"] .editor-controls label {
    color: var(--primary-200);
}

.progression-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--primary-300);
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    background: white;
    color: var(--primary-900);
    transition: all var(--transition-fast);
}

[data-theme="dark"] .progression-input {
    background: var(--dark-700);
    border-color: var(--dark-500);
    color: var(--primary-100);
}

.progression-input:focus {
    outline: none;
    border-color: var(--accent-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Chord List Editor */
.chord-list-editor {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    max-height: 400px;
    overflow-y: auto;
}

/* Chord Item */
.chord-item-editor {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--primary-100);
    border: 1px solid var(--primary-200);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

[data-theme="dark"] .chord-item-editor {
    background: var(--dark-700);
    border-color: var(--dark-600);
}

.chord-item-editor:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--primary-400);
}

[data-theme="dark"] .chord-item-editor:hover {
    border-color: var(--dark-500);
}

/* Chord Item Controls */
.chord-item-controls {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.chord-item-controls button {
    width: 32px;
    height: 28px;
    padding: 0;
    background: white;
    border: 1px solid var(--primary-300);
    border-radius: var(--radius-sm);
    color: var(--primary-600);
    font-size: 14px;
    transition: all var(--transition-fast);
}

[data-theme="dark"] .chord-item-controls button {
    background: var(--dark-600);
    border-color: var(--dark-500);
    color: var(--primary-300);
}

.chord-item-controls button:hover:not(:disabled) {
    background: var(--accent-500);
    border-color: var(--accent-600);
    color: white;
}

.chord-item-controls button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Chord Item Fields */
.chord-item-fields {
    display: flex;
    gap: var(--space-3);
    flex: 1;
}

.field-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.field-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-600);
    margin: 0;
}

[data-theme="dark"] .field-group label {
    color: var(--primary-400);
}

.field-group input {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--primary-300);
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    background: white;
    color: var(--primary-900);
    transition: all var(--transition-fast);
}

[data-theme="dark"] .field-group input {
    background: var(--dark-800);
    border-color: var(--dark-500);
    color: var(--primary-100);
}

.field-group input:focus {
    outline: none;
    border-color: var(--accent-500);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

/* Chord Item Actions */
.chord-item-actions {
    display: flex;
    align-items: center;
}

.remove-chord-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    background: var(--primary-200);
    border: 1px solid var(--primary-300);
    border-radius: var(--radius-sm);
    color: var(--primary-600);
    font-size: 1.5rem;
    line-height: 1;
    font-weight: 300;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

[data-theme="dark"] .remove-chord-btn {
    background: var(--dark-600);
    border-color: var(--dark-500);
    color: var(--primary-400);
}

.remove-chord-btn:hover {
    background: var(--error-500);
    border-color: var(--error-600);
    color: white;
    transform: scale(1.05);
}

/* V2 Notes Display */
.notes-display {
    flex: 2 !important;
    background: var(--success-50);
    border: 2px solid var(--success-200);
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-3);
}

[data-theme="dark"] .notes-display {
    background: rgba(34, 197, 94, 0.1);
    border-color: var(--success-700);
}

.notes-display label {
    color: var(--success-700) !important;
    font-weight: 700;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
}

[data-theme="dark"] .notes-display label {
    color: var(--success-400) !important;
}

.midi-notes-display {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--success-900);
    font-weight: 600;
    padding: var(--space-2);
    background: white;
    border-radius: var(--radius-sm);
    border: 1px solid var(--success-300);
    max-height: 60px;
    overflow-y: auto;
    overflow-x: hidden;
    line-height: 1.6;
    word-break: break-word;
    white-space: pre-wrap;
    display: inline-block;
    width: 100%;
}

[data-theme="dark"] .midi-notes-display {
    background: var(--dark-800);
    color: var(--success-300);
    border-color: var(--success-600);
}

/* V2 Action Buttons */
.v2-actions {
    flex: 2 !important;
    display: flex;
    gap: var(--space-2);
}

.play-original-btn,
.edit-notes-btn,
.reidentify-btn {
    flex: 1;
    padding: var(--space-2) var(--space-3);
    background: var(--accent-500);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
}

.edit-notes-btn:hover,
.reidentify-btn:hover {
    background: var(--accent-600);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.reidentify-btn {
    background: var(--warning-500);
}

.reidentify-btn:hover {
    background: var(--warning-600);
}

/* Readonly inputs for V2 chords */
.field-group input[readonly] {
    background: var(--primary-100);
    cursor: not-allowed;
    opacity: 0.7;
}

[data-theme="dark"] .field-group input[readonly] {
    background: var(--dark-600);
}

/* Enhanced confidence badge */
.confidence-badge {
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 700;
    margin-left: var(--space-2);
}

.confidence-badge.high {
    background: var(--success-500);
    color: white;
}

.confidence-badge.medium {
    background: var(--warning-500);
    color: white;
}

.confidence-badge.low {
    background: var(--error-500);
    color: white;
}

/* ========================================
   V2 Note-First Layout
   ======================================== */

/* Prominent Notes Display - Center Stage */
.notes-display-primary {
    flex: 3 !important;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.midi-notes-display-large {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--accent-700);
    padding: var(--space-3);
    background: white;
    border-radius: var(--radius-md);
    border: 2px solid var(--accent-200);
    text-align: center;
    line-height: 1.5;
}

[data-theme="dark"] .midi-notes-display-large {
    background: var(--dark-800);
    color: var(--accent-300);
    border-color: var(--accent-700);
}

/* Muted Chord Metadata */
.chord-metadata {
    display: flex;
    gap: var(--space-1);
    font-size: 0.7rem;
    color: var(--primary-500);
    justify-content: center;
    align-items: baseline;
}

[data-theme="dark"] .chord-metadata {
    color: var(--primary-400);
}

.chord-symbol-muted {
    font-weight: 500;
    opacity: 0.7;
}

.bass-note-muted {
    font-weight: 400;
    opacity: 0.6;
}

/* Compact Beats Row */
.beats-row {
    flex: 0.5 !important;
}

.beats-row label {
    font-size: 0.7rem;
}

.beats-row input {
    padding: var(--space-1) var(--space-2);
    font-size: 0.85rem;
    text-align: center;
}

/* Compact Action Buttons */
.v2-actions-compact {
    flex: 1.5 !important;
    display: flex;
    gap: var(--space-1);
    align-items: center;
}

.play-original-btn-compact,
.edit-notes-btn-compact,
.reidentify-btn-compact {
    flex: 1;
    padding: var(--space-2);
    background: var(--primary-200);
    color: var(--primary-700);
    border: 1px solid var(--primary-300);
    border-radius: var(--radius-sm);
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    min-height: 32px;
}

[data-theme="dark"] .play-original-btn-compact,
[data-theme="dark"] .edit-notes-btn-compact,
[data-theme="dark"] .reidentify-btn-compact {
    background: var(--dark-600);
    color: var(--primary-300);
    border-color: var(--dark-500);
}

.play-original-btn-compact:hover,
.edit-notes-btn-compact:hover,
.reidentify-btn-compact:hover {
    background: var(--accent-500);
    color: white;
    border-color: var(--accent-600);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .play-original-btn-compact:hover,
[data-theme="dark"] .edit-notes-btn-compact:hover,
[data-theme="dark"] .reidentify-btn-compact:hover {
    background: var(--accent-600);
    border-color: var(--accent-700);
}


/* Editor Actions */
.editor-actions {
    display: flex;
    justify-content: center;
    padding-top: var(--space-2);
}

.editor-actions button {
    min-width: 150px;
}

/* ========================================
   Piano Keyboard Selector Styles
   ======================================== */

/* Piano Keyboard Selector Modal */
.piano-keyboard-selector {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: var(--space-4);
}

.keyboard-selector-content {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: var(--space-6);
    max-width: calc(100vw - 4rem);
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
}

[data-theme="dark"] .keyboard-selector-content {
    background: var(--dark-800);
    border: 1px solid var(--dark-600);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate Y(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Keyboard Header */
.keyboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--primary-200);
}

[data-theme="dark"] .keyboard-header {
    border-bottom-color: var(--dark-600);
}

.keyboard-header h3 {
    margin: 0;
    color: var(--primary-900);
}

[data-theme="dark"] .keyboard-header h3 {
    color: var(--primary-100);
}

.close-keyboard-btn {
    width: 40px;
    height: 40px;
    background: var(--primary-100);
    border: 1px solid var(--primary-300);
    border-radius: var(--radius-md);
    color: var(--primary-700);
    font-size: 24px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.close-keyboard-btn:hover {
    background: var(--primary-200);
    color: var(--primary-900);
}

[data-theme="dark"] .close-keyboard-btn {
    background: var(--dark-700);
    border-color: var(--dark-500);
    color: var(--primary-300);
}

[data-theme="dark"] .close-keyboard-btn:hover {
    background: var(--dark-600);
    color: var(--primary-100);
}

/* Chord Identification Display */
.chord-identification-display {
    display: flex;
    gap: var(--space-6);
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    background: var(--primary-50);
    border: 1px solid var(--primary-200);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
}

[data-theme="dark"] .chord-identification-display {
    background: var(--dark-700);
    border-color: var(--dark-500);
}

.identified-chord,
.chord-confidence {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.chord-label,
.confidence-label {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--primary-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

[data-theme="dark"] .chord-label,
[data-theme="dark"] .confidence-label {
    color: var(--primary-400);
}

.chord-identification-display .chord-symbol {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--accent-600);
    font-family: 'Georgia', serif;
    min-width: 120px;
    text-align: center;
}

[data-theme="dark"] .chord-identification-display .chord-symbol {
    color: var(--accent-400);
}

.confidence-value {
    font-size: var(--font-size-lg);
    font-weight: 600;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-sm);
    min-width: 60px;
    text-align: center;
}

.confidence-value.high {
    background: var(--success-500);
    color: white;
}

.confidence-value.medium {
    background: var(--warning-500);
    color: white;
}

.confidence-value.low {
    background: var(--error-500);
    color: white;
}

/* Piano Keyboard Container */
.piano-keyboard-container {
    padding: var(--space-6);
    background: var(--primary-100);
    border: 1px solid var(--primary-200);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
    overflow-x: auto;
    overflow-y: hidden;
}

[data-theme="dark"] .piano-keyboard-container {
    background: var(--dark-700);
    border-color: var(--dark-500);
}

.piano-keyboard {
    display: flex;
    position: relative;
    width: max-content;
    margin: 0 auto;
    height: 240px;
}

/* Piano Keys */
.piano-key {
    position: relative;
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: var(--space-2);
}

.piano-key.white-key {
    width: 50px;
    height: 240px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid var(--primary-300);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.8),
        0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1;
}

[data-theme="dark"] .piano-key.white-key {
    background: linear-gradient(180deg, var(--dark-600) 0%, var(--dark-700) 100%);
    border-color: var(--dark-500);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 2px 4px rgba(0, 0, 0, 0.3);
}

.piano-key.black-key {
    width: 32px;
    height: 160px;
    background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    margin-left: -16px;
    margin-right: -16px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 4px 8px rgba(0, 0, 0, 0.4);
    z-index: 2;
}

[data-theme="dark"] .piano-key.black-key {
    background: linear-gradient(180deg, var(--dark-900) 0%, #0c1017 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 4px 8px rgba(0, 0, 0, 0.6);
}

.key-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--primary-600);
    opacity: 0.6;
    pointer-events: none;
}

.piano-key.black-key .key-label {
    color: var(--primary-300);
}

/* Piano Key States */
.piano-key:hover {
    transform: translateY(2px);
}

.piano-key.white-key:hover {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

[data-theme="dark"] .piano-key.white-key:hover {
    background: linear-gradient(180deg, var(--dark-500) 0%, var(--dark-600) 100%);
}

.piano-key.black-key:hover {
    background: linear-gradient(180deg, #374151 0%, #1f2937 100%);
}

[data-theme="dark"] .piano-key.black-key:hover {
    background: linear-gradient(180deg, var(--dark-800) 0%, var(--dark-900) 100%);
}

/* Selected State */
.piano-key.selected {
    transform: translateY(3px);
}

.piano-key.white-key.selected {
    background: linear-gradient(180deg, var(--accent-400) 0%, var(--accent-500) 100%);
    border-color: var(--accent-600);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.piano-key.white-key.selected .key-label {
    color: white;
    opacity: 1;
}

.piano-key.black-key.selected {
    background: linear-gradient(180deg, var(--accent-500) 0%, var(--accent-600) 100%);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.piano-key.black-key.selected .key-label {
    color: white;
    opacity: 1;
}

/* Root Note State */
.piano-key.root {
    animation: pulse 1s ease-in-out infinite;
}

.piano-key.white-key.root {
    background: linear-gradient(180deg, var(--success-400) 0%, var(--success-500) 100%);
    border-color: var(--success-600);
}

.piano-key.black-key.root {
    background: linear-gradient(180deg, var(--success-500) 0%, var(--success-600) 100%);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.85;
    }
}

/* Keyboard Controls */
.keyboard-controls {
    display: flex;
    gap: var(--space-3);
    justify-content: center;
    flex-wrap: wrap;
}

.keyboard-controls button {
    padding: var(--space-3) var(--space-6);
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.clear-selection-btn {
    background: var(--primary-500);
    color: white;
}

.clear-selection-btn:hover:not(:disabled) {
    background: var(--primary-600);
}

.cycle-root-btn {
    background: var(--warning-500);
    color: white;
}

.cycle-root-btn:hover:not(:disabled) {
    background: var(--warning-600);
}

.add-chord-btn {
    background: linear-gradient(135deg, var(--success-500) 0%, var(--success-600) 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.add-chord-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--success-600) 0%, var(--success-700) 100%);
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

.cancel-keyboard-btn {
    background: var(--primary-200);
    color: var(--primary-700);
}

.cancel-keyboard-btn:hover {
    background: var(--primary-300);
    color: var(--primary-900);
}

[data-theme="dark"] .cancel-keyboard-btn {
    background: var(--dark-700);
    color: var(--primary-300);
}

[data-theme="dark"] .cancel-keyboard-btn:hover {
    background: var(--dark-600);
    color: var(--primary-100);
}

.keyboard-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Keyboard Help Text */
.keyboard-help-text {
    text-align: center;
    font-size: var(--font-size-sm);
    color: var(--primary-600);
    margin-top: var(--space-4);
    padding: var(--space-3);
    background: var(--primary-50);
    border-radius: var(--radius-md);
}

[data-theme="dark"] .keyboard-help-text {
    color: var(--primary-400);
    background: var(--dark-700);
}