/* ============================================
   CHORD DIAGRAMS PANEL
   ============================================ */

.chord-panel {
    flex-shrink: 0;
    width: 300px;
    display: none;
    flex-direction: column;
    gap: 8px;
    margin-left: 24px;
    align-self: flex-start;
    padding-top: 24px;
    position: sticky;
    top: 24px;
}

.chord-panel.open {
    display: flex;
}

/* Mobile-only header: drag handle + close button */
.chord-panel-mobile-header {
    display: none; /* shown only via responsive.css */
    align-items: center;
    justify-content: center;
    padding: 10px 14px 4px;
    position: relative;
    flex-shrink: 0;
}

.chord-panel-drag-handle {
    width: 36px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
}

.chord-panel-close {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 13px;
    transition: color 0.15s;
}

.chord-panel-close:hover {
    color: var(--text-primary);
}

/* Guitar / Piano toggle — muted, full width */
.chord-view-switch {
    display: flex;
    gap: 2px;
    background: var(--surface-hover);
    border-radius: 7px;
    padding: 3px;
    width: 100%;
    box-sizing: border-box;
    opacity: 0.72;
    transition: opacity 0.15s;
}

.chord-view-switch:hover {
    opacity: 1;
}

.chord-view-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 26px;
    border: none;
    background: transparent;
    border-radius: 5px;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-size: 11px;
    gap: 5px;
}

.chord-view-btn:hover {
    color: var(--text-secondary);
}

.chord-view-btn.active {
    background: var(--surface-elevated);
    color: var(--text-secondary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* Cards container */
.chord-panel-content {
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    align-content: flex-start;
    max-height: calc(100vh - var(--nav-height) - 100px);
    max-height: min(60vh, calc(100vh - var(--nav-height) - 100px));
}

.chord-panel-empty {
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--text-tertiary);
    text-align: center;
    padding: 40px 16px;
    width: 100%;
}

/* Dedicated backdrop for mobile chord panel overlay */
.chord-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.38);
    z-index: 149;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.chord-backdrop.active {
    display: block;
    opacity: 1;
}

/* ============================================
   CHORD CARDS
   ============================================ */

/* Guitar: 2 columns */
.chord-card {
    width: calc(50% - 4px);
    background: var(--surface-elevated);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 10px 8px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
}

/* Piano: 1 column (2-octave keyboard needs the width) */
.chord-panel-content.piano-mode .chord-card {
    width: 100%;
}

/* Voicing navigation arrows */
.chord-voicing-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    margin-top: 4px;
}

.voicing-btn {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 1px 5px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}

.voicing-btn:hover {
    color: var(--text-primary);
    background: var(--surface-hover);
}

.voicing-counter {
    font-family: var(--font-sans);
    font-size: 10px;
    color: var(--text-tertiary);
    min-width: 22px;
    text-align: center;
    user-select: none;
}

.chord-card-name {
    font-family: var(--chord-font);
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 8px;
    text-align: center;
    line-height: 1;
    white-space: nowrap;
}

.auto-label {
    font-family: var(--font-sans);
    font-size: 10px;
    color: var(--text-tertiary);
    text-align: center;
    user-select: none;
    margin-bottom: 2px;
}

.chord-card-diagrams {
    width: 100%;
    display: flex;
    justify-content: center;
}

/* ============================================
   SVG DIAGRAMS (shared)
   ============================================ */

.chord-svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

/* ============================================
   GUITAR DIAGRAM SVG
   ============================================ */

.guitar-svg {
    max-width: 110px;
}

.guitar-svg .g-nut {
    fill: var(--text-primary);
}

.guitar-svg .g-nut-thin {
    stroke: var(--border);
    stroke-width: 2;
    fill: none;
}

.guitar-svg .g-fret {
    stroke: var(--border);
    stroke-width: 1.5;
    fill: none;
}

.guitar-svg .g-string {
    stroke: var(--text-tertiary);
    stroke-width: 1.5;
    fill: none;
}

.guitar-svg .g-open {
    fill: none;
    stroke: var(--text-secondary);
    stroke-width: 1.8;
}

.guitar-svg .g-mute {
    stroke: var(--text-tertiary);
    stroke-width: 1.8;
    stroke-linecap: round;
    fill: none;
}

.guitar-svg .g-dot {
    fill: var(--accent);
}

.guitar-svg .g-dot-num {
    fill: white;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-sans);
    dominant-baseline: central;
}

.guitar-svg .g-barre {
    fill: var(--accent);
    rx: 9;
}

.guitar-svg .g-fret-badge {
    fill: var(--accent);
    opacity: 0.15;
}

.guitar-svg .g-fret-num {
    fill: var(--accent);
    font-size: 14px;
    font-weight: 700;
    font-family: var(--font-sans);
    dominant-baseline: central;
}

.guitar-svg .g-no-data {
    fill: var(--text-tertiary);
    font-size: 16px;
    font-family: var(--font-sans);
    dominant-baseline: central;
}

/* ============================================
   PIANO DIAGRAM SVG
   ============================================ */

.piano-svg {
    max-width: 100%;
}

.piano-svg .p-white {
    fill: #f3f3f0;
    stroke: #c6c4be;
    stroke-width: 1;
}

.piano-svg .p-black {
    fill: #282828;
    stroke: none;
}

.piano-svg .p-active {
    fill: var(--accent) !important;
    opacity: 0.9;
}
