/*
 * VidTechy form fields: one site-wide stylesheet (owner request 2026-11-04, design only).
 * Loaded last in application/views/include/css_back.php, after acron.css.
 *
 * Styles: text-like inputs, textareas, native selects, select2, bootstrap-select, their labels, focus and disabled states.
 * Native single selects also get a styled OPEN list (appearance: base-select, last block, inside @supports; Firefox / Safari keep the
 * browser popup and the closed look from this file).
 * Leaves alone: checkboxes, radios, range, file, colour, buttons, the AI chat (.vt-aichat), Quill / summernote editors,
 * the DataTables length / search controls, small / large (-sm, -lg, -xl) controls, and the joined corners of .input-group.
 *
 * Specificity: every exclusion list sits inside :where(), so the base rules weigh (0,1,0) like acron.css's own .form-control
 * (this file loads later, so it wins ties) and bootstrap's .input-group rules and any page <style> still beat it.
 *
 * !important is used only where acron.css (or a page's inline <style>) forces it:
 *   - box-shadow on .form-control: acron.css has `box-shadow: initial !important`, so the focus ring needs it (also the validation ring);
 *   - the disabled / read-only background, border-color and box-shadow: acron.css has `background` and `border-color` with !important
 *     on .form-control:disabled / [readonly];
 *   - the closing select2 block: a few pages carry inline select2 rules with !important (config, keyword_autocomplete, video_optimize);
 *   - the bootstrap-select focus outline: bootstrap-select forces `outline: 0 !important` on some states.
 */

:root {
  --vtf-red: #DE0A07;
  --vtf-ring: 0 0 0 3px rgba(222, 10, 7, .15);
  --vtf-border: #d0d5dd;
  --vtf-border-hover: #98a2b3;
  --vtf-text: #1d2939;
  --vtf-placeholder: #8a94a6;
  --vtf-disabled-bg: #f2f4f7;
  --vtf-radius: 8px;
  --vtf-height: 42px;
  --vtf-chevron: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  --vtf-chevron-red: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23DE0A07' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

/* ---------- labels (not checkbox / radio labels, not horizontal-form column labels) ---------- */
.form-group > label:where(:not(.form-check-label, .custom-control-label, .checkbox, .radio, .btn, .switch, .col-form-label, :has(input[type=checkbox], input[type=radio]))),
label.form-label,
label.control-label {
  display: inline-block;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--vtf-text);
  line-height: 1.35;
}

/* size: single-line boxes only (no -sm / -lg / -xl, no textarea, no multi-line select) */
:is(.form-control, .custom-select):where(:not(.form-control-sm, .form-control-lg, .form-control-xl, .custom-select-sm, .custom-select-lg, textarea, select[multiple], select[size], [type=file], [type=checkbox], [type=radio], [type=range], [type=color], .vt-aichat *, .dataTables_filter *, .dataTables_length *)),
:where(input:is([type=text], [type=email], [type=password], [type=number], [type=search], [type=url], [type=tel], [type=date]), select:not([multiple], [size])):not([class]):where(:not(.vt-aichat *)) {
  min-height: var(--vtf-height);
  height: var(--vtf-height);
  padding: 8px 14px;
  line-height: 1.4;
}

/* look: colour, border, radius */
:is(.form-control, .custom-select):where(:not([type=file], [type=checkbox], [type=radio], [type=range], [type=color], .vt-aichat *, .dataTables_filter *, .dataTables_length *)),
:where(input:is([type=text], [type=email], [type=password], [type=number], [type=search], [type=url], [type=tel], [type=date]), select):not([class]):where(:not(.vt-aichat *)),
textarea:where(:not(.form-control, .note-editable, .note-codable, .ql-clipboard, .select2-search__field, [class*="kit__"], .vt-aichat *)) {
  background-color: #fff;
  color: var(--vtf-text);
  border: 1px solid var(--vtf-border);
  border-radius: var(--vtf-radius);
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

/* textareas: comfortable padding; no min-height or height here, so rows= and inline heights (hidden measuring boxes) win */
textarea:where(:not(.note-editable, .note-codable, .ql-clipboard, .select2-search__field, [class*="kit__"], .vt-aichat *)) {
  padding: 10px 14px;
  line-height: 1.5;
}

/* native single select: own chevron, no browser arrow (multiple / size lists keep the browser look) */
select:is(.form-control, .custom-select):where(:not([multiple], [size], .form-control-sm, .custom-select-sm, .vt-aichat *, .dataTables_length *)),
select:not([class], [multiple], [size]):where(:not(.vt-aichat *)) {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: var(--vtf-chevron);
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 16px;
  padding-right: 40px;
  cursor: pointer;
}
select.form-control:where([multiple], [size]):where(:not(.vt-aichat *)) {
  height: auto;
  padding: 6px 8px;
}

/* placeholder */
:is(.form-control, textarea, input:not([class]))::placeholder {
  color: var(--vtf-placeholder);
  opacity: 1;
}

/* hover */
:is(.form-control, .custom-select):where(:not(:disabled, [readonly], [type=file], [type=checkbox], [type=radio], [type=range], [type=color], .vt-aichat *, .dataTables_filter *, .dataTables_length *)):hover,
textarea:where(:not(:disabled, [readonly], .form-control, .note-editable, .note-codable, .select2-search__field, [class*="kit__"], .vt-aichat *)):hover,
:where(input:is([type=text], [type=email], [type=password], [type=number], [type=search], [type=url], [type=tel], [type=date]), select):not([class]):where(:not(:disabled, .vt-aichat *)):hover {
  border-color: var(--vtf-border-hover);
}

/* focus: red border and a soft ring (box-shadow needs !important: acron.css forces box-shadow: initial !important on .form-control) */
:is(.form-control, .custom-select):where(:not([type=file], [type=checkbox], [type=radio], [type=range], [type=color], .vt-aichat *, .dataTables_filter *, .dataTables_length *)):focus,
textarea:where(:not(.form-control, .note-editable, .note-codable, .select2-search__field, [class*="kit__"], .vt-aichat *)):focus,
:where(input:is([type=text], [type=email], [type=password], [type=number], [type=search], [type=url], [type=tel], [type=date]), select):not([class]):where(:not(.vt-aichat *)):focus {
  border-color: var(--vtf-red);
  box-shadow: var(--vtf-ring) !important;
  outline: 0;
  background-color: #fff;
  color: var(--vtf-text);
}
select:is(.form-control, .custom-select):where(:not([multiple], [size], .form-control-sm, .custom-select-sm, .vt-aichat *, .dataTables_length *)):focus,
select:not([class], [multiple], [size]):where(:not(.vt-aichat *)):focus {
  background-image: var(--vtf-chevron-red);
}

/* disabled / read-only (acron.css forces background and border-color with !important, so these need it too) */
:is(.form-control, .custom-select):is(:disabled, [readonly]):where(:not(.vt-aichat *, .dataTables_filter *, .dataTables_length *)),
textarea:where(:disabled):where(:not(.form-control, .note-editable, [class*="kit__"], .vt-aichat *)),
select:not([class]):where(:disabled):where(:not(.vt-aichat *)) {
  background-color: var(--vtf-disabled-bg) !important;
  border-color: #e4e7ec !important;
  color: #667085;
  cursor: not-allowed;
  opacity: 1;
  box-shadow: none !important;
}

/* validation states that bootstrap supplies keep their own colours */
.form-control.is-invalid:where(:not(.vt-aichat *)),
.was-validated .form-control:invalid:where(:not(.vt-aichat *)) { border-color: #d92d20; }
.form-control.is-invalid:focus:where(:not(.vt-aichat *)) { box-shadow: 0 0 0 3px rgba(217, 45, 32, .15) !important; }

/* ---------- input groups keep their joined edges (bootstrap's own rules at (0,3,0) also beat the base rules above) ---------- */
.input-group > .form-control:not(:last-child),
.input-group > .custom-select:not(:last-child) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.input-group > .form-control:not(:first-child),
.input-group > .custom-select:not(:first-child) {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
.input-group > .form-control:focus { z-index: 3; }

/* ---------- select2 ---------- */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
  background-color: #fff;
  border: 1px solid var(--vtf-border);
  border-radius: var(--vtf-radius);
  transition: border-color .15s ease, box-shadow .15s ease;
  outline: 0;
}
.select2-container--default .select2-selection--single {
  height: var(--vtf-height);
  background-image: var(--vtf-chevron);
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 16px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: calc(var(--vtf-height) - 2px);
  padding-left: 14px;
  padding-right: 40px;
  color: var(--vtf-text);
}
.select2-container--default .select2-selection--single .select2-selection__placeholder { color: var(--vtf-placeholder); }
.select2-container--default .select2-selection--single .select2-selection__arrow { display: none; }
.select2-container--default .select2-selection--single .select2-selection__clear {
  height: calc(var(--vtf-height) - 2px);
  line-height: calc(var(--vtf-height) - 2px);
  margin-right: 28px;
  color: #667085;
}
.select2-container--default .select2-selection--multiple {
  min-height: var(--vtf-height);
  padding: 3px 8px;
}
.select2-container--default .select2-selection--multiple .select2-selection__rendered { padding: 0; }
.select2-container--default .select2-selection--multiple .select2-selection__choice {
  background-color: rgba(222, 10, 7, .08);
  border: 1px solid rgba(222, 10, 7, .25);
  border-radius: 6px;
  color: var(--vtf-text);
  margin-top: 4px;
  padding: 1px 8px;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove { color: var(--vtf-red); margin-right: 6px; }
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover { color: #a30806; }
.select2-container--default .select2-search--inline .select2-search__field { margin-top: 7px; }
.select2-container--default .select2-selection--multiple .select2-search__field::placeholder { color: var(--vtf-placeholder); }

.select2-container--default:hover .select2-selection--single,
.select2-container--default:hover .select2-selection--multiple { border-color: var(--vtf-border-hover); }
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--multiple {
  border-color: var(--vtf-red);
  box-shadow: var(--vtf-ring);
}
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single { background-image: var(--vtf-chevron-red); }
.select2-container--default.select2-container--disabled .select2-selection--single,
.select2-container--default.select2-container--disabled .select2-selection--multiple {
  background-color: var(--vtf-disabled-bg);
  border-color: #e4e7ec;
  cursor: not-allowed;
}

/* the dropdown panel */
.select2-container--default .select2-dropdown {
  border: 1px solid var(--vtf-border);
  border-radius: var(--vtf-radius);
  box-shadow: 0 12px 28px rgba(16, 24, 40, .14);
  overflow: hidden;
}
.select2-container--default .select2-dropdown--below { margin-top: 4px; }
.select2-container--default .select2-dropdown--above { margin-bottom: 4px; }
.select2-container--default .select2-search--dropdown { padding: 8px; }
.select2-container--default .select2-search--dropdown .select2-search__field {
  height: 38px;
  padding: 6px 12px;
  border: 1px solid var(--vtf-border);
  border-radius: 6px;
  outline: 0;
  background: #fff;
  color: var(--vtf-text);
}
.select2-container--default .select2-search--dropdown .select2-search__field:focus {
  border-color: var(--vtf-red);
  box-shadow: var(--vtf-ring);
}
.select2-container--default .select2-results__option { padding: 9px 14px; color: var(--vtf-text); }
.select2-container--default .select2-results__option--highlighted[aria-selected],
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
  background-color: rgba(222, 10, 7, .08);
  color: var(--vtf-text);
}
.select2-container--default .select2-results__option[aria-selected=true],
.select2-container--default .select2-results__option--selected {
  background-color: rgba(222, 10, 7, .14);
  color: var(--vtf-text);
  font-weight: 600;
}
.select2-container--default .select2-results__option--highlighted[aria-selected=true] { background-color: rgba(222, 10, 7, .14); }

/* ---------- bootstrap-select ---------- */
.bootstrap-select > .dropdown-toggle:not(.btn-sm) {
  min-height: var(--vtf-height);
  padding: 8px 14px;
  background-color: #fff;
  color: var(--vtf-text);
  border: 1px solid var(--vtf-border);
  border-radius: var(--vtf-radius);
  box-shadow: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.bootstrap-select > .dropdown-toggle:hover { border-color: var(--vtf-border-hover); }
.bootstrap-select > .dropdown-toggle:focus,
.bootstrap-select.show > .dropdown-toggle,
.bootstrap-select.open > .dropdown-toggle {
  border-color: var(--vtf-red);
  box-shadow: var(--vtf-ring);
  outline: 0 !important;
}
.bootstrap-select > .dropdown-toggle.bs-placeholder,
.bootstrap-select > .dropdown-toggle.bs-placeholder:hover { color: var(--vtf-placeholder); }
.bootstrap-select.disabled > .dropdown-toggle,
.bootstrap-select > .dropdown-toggle.disabled {
  background-color: var(--vtf-disabled-bg);
  border-color: #e4e7ec;
  cursor: not-allowed;
}
.bootstrap-select .dropdown-menu {
  border: 1px solid var(--vtf-border);
  border-radius: var(--vtf-radius);
  box-shadow: 0 12px 28px rgba(16, 24, 40, .14);
}
.bootstrap-select .dropdown-menu li a:hover,
.bootstrap-select .dropdown-menu .dropdown-item:hover,
.bootstrap-select .dropdown-menu .dropdown-item:focus { background-color: rgba(222, 10, 7, .08); color: var(--vtf-text); }
.bootstrap-select .dropdown-menu .dropdown-item.active,
.bootstrap-select .dropdown-menu li.selected a { background-color: rgba(222, 10, 7, .14); color: var(--vtf-text); }
.bootstrap-select .bs-searchbox { padding: 8px; }
.bootstrap-select .bs-searchbox .form-control { height: 38px; min-height: 38px; padding: 6px 12px; }

/* ---------- mobile: 16 px stops iOS from zooming on focus ---------- */
@media (max-width: 575.98px) {
  :is(.form-control, .custom-select):where(:not([type=file], [type=checkbox], [type=radio], [type=range], [type=color], .vt-aichat *, .dataTables_filter *, .dataTables_length *)),
  textarea:where(:not(.note-editable, .note-codable, .ql-clipboard, .select2-search__field, [class*="kit__"], .vt-aichat *)),
  :where(input:is([type=text], [type=email], [type=password], [type=number], [type=search], [type=url], [type=tel], [type=date]), select):not([class]):where(:not(.vt-aichat *)),
  .select2-container--default .select2-selection--single .select2-selection__rendered,
  .select2-container--default .select2-search--dropdown .select2-search__field,
  .bootstrap-select > .dropdown-toggle {
    font-size: 16px;
  }
}

/*
 * Pages that carry their own inline select2 sizing with !important (config / account settings: height 36px and radius .15em;
 * Keyword Autocomplete and Video Optimize have similar rules). A page's inline <style> comes after this file and is !important,
 * so these few !important declarations, with one more selector (`body`) for specificity, bring those single selects in line.
 */
body .select2-container--default .select2-selection--single {
  height: var(--vtf-height) !important;
  border-radius: var(--vtf-radius) !important;
  border-color: var(--vtf-border);
}
body .select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: calc(var(--vtf-height) - 2px) !important;
  padding-left: 14px;
  color: var(--vtf-text) !important;
}
body .select2-container--default.select2-container--focus .select2-selection--single,
body .select2-container--default.select2-container--open .select2-selection--single { border-color: var(--vtf-red); }

/* outer corners of an input group follow the 8 px radius (acron.css gives .input-group .form-control a smaller right radius) */
.input-group:not(.input-group-sm) > .form-control:not(.form-control-sm, .form-control-lg):first-child {
  border-top-left-radius: var(--vtf-radius);
  border-bottom-left-radius: var(--vtf-radius);
}
.input-group:not(.input-group-sm) > .form-control:not(.form-control-sm, .form-control-lg):last-child {
  border-top-right-radius: var(--vtf-radius);
  border-bottom-right-radius: var(--vtf-radius);
}

/* ---------- native select: styled OPEN list (customizable select, progressive enhancement) ----------
 * Chromium 135+ (Chrome / Edge / Android Chrome). Firefox and Safari do not match @supports and keep the look above
 * (own closed field, the browser's own popup). Same single selects as above; not multiple / size / -sm, not the AI chat,
 * not the DataTables length select, not selects that select2 or bootstrap-select hide. Values, events and submission
 * are untouched: only the drawing of the closed field and of the popup changes.
 * The scope list is written once; the rules below are nested in it (CSS nesting, Chromium 120+, older than base-select).
 */
@supports (appearance: base-select) {
  :is(
    select:is(.form-control, .custom-select):where(:not([multiple], [size], .form-control-sm, .custom-select-sm, .select2-hidden-accessible, .bs-select-hidden, .bootstrap-select *, .vt-aichat *, .dataTables_length *)),
    select:not([class], [multiple], [size]):where(:not(.bootstrap-select *, .vt-aichat *))
  ) {
    appearance: base-select;

    /* closed field: same box as before; inline-flex keeps the select inline like a native one (.form-control is made block below);
       our SVG chevron stays, the built-in one is hidden so only one arrow shows; long text stays on one line and is cut before the chevron */
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    /* text-overflow: ellipsis has no effect on the browser-made selected-text box; clip it at the content edge instead, so it never runs under the chevron */
    overflow: clip;
    overflow-clip-margin: content-box;

    &::picker-icon { display: none; }
    &:open {
      border-color: var(--vtf-red);
      box-shadow: var(--vtf-ring) !important;
      background-image: var(--vtf-chevron-red);
    }

    /* the open list: same family as the select2 dropdown */
    &::picker(select) {
      appearance: base-select;
      box-sizing: border-box;
      min-inline-size: anchor-size(self-inline);
      max-block-size: min(300px, 60vh);
      margin-block: 4px;
      padding: 6px;
      background: #fff;
      border: 1px solid var(--vtf-border);
      border-radius: var(--vtf-radius);
      box-shadow: 0 12px 28px rgba(16, 24, 40, .14);
      overflow-y: auto;
    }

    option {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 9px 12px;
      border-radius: 6px;
      color: var(--vtf-text);
      font: inherit;
      line-height: 1.4;
      cursor: pointer;
    }
    /* selected = bold + red check + tint; hover / keyboard highlight comes after it, so it shows on the selected row too */
    option:checked {
      background-color: rgba(222, 10, 7, .14);
      font-weight: 600;
    }
    option:is(:hover, :focus, :focus-visible) {
      background-color: rgba(222, 10, 7, .08);
      color: var(--vtf-text);
      outline: 0;
    }
    option:checked:is(:hover, :focus, :focus-visible) { background-color: rgba(222, 10, 7, .22); }
    option::checkmark {
      order: 1;
      margin-inline-start: auto;
      color: var(--vtf-red);
    }
    option:disabled {
      color: #98a2b3;
      background: transparent;
      cursor: not-allowed;
    }
    optgroup {
      font-weight: 600;
      color: var(--vtf-text);
    }
  }

  /* .form-control selects were block-level (full width) before: keep that */
  select.form-control:where(:not([multiple], [size], .form-control-sm, .select2-hidden-accessible, .bs-select-hidden, .bootstrap-select *, .vt-aichat *, .dataTables_length *)) {
    display: flex;
  }
}

/* ---------- loading spinner (owner request 2026-11-04) ----------
 * The old Font Awesome 4 spinner glyph (`fa fa-spinner`, with or without fa-spin, ~120 places: "Saving...", "Analyzing...", page loaders)
 * becomes a thin ring in the current text colour. CSS only: same markup, same JS; size follows the icon's font-size (fa-2x etc.). */
.fa.fa-spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: .14em solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -.14em;
  box-sizing: border-box;
  animation: vt-spin .7s linear infinite;
  opacity: .9;
}
.fa.fa-spinner::before { content: none; }
@keyframes vt-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .fa.fa-spinner { animation-duration: 1.6s; }
}
