/**
 * MODE GAMMES - Piano Interactif
 * Style minimaliste inspiré du visuel R
 * Design plat avec bordures épaisses
 * Mode lecture seule (pas de clic)
 */

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

.piano-interactive {
    display: flex;
    justify-content: flex-start; /* Par défaut aligné à gauche pour permettre le scroll */
    width: auto; /* Au lieu de 100% - permet au piano de prendre sa taille naturelle */
    min-width: 100%; /* Minimum 100% mais peut être plus large */
    overflow-x: visible; /* Le scroll est géré par piano-scroll-wrapper */
    overflow-y: visible;
}

/* Centrer le piano uniquement en mode dézoomé */
.trouve-accord-instrument-container.zoomed-out .piano-interactive {
    justify-content: center;
}

/* 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;
}

/* ============================================
   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: default; /* Mode gammes : pas de clic */
    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 (MODE GAMMES)
   ============================================ */

/* Pas de hover en mode gammes (lecture seule) */
.piano-key.white-key:hover:not(.selected) {
    opacity: 1;
}

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

/* Touche sélectionnée (note de la gamme) - Orange */
.piano-key.white-key.selected {
    background: #FF8C00;
    border-color: #2d3748;
    box-shadow: 0 0 8px rgba(255, 140, 0, 0.5);
}

.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: 0 0 8px rgba(255, 140, 0, 0.5);
}

.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;
    }
}

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

@media (max-width: 47.9375rem) {
  
   .trouve-accord-instrument-container:not(.zoomed-out) .piano-interactive {
        transform: scale(0.55);
        transform-origin: left center;
    }
}

    .piano-key.white-key {
        width: 45px;
        height: 160px;
    }
    
    .piano-key.black-key {
        width: 28px;
        height: 100px;
    }
    
    .key-label {
        font-size: 0.65rem;
        bottom: 8px;
    }
    
    .black-key .key-label {
        font-size: 0.6rem;
        bottom: 6px;
    }
}

/* ============================================
   PRINT
   ============================================ */

@media print {
    .piano-key.white-key {
        background: #FFFFFF;
        border-color: #333;
    }

    .piano-key.black-key {
        background: #666;
        border-color: #333;
    }
    
    .piano-key.white-key.selected,
    .piano-key.black-key.selected {
        background: #999 !important;
        box-shadow: none;
    }
}
