/*
  Bates Range Splitter — additions layered on top of merge-tool.css's shared
  chrome (processing overlay, error modal, settings panel, toolbar, file
  cards) and bates-tool.css's shared components (accordion).
*/

/* ---------- Page grid: Bates badge overlay + split dividers ---------- */

.bates-range-page-grid .page-preview-card {
    position: relative;
}

.bates-range-badge {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.72);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 22;
}

.bates-range-badge.is-missing {
    background: rgba(217, 119, 6, 0.85);
}

/* A thin clickable gutter between page cards — click toggles a manual split
   boundary there. Rendered as its own grid item so it doesn't require
   absolute-positioning math against variable card sizes. */
.bates-range-divider-gap {
    grid-column: span 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    cursor: pointer;
}

.bates-range-divider-gap .divider-line {
    width: 3px;
    height: 70%;
    border-radius: 2px;
    background: transparent;
    transition: background var(--transition-fast);
}

.bates-range-divider-gap.is-split .divider-line {
    background: var(--color-primary);
}

.bates-range-divider-gap:hover .divider-line {
    background: var(--color-primary-soft, rgba(37, 99, 235, 0.4));
}

.bates-range-divider-gap.is-split:hover .divider-line {
    background: var(--color-primary);
}

.page-preview-card.is-range-start {
    box-shadow: inset 3px 0 0 var(--color-primary);
}

.page-preview-card.is-unverified {
    outline: 2px dashed var(--color-warning, #b45309);
    outline-offset: -2px;
}

/* ---------- Mobile: single-column page list with a horizontal split
   divider between pages instead of the desktop vertical bar (which, in
   the 2-column mobile grid, ends up stranded in its own narrow column
   next to each thumbnail). ---------- */
@media (max-width: 767.98px) {
    .bates-range-page-grid {
        grid-template-columns: 1fr !important;
    }

    .bates-range-divider-gap {
        min-height: 0;
        width: 100%;
        padding: 0.3rem 0;
    }

    .bates-range-divider-gap .divider-line {
        width: 70%;
        height: 3px;
    }
}

/* ---------- Range Source toolbar dropdown ---------- */

#toolbarRangeSourceMenu .dropdown-item.active {
    background: var(--color-primary-soft, rgba(37, 99, 235, 0.1));
    color: var(--color-primary);
    font-weight: 700;
}

/* ---------- Range editor table (settings panel) ---------- */

.bates-range-editor-table-wrap {
    max-height: 260px;
    overflow: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.bates-range-editor-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-xs, 0.75rem);
}

.bates-range-editor-table th {
    position: sticky;
    top: 0;
    background: var(--color-surface-soft);
    padding: 0.35rem 0.3rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    font-weight: 700;
}

.bates-range-editor-table td {
    padding: 0.25rem 0.3rem;
    border-bottom: 1px solid var(--color-border);
}

.bates-range-editor-table tr.is-unverified td:first-child {
    box-shadow: inset 3px 0 0 var(--color-warning, #b45309);
}

.bates-range-editor-table tr.is-overlap td {
    background: rgba(220, 38, 38, 0.08);
}

.bates-range-editor-table input {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 0.15rem 0.3rem;
    font-size: var(--font-size-xs, 0.75rem);
    background: var(--color-surface);
    color: var(--color-text);
}

.bates-range-editor-table input.pg-input {
    width: 48px;
}

.range-row-remove-btn {
    border: none;
    background: none;
    color: var(--color-danger);
    padding: 0.15rem;
}

/* ---------- CTA subtext badge in toolbar ---------- */

#rangeCountBadge {
    white-space: nowrap;
}
