/* ==========================================================================
   Piano Keyboard Shared Styles Module (modules/piano-keyboard.css)
   ========================================================================== */

.piano-keyboard {
    position: relative;
    width: 100% !important;
    max-width: 360px !important;
    height: 105px !important;
    background: #1e1e1e;
    border-radius: 8px 8px 16px 16px;
    padding: 8px 8px 12px 8px;
    box-shadow: inset 0 -4px 0 #000, 0 10px 25px rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: space-between;
    margin: 0.5rem 0 !important;
    box-sizing: border-box;
}

.key {
    border-radius: 0 0 4px 4px;
    cursor: pointer;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 4px;
    padding-bottom: 0;
    font-weight: 700;
    font-size: 0.75rem;
    color: transparent;
    user-select: none;
}

.key span.key-label {
    position: relative;
    z-index: 5;
    pointer-events: none;
}

.key.white {
    width: 6.8%;
    height: 100%;
    background: linear-gradient(to bottom, #fff 0%, #f0f0f0 100%);
    box-shadow: inset 0 0 3px rgba(0,0,0,0.2), 0 3px 5px rgba(0,0,0,0.3);
    z-index: 1;
}

.key.black {
    position: absolute;
    width: 4.5%;
    height: 60%;
    background: linear-gradient(to bottom, #333 0%, #000 100%);
    box-shadow: inset 0 0 2px rgba(255,255,255,0.2), 2px 3px 5px rgba(0,0,0,0.4);
    z-index: 2;
    top: 10px;
    border-radius: 0 0 3px 3px;
}

/* ==========================================================================
   Active Key & Note Pill Highlights (Current Chord - Green & Theory Colors)
   ========================================================================== */
.key.active {
    background: #10b981 !important;
    color: #fff !important;
    border-color: #059669 !important;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.6) !important;
}

.key.active.triad, .key.active.root {
    background: #10b981 !important;
    color: #fff !important;
    border-color: #059669 !important;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.6) !important;
}
.note-pill.active.triad, .note-pill.active.root {
    background-color: rgba(16, 185, 129, 0.85);
    color: #fff;
    border: 1px solid #10b981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.key.active.seventh {
    background: #3b82f6 !important;
    color: #fff !important;
    border-color: #2563eb !important;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.6) !important;
}
.note-pill.active.seventh {
    background-color: rgba(59, 130, 246, 0.85);
    color: #fff;
    border: 1px solid #3b82f6;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

.key.active.ninth {
    background: #8b5cf6 !important;
    color: #fff !important;
    border-color: #7c3aed !important;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.6) !important;
}
.note-pill.active.ninth {
    background-color: rgba(139, 92, 246, 0.85);
    color: #fff;
    border: 1px solid #8b5cf6;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
}

.key.active.alt {
    background: #ec4899 !important;
    color: #fff !important;
    border-color: #db2777 !important;
    box-shadow: 0 0 15px rgba(236, 72, 153, 0.6) !important;
}
.note-pill.active.alt {
    background-color: rgba(236, 72, 153, 0.85);
    color: #fff;
    border: 1px solid #ec4899;
    box-shadow: 0 0 10px rgba(236, 72, 153, 0.4);
}

/* ==========================================================================
   Next Chord Highlight (Amber / Gold Colors)
   ========================================================================== */
.key.next-active {
    background: #f59e0b !important;
    color: #000 !important;
    border: 1px solid #d97706 !important;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.75) !important;
}

.note-pill.next-active {
    background-color: rgba(245, 158, 11, 0.85) !important;
    color: #000 !important;
    border: 1px solid #f59e0b !important;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.4) !important;
    font-weight: 700;
}

/* ==========================================================================
   Common Notes Highlight (Dourado Claro para notas mantidas do acorde anterior)
   ========================================================================== */
.key.common-note {
    outline: 3px solid #fde047 !important;
    outline-offset: -2px;
    box-shadow: 0 0 18px rgba(253, 224, 71, 0.95), inset 0 0 10px rgba(253, 224, 71, 0.45) !important;
    color: #fef08a !important;
}

.note-pill.common-note {
    border: 2px solid #fde047 !important;
    box-shadow: 0 0 12px rgba(253, 224, 71, 0.85) !important;
    color: #fef08a !important;
}

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

.note-pill {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

/* ==========================================================================
   Piano Row Layout & Side Inversion Controls
   ========================================================================== */

.piano-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    width: 100%;
    margin: 0.5rem 0;
}

.piano-row .piano-keyboard {
    flex: 1;
    min-width: 0;
    max-width: 310px !important;
    margin: 0 !important;
}

.inversion-column {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 105px;
    width: 65px;
    flex-shrink: 0;
}

.inv-side-btn {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #cbd5e1;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.38rem 0.2rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    line-height: 1.1;
    width: 100%;
    user-select: none;
    font-family: inherit;
}

.inv-side-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.35);
    color: #fff;
    transform: translateX(-2px);
}

.inversion-column.current-inv .inv-side-btn.active {
    background: #10b981;
    border-color: #059669;
    color: #fff;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.65);
}

.inversion-column.next-inv .inv-side-btn.active {
    background: #f59e0b;
    border-color: #d97706;
    color: #000;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.65);
}

@media (max-width: 899px) {
    .piano-row {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        margin: 0.35rem 0 !important;
        gap: 3px !important;
    }
    .piano-keyboard {
        flex: 1 1 auto !important;
        width: calc(100% - 53px) !important;
        max-width: calc(100% - 53px) !important;
        height: 48px !important;
        min-height: 48px !important;
        max-height: 48px !important;
        margin: 0 !important;
        padding: 2px 4px 4px 4px !important;
    }
    .inversion-column {
        flex: 0 0 50px !important;
        width: 50px !important;
        min-width: 50px !important;
        max-width: 50px !important;
        height: 48px !important;
        min-height: 48px !important;
        max-height: 48px !important;
        margin: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        gap: 1px !important;
    }
    .key {
        padding-bottom: 2px !important;
        font-size: 0.52rem !important;
    }
    .inv-side-btn {
        padding: 2px 0 !important;
        font-size: 0.58rem !important;
        line-height: 1 !important;
        border-radius: 4px !important;
        width: 100% !important;
    }
}
