/* SSRM asset form theme — mirrors the .cp-* design used by the SSRM Assessment pages
   (see Pages/Assessment/ApplicationInformation.razor.css). Defined globally here so the
   shared form components in Shared/Forms/ can adopt the same look without relying on
   scoped CSS from another component. */

.ssrm-form-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
}

.ssrm-form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

/* Form title matches the .cp-section-subtitle look used by SSRM Assessment cards:
   small, uppercase, slate-grey lead-in. */
.ssrm-form-header .global-form-title {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin: 0;
}

.ssrm-form-header .global-form-title h3,
.ssrm-form-header .global-form-title h5 {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    line-height: 1.3;
    margin: 0;
}

.ssrm-form-header .global-form-title h5 {
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
}

.ssrm-form-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ssrm-form-actions .global-button,
.ssrm-form-actions .dxbl-btn {
    min-width: 110px;
    padding-left: 16px;
    padding-right: 16px;
}

.ssrm-form-section-subtitle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 6px;
    margin-bottom: 14px;
    margin-top: 4px;
}

.ssrm-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 16px;
    align-items: start;
}

/* Separate stacked grids (e.g. main grid → tracing grid → description grid)
   so they don't visually run into each other. */
.ssrm-form-grid + .ssrm-form-grid,
.ssrm-form-section-subtitle + .ssrm-form-grid {
    margin-top: 14px;
}

.ssrm-form-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.ssrm-form-item--full {
    grid-column: 1 / -1;
}

.ssrm-form-label {
    font-size: 11px;
    font-weight: 500;
    color: #374151;
    line-height: 1.3;
}

.ssrm-form-value {
    width: 100%;
}

.ssrm-form-value .dxbl-combobox,
.ssrm-form-value .dxbl-edit,
.ssrm-form-value .dxbl-memo,
.ssrm-form-value .dxbl-text-edit {
    width: 100%;
}

.ssrm-form-value .validation-message {
    color: #dc2626;
    font-size: 11px;
    margin-top: 2px;
}

/* When the form is rendered inside FormModal (.modal-container, defined in
   Shared/FormModal.razor.css) the modal already provides the white panel —
   suppress the inner card chrome to avoid a double border. */
.modal-container .ssrm-form-card {
    border: none;
    padding: 0;
}

/* S0011 — empty required field, pulsing red border (superseded the ticket's original "no blink"
   ask — a later request asked for a pulse instead).
   Targets the editor's actual rendered <input>/<textarea>, not the .cp-factor-item wrapper —
   confirmed via live devtools inspection that DevExpress.Blazor 24.1.6 text-based editors
   (DxTextBox, DxSpinEdit, DxComboBox, DxDateEdit — all built on the same text-edit base) render
   their real input as `<input class="dxbl-text-edit-input">`. An earlier guess (`.dxbl-input`)
   was wrong and never rendered — this class name is taken directly from a live element, not
   inferred from the theme's CSS bundle. DxMemo renders a plain <textarea>, no special class
   needed. No checkbox-bound field is currently in the highlighted scope — if one is added
   later, add and live-verify its selector then (don't guess; the .dxbl-input mistake above is
   exactly the failure mode an unverified guess produces). */
.field-missing .dxbl-text-edit-input,
.field-missing textarea {
    border-color: #dc2626 !important;
    border-width: 4px !important;
    border-radius: 4px;
    animation: field-missing-pulse 1.5s ease-in-out infinite;
}

@keyframes field-missing-pulse {
    0%, 100% {
        box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.45);
    }
    50% {
        box-shadow: 0 0 0 5px rgba(220, 38, 38, 0.15);
    }
}

@media (prefers-reduced-motion: reduce) {
    .field-missing .dxbl-text-edit-input,
    .field-missing textarea {
        animation: none;
        box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.45);
    }
}

/* Import Assessment: Excel-style error marker (S0014) — a small triangle in the cell's top-left
   corner, like Excel's own indicator, plus the message as the cell's title. Applied by DxGrid
   CustomizeElement, so it has to live in a global sheet — the grid renders its own <td>, outside
   ImportAssessment.razor.css's scope. ::after, not ::before — the DevExpress theme already owns
   td::before on selected/focused/hovered rows (a z-index:-1 shading layer with far higher
   specificity), and every creation row starts selected, so a ::before marker never showed. */
.dxbl-grid td.ssrm-import-invalid-cell {
    position: relative;
}

.dxbl-grid td.ssrm-import-invalid-cell::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    border-style: solid;
    border-width: 8px 8px 0 0;
    border-color: #dc3545 transparent transparent transparent;
    pointer-events: none;
}

/* Mitigation Summary → section jump (S0005) */
.ssrm-jump-flash { animation: ssrm-jump-flash 1.4s ease-out; }
@keyframes ssrm-jump-flash {
    0% { box-shadow: 0 0 0 3px #f6c66b; }
    100% { box-shadow: 0 0 0 3px rgba(246, 198, 107, 0); }
}

/* Mitigation: field changed from base assessment (S0005 #6963, #6964, #6965; extended to Consequence by #6967).
   .field-changed is added by AssessmentComponentBase.ChangedClass only in Mitigation mode, or
   directly on the mitigation-only "Mitigate using new trap" checkbox when it's set (no base
   equivalent to diff against). Specificity (0,3,0) beats the scoped .cp-factor-label[b-xxx]
   (0,2,0), so no !important.
   DxTextBox/DxComboBox/DxSpinEdit/DxDateEdit/DxMemo all render .dxbl-text-edit as a base class
   (confirmed against the compiled theme this app actually ships — office-white.bs5.css — where
   DxMemo's own rule is literally ".dxbl-text-edit.dxbl-memo-edit"). DxCheckBox does NOT share that
   base class (it has its own --dxbl-checkbox-* custom properties in the same theme file), so it
   needs its own selector — .dxbl-checkbox, also confirmed against that theme file.
   Steam Trap uses two wrapper classes (cp-factor-item; cp-fault-item in Critical Faults) and two
   label structures (cp-factor-label; cp-checkbox-label wrapping label+checkbox together). */
.cp-factor-item.field-changed .dxbl-text-edit,
.cp-fault-item.field-changed .dxbl-text-edit,
.cp-factor-item.field-changed .dxbl-checkbox,
.cp-fault-item.field-changed .dxbl-checkbox {
    background: #fff7e6;
    border-color: #e8961e;
    border-left: 3px solid #e8961e;
    box-shadow: 0 0 0 2px rgba(232, 150, 30, .10);
}

.cp-factor-item.field-changed .cp-factor-label,
.cp-factor-item.field-changed .cp-checkbox-label,
.cp-fault-item.field-changed .cp-checkbox-label {
    color: #b45309;
    font-weight: 600;
}

.cp-factor-item.field-changed .cp-factor-label::after,
.cp-factor-item.field-changed .cp-checkbox-label::after,
.cp-fault-item.field-changed .cp-checkbox-label::after {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-left: 6px;
    border-radius: 50%;
    background: #e8961e;
    vertical-align: middle;
}
