/* RCS application styles. Bootstrap does the heavy lifting; only
   app-specific rules live here (sticky toolbars, table chrome, …). */

.launchpad-tile {
  color: inherit;
}

.launchpad-tile:hover {
  border-color: var(--bs-primary);
  color: var(--bs-primary);
}

.login-card {
  max-width: 420px;
}

/* Table regions (§3.8): long lists scroll inside the panel; the toolbar and
   header row stay pinned (spec §9). */
.rcs-table-scroll {
  max-height: 60vh;
  overflow-y: auto;
}

.rcs-table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background-color: var(--bs-body-bg);
  box-shadow: inset 0 -1px 0 var(--bs-border-color);
}

/* Sizing utilities: narrow forms/panels and short embedded lists
   (templates never use inline styles — djlint H021). */
.rcs-maxw-32 {
  max-width: 32rem;
}

.rcs-maxw-36 {
  max-width: 36rem;
}

.rcs-maxw-48 {
  max-width: 48rem;
}

.rcs-scroll-12 {
  max-height: 12rem;
}

.rcs-scroll-14 {
  max-height: 14rem;
}

[data-rcs-table] tbody tr[data-id] {
  cursor: pointer;
}

/* Selected row: primary tint, distinct from (and stable under) the gray
   hover highlight. The second selector out-specifies .table-hover's rule. */
[data-rcs-table] tbody tr.table-active > *,
.table-hover > tbody > tr.table-active:hover > * {
  --bs-table-bg-state: rgba(var(--bs-primary-rgb), 0.18);
}

/* The focusable table panel (keyboard navigation target). */
.rcs-table-scroll:focus-visible {
  outline: 2px solid rgba(var(--bs-primary-rgb), 0.5);
  outline-offset: -2px;
}

/* Markdown render area: keep embedded content inside the dialog. */
.rcs-markdown img {
  max-width: 100%;
}

.rcs-markdown > :last-child {
  margin-bottom: 0;
}

/* Alpine x-cloak: hide confirm-state controls until Alpine initializes. */
[x-cloak] {
  display: none !important;
}

/* Stacked dialogs (#modal-host-2) run without a Bootstrap backdrop — the
   modal element itself dims the parent dialog underneath. */
#modal-host-2 .modal {
  background-color: rgba(0, 0, 0, 0.35);
}

/* CRUD dialogs wrap header/body/footer in a <form>, which breaks Bootstrap's
   modal-dialog-scrollable flex chain: tall forms clipped their footer (the
   Save/Cancel row). Make the form the flex column that owns the scroll. */
.modal-content > form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}

.modal-content > form > .modal-body {
  overflow-y: auto;
}

/* Toolbar buttons: disabled actions drop to grey so the enabled ones stand
   out in color (spec feedback I7). */
.rcs-toolbar .btn:disabled {
  --bs-btn-disabled-color: var(--bs-secondary-color);
  --bs-btn-disabled-bg: transparent;
  --bs-btn-disabled-border-color: var(--bs-border-color);
}

/* Filter Apply buttons show their in-flight spinner (htmx-request marks the
   issuing element) so a slow search never reads as "nothing happened". */
[data-rcs-apply] .spinner-border {
  display: none;
}

[data-rcs-apply].htmx-request .spinner-border {
  display: inline-block;
}

/* Keyboard-shortcut hints appended to toolbar buttons by app.js (I2). */
.rcs-kbd {
  font-size: 0.72em;
  padding: 0.1em 0.3em;
  background-color: rgba(0, 0, 0, 0.14);
  border-radius: 0.25em;
}

/* Numeric inputs that take decimals suppress the up/down spinner — spinners
   stay on integer-only fields (I4). */
input.rcs-no-spin::-webkit-outer-spin-button,
input.rcs-no-spin::-webkit-inner-spin-button {
  appearance: none;
  margin: 0;
}

input.rcs-no-spin {
  appearance: textfield;
}
