/* Contract Import — upload + review
 *
 * Loaded alongside shared/form-components.css (which supplies .form-group, .form-label,
 * .info-banner, .file-upload-section, .file-upload-label) and the global v2-styles.css
 * (.form-row, .table-container, .data-table, .btn).
 *
 * .form-section / .form-section-title / .form-group-half / .form-actions / .tab-badge are
 * NOT in either of those — every page that uses them defines them locally. Copied here
 * from contracts/contract-detail/create.css so this view matches the rest of the module.
 */

/* Full width, matching .create-form-container on New Contract. The review table has a lot
   of columns (item, pricing, price, condition, source) and a max-width squeezed them. */
.import-container {
    width: 100%;
}

/* ---------- Card shell (mirrors contract-detail/create.css) ---------- */

.form-section {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 20px;
}

.form-section-title {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-section-title i {
    color: #059669;
    font-size: 14px;
}

.form-group-half {
    flex: 1;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 8px;
    padding-bottom: 24px;
}

.tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: #e2e8f0;
    color: #475569;
    font-size: 11px;
    font-weight: 600;
}

/* ---------- Upload ---------- */

/* shared/form-components.css owns the base .file-upload-label. Only the drag state
   and the green accent are ours. */
.file-upload-label.is-dragging {
    border-color: #059669;
    background: #f0fdf4;
}

.file-upload-label.is-dragging i,
.file-upload-label.is-dragging span {
    color: #047857;
}

#import-file-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
}

#import-file-preview i {
    color: #dc2626;
    font-size: 20px;
}

#import-file-preview span {
    flex: 1;
    font-weight: 600;
    color: #1e293b;
}

/* ---------- Warnings ---------- */

.warning-banner {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #92400e;
}

.warning-banner ul {
    margin: 6px 0 0;
    padding-left: 18px;
}

.warning-banner li {
    margin-bottom: 4px;
}

/* ---------- Summary tiles ---------- */

.import-tiles {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.import-tile {
    flex: 1;
    min-width: 110px;
    padding: 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    text-align: center;
}

.import-tile-count {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
}

.import-tile-label {
    font-size: 12px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.import-note {
    display: flex;
    gap: 8px;
    align-items: baseline;
    padding: 12px 14px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    color: #475569;
    margin-bottom: 20px;
}

/* ---------- Header facts ---------- */

.header-facts {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    padding-top: 16px;
    border-top: 1px dashed #e2e8f0;
    margin-top: 16px;
}

.header-fact {
    display: flex;
    flex-direction: column;
}

.header-fact-label {
    font-size: 11px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.header-fact-value {
    font-weight: 600;
    color: #1e293b;
}

/* ---------- Groups + rows ---------- */

.import-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.import-group {
    margin-bottom: 24px;
}

.import-group:last-child {
    margin-bottom: 0;
}

.import-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.row-sub {
    font-size: 12px;
    color: #64748b;
    margin-top: 2px;
}

.row-flag {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    padding: 2px 6px;
    border-radius: 4px;
    vertical-align: middle;
}

.row-flag-warn {
    background: #fef3c7;
    color: #b45309;
}

.row-flag-low {
    background: #fee2e2;
    color: #991b1b;
}

/* A suspicious price gets a rail, not a hidden tooltip — it must be seen. */
tr.row-suspicious td {
    background: #fffbeb;
}

tr.row-suspicious td:first-child {
    box-shadow: inset 3px 0 0 #f59e0b;
}

tr.row-excluded {
    opacity: .45;
}

.source-ref {
    color: #94a3b8;
    font-size: 12px;
    cursor: help;
    white-space: nowrap;
}

.source-ref i {
    font-size: 10px;
    margin-right: 3px;
}

/* ---------- Clauses ---------- */

.import-clause {
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 10px;
    background: #ffffff;
}

.import-clause-body {
    margin-top: 8px;
    padding-left: 24px;
    font-size: 13px;
    color: #475569;
    white-space: pre-wrap;
    max-height: 140px;
    overflow-y: auto;
}
