/**
 * TROUVE ACCORD - Piano Interactif
 * Style minimaliste inspiré du visuel R
 * Design plat avec bordures épaisses
 */

/* ============================================
   STRUCTURE DU PIANO
   ============================================ */

.piano-interactive {
    display: flex;
    justify-content: flex-start;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

/* Bordure gauche sur la première touche blanche */
.piano-octave:first-child .piano-key-container:first-child .piano-key.white-key {
    border-left-width: 1.5px;
}

/* Bordure droite sur la dernière touche blanche */
.piano-octave:last-child .piano-key-container:last-child .piano-key.white-key {
    border-right-width: 1.5px;
}

/* Scrollbar personnalisée */
.piano-interactive::-webkit-scrollbar {
    height: 8px;
}

.piano-interactive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.piano-interactive::-webkit-scrollbar-thumb {
    background: #2d3748;
    border-radius: 4px;
}

.piano-interactive::-webkit-scrollbar-thumb:hover {
    background: #1a202c;
}

/* ============================================
   OCTAVE
   ============================================ */

.piano-octave {
    display: flex;
    position: relative;
}

/* Do en gras pour toutes les octaves */
.piano-key.white-key[data-note-name="C"] .key-label {
    font-weight: 900;
}

/* ============================================
   CONTENEUR DE TOUCHE
   ============================================ */

.piano-key-container {
    position: relative;
    display: flex;
}

/* ============================================
   TOUCHES - STYLE MINIMALISTE R
   ============================================ */

.piano-key {
    cursor: pointer;
    transition: opacity 0.15s ease;
    user-select: none;
    position: relative;
}

/* Touche blanche - Style plat */
.piano-key.white-key {
    width: 55px;
    height: 200px;
    background: #FFFFFF;
    border: 1px solid #2d3748;
    border-top-width: 1.5px;
    border-bottom-width: 1.5px;
    border-radius: 0;
    box-shadow: none;
    z-index: 1;
}

/* Touche noire - Style plat */
.piano-key.black-key {
    position: absolute;
    left: 100%;
    top: 0;
    width: 35px;
    height: 125px;
    background: #2d3748;
    border: 1px solid #2d3748;
    border-top-width: 1.5px;
    border-bottom-width: 1.5px;
    border-radius: 0;
    box-shadow: none;
    z-index: 2;
    transform: translateX(-50%);
}

/* ============================================
   LABELS DES TOUCHES
   ============================================ */

.key-label {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    font-weight: 600;
    color: #2d3748;
    pointer-events: none;
}

.black-key .key-label {
    color: #FFFFFF;
    font-size: 0.6875rem;
    bottom: 8px;
}

/* ============================================
   ÉTATS DES TOUCHES
   ============================================ */

/* Hover - Légère opacité */
.piano-key.white-key:hover:not(.selected) {
    opacity: 0.85;
}

.piano-key.black-key:hover:not(.selected) {
    background: #3a3a3a;
}

/* Touche sélectionnée - Orange */
.piano-key.white-key.selected {
    background: #FF8C00;
    border-color: #2d3748;
    box-shadow: none;
}

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

/* Touche noire sélectionnée */
.piano-key.black-key.selected {
    background: #FF8C00;
    border-color: #2d3748;
    box-shadow: none;
}

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

/* ============================================
   ACCESSIBILITÉ
   ============================================ */

.piano-key:focus {
    outline: 3px solid #FF8C00;
    outline-offset: 2px;
    z-index: 3;
}

.piano-key:focus:not(:focus-visible) {
    outline: none;
}

@media (prefers-reduced-motion: reduce) {
    .piano-key {
        transition: none;
    }
}

/* ============================================
   MODE SOMBRE
   ============================================ */

@media (prefers-color-scheme: dark) {
    .piano-key.white-key {
        background: #FFFFFF;
        border-color: #2d3748;
    }

    .piano-key.black-key {
        background: #2d3748;
        border-color: #2d3748;
    }

    .piano-key.white-key:hover:not(.selected) {
        opacity: 0.85;
    }
    
    .piano-key.white-key.selected,
    .piano-key.black-key.selected {
        background: #FF8C00;
    }
}