:root {
    --action-column-width: 800px;
}
/* ── Actions column ─────────────────────────────────────────── */

#csvTable tbody td.action-cell {
    width: var(--action-column-width) !important;
    min-width: var(--action-column-width) !important;
    max-width: var(--action-column-width) !important;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    background: rgba(37, 99, 235, 0.04) !important;
    border-left: 2px solid rgba(59, 130, 246, 0.35) !important;
}

#csvTable thead th.action-cell,
.dataTables_scrollHead th.action-cell,
#csvTable thead th:first-child,
.dataTables_scrollHead th:first-child {
    width: var(--action-column-width) !important;
    min-width: var(--action-column-width) !important;
    max-width: var(--action-column-width) !important;
}
.action-cell-wrap {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: nowrap;
}

/* cluster_id is now a normal data column */
#csvTable tbody td.cluster-cell {
    min-width: 140px !important;
    max-width: 280px !important;
    position: static !important;
    left: auto !important;
    box-shadow: none !important;
    border-left: none !important;
    background: inherit !important;
}

.cluster-action-btn {
    min-height: 26px;
    flex-shrink: 0;
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-sm);
    padding: 0.14rem 0.52rem;
    font-size: 0.68rem;
    font-weight: 800;
    cursor: pointer;
    font-family: "Syne", sans-serif;
    transition:
        background var(--transition),
        color var(--transition),
        border-color var(--transition),
        transform var(--transition),
        box-shadow var(--transition);
    letter-spacing: 0.02em;
}

.cluster-action-btn:hover {
    transform: translateY(-1px);
}
/* Light mode: stronger contrast for action buttons */
:root[data-theme="light"] #csvTable tbody td.action-cell {
    background: #f1f5f9 !important;
    border-left-color: rgba(37, 99, 235, 0.35) !important;
}

:root[data-theme="light"] .cluster-action-btn {
    font-weight: 800;
}

/* Star */
:root[data-theme="light"] .cluster-action-btn.save {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #64748b;
}

:root[data-theme="light"] .cluster-action-btn.save:hover {
    background: #fef3c7;
    border-color: #d97706;
    color: #b45309;
}

:root[data-theme="light"] .cluster-action-btn.save.saved {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #b45309;
    box-shadow: inset 0 0 0 1px rgba(180, 83, 9, 0.18);
}

/* Twitcher */
:root[data-theme="light"] .cluster-action-btn.twitcher {
    background: #dbeafe;
    border-color: #2563eb;
    color: #1d4ed8;
}

:root[data-theme="light"] .cluster-action-btn.twitcher:hover {
    background: #bfdbfe;
    color: #1e40af;
}

/* JBrowse */
:root[data-theme="light"] .cluster-action-btn.event {
    background: #d1fae5;
    border-color: #059669;
    color: #047857;
}

:root[data-theme="light"] .cluster-action-btn.event:hover {
    background: #a7f3d0;
    color: #065f46;
}

/* IGV */
:root[data-theme="light"] .cluster-action-btn.igv {
    background: #ede9fe;
    border-color: #7c3aed;
    color: #6d28d9;
}

:root[data-theme="light"] .cluster-action-btn.igv:hover {
    background: #ddd6fe;
    color: #5b21b6;
}

/* BAM */
:root[data-theme="light"] .cluster-action-btn.bam {
    background: #fef3c7;
    border-color: #d97706;
    color: #b45309;
}

:root[data-theme="light"] .cluster-action-btn.bam:hover {
    background: #fde68a;
    color: #92400e;
}

/* Save/star button */
.cluster-action-btn.save {
    width: 2.15rem;
    min-width: 2.15rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(148, 163, 184, 0.12);
    border-color: rgba(148, 163, 184, 0.35);
    color: #94a3b8;
}

.cluster-action-btn.save:hover {
    background: rgba(234, 179, 8, 0.16);
    border-color: rgba(234, 179, 8, 0.55);
    color: #facc15;
}

.cluster-action-btn.save.saved {
    background: rgba(234, 179, 8, 0.22);
    border-color: rgba(234, 179, 8, 0.7);
    color: #facc15;
    box-shadow: 0 0 0 1px rgba(234, 179, 8, 0.16);
}

.save-star-icon {
    width: 15px;
    height: 15px;
    display: block;
}

/* Dark/default theme action colors */
.cluster-action-btn.twitcher {
    background: rgba(37, 99, 235, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
    color: #93c5fd;
}

.cluster-action-btn.twitcher:hover {
    background: rgba(37, 99, 235, 0.3);
    color: #bfdbfe;
}

.cluster-action-btn.event {
    background: rgba(22, 163, 74, 0.12);
    border-color: rgba(52, 211, 153, 0.3);
    color: #6ee7b7;
}

.cluster-action-btn.event:hover {
    background: rgba(22, 163, 74, 0.25);
}

.cluster-action-btn.igv {
    background: rgba(124, 58, 237, 0.12);
    border-color: rgba(167, 139, 250, 0.3);
    color: #c4b5fd;
}

.cluster-action-btn.igv:hover {
    background: rgba(124, 58, 237, 0.25);
}

.cluster-action-btn.bam {
    background: rgba(234, 179, 8, 0.12);
    border-color: rgba(234, 179, 8, 0.35);
    color: #fde68a;
}

.cluster-action-btn.bam:hover {
    background: rgba(234, 179, 8, 0.25);
    color: #fef3c7;
}

.filter-controls {
    align-items: center;
}

.filter-inline-action {
    display: inline-flex;
    align-items: center;
    margin: 0;
}

.filter-inline-action.hidden {
    display: none !important;
}

.filter-controls .btn-dna-foldprimary,
.filter-controls .btn-ghost {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cluster-action-btn.bam {
    background: rgba(234, 179, 8, 0.12);
    border-color: rgba(234, 179, 8, 0.35);
    color: #fde68a;
}

.cluster-action-btn.bam:hover {
    background: rgba(234, 179, 8, 0.25);
    color: #fef3c7;
}

.cluster-action-btn.save {
    min-width: 2rem;
    background: rgba(148, 163, 184, 0.1);
    border-color: rgba(148, 163, 184, 0.32);
    color: #cbd5e1;
    font-family: "JetBrains Mono", monospace;
}

.cluster-action-btn.save:hover {
    background: rgba(234, 179, 8, 0.16);
    border-color: rgba(234, 179, 8, 0.4);
    color: #fde68a;
}

.cluster-action-btn.save.saved {
    background: rgba(234, 179, 8, 0.2);
    border-color: rgba(234, 179, 8, 0.55);
    color: #facc15;
}

/* ── Located bookmark row highlight: persistent + visible pulse ───────── */

/*
  Persistent highlight.
  Use a solid color, not a gradient, because gradients repeat in every <td>.
*/
#csvTable tbody tr.row-highlighted-event > td,
#csvTable.stripe tbody tr.row-highlighted-event:nth-child(even) > td,
#csvTable.hover tbody tr.row-highlighted-event:hover > td {
    background: rgba(250, 204, 21, 0.3) !important;
    color: var(--text) !important;
    box-shadow:
        inset 0 1px 0 rgba(250, 204, 21, 0.42),
        inset 0 -1px 0 rgba(250, 204, 21, 0.42) !important;
}

/* Action cell has its own background, so force it too */
#csvTable tbody tr.row-highlighted-event > td.action-cell {
    background: rgba(250, 204, 21, 0.38) !important;
    border-left-color: #facc15 !important;
}

/* Strong row-start marker */
#csvTable tbody tr.row-highlighted-event > td:first-child {
    box-shadow:
        inset 6px 0 0 #facc15,
        inset 0 1px 0 rgba(250, 204, 21, 0.42),
        inset 0 -1px 0 rgba(250, 204, 21, 0.42) !important;
}

/*
  Pulse effect.
  Animate box-shadow/filter instead of background because DataTables has
  several background !important rules.
*/
#csvTable tbody tr.row-highlight-pulse > td {
    animation: bookmarkLocatePulseStrong 3.2s ease-out 1;
}

@keyframes bookmarkLocatePulseStrong {
    0% {
        filter: brightness(1.75) saturate(1.6);
        box-shadow:
            inset 6px 0 0 #facc15,
            inset 0 0 0 9999px rgba(250, 204, 21, 0.62),
            0 0 0 0 rgba(250, 204, 21, 0.95),
            0 0 26px rgba(250, 204, 21, 0.85) !important;
    }

    18% {
        filter: brightness(1.15) saturate(1.2);
        box-shadow:
            inset 6px 0 0 #facc15,
            inset 0 0 0 9999px rgba(250, 204, 21, 0.24),
            0 0 0 5px rgba(250, 204, 21, 0.55),
            0 0 18px rgba(250, 204, 21, 0.48) !important;
    }

    38% {
        filter: brightness(1.8) saturate(1.7);
        box-shadow:
            inset 6px 0 0 #facc15,
            inset 0 0 0 9999px rgba(250, 204, 21, 0.66),
            0 0 0 2px rgba(250, 204, 21, 0.75),
            0 0 30px rgba(250, 204, 21, 0.9) !important;
    }

    68% {
        filter: brightness(1.2) saturate(1.3);
        box-shadow:
            inset 6px 0 0 #facc15,
            inset 0 0 0 9999px rgba(250, 204, 21, 0.28),
            0 0 0 4px rgba(250, 204, 21, 0.42),
            0 0 18px rgba(250, 204, 21, 0.4) !important;
    }

    100% {
        filter: none;
        box-shadow:
            inset 6px 0 0 #facc15,
            inset 0 1px 0 rgba(250, 204, 21, 0.42),
            inset 0 -1px 0 rgba(250, 204, 21, 0.42) !important;
    }
}

/* Light mode persistent highlight */
:root[data-theme="light"] #csvTable tbody tr.row-highlighted-event > td,
:root[data-theme="light"]
    #csvTable.stripe
    tbody
    tr.row-highlighted-event:nth-child(even)
    > td,
:root[data-theme="light"]
    #csvTable.hover
    tbody
    tr.row-highlighted-event:hover
    > td {
    background: #fde68a !important;
    color: #111827 !important;
    box-shadow:
        inset 0 1px 0 rgba(180, 83, 9, 0.35),
        inset 0 -1px 0 rgba(180, 83, 9, 0.35) !important;
}

:root[data-theme="light"]
    #csvTable
    tbody
    tr.row-highlighted-event
    > td.action-cell {
    background: #fcd34d !important;
    border-left-color: #d97706 !important;
}

:root[data-theme="light"]
    #csvTable
    tbody
    tr.row-highlighted-event
    > td:first-child {
    box-shadow:
        inset 6px 0 0 #d97706,
        inset 0 1px 0 rgba(180, 83, 9, 0.35),
        inset 0 -1px 0 rgba(180, 83, 9, 0.35) !important;
}

/* Light mode pulse */
:root[data-theme="light"] #csvTable tbody tr.row-highlight-pulse > td {
    animation: bookmarkLocatePulseStrongLight 3.2s ease-out 1;
}

@keyframes bookmarkLocatePulseStrongLight {
    0% {
        filter: brightness(1.08) saturate(1.8);
        box-shadow:
            inset 6px 0 0 #d97706,
            inset 0 0 0 9999px rgba(217, 119, 6, 0.36),
            0 0 0 0 rgba(217, 119, 6, 0.85),
            0 0 24px rgba(217, 119, 6, 0.58) !important;
    }

    18% {
        filter: brightness(1.02) saturate(1.25);
        box-shadow:
            inset 6px 0 0 #d97706,
            inset 0 0 0 9999px rgba(217, 119, 6, 0.14),
            0 0 0 5px rgba(217, 119, 6, 0.42),
            0 0 16px rgba(217, 119, 6, 0.34) !important;
    }

    38% {
        filter: brightness(1.1) saturate(1.9);
        box-shadow:
            inset 6px 0 0 #d97706,
            inset 0 0 0 9999px rgba(217, 119, 6, 0.4),
            0 0 0 2px rgba(217, 119, 6, 0.7),
            0 0 28px rgba(217, 119, 6, 0.54) !important;
    }

    68% {
        filter: brightness(1.03) saturate(1.35);
        box-shadow:
            inset 6px 0 0 #d97706,
            inset 0 0 0 9999px rgba(217, 119, 6, 0.18),
            0 0 0 4px rgba(217, 119, 6, 0.34),
            0 0 14px rgba(217, 119, 6, 0.3) !important;
    }

    100% {
        filter: none;
        box-shadow:
            inset 6px 0 0 #d97706,
            inset 0 1px 0 rgba(180, 83, 9, 0.35),
            inset 0 -1px 0 rgba(180, 83, 9, 0.35) !important;
    }
}

/* ── Last clicked table row: subtle marker ───────────────────── */

/*
  Subtle blue marker for the last row clicked by the user.
  This applies to action-button clicks and normal text/cell clicks.
*/
#csvTable tbody tr.row-last-clicked-event > td {
    background: rgba(59, 130, 246, 0.055) !important;
    box-shadow:
        inset 0 1px 0 rgba(59, 130, 246, 0.1),
        inset 0 -1px 0 rgba(59, 130, 246, 0.1) !important;
}

#csvTable tbody tr.row-last-clicked-event > td:first-child {
    box-shadow:
        inset 3px 0 0 rgba(59, 130, 246, 0.48),
        inset 0 1px 0 rgba(59, 130, 246, 0.1),
        inset 0 -1px 0 rgba(59, 130, 246, 0.1) !important;
}

#csvTable tbody tr.row-last-clicked-event > td.action-cell {
    background: rgba(59, 130, 246, 0.085) !important;
    border-left-color: rgba(59, 130, 246, 0.5) !important;
}

/*
  Strong bookmark locate highlight should always win over subtle click marker.
*/
#csvTable tbody tr.row-highlighted-event.row-last-clicked-event > td {
    background: rgba(250, 204, 21, 0.3) !important;
}

/* Light mode */
:root[data-theme="light"] #csvTable tbody tr.row-last-clicked-event > td {
    background: #eff6ff !important;
    color: #0f172a !important;
    box-shadow:
        inset 0 1px 0 rgba(37, 99, 235, 0.12),
        inset 0 -1px 0 rgba(37, 99, 235, 0.12) !important;
}

:root[data-theme="light"]
    #csvTable
    tbody
    tr.row-last-clicked-event
    > td:first-child {
    box-shadow:
        inset 3px 0 0 rgba(37, 99, 235, 0.7),
        inset 0 1px 0 rgba(37, 99, 235, 0.12),
        inset 0 -1px 0 rgba(37, 99, 235, 0.12) !important;
}

:root[data-theme="light"]
    #csvTable
    tbody
    tr.row-last-clicked-event
    > td.action-cell {
    background: #dbeafe !important;
    border-left-color: #2563eb !important;
}

:root[data-theme="light"]
    #csvTable
    tbody
    tr.row-highlighted-event.row-last-clicked-event
    > td {
    background: #fde68a !important;
}
/* ── Last clicked row: stronger visibility on striped/even rows ───────── */

/* Base subtle clicked-row marker */
#csvTable tbody tr.row-last-clicked-event > td,
#csvTable.stripe tbody tr.row-last-clicked-event:nth-child(even) > td,
#csvTable.hover tbody tr.row-last-clicked-event:hover > td {
    background: rgba(59, 130, 246, 0.13) !important;
    color: var(--text) !important;
    box-shadow:
        inset 0 1px 0 rgba(59, 130, 246, 0.22),
        inset 0 -1px 0 rgba(59, 130, 246, 0.22) !important;
}

/* Slightly stronger for even striped rows */
#csvTable.stripe tbody tr.row-last-clicked-event:nth-child(even) > td {
    background: rgba(59, 130, 246, 0.17) !important;
}

/* Strong row-start marker */
#csvTable tbody tr.row-last-clicked-event > td:first-child,
#csvTable.stripe
    tbody
    tr.row-last-clicked-event:nth-child(even)
    > td:first-child {
    box-shadow:
        inset 4px 0 0 rgba(96, 165, 250, 0.85),
        inset 0 1px 0 rgba(59, 130, 246, 0.22),
        inset 0 -1px 0 rgba(59, 130, 246, 0.22) !important;
}

/* Action cell has its own background, so force it separately */
#csvTable tbody tr.row-last-clicked-event > td.action-cell,
#csvTable.stripe
    tbody
    tr.row-last-clicked-event:nth-child(even)
    > td.action-cell {
    background: rgba(59, 130, 246, 0.18) !important;
    border-left-color: rgba(96, 165, 250, 0.85) !important;
}

/* Light mode */
:root[data-theme="light"] #csvTable tbody tr.row-last-clicked-event > td,
:root[data-theme="light"]
    #csvTable.stripe
    tbody
    tr.row-last-clicked-event:nth-child(even)
    > td,
:root[data-theme="light"]
    #csvTable.hover
    tbody
    tr.row-last-clicked-event:hover
    > td {
    background: #dbeafe !important;
    color: #0f172a !important;
    box-shadow:
        inset 0 1px 0 rgba(37, 99, 235, 0.22),
        inset 0 -1px 0 rgba(37, 99, 235, 0.22) !important;
}

/* Light mode even rows need a bit more contrast */
:root[data-theme="light"]
    #csvTable.stripe
    tbody
    tr.row-last-clicked-event:nth-child(even)
    > td {
    background: #bfdbfe !important;
}

/* Light mode row-start marker */
:root[data-theme="light"]
    #csvTable
    tbody
    tr.row-last-clicked-event
    > td:first-child,
:root[data-theme="light"]
    #csvTable.stripe
    tbody
    tr.row-last-clicked-event:nth-child(even)
    > td:first-child {
    box-shadow:
        inset 4px 0 0 #2563eb,
        inset 0 1px 0 rgba(37, 99, 235, 0.22),
        inset 0 -1px 0 rgba(37, 99, 235, 0.22) !important;
}

/* Light mode action cell */
:root[data-theme="light"]
    #csvTable
    tbody
    tr.row-last-clicked-event
    > td.action-cell,
:root[data-theme="light"]
    #csvTable.stripe
    tbody
    tr.row-last-clicked-event:nth-child(even)
    > td.action-cell {
    background: #bfdbfe !important;
    border-left-color: #2563eb !important;
}

/*
  Bookmark locate highlight should remain stronger than last-clicked highlight.
  Keep these AFTER the last-clicked rules.
*/
#csvTable tbody tr.row-highlighted-event.row-last-clicked-event > td,
#csvTable.stripe
    tbody
    tr.row-highlighted-event.row-last-clicked-event:nth-child(even)
    > td {
    background: rgba(250, 204, 21, 0.3) !important;
}

:root[data-theme="light"]
    #csvTable
    tbody
    tr.row-highlighted-event.row-last-clicked-event
    > td,
:root[data-theme="light"]
    #csvTable.stripe
    tbody
    tr.row-highlighted-event.row-last-clicked-event:nth-child(even)
    > td {
    background: #fde68a !important;
}
.cluster-action-btn.dna-fold {
    border-color: rgba(168, 85, 247, 0.38);
    background: rgba(168, 85, 247, 0.12);
    color: #ddd6fe;
}
:root[data-theme="light"]
.cluster-action-btn.dna-fold:hover {
    border-color: rgba(168, 85, 247, 0.38);
    background: rgba(190, 5, 247, 0.32);
    color: #3c007e;
}
:root[data-theme="light"]
.cluster-action-btn.dna-fold {
    border-color: rgba(168, 85, 247, 0.38);
    background: rgba(168, 85, 247, 0.12);
    color: #3c007e;
}

.cluster-action-btn.dna-fold:hover {
    background: rgba(168, 85, 247, 0.22);
    border-color: rgba(168, 85, 247, 0.58);
}

.filter-column-search {
    width: 100%;
    box-sizing: border-box;
    margin: 0 0 0.35rem;
    padding: 0.38rem 0.55rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 0.45rem;
    background: #ffffff;
    color: #111827;
    font-size: 0.78rem;
}

.filter-column-search::placeholder {
    color: #94a3b8;
}

:root[data-theme="dark"] .filter-column-search,
.dark .filter-column-search {
    background: #020617;
    color: #e5e7eb;
    border-color: rgba(148, 163, 184, 0.35);
}


/* ── User-defined read/sample labels ────────────────────────── */

.read-id-cell {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}

.read-id-raw {
    min-width: 0;
    overflow: hidden;
    color: var(--text-mid);
    font-family: "JetBrains Mono", monospace;
    font-size: 0.68rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.read-label-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
    min-height: 23px;
    padding: 0.1rem 0.42rem;
    border: 1px solid var(--read-label-border);
    border-radius: 999px;
    background: var(--read-label-bg);
    color: var(--read-label-text);
    font-family: "JetBrains Mono", monospace;
    font-size: 0.63rem;
    font-weight: 800;
    white-space: nowrap;
}

.read-label-badge-text {
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.read-label-edit-btn {
    width: 17px;
    height: 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.45);
    color: inherit;
    cursor: pointer;
    font-size: 0.62rem;
    font-weight: 900;
}

.read-label-edit-btn:hover {
    background: rgba(255, 255, 255, 0.8);
}

.read-label-add-btn {
    min-height: 23px;
    padding: 0.1rem 0.42rem;
    border: 1px dashed var(--border-mid);
    border-radius: 999px;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.61rem;
    white-space: nowrap;
}

.read-label-add-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.duplicate-member-read-label {
    margin-top: 0.35rem;
}
