/* ============================================
   TONLEITER APP - Keyboard Component Styles
   ============================================ */

.keyboard-container {
    display: flex;
    justify-content: center;
    padding: var(--spacing-md);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.keyboard {
    display: flex;
    position: relative;
    background: linear-gradient(180deg, #1a1a1a 0%, #2d2d2d 100%);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl), inset 0 1px 0 rgba(255,255,255,0.1);
}

/* White keys */
.key {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid #d0d0d0;
    border-bottom: 3px solid #aaa;
    border-radius: 0 0 8px 8px;
    cursor: pointer;
    transition: all var(--ease-spring) var(--duration-normal);
    -webkit-user-select: none;
    user-select: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1), inset 0 -2px 4px rgba(0,0,0,0.05);
}

/* Key sizes - Desktop */
.key.white {
    width: 80px;
    height: 350px;
    margin-right: 3px;
    z-index: 1;
}

.key.white:last-of-type {
    margin-right: 0;
}

/* Black keys */
.key.black {
    position: absolute;
    width: 52px;
    height: 215px;
    background: linear-gradient(180deg, #2c3e50 0%, #1a252f 100%);
    border: 1px solid #0a0a0a;
    border-bottom: 3px solid #000;
    border-radius: 0 0 8px 8px;
    z-index: 10;
    box-shadow: 0 3px 6px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.1);
}

/* Key states */
.key.active {
    cursor: pointer;
}

.key.active.white {
    background: linear-gradient(180deg, var(--key-active) 0%, #FDB44B 100%);
    border-color: var(--color-accent);
    border-width: 2px;
    box-shadow: 0 0 12px var(--key-glow), 0 4px 8px rgba(0,0,0,0.15), inset 0 -2px 4px rgba(0,0,0,0.05);
    z-index: 2;
}

.key.active.black {
    background: linear-gradient(180deg, var(--key-active) 0%, #E0A84B 100%);
    box-shadow: 0 0 12px var(--key-glow), 0 3px 6px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.2);
    z-index: 10;
}

.key.inactive {
    cursor: not-allowed;
}

.key.inactive.white {
    background: #ffffff;
    border-color: #d0d0d0;
}

.key.inactive.black {
    background: #000000;
    border-color: #000000;
    z-index: 11;
}

.key.pressed.white,
.key.active.white:active {
    background: linear-gradient(180deg, #FDB44B 0%, var(--key-active) 100%);
    transform: translateY(2px);
    box-shadow: 0 0 20px var(--key-glow), 0 2px 4px rgba(0,0,0,0.2);
}

.key.pressed.black,
.key.active.black:active {
    background: linear-gradient(180deg, #E0A84B 0%, var(--key-active) 100%);
    transform: translateY(2px);
    box-shadow: 0 0 16px var(--key-glow), 0 1px 3px rgba(0,0,0,0.4);
}

/* Key number label */
.key-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-primary) 100%);
    color: white;
    border-radius: 50%;
    font-size: 28px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
}

.key.black .key-number {
    width: 48px;
    height: 48px;
    font-size: 24px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    box-shadow: 0 3px 10px rgba(255, 107, 107, 0.5);
}

.key.inactive .key-number {
    display: none;
}

/* Key note label (for debugging/accessibility) */
.key-note {
    font-size: 22px;
    color: var(--color-text-muted);
    margin-bottom: 8px;
}

.key.black .key-note {
    color: #aaa;
}

.key.inactive .key-note {
    display: none;
}

/* Arrow indicators between keys */
.arrow-indicator {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 30px;
}

/* Responsive - Tablet */
@media (max-width: 1024px) {
    .key.white {
        width: 70px;
        height: 304px;
    }

    .key.black {
        width: 45px;
        height: 184px;
    }

    .key-number {
        width: 48px;
        height: 48px;
        font-size: 24px;
    }

    .key.black .key-number {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
}

/* Responsive - Mobile */
@media (max-width: 600px) {
    .key.white {
        width: 61px;
        height: 264px;
    }

    .key.black {
        width: 38px;
        height: 160px;
    }

    .key-number {
        width: 44px;
        height: 44px;
        font-size: 22px;
    }

    .key.black .key-number {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
}

/* High contrast mode for accessibility */
@media (prefers-contrast: high) {
    .key.active.white {
        border-width: 3px;
        border-color: var(--color-primary-dark);
    }

    .key-number {
        font-weight: 700;
    }
}

/* ============================================
   REFERENCE KEYBOARD (Static, for Trainer)
   ============================================ */

.keyboard.reference {
    padding: var(--spacing-md);
    background: linear-gradient(180deg, #2a2a2a 0%, #1a1a1a 100%);
}

.keyboard.reference .key.white {
    width: 56px;
    height: 100px;
    margin-right: 2px;
    cursor: default;
}

.keyboard.reference .key.black {
    width: 36px;
    height: 65px;
    cursor: default;
    border: 0.5px solid #0a0a0a;
    border-bottom: 1px solid #000;
}

/* Key labels for reference keyboard */
.keyboard.reference .key-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.keyboard.reference .key.black .key-label {
    font-size: 11px;
    color: #fff;
    margin-bottom: 6px;
}

/* Reference keyboard responsive - Tablet */
@media (max-width: 1024px) {
    .keyboard.reference .key.white {
        width: 48px;
        height: 85px;
    }

    .keyboard.reference .key.black {
        width: 32px;
        height: 55px;
        border: 0.5px solid #0a0a0a;
        border-bottom: 1px solid #000;
    }

    .keyboard.reference .key-label {
        font-size: 12px;
    }

    .keyboard.reference .key.black .key-label {
        font-size: 10px;
    }
}

/* Reference keyboard responsive - Mobile */
@media (max-width: 600px) {
    .keyboard.reference .key.white {
        width: 40px;
        height: 70px;
    }

    .keyboard.reference .key.black {
        width: 28px;
        height: 45px;
        border: 0.5px solid #0a0a0a;
        border-bottom: 1px solid #000;
    }

    .keyboard.reference .key-label {
        font-size: 11px;
        margin-bottom: 4px;
    }

    .keyboard.reference .key.black .key-label {
        font-size: 9px;
        margin-bottom: 3px;
    }
}
