/**
 * chrome.css — shared app chrome: navbar, sidebar, loaders and transitions.
 *
 * Loaded by BOTH layouts (templates/base.html and
 * myhub/elements/layouts/admin.html) so the top navbar and left sidebar look and
 * behave identically on every page. Owns navbar alignment, the right-nav themed
 * icons, the collapsible / hover-reveal / scroll-remembering sidebar and the
 * global loading affordances. chrome.js keeps the live navbar height token in
 * sync and sets the body classes this file reacts to.
 *
 * Sections:
 *  0. Sticky footer — on a short page the footer sits at the bottom of the
 *     viewport instead of riding up under the content; on a long page it scrolls
 *     off the end. Done with flex rather than `position: fixed` so the footer
 *     never covers content: <body> is a column, <main> grows to eat the leftover
 *     height, and .footer is the last, non-growing row (min-height uses dvh on
 *     mobile browsers to exclude the URL bar). Scoped to `body.app-shell`, which
 *     only the app layout sets — the public pages on base.html have no footer,
 *     so flexing their <body> would change their layout for no gain. The rest of
 *     the chrome (navbar, loader bar, alert stack, cookie banner) is
 *     position: fixed and out of flow. Anything added later that is NOT fixed
 *     must be given `flex: 0 0 auto`, or it will stretch.
 *  1. Navbar — one comfortable height with equal room top and bottom and every
 *     item centred on one line (logo + organisation title, search, the collapse
 *     button and the right-hand menus). Themed leading icons on the right-hand
 *     options; non-linking top-level toggles swap the theme's ::after caret for
 *     a chevron that rotates when open (submenu toggles keep their native
 *     carets); the right-side icon buttons keep a constant gap.
 *  2. Sidebar — sticky and independently scrollable, collapsible with
 *     hover-reveal. Every layout with a sidebar marks its columns
 *     `.app-sidebar-col` / `.app-content-col` (the dashboard layout also keeps
 *     the older #appSidebarCol / #appContentCol ids); both are matched so the
 *     navbar's collapse button works on every page with a rail, not only the
 *     dashboard. Collapsed (body.sidebar-start-enabled) the rail leaves the flow
 *     and the content takes the width; a far-left hover strip with a subtle
 *     handle brings it back. There is deliberately NO transition on the content
 *     column — animating flex-basis / max-width made the whole page visibly
 *     lurch and re-wrap. When a page has no sidebar chrome.js marks <body> and
 *     the collapse button is hidden, because a dead control is worse than none.
 *  3. Global loading / upload / download affordances — the determinate progress
 *     rail (complements the indeterminate bar in partials/_loader.html), an
 *     inline spinner utility, fade-in for async content and a skeleton shimmer.
 *  4. Forms — compact, centred, bordered focus cards for form-only pages: add
 *     .app-form to a <form> (already on the shared CRUD renderer
 *     myhub/elements/_form.html) or wrap a page in .app-form-focus.
 *  5. Global alert / toast stack (partials/_alerts.html) — one fixed stack just
 *     below the navbar, the single place every Django `messages` alert appears;
 *     chrome.js auto-dismisses each after a few seconds (ALERT_TTL). The stack
 *     lets clicks through its empty gaps.
 *  6. Onboarding framed pages (registration + enrolment checkout) — full-bleed
 *     background image and one centred form, no navbar / footer; reduced-motion
 *     preferences are respected.
 *  Then: the global navbar search dropdown.
 *  Print — the page, not the application around it. Every printable page
 *     (receipts, invoices, reports) extends the shared layout, so the shell is
 *     hidden here once for all of them: the navbar, sidebar and footer (the
 *     shared footer is a <div class="footer">, not a <footer>) are dropped, the
 *     content takes the whole sheet, cards stop drawing boxes or clipping across
 *     page breaks, backgrounds and link colours print as authored, and no
 *     "(https://…)" is appended after links. A page with something extra to hide
 *     adds Bootstrap's `.d-print-none`.
 *  Super student — the navbar "Student view" toggle and the bar shown while it
 *     is on (core.student_view), in gold so it reads as "not your normal
 *     account" at a glance in both themes; plus the student-view picker (one card
 *     per institution, its programmes as options).
 *  Phone fit — a table scroller must be the containing block for what is
 *     absolutely positioned inside it (the .visually-hidden labels on icon
 *     buttons), or those escape, widen the page, and a phone opens it zoomed out
 *     with the menu off-screen. A .row dropped straight into the content column
 *     has wider negative margins than the column's padding, so it is reined in.
 */

:root {
  --app-nav-h: 66px;
  --app-sidebar-w: 290px;
}

html { min-height: 100%; }
body.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}
body.app-shell > main { flex: 1 0 auto; }
body.app-shell > .footer { flex: 0 0 auto; margin-top: auto; }

header.navbar-light .navbar { padding-top: .5rem; padding-bottom: .5rem; min-height: 64px; }
header.navbar-light .navbar > .container-fluid {
  align-items: center;
  column-gap: .4rem;
  min-height: 48px;
}
header.navbar-light .navbar-collapse { align-items: center; }

header.navbar-light .navbar-brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0;
  padding: 0;
}
header.navbar-light .navbar-brand .navbar-brand-item { max-height: 32px; }
header.navbar-light .navbar-brand > span { line-height: 1; }
header.navbar-light .sidebar-start-toggle { margin: 0; align-self: center; }

header.navbar-light .navbar-nav .nav-link { padding-top: .35rem; padding-bottom: .35rem; }
header.navbar-light .nav-item.w-100 .form-control { height: 42px; }

header.navbar-light .navbar-nav > .nav-item > .nav-link > .nav-ico {
  font-size: 1.05rem;
  margin-right: .35rem;
  vertical-align: -1px;
}

header.navbar-light .navbar-nav > .nav-item > .nav-link.dropdown-toggle::after { display: none; }
header.navbar-light .nav-link.dropdown-toggle .nav-caret { transition: transform .18s ease; }
header.navbar-light .nav-link.dropdown-toggle[aria-expanded="true"] .nav-caret { transform: rotate(180deg); }

header.navbar-light .nav.flex-nowrap.align-items-center > .nav-item { margin-bottom: 0; }

@media (min-width: 992px) {
  #appSidebarCol, .app-sidebar-col {
    position: sticky;
    top: .75rem;
    align-self: flex-start;
    max-height: calc(100vh - 1rem);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
  }
  #appSidebarCol::-webkit-scrollbar,
  .app-sidebar-col::-webkit-scrollbar { width: 7px; }
  #appSidebarCol::-webkit-scrollbar-thumb,
  .app-sidebar-col::-webkit-scrollbar-thumb { background: rgba(0,0,0,.18); border-radius: 4px; }

  body.sidebar-start-enabled #appSidebarCol,
  body.sidebar-start-enabled .app-sidebar-col {
    position: fixed;
    left: 0;
    top: var(--app-nav-h);
    width: var(--app-sidebar-w);
    max-width: var(--app-sidebar-w);
    height: calc(100vh - var(--app-nav-h));
    max-height: none;
    padding: .75rem .5rem 1rem;
    margin: 0;
    background: var(--bs-body-bg, #fff);
    box-shadow: 0 .5rem 2rem rgba(0,0,0,.18);
    border-right: 1px solid rgba(0,0,0,.06);
    z-index: 1045;
    display: none;
  }
  body.sidebar-start-enabled #appContentCol,
  body.sidebar-start-enabled .app-content-col {
    flex: 0 0 100%;
    max-width: 100%;
    width: 100%;
  }
  body.sidebar-start-enabled.sidebar-hover-open #appSidebarCol,
  body.sidebar-start-enabled.sidebar-hover-open .app-sidebar-col { display: block; }

  #sidebarHoverZone {
    position: fixed;
    left: 0;
    top: var(--app-nav-h);
    width: 16px;
    height: calc(100vh - var(--app-nav-h));
    z-index: 1044;
    display: none;
  }
  body.sidebar-start-enabled #sidebarHoverZone { display: block; }
  body.sidebar-start-enabled #sidebarHoverZone::after {
    content: "";
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    width: 4px; height: 64px;
    border-radius: 0 6px 6px 0;
    background: linear-gradient(180deg, #0B5FC6, #0B1F4D);
    opacity: .55;
  }
  body.sidebar-start-enabled #sidebarHoverZone:hover::after { opacity: 1; width: 6px; }
}

body.no-sidebar .sidebar-start-toggle { display: none !important; }

#appContentCol, .app-content-col { transition: none !important; }

#appLoader .app-loader-bar.determinate { transition: width .15s linear; }

.is-loading { position: relative; pointer-events: none; }
.is-loading > * { opacity: .45; }
.is-loading::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 1.15rem; height: 1.15rem;
  margin: -.575rem 0 0 -.575rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  opacity: .85;
  animation: appspin .65s linear infinite;
}
button.is-loading, a.btn.is-loading { color: transparent !important; }
button.is-loading::after, a.btn.is-loading::after { color: #fff; }

.app-fade-in { animation: appFadeIn .3s ease both; }
@keyframes appFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.app-skeleton {
  background: linear-gradient(90deg, rgba(0,0,0,.06) 25%, rgba(0,0,0,.12) 37%, rgba(0,0,0,.06) 63%);
  background-size: 400% 100%;
  animation: appShimmer 1.3s ease infinite;
  border-radius: .5rem;
}
@keyframes appShimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

@keyframes appspin { to { transform: rotate(360deg); } }

.card:has(> .card-body > form.app-form),
.card:has(> .card-body > .app-form),
.app-form-focus > .card {
  max-width: 820px;
  margin-inline: auto;
  border: 1px solid rgba(11, 95, 198, .12);
  box-shadow: 0 1.25rem 3rem rgba(11, 95, 198, .10);
  border-radius: 1rem;
}
.card:has(> .card-body > form.app-form) > .card-body,
.app-form-focus > .card > .card-body { padding: 1.75rem; }

.app-form-focus,
.card:has(> .card-body > form.app-form) { position: relative; }
.app-form-focus::before,
main:has(form.app-form)::before {
  content: "";
  position: fixed; inset: var(--app-nav-h) 0 0 0;
  background: radial-gradient(60% 55% at 50% 30%, rgba(11,95,198,.06), transparent 70%);
  backdrop-filter: saturate(108%);
  pointer-events: none; z-index: 0;
}
main:has(form.app-form) > .container-fluid { position: relative; z-index: 1; }

form.app-form .form-control,
form.app-form .form-select,
form.app-form textarea {
  padding: .6rem .85rem;
  border-radius: .6rem;
}
form.app-form .form-control:focus,
form.app-form .form-select:focus,
form.app-form textarea:focus {
  border-color: #0B5FC6;
  box-shadow: 0 0 0 .25rem rgba(11, 95, 198, .15);
}
form.app-form .form-label { font-weight: 600; font-size: .875rem; margin-bottom: .3rem; }
form.app-form .btn { padding-inline: 1.4rem; }
form.app-form .mt-2 { margin-top: 1.25rem !important; display: flex; gap: .5rem; }

.app-alerts {
  position: fixed;
  top: calc(var(--app-nav-h) + .5rem);
  right: 1rem;
  z-index: 1090;
  width: 380px;
  max-width: calc(100vw - 2rem);
  display: flex;
  flex-direction: column;
  gap: .5rem;
  pointer-events: none;
}
.app-alert {
  pointer-events: auto;
  margin: 0;
  border: 0;
  border-left: 4px solid currentColor;
  border-radius: .6rem;
  box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .16);
  animation: appAlertIn .28s cubic-bezier(.22, 1, .36, 1) both;
}
.app-alert .btn-close { padding: .6rem; }
.app-alert.hiding { animation: appAlertOut .3s ease forwards; }
@keyframes appAlertIn  { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes appAlertOut { to { opacity: 0; transform: translateX(24px); max-height: 0;
  margin: 0; padding-top: 0; padding-bottom: 0; border-width: 0; } }

.reg-bg {
  position: fixed; inset: 0; z-index: -2;
  background: url('/static/images/bg/05.jpg') center / cover no-repeat;
}
.reg-bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(160deg, rgba(11,95,198,.82), rgba(8,17,38,.92));
}
.reg-shell { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; }
.reg-frame {
  width: 100%; max-width: 800px; background: var(--bs-body-bg, #fff);
  border-radius: 18px; border: 1px solid rgba(255,255,255,.35);
  box-shadow: 0 28px 70px rgba(0,0,0,.38); overflow: hidden;
}
.reg-head { background: linear-gradient(135deg,#0B5FC6,#0B1F4D); color: #fff; padding: 28px 34px; }
.reg-body { padding: 28px 34px 34px; }
.reg-section { padding: 22px 0; border-bottom: 1px solid #eef0f3; }
.reg-section:last-of-type { border-bottom: 0; }
.reg-section > h6 { text-transform: uppercase; letter-spacing: .04em; color: #8a8f9c; font-size: .78rem; font-weight: 700; margin-bottom: 14px; }
.reg-frame .form-control, .reg-frame .form-select, .reg-frame textarea { padding: .6rem .85rem; border-radius: .6rem; }
.role-card { cursor: pointer; border: 2px solid #e6e8ee; border-radius: 12px; padding: 14px; text-align: center; transition: .15s; height: 100%; }
.role-card:hover { border-color: #9ec5fe; }
.role-card input { display: none; }
.role-card:has(input:checked) { border-color: #0B5FC6; background: #E8F0FB; }
.pick { display: flex; align-items: center; gap: 12px; border: 2px solid #e6e8ee; border-radius: 12px; padding: 11px 14px; cursor: pointer; transition: .15s; margin-bottom: 10px; }
.pick:hover { border-color: #9ec5fe; }
.pick:has(input:checked) { border-color: #0B5FC6; background: #E8F0FB; }
.pick input { margin: 0; flex: 0 0 auto; }
.pick .price { margin-left: auto; font-weight: 700; white-space: nowrap; }
.pick .price.free { color: #198754; }
.pick .price.paid { color: #0B5FC6; }
@media (max-width: 575.98px) { .reg-head, .reg-body { padding-left: 20px; padding-right: 20px; } }

@media (prefers-reduced-motion: reduce) {
  #appSidebarCol, #appContentCol, .app-fade-in, .app-skeleton, .app-alert,
  header.navbar-light .nav-caret { transition: none !important; animation: none !important; }
}

.app-search-results{
  position:absolute; top:calc(100% + 6px); left:0; right:0; z-index:1050;
  background:#fff; border:1px solid #e6e8ee; border-radius:12px; overflow:hidden;
  max-height:min(60vh,460px); overflow-y:auto; padding:4px;
}
.app-search-group{ font-size:.68rem; letter-spacing:.06em; text-transform:uppercase;
  color:#94a0b8; font-weight:700; padding:8px 12px 4px; }
.app-search-item{ display:flex; align-items:center; gap:10px; padding:8px 12px; border-radius:8px;
  text-decoration:none; color:#2b3550; }
.app-search-item:hover, .app-search-item.active{ background:#E8F0FB; color:#0B5FC6; }
.app-search-item > i{ font-size:1rem; color:#6c8cff; flex:0 0 auto; }
.app-search-item .asi-label{ flex:1 1 auto; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.app-search-item .asi-sub{ font-size:.72rem; color:#98a2b6; flex:0 0 auto; }
.app-search-empty{ padding:14px 16px; color:#98a2b6; font-size:.85rem; text-align:center; }

@media print {
  .su-navbar,
  nav.navbar,
  #appSidebarCol, .app-sidebar-col,
  #offcanvasSideNavbar,
  #sidebarHoverZone,
  #htmxBar,
  .app-alert, #appAlerts,
  .su-loader, #appLoader,
  footer, .app-footer, .footer,
  .no-print { display: none !important; }

  #appContentCol, .app-content-col {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  main > .container-fluid,
  .content-body > .container-fluid { padding: 0 !important; }
  body.su-shell { padding-top: 0 !important; background: #fff !important; }

  .card { border: 0 !important; box-shadow: none !important; break-inside: auto; }

  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  a[href]::after { content: none !important; }
}

.su-student-view.is-on{
  background: rgba(var(--thrive-gold-rgb, 245, 197, 24), .22);
  color: inherit;
}
.su-student-view.is-on:hover, .su-student-view.is-on:focus-visible{
  background: rgba(var(--thrive-gold-rgb, 245, 197, 24), .35);
}
.su-student-view-bar{
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .75rem;
  margin: .5rem 1rem 0; padding: .45rem .9rem;
  border-radius: .6rem; font-size: .875rem;
  background: rgba(var(--thrive-gold-rgb, 245, 197, 24), .18);
  border: 1px solid rgba(var(--thrive-gold-rgb, 245, 197, 24), .55);
  color: var(--bs-body-color);
}
.su-student-view-bar .su-svb-text{ flex: 1 1 14rem; min-width: 0; }
.su-student-view-bar .su-svb-link{ font-weight: 600; }
.su-student-view-bar .su-svb-exit{
  border: 0; border-radius: .45rem; padding: .2rem .65rem;
  background: var(--thrive-navy, #0B1F4D); color: #fff; font-weight: 600;
}
.su-student-view-bar .su-svb-exit:hover{ filter: brightness(1.15); }
[data-bs-theme="dark"] .su-student-view-bar .su-svb-exit{ background: var(--thrive-gold, #F5C518); color: #0B1F4D; }
@media (max-width: 575.98px){ .su-student-view-bar{ margin: .5rem .6rem 0; } }
@media print{ .su-student-view-bar{ display: none !important; } }

.sv-option{
  display: flex; align-items: center; gap: .6rem; width: 100%;
  padding: .55rem .75rem; border-radius: .55rem; text-align: left;
  border: 1px solid var(--bs-border-color); background: var(--bs-body-bg); color: var(--bs-body-color);
}
.sv-option:hover, .sv-option:focus-visible{ border-color: var(--thrive-blue, #0B5FC6); }
.sv-option.is-current{ border-color: var(--thrive-gold, #F5C518); box-shadow: 0 0 0 2px rgba(var(--thrive-gold-rgb, 245, 197, 24), .35); }
.sv-option .sv-meta{ font-size: .78rem; color: var(--bs-secondary-color); }
.sv-swatch{ width: .7rem; height: .7rem; border-radius: 50%; flex: 0 0 auto; }

.table-responsive, .tc-table-wrap{ position: relative; }
@media (max-width: 991.98px){ .app-content-col > .row, .app-content-col > .dash > .row{ margin-left: 0; margin-right: 0; } }
