/* Taal Notation table: khand/matra headers, line meta cell, row action buttons, drag-and-drop, text rows, matra cells. */

.tableSection {
    min-width: 0;
}

.tableScroller {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    background: #fff;
}

.notationTable {
    width: 100%;
    min-width: 900px;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    background: #fff;
}

.notationTable th,
.notationTable td {
    border-right: 1px solid var(--border-strong);
    border-bottom: 1px solid var(--border-strong);
    padding: 0;
    vertical-align: middle;
}

.notationTable tr>*:last-child {
    border-right: 0;
}

.notationTable tbody tr:last-child>* {
    border-bottom: 0;
}

.notationTable thead th {
    background: #f4f7fb;
    color: #344054;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
}

.lineHeader {
    width: var(--line-column-width);
    min-width: var(--line-column-width);
    padding: 10px !important;
    text-align: left !important;
}

.taalNameHeader {
    padding: 9px 8px !important;
    background: #eaf0ff !important;
    color: #173b91 !important;
    font-size: 13px !important;
}

.khandHeader {
    padding: 7px 5px !important;
}

.khandHeader .khandName {
    display: block;
    font-weight: 800;
}

.khandHeader .khandMarker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-top: 3px;
    font-size: 10px;
    color: var(--muted);
}

.markerBadge {
    display: inline-grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: #fff;
    color: var(--text);
    font-weight: 800;
}

.khandHeader[data-marker-type="khali"] {
    background: #fff8e6;
}

.khandHeader[data-marker-type="sam"] {
    background: #eaf7ef;
}

.matraHeader {
    height: 30px;
    font-size: 10px !important;
}

.lineMetaCell {
    width: var(--line-column-width);
    min-width: var(--line-column-width);
    background: #fafbfd;
    cursor: grab;
}

.lineMetaInner {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
}

.lineMetaTop {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.cycleNumber {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.rowActionButtons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    margin-top: 4px;
}

.rowActionButton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    font-size: 11px;
    color: #4b5563;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.rowActionButton:hover {
    background: #e5e7eb;
    color: #111827;
}

.rowActionButton.danger {
    color: #b91c1c;
}

.rowActionButton.danger:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
}

.rowMuteButton {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 12px;
    opacity: 0.4;
    transition: opacity 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    outline: none;
}
.rowMuteButton:hover {
    opacity: 1;
}
.rowMuteButton.muted {
    opacity: 1;
}

/* Drag and Drop styling */
tr.dragging {
    opacity: 0.4;
    background: #f3f4f6;
}

tr.drag-over-above td {
    border-top: 3px solid var(--accent) !important;
}

tr.drag-over-below td {
    border-bottom: 3px solid var(--accent) !important;
}

.rowLabelInput,
.repeatInput,
.textRowInput {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
    color: var(--text);
}

.rowLabelInput {
    min-height: 34px;
    padding: 6px 8px;
    font-size: 12px;
    font-weight: 650;
}

.repeatInput {
    min-height: 30px;
    padding: 5px 8px;
    font-size: 11px;
}

.matraCell {
    position: relative;
    height: 82px;
    min-width: 42px;
    background: #fff;
    overflow: hidden;
}

.matraCellInner {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.matraCell.khandStart {
    border-left: 2px solid #7f8ca1;
}

.matraCell.active {
    box-shadow: inset 0 0 0 3px var(--accent);
    z-index: 2;
}

.matraCell.selected {
    background: #e0f2fe !important;
}

.matraCell.englishMode {
    background: #fbf8f2;
}

.matraCell.invalid {
    background: #fff3f1;
}

.matraText {
    display: inline-block;
    font-family: var(--notation-font-family), sans-serif;
    font-size: var(--matra-font-size);
    font-variant-ligatures: normal;
    line-height: 1.25;
    letter-spacing: 0.5px;
    color: #111827;
    white-space: nowrap;
    position: relative;
    pointer-events: none;
    z-index: 1;
}

.matraCell.englishMode .matraText {
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: calc(var(--matra-font-size) * 0.67);
    font-weight: 650;
    letter-spacing: 0;
}

.matraCell.meend .matraText::before,
.matraCell.combined .matraText::after {
    content: "";
    position: absolute;
    left: -5%;
    width: 110%;
    height: 14px;
    pointer-events: none;
    z-index: 2;
}

.matraCell.meend .matraText::before {
    top: -5px;
    border-top: 2px solid #111827;
    border-radius: 100%;
}

.matraCell.combined .matraText::after {
    bottom: -5px;
    border-bottom: 2px solid #111827;
    border-radius: 100%;
}

.cellModeBadge {
    position: absolute;
    top: 3px;
    right: 4px;
    z-index: 3;
    color: #8b6b20;
    font: 700 8px/1 ui-sans-serif, system-ui, sans-serif;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    pointer-events: none;
}

.matraInput {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    padding: 17px 4px 15px;
    background: transparent;
    color: transparent;
    caret-color: #111827;
    text-align: center;
    font-family: var(--notation-font-family), sans-serif;
    font-size: var(--matra-font-size);
    font-variant-ligatures: normal;
    line-height: 1.25;
    letter-spacing: 0.5px;
    z-index: 3;
}

.matraCell.englishMode .matraInput {
    padding-left: 4px;
    padding-right: 4px;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: calc(var(--matra-font-size) * 0.67);
    font-weight: 650;
    letter-spacing: 0;
}

.textRow td {
    background: #fff;
}

.textRowCell {
    padding: 7px !important;
}

.textRowInner {
    position: relative;
    display: flex;
    align-items: center;
    gap: 7px;
}

.textRowInput {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    padding-right: 75px;
    font-size: 13px;
}

.textRowAlignControls {
    position: absolute;
    right: 8px;
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.textRowInner:hover .textRowAlignControls,
.textRowInner:focus-within .textRowAlignControls {
    opacity: 1;
}

.textRowTag {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

