/* ========================================================================== 
   FILE: __core/coreCss/components.forms.css
   PURPOSE: Consistent form controls and field feedback.
   SCOPE: Inputs, selects, textareas, and field messages.
   DEPENDS: tokens.css, base.css.
   NOTES: Dense but readable form controls for enterprise flows.
   ========================================================================== */

/* [FORMS] Control shell */
.form-control,
.inputtextStripped,
.dd-field__control {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  color: var(--text);
}

.form-control:focus,
.inputtextStripped:focus,
.dd-field__control:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

/* [FORMS] Help and error text */
.dd-field__help {
  color: var(--text-muted);
  font-size: 12px;
}

.dd-field__error {
  color: var(--danger);
  font-size: 12px;
  font-weight: 600;
}

/* [FORMS] DDKV26 selectmultiple */
.dd-selectmultiple {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: var(--sp-2);
  align-items: stretch;
  width: 100%;
  margin-top: var(--sp-2);
}

.dd-selectmultiple-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  overflow: hidden;
}

.dd-selectmultiple-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  min-height: 2.25rem;
  padding: 0.45rem 0.65rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--divider);
}

.dd-selectmultiple-title {
  min-width: 0;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dd-selectmultiple-count {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.55rem;
  height: 1.35rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary) 24%, transparent);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

.dd-selectmultiple-select.inputtextStripped {
  flex: 1 1 auto;
  min-height: 14rem;
  height: clamp(14rem, 34vh, 19rem);
  width: 100% !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: var(--surface-1);
  padding: 0.45rem;
  resize: vertical;
}

.dd-selectmultiple-select.inputtextStripped:focus {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 58%, transparent);
}

.dd-selectmultiple-select option {
  min-height: 2rem;
  padding: 0.4rem 0.5rem;
  border-radius: 0.3rem;
  white-space: normal;
}

.dd-selectmultiple-actions {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--sp-2);
  min-width: 7.25rem;
}

.dd-selectmultiple-action {
  justify-content: center;
  width: 100%;
  min-height: 2.45rem;
  gap: 0.35rem;
  white-space: nowrap;
}

.dd-selectmultiple-action i,
.dd-selectmultiple-action svg {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
}

@media (max-width: 760px) {
  .dd-selectmultiple {
    grid-template-columns: minmax(0, 1fr);
  }

  .dd-selectmultiple-actions {
    flex-direction: row;
    min-width: 0;
    align-self: stretch;
  }

  .dd-selectmultiple-action {
    flex: 1 1 0;
    min-width: 0;
    min-height: 2.75rem;
  }

  .dd-selectmultiple-select.inputtextStripped {
    min-height: 10.5rem;
    height: 12rem;
  }
}

@media (max-width: 420px) {
  .dd-selectmultiple-actions {
    flex-direction: column;
  }
}

/* [FORMS] Read-only empty value */
.dd-readonly-placeholder {
  display: inline-flex;
  align-items: center;
  min-height: 1.4rem;
  color: var(--text-muted) !important;
  font-size: 0.86rem;
  font-style: italic;
}

html[data-theme='dark'] .dd-readonly-placeholder {
  color: color-mix(in srgb, var(--text) 78%, var(--text-muted)) !important;
}

/* [FORMS] Reusable grouped section title */
.dd-section-title {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.dd-section-title::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: var(--accent);
  opacity: 0.8;
}

/* [FORMS] Grouped checkbox options */
.dd-checkbox-group {
  display: grid;
  gap: var(--sp-3);
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
}

.dd-checkbox-group__group {
  display: grid;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
}

.dd-checkbox-group__group-title {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.25;
}

.dd-checkbox-group__option {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  margin: 0;
  color: var(--text);
  cursor: pointer;
  line-height: 1.35;
}

.dd-checkbox-group__input {
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  margin: 0.15rem 0 0;
}

.dd-checkbox-group__label {
  min-width: 0;
}

.dd-checkbox-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
}

table.dd-checkbox-table {
  width: 100%;
  min-width: 38rem;
  border-collapse: collapse;
  color: var(--text);
}

.dd-checkbox-table th,
.dd-checkbox-table td {
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--divider);
  text-align: left;
  vertical-align: middle;
}

.dd-checkbox-table th {
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.2;
}

.dd-checkbox-table tbody tr:last-child td {
  border-bottom: 0;
}

.dd-checkbox-table__row {
  transition: background-color 140ms ease;
}

.dd-checkbox-table__row:hover {
  background: color-mix(in srgb, var(--accent) 7%, var(--surface-1));
}

.dd-checkbox-table__selection {
  width: 5.75rem;
  text-align: center !important;
}

.dd-checkbox-table__input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  cursor: pointer;
}

.dd-checkbox-table__group {
  width: 28%;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.dd-checkbox-table__label {
  font-weight: 600;
}

.dd-checkbox-table__code {
  color: var(--text-muted);
  font-family: var(--font-mono, monospace);
  font-size: 0.8rem;
  white-space: nowrap;
}

/* [FORMS] File preview */
.file-preview-wrapper {
  position: relative;
  display: inline-block;
  margin: 5px;
  max-width: 220px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
}

.file-preview-image {
  display: block;
  width: 220px;
  max-width: 100%;
  max-height: 220px;
  height: auto;
  object-fit: contain;
  background: var(--surface-1);
}

.file-preview-pdf {
  display: block;
  width: 220px;
  height: 220px;
  border: 0;
  background: var(--surface-1);
}

.file-preview-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 220px;
  height: 220px;
  max-width: 100%;
  font-size: 50px;
  color: var(--text-muted);
  background: var(--surface-1);
}

.file-delete-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.78);
  color: #ffffff;
  font-size: 28px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.file-preview-wrapper:hover .file-delete-overlay,
.file-preview-wrapper:focus-within .file-delete-overlay {
  opacity: 1;
}

.file-delete-icon {
  font-size: 24px;
  color: #ef4444;
  background-color: #000000;
  border-radius: 50%;
  padding: 10px;
}

.file-delete-text {
  margin-top: 10px;
  color: #ffffff;
  font-size: 14px;
}

/* [FORMS] Global decision filters shared by operational Nuvex surfaces. */
.dd-global-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  padding: 12px 0 14px;
  border-bottom: 1px solid var(--divider, var(--border));
}

.dd-global-filter__title {
  flex: 0 0 auto;
  min-width: 72px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.dd-global-filter__form {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  min-width: 0;
}

.dd-global-filter__field,
.dd-global-filter__form .mrq-filter-search {
  display: grid;
  flex: 0 1 170px;
  gap: 4px;
  min-width: 140px;
  color: var(--text-muted);
  font-size: 12px;
}

.dd-global-filter__field--search {
  flex-basis: 240px;
}

.dd-global-filter__field span,
.dd-global-filter__form .mrq-filter-search span {
  display: block;
}

.dd-global-filter__form input,
.dd-global-filter__form select {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-1);
  color: var(--text);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, .04);
  font: inherit;
  line-height: 1.2;
}

.dd-global-filter__form input:focus,
.dd-global-filter__form select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
}

.dd-global-filter__actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.dd-global-filter__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-1);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.dd-global-filter__button:hover {
  border-color: var(--primary);
}

.dd-global-filter__button--primary {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-contrast);
}

.dd-global-filter__button--primary:hover {
  border-color: color-mix(in srgb, var(--primary) 82%, #000);
  background: color-mix(in srgb, var(--primary) 88%, #000);
}

@media (max-width: 720px) {
  .dd-global-filter__title {
    width: 100%;
  }

  .dd-global-filter__field {
    flex: 1 1 150px;
  }
}
/* Per-document choices precede the preview without changing other attachment layouts. */
.ms-attachment-item.ms-attachment-item--numbering { flex-wrap: wrap; }
.nuvex-document-numbering-controls { flex: 0 0 100%; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.nuvex-document-numbering-options { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.nuvex-document-numbering-options[hidden] { display: none; }
.nuvex-document-numbering-options > select { width: auto; max-width: 100%; }
.nuvex-document-numbering-options > label { flex: 0 1 140px; min-width: 0; }
.dd-datalist-select { position: relative; width: 100%; }
.dd-checkbox-table { position:relative; width:100%; }
.dd-form-information { color:var(--text); line-height:1.6; overflow-wrap:anywhere; overflow-x:auto; }
.dd-form-information__table { width:100%; border-collapse:collapse; color:var(--text); background:var(--surface-2); }
.dd-form-information__table :is(th,td) { text-align:left; padding:8px 12px; border-bottom:1px solid var(--border); }
.dd-form-information__table th { color:var(--text-muted); font-weight:600; }
.dd-checkbox-table__source { position:absolute !important; width:1px !important; height:1px !important; opacity:0; pointer-events:none; }
.dd-checkbox-table__view { min-width:0; width:100%; max-width:100%; overflow:auto; max-height:24rem; border:1px solid var(--border); border-radius:6px; }
.dd-checkbox-table__table { width:100%; min-width:38rem; border-collapse:collapse; background:var(--surface-2); color:var(--text); font-size:12px; }
.dd-checkbox-table__table :is(th,td) { padding:10px 12px; text-align:left; border-bottom:1px solid var(--border); overflow-wrap:anywhere; }
.dd-checkbox-table__table th { color:var(--text-muted); font-weight:600; }
.dd-checkbox-table__table :is(th,td):first-child { width:28px; padding:8px; text-align:center; }
.dd-checkbox-table__table input[type="checkbox"] { width:18px; height:18px; accent-color:var(--primary); cursor:pointer; }
.dd-checkbox-table__table input:focus-visible { outline:2px solid var(--primary); outline-offset:3px; }
.dd-datalist-select__source { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0; pointer-events: none; }
.dd-datalist-select__options { position: fixed; inset: auto; margin: 0; z-index: 2000; box-sizing: border-box; max-height: 18rem; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--border, #88909d); border-radius: .4rem; background: var(--surface-1, #fff); color: var(--text, #17202d); box-shadow: 0 8px 24px #0003; }
.dd-datalist-select__options[hidden] { display: none; }
.dd-datalist-select__options > div { padding: .6rem .8rem; cursor: pointer; }
.dd-datalist-select__options > div:hover, .dd-datalist-select__options > div[aria-selected="true"] { background: var(--primary, #186dca); color: white; }
[data-bs-theme="dark"] .dd-datalist-select__options, .ambientModeDark .dd-datalist-select__options { background: #1c2430; color: #edf2f7; }

/* Informative cells can group escaped text; compact tables opt into mobile row cards. */
.dd-form-information__lines { display:block; min-width:0; white-space:normal; overflow-wrap:anywhere; }
.dd-form-information__lines > span { color:var(--text-muted); }
.dd-form-information__table--responsive { table-layout:fixed; }
.dd-form-information__table--responsive th { overflow-wrap:normal; word-break:normal; white-space:nowrap; }
.dd-form-information__table--responsive td { vertical-align:top; overflow-wrap:anywhere; word-break:normal; white-space:normal; }
@media (max-width:640px) {
  .dd-form-information__table--responsive,
  .dd-form-information__table--responsive tbody,
  .dd-form-information__table--responsive tr,
  .dd-form-information__table--responsive td { display:block; width:100%; box-sizing:border-box; }
  .dd-form-information__table--responsive thead { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
  .dd-form-information__table--responsive tr { margin-bottom:.75rem; border:1px solid var(--border); border-radius:.4rem; }
  .dd-form-information__table--responsive td { box-sizing:border-box; }
  .dd-form-information__table--responsive td:last-child { border-bottom:0; }
  .dd-form-information__table--responsive td::before { content:attr(data-label); display:block; margin-bottom:.25rem; color:var(--text-muted); font-size:.75rem; font-weight:600; }
  .dd-form-information__table--responsive td:not([data-label])::before { display:none; }
}
