/**
 * Global UI depth & contrast — page → card → input → action
 * Loaded last so tokens apply across admin, dash, and public layouts.
 */

:root {
  /*
   * Background layers — reference dark-theme.css tokens so a single
   * [data-theme] toggle drives both systems automatically.
   *   light: --bg-primary  #EFF2F7 (page) / --bg-secondary #FFFFFF (card)
   *   dark:  --bg-primary  #0D1117        / --bg-secondary #161B25
   */
  --bg-page:  var(--bg-primary);
  --bg-card:  var(--bg-secondary);
  --bg-input: var(--bg-tertiary);

  /* Borders — also driven by dark-theme.css tokens */
  --border-default: var(--border-primary);
  --border-strong:  var(--border-secondary);
  /* --border-input is defined in dark-theme.css and wins via load order */

  /* Text — dark-theme.css owns these; keep placeholder only */
  --text-placeholder: #9ca3af;

  /* Brand (Brispa coral — aligns with theme / logo accents in style.css) */
  --brand-primary: #e5765b;
  --brand-soft: rgba(229, 118, 91, 0.15);

  /* Shadows */
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-card-hover: 0 2px 4px rgba(0, 0, 0, 0.06), 0 8px 16px rgba(0, 0, 0, 0.08);
  /* Soft transparent brand glow on focused inputs */
  --shadow-focus: 0 0 0 3px rgba(229, 118, 91, 0.28);

  /* Radius */
  --radius-md: 10px;
  --radius-input: 8px;
}

/* ----- Page canvas ----- */
html {
  background-color: var(--bg-page);
}

body {
  background-color: var(--bg-page);
}

/* ----- Cards / panels ----- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-primary);
}

/* Padding when Bootstrap .card-body is not used (avoids double padding) */
.card:not(:has(> .card-body)):not(:has(> .card-header)):not(:has(> .list-group)) {
  padding: 16px 20px;
}

@media (hover: hover) and (pointer: fine) {
  .card:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-1px);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
  }

  /* Accordions: avoid lift / layout shift */
  .generic-accordion .card:hover,
  .generic--accordion .card:hover,
  .generic-accordion-layout-2 .card:hover {
    transform: none;
    box-shadow: var(--shadow-card);
  }
}

/* ----- Form controls (Bootstrap 4 + native) ----- */
.form-control,
.custom-select,
select.form-control,
textarea.form-control,
input.form-control,
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="hidden"]):not([type="image"]):not([type="color"]):not([type="submit"]):not([type="button"]):not([type="reset"]),
select:not([multiple]),
textarea {
  background-color: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-input);
  padding: 10px 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  font-size: 14px;
  color: var(--text-primary);
}

/*
 * Default Bootstrap .form-control height is calc(1.5em + 0.75rem + 2px) (~38px) for
 * ~6px vertical padding. We use 10px vertical padding, so text is clipped unless the
 * box grows (admin CAT sessions filter bar, etc.).
 */
select.form-control:not(.form-control-sm):not(.form-control-lg):not([multiple]),
input.form-control:not(.form-control-sm):not(.form-control-lg):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="hidden"]):not([type="image"]):not([type="color"]):not([type="submit"]):not([type="button"]):not([type="reset"]) {
  min-height: calc(1.5em + 20px + 2px);
  height: auto;
}

.custom-select:not(.custom-select-sm):not(.custom-select-lg) {
  min-height: calc(1.5em + 20px + 2px);
  height: auto;
}

select[multiple],
select.form-control[multiple] {
  padding: 10px 12px;
  min-height: 120px;
}

/*
 * Bootstrap .form-control-sm / .form-control-lg set explicit heights; the rules above
 * use 10px vertical padding. That combination shrinks the text box to ~31px tall while
 * forcing 20px padding — selected option text is clipped (common on admin QBank filters).
 */
.form-control.form-control-sm,
select.form-control.form-control-sm,
textarea.form-control.form-control-sm,
input.form-control.form-control-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  line-height: 1.5;
}

select.form-control.form-control-sm,
input.form-control.form-control-sm:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="hidden"]):not([type="image"]):not([type="color"]):not([type="submit"]):not([type="button"]):not([type="reset"]) {
  height: calc(1.5em + 0.5rem + 2px);
}

.form-control.form-control-lg,
select.form-control.form-control-lg,
textarea.form-control.form-control-lg,
input.form-control.form-control-lg {
  padding: 0.5rem 1rem;
  font-size: 1.25rem;
  line-height: 1.5;
}

select.form-control.form-control-lg,
input.form-control.form-control-lg:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="hidden"]):not([type="image"]):not([type="color"]):not([type="submit"]):not([type="button"]):not([type="reset"]) {
  height: calc(1.5em + 1rem + 2px);
}

.form-control:focus,
.custom-select:focus,
select.form-control:focus,
textarea.form-control:focus,
input.form-control:focus,
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="hidden"]):not([type="image"]):not([type="color"]):not([type="submit"]):not([type="button"]):not([type="reset"]):focus,
select:not([multiple]):focus,
textarea:focus {
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-focus);
  outline: none;
  background-color: var(--bg-secondary);
}

/* Quest builder + legacy contact forms: .form--control used with .form-control */
.form-control.form--control {
  border-color: var(--border-input);
  /* Reserve space for .input-icon (absolute left ~20px); generic .form-control padding would override style.css */
  padding-top: 10px;
  padding-bottom: 10px;
  padding-right: 12px;
  padding-left: 3rem;
}

/* Extra left room for icon-bearing auth inputs to prevent overlap at varying font/render scales. */
.form-control.form--control.has-left-icon {
  padding-left: 3.4rem;
}

.form-control.form--control:focus {
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-focus);
  outline: none;
  background-color: var(--bg-secondary);
}

.form-control::placeholder,
textarea::placeholder,
input.form-control::placeholder {
  color: var(--text-placeholder);
  font-style: italic;
  font-weight: 400;
  opacity: 1;
}

/* Field labels vs placeholder: clear “prompt vs answer” hierarchy */
.label-text,
.form-group > label.label-text {
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

/* ----- Section rhythm ----- */
.section {
  margin-bottom: 24px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-primary);
}

/* ----- Buttons ----- */
.btn-primary {
  background: var(--brand-primary);
  color: #fff;
  border-color: var(--brand-primary);
  border-radius: var(--radius-input);
  padding: 10px 16px;
  transition: opacity 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
  opacity: 0.92;
}

.btn-secondary {
  background: #e5e7eb;
  color: #374151;
  border-color: #d1d5db;
  border-radius: var(--radius-input);
  padding: 10px 16px;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn-secondary:hover,
.btn-secondary:focus {
  background: #d1d5db;
  color: #1f2937;
  border-color: #9ca3af;
}

/* ----- Tables (admin / DataTables) ----- */
table {
  background: var(--bg-card);
}

.table {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.table thead th,
table thead th {
  background: var(--bg-accent);
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-default);
}

.table td,
.table th,
table td,
table th {
  border-color: var(--border-default);
}

/* Rounded shell without breaking horizontal scroll (do not use overflow:hidden here) */
.table-responsive {
  border-radius: var(--radius-md);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}

/* DataTables keeps thead — align striping with depth */
table.dataTable tbody tr {
  background-color: var(--bg-card);
}

table.dataTable.stripe tbody tr.odd,
table.dataTable.display tbody tr.odd {
  background-color: var(--bg-tertiary);
}
