/* iDEAL OCR review UI — supplements the copied iFinance design system.
   Holds the few component rules not in the shared CSS, plus light styling so
   the pre-existing bare-table pages (job detail, upload, login) stay readable. */

.text-ideal-teal { color: var(--ideal-teal) !important; }

/* Usage analytics stat card (icon / big number / label) */
.usage-card {
    background: #fff;
    border: 1px solid var(--ideal-gray-medium);
    border-radius: var(--ideal-border-radius-lg);
    padding: 1.5rem 1rem;
    text-align: center;
    height: 100%;
    box-shadow: var(--ideal-shadow-sm);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.usage-card:hover { box-shadow: var(--ideal-shadow-md); transform: translateY(-2px); }
.usage-card .usage-icon {
    width: 3rem; height: 3rem; margin: 0 auto 0.6rem;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; background: rgba(92, 189, 189, 0.12);
    color: var(--ideal-teal); font-size: 1.4rem;
}
.usage-card .usage-value { font-size: 2rem; font-weight: 700; color: #1d2a4d; line-height: 1; }
.usage-card .usage-label { color: var(--ideal-text-muted); font-size: 0.85rem; margin-top: 0.4rem; }

/* Teal badge for the "extracted" status (Bootstrap has no teal) */
.badge-teal { background: var(--ideal-teal); color: #fff; }

/* Login */
.login-wrap { max-width: 400px; margin: 6vh auto 0; }
.login-card {
    background: #fff;
    border: 1px solid var(--ideal-gray-medium);
    border-radius: var(--ideal-border-radius-lg);
    box-shadow: var(--ideal-shadow-md);
    padding: 2rem;
}
.login-brand { text-align: center; color: var(--ideal-teal); font-weight: 700; font-size: 1.4rem; }

/* Job detail layout */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }
@media (max-width: 991.98px) { .detail-grid { grid-template-columns: 1fr; } }
.doc-frame { border: 1px solid var(--ideal-gray-medium); border-radius: var(--ideal-border-radius-md); max-width: 100%; }

/* Processing overlay — blocks the content area while extraction runs */
.processing-overlay {
    position: fixed; top: 0; right: 0; bottom: 0; left: var(--sidebar-width);
    z-index: 1080;
    background: rgba(248, 249, 250, 0.8);
    backdrop-filter: blur(2px);
    display: flex; align-items: center; justify-content: center;
}
@media (max-width: 991.98px) { .processing-overlay { left: 0; } }
@media (min-width: 992px) { body.sidebar-collapsed .processing-overlay { left: var(--sidebar-collapsed-width); } }
.processing-card {
    background: #fff;
    border: 1px solid var(--ideal-gray-medium);
    border-radius: var(--ideal-border-radius-lg);
    box-shadow: var(--ideal-shadow-lg);
    padding: 2.25rem 2.75rem;
    text-align: center;
    max-width: 360px;
}
.processing-card .spinner-border { width: 2.5rem; height: 2.5rem; }

/* Document viewer toolbar */
.doc-toolbar { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.doc-toolbar .spacer { flex: 1 1 auto; }
.doc-toolbar input[type=range] { width: 110px; accent-color: var(--ideal-teal); }
.doc-toolbar .btn-sm { padding: 0.2rem 0.5rem; }

/* Scrollable document viewer so the highlighted box can be scrolled into view */
.doc-viewer { position: relative; max-height: 80vh; overflow: auto; border: 1px solid var(--ideal-gray-medium); border-radius: var(--ideal-border-radius-md); background: #f3f5fa; padding: 0.75rem; }
.doc-viewer .docpage { width: 100%; max-width: none; margin: 0 auto; transform-origin: center top; }
.doc-viewer .docpage img { display: block; width: 100%; box-shadow: var(--ideal-shadow-md); }

/* Field rows: only box-bearing rows are "locatable" (hover to highlight on the doc) */
.field-table td { vertical-align: middle; transition: background .12s ease; }
.field-table tbody tr:hover > td { background: rgba(92, 189, 189, 0.14); }
.field-table tr.locatable { cursor: pointer; }
.field-table tr.locatable:hover > td { background: rgba(92, 189, 189, 0.26); }
.field-table tr.locatable:hover > td:first-child { box-shadow: inset 4px 0 0 0 var(--ideal-teal); }
.locate-pin { color: var(--ideal-teal); font-size: 0.8rem; }

/* Line items: keep columns on one line and scroll horizontally instead of wrapping to mush */
.li-scroll { overflow-x: auto; }
.li-table { min-width: 760px; cursor: default; }
.li-table th, .li-table td { white-space: nowrap; }
.li-table th.li-desc, .li-table td.li-desc { white-space: normal; min-width: 240px; }
.li-table tbody tr.locatable { cursor: pointer; }
.li-table tbody tr:hover > td { background: rgba(92, 189, 189, 0.18); }
.li-table tbody tr.locatable:hover > td:first-child { box-shadow: inset 4px 0 0 0 var(--ideal-teal); }

/* Chart panel */
.chart-container { position: relative; height: 340px; width: 100%; }

/* Monitoring table — filter toolbar, grounded header, cell gutters, teal pagination */
.table-toolbar {
    display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center;
    background: var(--ideal-gray-light);
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--ideal-gray-medium);
}
.monitor-table { margin-bottom: 0; }
.monitor-table thead th {
    background: var(--ideal-gray-light);
    border-bottom: 2px solid var(--ideal-gray-medium);
    color: #495057; font-weight: 600; white-space: nowrap;
}
.monitor-table td, .monitor-table th { padding-top: 0.7rem; padding-bottom: 0.7rem; }
.monitor-table > :not(caption) > * > *:first-child { padding-left: 1.25rem; }
.monitor-table > :not(caption) > * > *:last-child { padding-right: 1.25rem; }
.pagination .page-link { color: var(--ideal-teal-dark); }
.pagination .page-item.active > .page-link { background: var(--ideal-teal); border-color: var(--ideal-teal); color: #fff; }

/* File-name + id subtitle cell in the monitoring table */
.file-cell .file-name {
    color: var(--ideal-teal-dark); font-weight: 500;
    display: block; max-width: 480px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.file-cell .file-id { color: var(--ideal-text-muted); font-size: 0.78rem; font-family: var(--ideal-font-family-mono); }

/* Teal primary button — themed through Bootstrap's own button CSS variables so
   the colour holds across hover/focus/active/disabled (e.g. when a modal returns
   focus to its trigger). Setting plain `background` would lose to Bootstrap's
   more-specific :active/:focus rules. */
.btn {
    --bs-btn-bg: var(--ideal-teal);
    --bs-btn-color: #fff;
    --bs-btn-border-color: var(--ideal-teal);
    --bs-btn-hover-bg: var(--ideal-teal-dark);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-border-color: var(--ideal-teal-dark);
    --bs-btn-active-bg: var(--ideal-teal-dark);
    --bs-btn-active-color: #fff;
    --bs-btn-active-border-color: var(--ideal-teal-dark);
    --bs-btn-disabled-bg: var(--ideal-teal);
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-border-color: var(--ideal-teal);
    --bs-btn-focus-shadow-rgb: 92, 189, 189;
    font-weight: 500;
}

/* Secondary "ghost" button */
.btn-ghost {
    --bs-btn-bg: #fff;
    --bs-btn-color: var(--ideal-teal-dark);
    --bs-btn-border-color: var(--ideal-gray-medium);
    --bs-btn-hover-bg: var(--ideal-gray-light);
    --bs-btn-hover-color: var(--ideal-teal-dark);
    --bs-btn-hover-border-color: var(--ideal-gray-medium);
    --bs-btn-active-bg: var(--ideal-gray-light);
    --bs-btn-active-color: var(--ideal-teal-dark);
    --bs-btn-active-border-color: var(--ideal-gray-medium);
}

.conf-low { color: var(--ideal-danger); font-weight: 600; }
.status { padding: 0.1rem 0.5rem; border-radius: 0.5rem; font-size: 0.8rem; background: #eee; }

/* Keep the legacy bare-table pages (job detail) legible without Bootstrap's .table class */
.main-content table:not(.table) { border-collapse: collapse; width: 100%; }
.main-content table:not(.table) th,
.main-content table:not(.table) td {
    border: 1px solid #e3e6ee;
    padding: 0.4rem 0.6rem;
    text-align: left;
    font-size: 0.9rem;
}
.main-content table:not(.table) th { background: #f3f5fa; }
.main-content input[type=text]:not(.form-control) { width: 100%; box-sizing: border-box; padding: 0.3rem; }

/* Upload drag-and-drop */
.upload-card { max-width: 640px; margin: 0 auto; }
.dropzone {
    border: 2px dashed var(--ideal-gray-medium);
    border-radius: var(--ideal-border-radius-lg);
    background: var(--ideal-gray-light);
    padding: 3rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}
.dropzone:hover { border-color: var(--ideal-teal); }
.dropzone.dragover { border-color: var(--ideal-teal); background: rgba(92, 189, 189, 0.08); }
.dropzone .dz-icon { font-size: 2.75rem; color: var(--ideal-teal); line-height: 1; }
.dropzone .dz-title { font-weight: 600; margin-top: 0.6rem; }
.dropzone .dz-hint { color: var(--ideal-text-muted); font-size: 0.85rem; margin-top: 0.15rem; }
.dz-file {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0.95rem;
    background: #fff;
    border: 1px solid var(--ideal-gray-medium);
    border-radius: var(--ideal-border-radius-md);
}
.dz-file .dz-file-name { font-weight: 500; word-break: break-all; }
.dz-file .dz-file-size { color: var(--ideal-text-muted); font-size: 0.8rem; }
.dz-remove { background: none; border: none; color: var(--ideal-danger); cursor: pointer; line-height: 1; }
