/* ── Chord Overview (Chordify-like grid) ── */

/* Toggle button group */
.chord-view-toggle {
    display: inline-flex;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    background: #fff;
}

.chord-view-toggle button {
    padding: 6px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    border: none;
    background: #fff;
    color: #6b7280;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.chord-view-toggle button:not(:last-child) {
    border-right: 1px solid #e5e7eb;
}

.chord-view-toggle button:hover {
    background: #f9fafb;
}

.chord-view-toggle button.active {
    background: #f3f4f6;
    color: #111827;
}

.chord-view-toggle button.active::before {
    content: '✓';
    font-size: 0.75rem;
}

/* "new" badge */
.chord-view-new-badge {
    display: inline-block;
    padding: 1px 6px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #fff;
    background: #4f46e5;
    border-radius: 9999px;
    line-height: 1.4;
    vertical-align: middle;
    margin-left: 2px;
}

/* Overview container */
.chord-overview-container {
    width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    max-height: 500px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #f9fafb;
    margin-top: 12px;
    scroll-behavior: smooth;
}

/* The grid table */
.chord-overview-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Every cell = one bar (Takt) */
.chord-overview-table td {
    padding: 0;
    margin: 0;
    vertical-align: top;
    position: relative;
    height: 56px;
    min-height: 56px;
    width: 25%;
    /* 4 bars per row → each 25% */
    border-right: 2px solid #9ca3af;
    border-bottom: 1px solid #e5e7eb;
    transition: background 0.12s ease;
}

/* Last column in each row – no right border */
.chord-overview-table td:last-child {
    border-right: none;
}

/* Bar cell content */
.chord-overview-cell {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 56px;
    display: flex;
    align-items: flex-start;
    padding: 8px 12px;
    font-size: 1rem;
    font-weight: 500;
    color: #1f2937;
    box-sizing: border-box;
}

/* Alternating row colours for readability */
.chord-overview-table tr:nth-child(even) td {
    background: #fff;
}

.chord-overview-table tr:nth-child(odd) td {
    background: #f9fafb;
}

/* ── Active bar highlight (dark overlay like Chordify) ── */
.chord-overview-cell.active-bar {
    position: relative;
}

.chord-overview-cell.active-bar::after {
    content: '';
    position: absolute;
    inset: 4px;
    background: rgba(30, 30, 30, 0.85);
    border-radius: 4px;
    z-index: 1;
    pointer-events: none;
}

/* Chord label stays visible on top of dark overlay */
.chord-overview-cell.active-bar .chord-label {
    position: relative;
    z-index: 2;
    color: #fff;
}

/* Chord label */
.chord-label {
    position: relative;
    z-index: 0;
    line-height: 1.15;
}

.chord-label .chord-accidental {
    font-size: 0.72em;
    vertical-align: super;
    line-height: 0;
}

.chord-label .chord-quality {
    font-size: 0.82em;
    font-weight: 400;
    color: #4b5563;
}

.chord-overview-cell.active-bar .chord-label .chord-quality {
    color: rgba(255, 255, 255, 0.8);
}

/* Hover feedback */
.chord-overview-table td:hover {
    background: #eef2ff !important;
    cursor: pointer;
}

/* Current row subtle highlight */
.chord-overview-table tr.active-row td {
    background: #eef2ff !important;
}

/* Scrollbar styling */
.chord-overview-container::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.chord-overview-container::-webkit-scrollbar-track {
    background: transparent;
}

.chord-overview-container::-webkit-scrollbar-thumb {
    background: #c4c4c4;
    border-radius: 3px;
}

.chord-overview-container::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}