/*
 * MCIMS brand theme — overrides the Aquiry template's default palette with
 * the indigo/gold identity used on the public landing page, and adds an
 * "mcims" preset alongside the template's existing swatches so the built-in
 * customizer (data-theme-colors radios, already wired by assets/js/app.js)
 * can switch back to them if a tenant ever wants to.
 *
 * Load this AFTER app.min.css - selector specificity matches the template's
 * own theme blocks exactly, so later source order decides ties in our favor.
 */

:root {
  --mcims-ink-indigo: #1a1148;
  --mcims-brand-indigo: #2a166e;
  --mcims-gold: #f0b92e;
  --mcims-gold-deep: #a97a0f;
  --mcims-paper: #f7f6fb;
}

body {
  font-family: 'Inter', sans-serif;
}

h1, h2, h3, h4, h5, h6,
.card-title, .modal-title, .offcanvas-title {
  font-family: 'Fraunces', serif;
  letter-spacing: -0.01em;
}

.eyebrow, .fw-mono {
  font-family: 'IBM Plex Mono', monospace;
}

/* ---------- Brand primary (this is the default swatch — "mcims") ---------- */
:root[data-theme-colors=default],
:root[data-theme-colors=mcims],
[data-bs-theme=light][data-theme-colors=default],
[data-bs-theme=light][data-theme-colors=mcims] {
  --bs-primary: var(--mcims-brand-indigo);
  --bs-primary-rgb: 42, 22, 110;
  --bs-primary-text-emphasis: var(--mcims-ink-indigo);
  --bs-primary-bg-subtle: rgba(42, 22, 110, 0.08);
  --bs-primary-border-subtle: rgba(42, 22, 110, 0.35);
  --bs-link-color-rgb: 42, 22, 110;
  --bs-link-hover-color-rgb: 26, 17, 72;
}

/* Swatch preview colors in the theme customizer */
.form-check.sidebar-setting.card-radio input[value=default] + label,
.form-check.sidebar-setting.card-radio input[value=mcims] + label {
  background: linear-gradient(135deg, var(--mcims-brand-indigo) 50%, var(--mcims-gold) 50%);
}

/* ---------- Brand accent utilities (gold) ---------- */
.btn-brand-gold {
  background-color: var(--mcims-gold);
  border-color: var(--mcims-gold);
  color: var(--mcims-ink-indigo);
  font-weight: 600;
}
.btn-brand-gold:hover, .btn-brand-gold:focus {
  background-color: var(--mcims-gold-deep);
  border-color: var(--mcims-gold-deep);
  color: var(--mcims-ink-indigo);
}
.text-brand-gold { color: var(--mcims-gold-deep) !important; }
.badge-brand-gold { background-color: var(--mcims-gold); color: var(--mcims-ink-indigo); }

/* ---------- On-brand dark sidebar/topbar (instead of Aquiry's default slate) ---------- */
[data-sidebar-color=dark] .sidebar-left {
  background: var(--mcims-ink-indigo) !important;
}
[data-topbar-color=dark] #page-topbar {
  background: var(--mcims-ink-indigo) !important;
}

/* ---------- Softer pill buttons, matching the landing page's shape language ---------- */
.btn {
  border-radius: 999px;
}
.btn-sm { border-radius: 999px; }

/* Cards/modals get the same warm paper background used on the landing page */
body[data-bs-theme=light] {
  background-color: var(--mcims-paper);
}

/* ---------- Visible input boundaries app-wide ----------
 * Bootstrap's default form-control border is very low-contrast against a
 * light page background (the same issue found on the login page) - give
 * every input/select/textarea a clearly visible fill and border everywhere,
 * not just on auth screens.
 */
.form-control, .form-select {
  background-color: #fff;
  border: 1.5px solid rgba(26, 17, 72, .16);
}
.form-control:focus, .form-select:focus {
  border-color: var(--mcims-brand-indigo);
  box-shadow: 0 0 0 .2rem rgba(42, 22, 110, .14);
}
.form-control::placeholder {
  color: #9a94b8;
}

/* ---------- Searchable selects (see assets/js/searchable-select.js) ----------
 * Self-contained progressive enhancement - no separate vendored library, so
 * nothing here depends on an extra asset path being deployed correctly.
 * The trigger button reuses .form-select/.form-control-sm etc. so it's
 * already styled identically to a native select by the rules above; this
 * only styles the parts that don't exist natively (the dropdown panel).
 */
.ss-trigger {
  text-align: left;
  cursor: pointer;
}
.ss-trigger.is-invalid {
  border-color: #dc3545;
}
.ss-trigger-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ss-panel {
  position: fixed;
  z-index: 1080;
  display: flex;
  flex-direction: column;
  background-color: #fff;
  border: 1.5px solid rgba(26, 17, 72, .16);
  border-radius: .25rem;
  box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .15);
  max-height: 260px;
}
.ss-panel[hidden] {
  display: none;
}
.ss-search-wrap {
  padding: 6px;
  border-bottom: 1px solid rgba(26, 17, 72, .1);
}
.ss-options {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.ss-options li {
  padding: 6px 12px;
  cursor: pointer;
  font-size: .875rem;
}
@media (pointer: coarse) {
  /* Finger-sized tap targets; 16px search text stops iOS zooming the page
     when the box is focused (which would itself scroll/resize mid-tap). */
  .ss-options li {
    padding: 11px 14px;
  }
  .ss-search {
    font-size: 16px;
  }
}
.ss-options li:hover,
.ss-options li.ss-option-highlighted {
  background-color: var(--mcims-brand-indigo);
  color: #fff;
}
.ss-options li.ss-option-active {
  font-weight: 600;
}
.ss-options li.ss-option-disabled {
  color: #9a94b8;
  cursor: not-allowed;
}

/* ---------- Step wizard (reusable - see assets/js/wizard.js) ---------- */
.wizard-steps {
  gap: 8px;
}
.wizard-step-indicator {
  flex: 1;
  text-align: center;
  position: relative;
  cursor: pointer;
}
.wizard-step-indicator:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 18px;
  left: 55%;
  width: 90%;
  height: 2px;
  background: rgba(26, 17, 72, .12);
  z-index: 0;
}
.wizard-step-indicator.completed:not(:last-child)::after {
  background: var(--mcims-gold);
}
.wizard-step-indicator .step-num {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(26, 17, 72, .08);
  color: var(--mcims-brand-indigo);
  font-family: 'Fraunces', serif;
  font-weight: 600;
}
.wizard-step-indicator.active .step-num {
  background: var(--mcims-brand-indigo);
  color: #fff;
}
.wizard-step-indicator.completed .step-num {
  background: var(--mcims-gold);
  color: var(--mcims-ink-indigo);
}
.wizard-step-indicator .step-label {
  display: block;
  font-size: .76rem;
  margin-top: 6px;
  color: var(--mcims-ink-soft, #524c76);
}
.wizard-step-indicator.active .step-label {
  color: var(--mcims-brand-indigo);
  font-weight: 600;
}

/* Topbar: keep a long staff name from stretching the header (Settings > Staff Users
   names can be long, e.g. "Dr. Ruth Nabirye (HOD, seed account)") */
.topbar-username {
  display: inline-block;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}
.admin-user-info .avatar-label-primary {
  width: 32px;
  height: 32px;
}

/* Feedback FAB: must be a real CSS rule, not an inline style="" attribute -
   the app's CSP has no style-src-attr allowance, so inline styles are
   silently dropped by the browser (position:fixed on the FAB was being lost
   entirely, sinking the button to the bottom of the page). */

.feedback-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 56px;
  height: 56px;
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.feedback-fab i {
  font-size: 24px;
}

/* AI help-chat widget - stacked directly above the feedback FAB (same
   fixed-to-viewport idiom, +72px so the two buttons don't touch). */
.ai-chat-fab {
  position: fixed;
  right: 24px;
  bottom: 96px;
  width: 56px;
  height: 56px;
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.ai-chat-fab i {
  font-size: 24px;
}
.ai-chat-panel {
  position: fixed;
  right: 24px;
  bottom: 160px;
  width: 340px;
  max-width: calc(100vw - 32px);
  height: 440px;
  max-height: calc(100vh - 200px);
  z-index: 1050;
  display: flex;
  flex-direction: column;
}
.ai-chat-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ai-chat-msg {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.4;
  word-wrap: break-word;
}
.ai-chat-msg-assistant {
  align-self: flex-start;
  background: var(--bs-tertiary-bg, #f1f3f5);
  color: var(--bs-body-color);
}
.ai-chat-msg-user {
  align-self: flex-end;
  background: var(--bs-primary);
  color: #fff;
}
.ai-chat-msg-error {
  color: #b91c1c;
}

/* Shared error-page chrome (404/403/500) - same CSP reasoning as above:
   real classes, not inline style="" sizing. */
.error-page-wrap {
  max-width: 480px;
}
.error-page-icon {
  width: 72px;
  height: 72px;
}
.error-page-icon i {
  font-size: 32px;
}

/* Ticket/feedback thread screenshot attachments - fixed-size thumbnail,
   click-through to the full image via the same access-controlled route. */
.ticket-attachment-thumb {
  width: 84px;
  height: 84px;
  object-fit: cover;
}
