/* Keyboard Course Styles */

/* Accent color for this course - warm amber */
:root {
    --kb-accent: #F59E0B;
    --kb-accent-light: #FCD34D;
    --kb-accent-dark: #D97706;
    --kb-accent-glow: rgba(245, 158, 11, 0.4);
}

/* Active lesson nav */
.lesson-nav-link.active {
    background: rgba(245, 158, 11, 0.1);
    color: var(--kb-accent);
}

/* Gradient border for tools */
.gradient-border {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(245, 158, 11, 0.05));
}

/* ==================== */
/* KEYBOARD COMPONENT   */
/* ==================== */

.keyboard-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    touch-action: manipulation;
}

.keyboard {
    position: relative;
    background: linear-gradient(180deg, #1a1a2e 0%, #0f0f1a 100%);
    padding: 20px 15px 15px;
    border-radius: 12px;
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    overflow-x: auto;
    max-width: 100%;
    /* Height for keys (160px) + padding */
    height: 195px;
}

/* Dynamic width based on octaves - 42px per white key slot + padding */
.keyboard[data-octaves="1"] {
    width: calc(8 * 42px + 30px); /* 7 keys + final C + padding */
}

.keyboard[data-octaves="2"] {
    width: calc(15 * 42px + 30px); /* 14 keys + final C + padding */
}

.keyboard[data-octaves="3"] {
    width: calc(22 * 42px + 30px); /* 21 keys + final C + padding */
}

.keyboard-octave {
    position: relative;
}

/* White Keys */
.key.white {
    width: 40px;
    height: 160px;
    background: linear-gradient(180deg, #ffffff 0%, #f0f0f0 100%);
    border: 1px solid #ccc;
    border-radius: 0 0 6px 6px;
    cursor: pointer;
    position: absolute;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 8px;
    transition: all 0.08s ease;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.3),
        inset 0 -2px 4px rgba(0, 0, 0, 0.1);
}

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

.key.white.active {
    background: linear-gradient(180deg, #e8e8e8 0%, #d8d8d8 100%);
    transform: translateY(2px);
    box-shadow:
        0 2px 3px rgba(0, 0, 0, 0.2),
        inset 0 -1px 2px rgba(0, 0, 0, 0.1);
}

.key.white .key-label {
    font-size: 11px;
    font-weight: 600;
    color: #555;
    pointer-events: none;
}

/* Black Keys */
.key.black {
    width: 26px;
    height: 100px;
    background: linear-gradient(180deg, #3a3a3a 0%, #1a1a1a 100%);
    border-radius: 0 0 4px 4px;
    cursor: pointer;
    position: absolute;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 6px;
    transition: all 0.08s ease;
    box-shadow:
        0 4px 8px rgba(0, 0, 0, 0.5),
        inset 0 -2px 4px rgba(0, 0, 0, 0.3);
}

.key.black:hover {
    background: linear-gradient(180deg, #454545 0%, #252525 100%);
}

.key.black.active {
    background: linear-gradient(180deg, #2a2a2a 0%, #151515 100%);
    transform: translateY(2px);
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.4),
        inset 0 -1px 2px rgba(0, 0, 0, 0.2);
}

.key.black .key-label {
    font-size: 9px;
    font-weight: 500;
    color: #aaa;
    pointer-events: none;
}

/* Highlighted Keys */
.key.highlighted {
    box-shadow:
        0 0 20px var(--kb-accent-glow),
        0 0 40px var(--kb-accent-glow);
}

.key.white.highlighted {
    background: linear-gradient(180deg, var(--kb-accent-light) 0%, var(--kb-accent) 100%);
    border-color: var(--kb-accent-dark);
}

.key.white.highlighted .key-label {
    color: #1a1a1a;
    font-weight: 700;
}

.key.black.highlighted {
    background: linear-gradient(180deg, var(--kb-accent) 0%, var(--kb-accent-dark) 100%);
}

.key.black.highlighted .key-label {
    color: #fff;
}

/* Disabled Keys */
.key.disabled {
    opacity: 0.3;
    pointer-events: none;
}

/* Dimmed Keys (not disabled, just de-emphasized) */
.key.dimmed {
    opacity: 0.5;
}

/* Success Animation */
.key.success-pulse {
    animation: keySuccessPulse 0.6s ease-out;
}

@keyframes keySuccessPulse {
    0% {
        box-shadow: 0 0 20px var(--kb-accent-glow);
    }
    50% {
        box-shadow: 0 0 40px var(--kb-accent), 0 0 60px var(--kb-accent-glow);
    }
    100% {
        box-shadow: 0 0 20px var(--kb-accent-glow);
    }
}

/* Arpeggiator Active State */
.key.arp-active {
    box-shadow: 0 0 25px var(--kb-accent), 0 0 50px var(--kb-accent-glow) !important;
}

/* Note Display */
.note-display {
    background: rgba(26, 26, 46, 0.8);
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 0.5rem 1.5rem;
    text-align: center;
}

.note-name {
    font-family: ui-monospace, monospace;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--kb-accent);
}

/* Final C key (extends past last octave) */
.key.final-c {
    border-left: 1px solid #ccc;
}

/* ==================== */
/* EXERCISE CONTROLS    */
/* ==================== */

.exercise-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    margin-top: 1.5rem;
}

.btn-demo, .btn-reset {
    padding: 0.75rem 1.5rem;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--kb-accent);
    border-radius: 8px;
    color: var(--kb-accent);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-demo:hover, .btn-reset:hover {
    background: rgba(245, 158, 11, 0.2);
}

.tempo-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #a0a0a0;
    font-size: 0.875rem;
}

.tempo-slider {
    width: 100px;
    accent-color: var(--kb-accent);
}

/* ==================== */
/* PROGRESS INDICATOR   */
/* ==================== */

.progress-indicator {
    width: 100%;
    max-width: 400px;
    margin: 1rem auto;
}

.progress-steps {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.progress-step {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #2a2a2a;
    border: 2px solid #3a3a3a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #666;
    transition: all 0.3s;
}

.progress-step.complete {
    background: var(--kb-accent);
    border-color: var(--kb-accent);
    color: #1a1a1a;
}

.progress-step.active {
    border-color: var(--kb-accent);
    color: var(--kb-accent);
    box-shadow: 0 0 15px var(--kb-accent-glow);
}

.progress-bar {
    height: 6px;
    background: #2a2a2a;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--kb-accent), var(--kb-accent-light));
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* ==================== */
/* CHORD DISPLAY        */
/* ==================== */

.chord-display {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    margin: 1.5rem 0;
}

.chord-box {
    padding: 1rem 1.5rem;
    background: rgba(26, 26, 46, 0.8);
    border: 2px solid #2a2a2a;
    border-radius: 12px;
    text-align: center;
    min-width: 80px;
    transition: all 0.3s;
}

.chord-box.active {
    border-color: var(--kb-accent);
    background: rgba(245, 158, 11, 0.1);
    box-shadow: 0 0 20px var(--kb-accent-glow);
}

.chord-box.complete {
    border-color: #4ADE80;
    background: rgba(74, 222, 128, 0.1);
}

.chord-name {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #f5f5f5;
    margin-bottom: 0.25rem;
}

.chord-box.active .chord-name {
    color: var(--kb-accent);
}

.chord-notes {
    display: block;
    font-size: 0.75rem;
    color: #888;
    font-family: ui-monospace, monospace;
}

/* ==================== */
/* SOUND SELECTOR       */
/* ==================== */

.sound-selector {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    margin: 1rem 0;
}

.sound-btn {
    padding: 0.5rem 1rem;
    background: rgba(26, 26, 46, 0.8);
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    color: #a0a0a0;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.sound-btn:hover {
    border-color: rgba(245, 158, 11, 0.5);
    color: #f5f5f5;
}

.sound-btn.active {
    background: rgba(245, 158, 11, 0.1);
    border-color: var(--kb-accent);
    color: var(--kb-accent);
}

/* ==================== */
/* ARPEGGIATOR CONTROLS */
/* ==================== */

.arp-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    background: rgba(26, 26, 46, 0.5);
    border-radius: 12px;
    margin-top: 1rem;
}

.arp-control-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.arp-control-group label {
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.arp-control-group select,
.arp-control-group input {
    padding: 0.5rem;
    background: #1a1a2e;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    color: #f5f5f5;
    font-size: 0.875rem;
}

/* ==================== */
/* SUCCESS MESSAGE      */
/* ==================== */

.success-message {
    padding: 1.5rem;
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.3);
    border-radius: 12px;
    text-align: center;
    margin-top: 1.5rem;
    animation: fadeInUp 0.4s ease-out;
}

.success-message h4 {
    color: #4ADE80;
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.success-message p {
    color: #a0a0a0;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== */
/* FINGER DIAGRAM       */
/* ==================== */

.finger-diagram {
    display: flex;
    justify-content: center;
    gap: 3rem;
    padding: 2rem;
    background: rgba(26, 26, 46, 0.5);
    border-radius: 12px;
}

.hand-diagram {
    text-align: center;
}

.hand-diagram h4 {
    color: #f5f5f5;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.hand-svg {
    width: 150px;
    height: 180px;
}

/* ==================== */
/* LANDSCAPE PROMPT     */
/* ==================== */

.landscape-prompt {
    display: none;
    padding: 1.5rem;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--kb-accent);
    border-radius: 12px;
    text-align: center;
    margin-bottom: 1rem;
}

.landscape-prompt svg {
    width: 48px;
    height: 48px;
    color: var(--kb-accent);
    margin-bottom: 0.75rem;
    animation: rotateHint 2s ease-in-out infinite;
}

@keyframes rotateHint {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(90deg); }
}

.landscape-prompt p {
    color: #f5f5f5;
    font-size: 0.875rem;
}

/* Show landscape prompt on portrait mobile */
@media (max-width: 640px) and (orientation: portrait) {
    .landscape-prompt {
        display: block;
    }
}

/* ==================== */
/* MOBILE RESPONSIVE    */
/* ==================== */

@media (max-width: 768px) {
    .keyboard {
        padding: 15px 10px 10px;
    }

    .key.white {
        width: 36px;
        height: 140px;
    }

    .key.black {
        width: 24px;
        height: 90px;
    }

    .key.white .key-label {
        font-size: 10px;
    }

    .key.black .key-label {
        font-size: 8px;
    }

    .chord-display {
        gap: 0.5rem;
    }

    .chord-box {
        padding: 0.75rem 1rem;
        min-width: 60px;
    }

    .chord-name {
        font-size: 1.25rem;
    }
}

/* Extra small screens - make keyboard scrollable */
@media (max-width: 480px) {
    .keyboard-wrapper {
        padding: 0.5rem;
    }

    .keyboard {
        padding: 12px 8px 8px;
        min-width: max-content;
    }

    .key.white {
        width: 32px;
        height: 120px;
    }

    .key.black {
        width: 20px;
        height: 75px;
    }
}

/* Landscape mode on mobile - better experience */
@media (max-height: 500px) and (orientation: landscape) {
    .keyboard-wrapper {
        padding: 0.5rem;
    }

    .key.white {
        height: 120px;
    }

    .key.black {
        height: 75px;
    }

    .landscape-prompt {
        display: none !important;
    }
}
