/* App shell support for the light DOM. The shell itself (sidebar, header,
   user menu) is React + shadcn inside a shadow root on #app-shell; its own
   stylesheet is injected there. This file covers what lives outside it. */

@font-face {
  font-family: 'Sansation';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/sansation.woff2') format('woff2');
}

/* Until the module bundle has downloaded and mounted, lay the page out where
   the shell will put it — a fixed sidebar-coloured column on the left, the
   header's height on top, the inset's padding — so the server-rendered
   content paints immediately and doesn't jump when the shell appears.
   header.php sets html.shell-collapsed from the sidebar_state cookie. */
#app-shell:not(.shell-ready) {
  --shell-sidebar-width: 16rem;
  --shell-sidebar-bg: oklch(0.27 0.004 286);
  --shell-content-bg: oklch(1 0 0);
  min-height: 100vh;
  padding: 4.5rem 2.5rem 2rem calc(var(--shell-sidebar-width) + 2.5rem);
  background: var(--shell-content-bg);
}
#app-shell:not(.shell-ready)::before {
  content: '';
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--shell-sidebar-width);
  background: var(--shell-sidebar-bg);
}
html.shell-collapsed #app-shell:not(.shell-ready) {
  --shell-sidebar-width: 3rem;
  padding-top: 3.5rem; /* header is h-12 when the sidebar is collapsed */
}
html[data-theme='dark'] #app-shell:not(.shell-ready) {
  --shell-sidebar-bg: oklch(0.22 0.004 286);
  --shell-content-bg: oklch(0.175 0.003 285);
}
@media (max-width: 767.98px) {
  #app-shell:not(.shell-ready) {
    padding: 4.5rem 1.5rem 2rem;
  }
  #app-shell:not(.shell-ready)::before {
    display: none;
  }
}

/* AdminLTE page bodies are slotted into the shell's content area, so none of
   the theme's fixed-sidebar offsets or page background apply any more. */
html,
body {
  height: auto;
  min-height: 100%;
}
/* The shell's stylesheet (inside the shadow root) sets Inter on :host, which
   the slotted page body inherits once the shell mounts. Declare the same face
   here from the bundle's font files and use it on <body> from the first
   paint, so the text doesn't change face (and apparent size) on mount. Names
   are @fontsource-variable/inter's and are stable across builds. */
@font-face {
  font-family: 'Inter Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/dist/assets/inter-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/dist/assets/inter-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
body,
#app-shell .content-wrapper,
#app-shell .form-control,
#app-shell .btn,
#app-shell .table,
#app-shell .modal {
  font-family: 'Inter Variable', Inter, system-ui, -apple-system, sans-serif;
}

/* Bootstrap 3 sets html to 10px, which the shell's rem-based sizing inside the
   shadow root inherits. Bootstrap 3 itself sizes in px, so restoring 16px is safe. */
html {
  font-size: 16px;
}
body {
  background: oklch(1 0 0);
}
html[data-theme='dark'] body {
  background: oklch(0.175 0.003 285);
  color: oklch(0.87 0.004 286);
}
#app-shell .content-wrapper {
  margin-left: 0;
  min-height: 0;
  background: transparent;
  z-index: auto;
}
#app-shell .content-header {
  padding: 0 0 15px;
}
#app-shell .content {
  padding: 0;
  min-height: 0;
}

/* ---- Dark mode for the AdminLTE page bodies -----------------------------
   Interim, until each screen is ported to React. Greys match app.css's dark
   tokens (card oklch(0.215), border white/10%, text oklch(0.87)). */
html[data-theme='dark'] #app-shell {
  --dk-card: oklch(0.215 0.004 286);
  --dk-card-2: oklch(0.25 0.005 286);
  --dk-border: oklch(1 0 0 / 10%);
  --dk-input: oklch(1 0 0 / 14%);
  --dk-text: oklch(0.87 0.004 286);
  --dk-muted: oklch(0.65 0.01 286);
  color: var(--dk-text);
}
html[data-theme='dark'] #app-shell h1,
html[data-theme='dark'] #app-shell h2,
html[data-theme='dark'] #app-shell h3,
html[data-theme='dark'] #app-shell h4,
html[data-theme='dark'] #app-shell label,
html[data-theme='dark'] #app-shell .box-title,
html[data-theme='dark'] #app-shell .modal-title {
  color: var(--dk-text);
}
html[data-theme='dark'] #app-shell .content-header > h1 > small,
html[data-theme='dark'] #app-shell .help-block,
html[data-theme='dark'] #app-shell .text-muted,
html[data-theme='dark'] #app-shell .dataTables_info,
html[data-theme='dark'] #app-shell .info-box-text {
  color: var(--dk-muted);
}
html[data-theme='dark'] #app-shell .box,
html[data-theme='dark'] #app-shell .info-box,
html[data-theme='dark'] #app-shell .modal-content {
  background: var(--dk-card);
  border-color: var(--dk-border);
  box-shadow: none;
}
html[data-theme='dark'] #app-shell .box-header.with-border,
html[data-theme='dark'] #app-shell .box-footer,
html[data-theme='dark'] #app-shell .modal-header,
html[data-theme='dark'] #app-shell .modal-footer {
  border-color: var(--dk-border);
  background: transparent;
}
html[data-theme='dark'] #app-shell .form-control,
html[data-theme='dark'] #app-shell .input-group-addon,
html[data-theme='dark'] #app-shell select,
html[data-theme='dark'] #app-shell .dataTables_filter input,
html[data-theme='dark'] #app-shell .dataTables_length select {
  background: var(--dk-card-2);
  border-color: var(--dk-input);
  color: var(--dk-text);
  box-shadow: none;
}
html[data-theme='dark'] #app-shell .form-control::placeholder {
  color: var(--dk-muted);
}
html[data-theme='dark'] #app-shell .form-control:focus {
  border-color: oklch(0.72 0.13 242.749);
}
html[data-theme='dark'] #app-shell .btn-default {
  background: var(--dk-card-2);
  border-color: var(--dk-input);
  color: var(--dk-text);
}
html[data-theme='dark'] #app-shell .btn-default:hover {
  background: oklch(0.3 0.005 286);
}
html[data-theme='dark'] #app-shell .table > thead > tr > th,
html[data-theme='dark'] #app-shell .table > tbody > tr > td,
html[data-theme='dark'] #app-shell .table > tbody > tr > th {
  border-color: var(--dk-border);
  color: var(--dk-text);
}
html[data-theme='dark'] #app-shell .table-striped > tbody > tr:nth-of-type(odd),
html[data-theme='dark'] #app-shell .table-hover > tbody > tr:hover {
  background: var(--dk-card-2);
}
html[data-theme='dark'] #app-shell .pagination > li > a,
html[data-theme='dark'] #app-shell .pagination > li > span {
  background: var(--dk-card);
  border-color: var(--dk-border);
  color: var(--dk-text);
}
html[data-theme='dark'] #app-shell .pagination > .active > a {
  background: oklch(0.72 0.13 242.749);
  border-color: transparent;
  color: oklch(0.17 0.03 240);
}
html[data-theme='dark'] #app-shell .alert-info {
  background: oklch(0.29 0.05 252) !important;
  border-color: oklch(0.38 0.06 252) !important;
  color: oklch(0.85 0.06 252) !important;
}
html[data-theme='dark'] #app-shell .alert-success {
  background: oklch(0.26 0.06 145) !important;
  border-color: oklch(0.38 0.08 145) !important;
  color: oklch(0.85 0.1 145) !important;
}
html[data-theme='dark'] #app-shell .alert-warning {
  background: oklch(0.28 0.05 75) !important;
  border-color: oklch(0.42 0.08 75) !important;
  color: oklch(0.88 0.1 80) !important;
}
html[data-theme='dark'] #app-shell .alert-danger {
  background: oklch(0.27 0.06 25) !important;
  border-color: oklch(0.4 0.1 25) !important;
  color: oklch(0.85 0.1 25) !important;
}
/* TinyMCE 5 switches to its oxide-dark skin via functions.php; square up its frame. */
html[data-theme='dark'] #app-shell .tox-tinymce {
  border-color: var(--dk-border);
}

/* ---- Buttons ----------------------------------------------------------
   Every AdminLTE button restyled as the shell's default shadcn Button
   (--primary blue, h-9, rounded-md, 14px medium) so the old pages sit with
   the new chrome until they are ported. Applies to every variant. */
#app-shell .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.25rem;
  padding: 0 1rem;
  border: 1px solid transparent;
  border-radius: 0.45rem;
  background: oklch(0.5 0.134 242.749);
  color: oklch(0.977 0.013 236.62);
  font-family: 'Inter Variable', Inter, system-ui, sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  box-shadow: none;
  text-shadow: none;
  background-image: none;
  transition: background-color 150ms, opacity 150ms;
}
#app-shell .btn:hover,
#app-shell .btn:focus,
#app-shell .btn:active,
#app-shell .btn.active,
#app-shell .btn:active:focus {
  background: oklch(0.45 0.134 242.749);
  color: oklch(0.977 0.013 236.62);
  box-shadow: none;
  outline: none;
}
#app-shell .btn:focus-visible {
  outline: 3px solid oklch(0.5 0.134 242.749 / 50%);
  outline-offset: 2px;
}
#app-shell .btn.disabled,
#app-shell .btn[disabled],
#app-shell .btn.is-submitting {
  opacity: 0.6;
  pointer-events: none;
  background: oklch(0.5 0.134 242.749);
}
#app-shell .btn-block {
  display: flex;
  width: 100%;
}
#app-shell .btn .fa,
#app-shell .btn .glyphicon {
  line-height: 1;
}
#app-shell .btn-group > .btn + .dropdown-toggle {
  padding: 0 0.75rem;
  border-left-color: oklch(1 0 0 / 20%);
}
html[data-theme='dark'] #app-shell .btn,
html[data-theme='dark'] #app-shell .btn.disabled,
html[data-theme='dark'] #app-shell .btn[disabled],
html[data-theme='dark'] #app-shell .btn.is-submitting {
  background: oklch(0.72 0.13 242.749);
  color: oklch(0.17 0.03 240);
}
html[data-theme='dark'] #app-shell .btn:hover,
html[data-theme='dark'] #app-shell .btn:focus,
html[data-theme='dark'] #app-shell .btn:active {
  background: oklch(0.66 0.13 242.749);
  color: oklch(0.17 0.03 240);
}

/* Submit feedback: admin-forms.js swaps the clicked submit button's label for
   this spinner and "Please wait…" and blocks a second submission. */
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}
#app-shell .btn-spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  #app-shell .btn-spinner {
    animation-duration: 1.5s;
  }
}
