/* ============================================================
   ACORD Forms Module dialog chrome (ASIModule.Client.Forms)
   Global stylesheet because Blazor scoped CSS bundles are
   unreliable in production (same pattern as marketing.css /
   reminders.css). Linked in _CommonHeadResources.cshtml.

   Covers the chrome (panels, scrollbars, PDF surround) of
   FormEditorDialog and AcordTemplateViewDialog - both render
   inside a .form-editor-dialog container.

   IMPORTANT: the ACORD document canvas itself is a PAPER
   document and intentionally stays white in every theme,
   including dark (see --document-canvas-bg in themes.css).
   Only the chrome around the paper is theme-driven here.
   ============================================================ */

/* Side panels (field list / properties) */
.form-editor-dialog .form-field-panel,
.form-editor-dialog .form-properties-panel {
    background: var(--dialog-panel-bg);
}

.form-editor-dialog .field-list-item:hover {
    background-color: var(--dialog-panel-hover-bg);
}

.form-editor-dialog .field-list-item.active {
    background-color: var(--dialog-panel-active-bg);
    border-left: 3px solid var(--dialog-panel-active-border);
}

/* PDF viewer surround (dark in all themes, like a PDF reader) */
.form-editor-dialog .pdf-viewer-container {
    background: var(--pdf-viewer-bg);
}

/* Global fallback for filled ACORD fields. Do not rely on FormEditorDialog.razor.css:
   its scoped bundle is not consistently present in production. The page is paper in every theme. */
.form-editor-dialog .form-page .form-field-overlay.field-filled {
    background-color: var(--document-canvas-bg);
}

/* Transparent pixels and object-fit letterboxing around a placed signature should reveal
   the ACORD page, not the global filled-field background. Keep this selector more specific
   than both the fallback above and the component's scoped field rules. */
.form-editor-dialog .form-page .form-field-overlay.field-filled.signature-image-overlay {
    background-color: transparent;
}

/* Scrollbar styling for the document and panel scroll containers */
.form-editor-dialog .field-list-container::-webkit-scrollbar,
.form-editor-dialog .form-viewer-container::-webkit-scrollbar,
.form-editor-dialog .form-properties-panel::-webkit-scrollbar {
    width: 8px;
}

.form-editor-dialog .field-list-container::-webkit-scrollbar-track,
.form-editor-dialog .form-viewer-container::-webkit-scrollbar-track,
.form-editor-dialog .form-properties-panel::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

.form-editor-dialog .field-list-container::-webkit-scrollbar-thumb,
.form-editor-dialog .form-viewer-container::-webkit-scrollbar-thumb,
.form-editor-dialog .form-properties-panel::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}

.form-editor-dialog .field-list-container::-webkit-scrollbar-thumb:hover,
.form-editor-dialog .form-viewer-container::-webkit-scrollbar-thumb:hover,
.form-editor-dialog .form-properties-panel::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* ============================================================
   Contact Context chain editor (FieldMappingModal)
   Ordered, prioritized list of contact entity types used to
   resolve Address/Phone/Email mappings. Lives here (global)
   because Blazor scoped CSS bundles are unreliable in
   production. Colors are theme variables only.
   ============================================================ */

.contact-context-list {
    margin-bottom: 0.5rem;
}

.contact-context-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--dialog-panel-border);
    border-radius: var(--bs-border-radius);
    background-color: var(--dialog-panel-bg);
    margin-bottom: 0.25rem;
}

.contact-context-item:hover {
    background-color: var(--dialog-panel-hover-bg);
}

.contact-context-position {
    flex: 0 0 auto;
    min-width: 1.75rem;
    height: 1.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.8125rem;
    background-color: var(--dialog-panel-active-bg);
    color: var(--dialog-panel-text);
    border: 1px solid var(--dialog-panel-active-border);
}

.contact-context-name {
    flex: 1 1 auto;
    color: var(--dialog-panel-text);
    font-size: 0.9375rem;
    overflow-wrap: anywhere;
}

.contact-context-actions {
    flex: 0 0 auto;
    display: inline-flex;
    gap: 0.25rem;
}

.contact-context-add {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.contact-context-add .form-select {
    flex: 1 1 auto;
}

.contact-context-empty {
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border: 1px dashed var(--drop-zone-border);
    border-radius: var(--bs-border-radius);
    color: var(--dialog-panel-text-muted);
    font-size: 0.875rem;
}

.contact-context-message {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--bs-danger);
}

/* Form attach modals (vehicles, property, equipment, drivers, additional interests):
   filter bar + scrollable list so clients with hundreds of items stay usable. */
.attachment-filter-bar {
    margin-bottom: 0.75rem;
}

.attachment-filter-label {
    margin-bottom: 0.125rem;
    font-size: 0.75rem;
    color: var(--dialog-panel-text-muted);
}

.attachment-filter-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.attachment-filter-counts {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    font-size: 0.875rem;
    color: var(--dialog-panel-text-muted);
}

.attachment-list-scroll {
    max-height: 55vh;
    overflow-y: auto;
}

/* ------------------------------------------------------------
   Apply Common Field Mapping - conflict picker
   (AcordTemplateViewDialog). Stacks above the mapping dialog and
   its other prompts; colors come from theme variables only.
   ------------------------------------------------------------ */
.common-mapping-conflict-backdrop {
    z-index: 1080;
}

.common-mapping-conflict-modal {
    z-index: 1085;
}

.common-mapping-conflict-field {
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem 0.25rem;
    margin-bottom: 0.75rem;
}

.common-mapping-conflict-legend {
    float: none;
    width: auto;
    padding: 0 0.25rem;
    margin-bottom: 0.25rem;
    font-size: 1rem;
    font-weight: 600;
}

.common-mapping-conflict-option {
    margin-bottom: 0.5rem;
}

.common-mapping-conflict-expression {
    white-space: pre-wrap;
    word-break: break-word;
}

.common-mapping-conflict-counters {
    display: block;
    font-size: 0.875rem;
}
