/* ─────────────────────────────────────────────────────────────────────
 * Sheet Set Import — Phase 2.5
 *
 * Inner content styles lifted from the prototype
 * (docs/pdf-sheet-splitter.html). Outer chrome (overlay, dialog, buttons)
 * is inherited from the Documents module's `.documents-modal-overlay`
 * and `.documents-modal-dialog` classes so the modal feels native.
 *
 * All selectors are scoped under `.sheet-set-modal` to avoid colliding
 * with the prototype's global IDs.
 * ───────────────────────────────────────────────────────────────────── */

.sheet-set-modal *,
.sheet-set-modal *::before,
.sheet-set-modal *::after { box-sizing: border-box; }

/* Dialog — wider than the default Upload modal (700px) */
.documents-modal-dialog.sheet-set-modal-dialog {
    width: 1100px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
}
.documents-modal-dialog.sheet-set-modal-dialog .documents-modal-body {
    overflow: auto;
    flex: 1;
    min-height: 0;
}

/* Banners */
.sheet-set-modal .sheet-set-banner {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 12px;
    margin-bottom: 12px;
}
.sheet-set-modal .sheet-set-banner.warn  { background: #fff3cd; color: #713f12; border: 1px solid #facc15; }
.sheet-set-modal .sheet-set-banner.info  { background: #dbeafe; color: #1e3a8a; border: 1px solid #93c5fd; }
.sheet-set-modal .sheet-set-banner.good  { background: #d1fae5; color: #065f46; border: 1px solid #86efac; }
.sheet-set-modal .sheet-set-banner.error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* Set-name input row */
.sheet-set-modal .sheet-set-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.sheet-set-modal .sheet-set-name-row label {
    font-size: 12px;
    font-weight: 600;
    color: #475569;
}
.sheet-set-modal .sheet-set-name-input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 13px;
}

/* Dropzone */
.sheet-set-modal .sheet-set-dropzone {
    border: 2px dashed #94a3b8;
    border-radius: 8px;
    padding: 36px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
}
.sheet-set-modal .sheet-set-dropzone.drag {
    border-color: #2563eb;
    background: #eff6ff;
}
.sheet-set-modal .sheet-set-dropzone-icon { font-size: 32px; color: #94a3b8; }
.sheet-set-modal .sheet-set-dropzone-hint { font-size: 12px; color: #64748b; margin-top: 4px; }
.sheet-set-modal .sheet-set-filename {
    font-size: 13px;
    color: #0c4a6e;
    margin-top: 10px;
    font-weight: 600;
}

/* Options row */
.sheet-set-modal .sheet-set-options {
    display: flex;
    gap: 18px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 14px;
    font-size: 13px;
}
.sheet-set-modal .sheet-set-options label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}
.sheet-set-modal .sheet-set-options input[type="number"] {
    width: 70px;
    padding: 4px 6px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 12px;
}

/* Action row */
.sheet-set-modal .sheet-set-action-row {
    margin-top: 16px;
    display: flex;
    gap: 10px;
    align-items: center;
}
.sheet-set-modal .sheet-set-status-text {
    font-size: 12px;
    color: #64748b;
}

/* Progress bar */
.sheet-set-modal .sheet-set-progress {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 10px;
}
.sheet-set-modal .sheet-set-progress-fill {
    height: 100%;
    background: #2563eb;
    transition: width 0.3s;
    width: 0%;
}

/* Spinner */
.sheet-set-modal .sheet-set-spin {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #cbd5e1;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: sheet-set-spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}
@keyframes sheet-set-spin { to { transform: rotate(360deg); } }

/* Summary tiles */
.sheet-set-modal .sheet-set-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}
.sheet-set-modal .sheet-set-stat {
    background: #f8fafc;
    border-radius: 6px;
    padding: 10px;
}
.sheet-set-modal .sheet-set-stat-label {
    font-size: 10px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.sheet-set-modal .sheet-set-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin-top: 2px;
}
.sheet-set-modal .sheet-set-stat-value.good { color: #065f46; }
.sheet-set-modal .sheet-set-stat-value.warn { color: #92400e; }
.sheet-set-modal .sheet-set-stat-value.bad  { color: #991b1b; }

/* Results table */
.sheet-set-modal .sheet-set-table-wrap {
    max-height: 55vh;
    overflow: auto;
    margin-top: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}
.sheet-set-modal table.sheet-set-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.sheet-set-modal .sheet-set-table th {
    background: #f8fafc;
    text-align: left;
    padding: 8px;
    font-weight: 600;
    color: #475569;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 1;
}
.sheet-set-modal .sheet-set-table td {
    padding: 8px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: top;
}
.sheet-set-modal .sheet-set-table tr:hover td { background: #f8fafc; }
.sheet-set-modal .sheet-set-table td.editable {
    cursor: text;
    background: #fffef5;
}
.sheet-set-modal .sheet-set-table td.editable:focus {
    outline: 2px solid #2563eb;
    outline-offset: -2px;
    background: #fff;
}
.sheet-set-modal .sheet-set-table td.edited {
    background: #ecfdf5;
}

/* Status chips */
.sheet-set-modal .sheet-set-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
}
.sheet-set-modal .status-ok_bookmark     { background: #e0e7ff; color: #3730a3; }
.sheet-set-modal .status-ok_regex        { background: #d1fae5; color: #065f46; }
.sheet-set-modal .status-ok_ai_text      { background: #ccfbf1; color: #115e59; }
.sheet-set-modal .status-ok_ai_ocr       { background: #ede9fe; color: #5b21b6; }
.sheet-set-modal .status-heuristic_only  { background: #e0f2fe; color: #0c4a6e; }
.sheet-set-modal .status-no_text         { background: #fef3c7; color: #92400e; }
.sheet-set-modal .status-ai_error        { background: #fee2e2; color: #991b1b; }
.sheet-set-modal .status-pending         { background: #f1f5f9; color: #475569; }

/* Upload status */
.sheet-set-modal .upload-status-pending   { color: #64748b; }
.sheet-set-modal .upload-status-uploading { color: #1e40af; }
.sheet-set-modal .upload-status-uploaded  { color: #065f46; }
.sheet-set-modal .upload-status-failed    { color: #991b1b; font-weight: 600; }
.sheet-set-modal .upload-status-skipped   { color: #94a3b8; }

/* Preview text box */
.sheet-set-modal .sheet-set-preview-text {
    background: #f8fafc;
    padding: 8px;
    border-radius: 4px;
    font-family: Consolas, Monaco, monospace;
    font-size: 10px;
    max-height: 140px;
    overflow: auto;
    white-space: pre-wrap;
    color: #334155;
    margin-top: 6px;
}
.sheet-set-modal .mono { font-family: Consolas, Monaco, monospace; font-size: 11px; }

/* Confirm-dialog summary list */
.sheet-set-modal .sheet-set-confirm-body {
    font-size: 13px;
    line-height: 1.5;
}
.sheet-set-modal .sheet-set-confirm-details {
    margin-top: 8px;
    padding: 6px 10px;
    background: #f8fafc;
    border-radius: 4px;
    max-height: 220px;
    overflow: auto;
}

/* Confirm modal sits above the main modal when both are open */
.sheet-set-confirm-overlay {
    position: fixed !important;
    inset: 0 !important;
    background: rgba(15, 23, 42, 0.55) !important;
    z-index: 100001 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
.sheet-set-confirm-dialog {
    background: #fff !important;
    border-radius: 8px !important;
    padding: 20px !important;
    width: 520px !important;
    max-width: calc(100vw - 40px) !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25) !important;
    z-index: 100002 !important;
}
.sheet-set-confirm-dialog h3 {
    margin: 0 0 10px 0;
    font-size: 15px;
    color: #0f172a;
}
.sheet-set-confirm-dialog .btn-row {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

/* Multi-page detection banner in the existing Upload modal */
.doc-upload-multipage-banner {
    margin: 10px 0;
    padding: 10px 14px;
    border-radius: 6px;
    background: #dbeafe;
    color: #1e3a8a;
    border: 1px solid #93c5fd;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.doc-upload-multipage-banner .banner-actions {
    display: flex;
    gap: 6px;
    margin-left: auto;
}

/* Documents grid — Source Set column chip + Group-by-Sheet-Set rollup visuals */
.doc-grid-source-set {
    color: #0c4a6e;
    font-size: 11px;
}
.doc-grid-parent-set-row {
    background: #eff6ff !important;
    font-weight: 600;
}
.doc-grid-parent-set-row td { color: #1e3a8a; }
.doc-grid-parent-set-caret {
    display: inline-block;
    width: 14px;
    cursor: pointer;
    user-select: none;
}
.doc-grid-child-of-set td:first-child {
    padding-left: 28px;
}
.doc-grid-child-of-set.collapsed { display: none; }

/* Scroll-to-new-row flash (§27.4) */
@keyframes sheet-set-row-flash {
    0%   { background: #fef08a; }
    100% { background: transparent; }
}
.doc-grid-row-flash { animation: sheet-set-row-flash 2s ease-out; }
