/* =====================================================================
   Modernization layer on top of adminHMD's stock style.css.
   Loaded last so it wins on the properties it touches: typography,
   radius/shadow scale, and a handful of component refinements
   (nav active state, buttons, cards, alerts, progress). Everything else
   (layout, grid, sidebar mechanics, dark mode plumbing) stays exactly
   as adminHMD ships it.
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --admin-radius-sm: 10px;
  --admin-radius: 14px;
  --admin-radius-lg: 20px;

  --admin-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 6px 16px rgba(15, 23, 42, 0.05);
  --admin-shadow: 0 4px 10px rgba(15, 23, 42, 0.04), 0 16px 32px -8px rgba(15, 23, 42, 0.10);
  --admin-shadow-lg: 0 8px 20px rgba(15, 23, 42, 0.06), 0 28px 60px -12px rgba(15, 23, 42, 0.16);

  --admin-primary: #4338ca;
  --admin-primary-dark: #3730a3;
  --admin-primary-soft: #eef0fd;

  --admin-good-soft: #e3f1e8;
  --admin-warm-soft: #faf0d7;
  --admin-tip: #1d7a8c;
  --admin-tip-soft: #dff1f3;

  /* -----------------------------------------------------------------
     Compatibility aliases for the course content's inline SVG diagrams
     (imported from the legacy site, hand-authored with these variable
     names). Keeping the names stable here means the diagrams never need
     to be re-generated when the shell's own palette changes.
     ------------------------------------------------------------------- */
  --paper: var(--admin-bg);
  --surface: var(--admin-surface);
  --ink: var(--admin-text);
  --ink-soft: var(--admin-muted);
  --ink-faint: var(--admin-muted);
  --line: var(--admin-border);
  --line-strong: var(--admin-border);
  --acc: var(--admin-primary);
  --acc-soft: var(--admin-primary-soft);
  --good: var(--admin-success);
  --good-soft: var(--admin-good-soft);
  --warm: var(--admin-warning);
  --warm-soft: var(--admin-warm-soft);
  --tip: var(--admin-tip);
  --tip-soft: var(--admin-tip-soft);
  --font-body: 'Plus Jakarta Sans', 'Segoe UI', Arial, sans-serif;
}

html[data-theme='dark'] {
  --admin-primary: #818cf8;
  --admin-primary-dark: #6366f1;
  --admin-primary-soft: rgba(129, 140, 248, 0.14);

  --admin-good-soft: rgba(15, 118, 110, 0.18);
  --admin-warm-soft: rgba(217, 119, 6, 0.18);
  --admin-tip: #5fc2d3;
  --admin-tip-soft: rgba(95, 194, 211, 0.16);
}

/* ---------------------------------------------------------------------
   Global type scale — one notch smaller and denser across the whole
   platform. Shrinking the root size cascades through every rem-based
   size in both adminHMD's stylesheet and this file, rather than having
   to hunt down each one individually.
   ------------------------------------------------------------------- */
html {
  font-size: 93.75%; /* 16px -> 15px base */
}

body,
.btn,
.form-control,
.form-select {
  font-family: 'Plus Jakarta Sans', 'Segoe UI', Arial, sans-serif;
}

h1, h2, h3, h4, h5, h6,
.page-heading h1,
.section-title,
.metric-value,
.brand-title,
.auth-brand strong {
  font-family: 'Plus Jakarta Sans', 'Segoe UI', Arial, sans-serif;
  letter-spacing: -0.01em;
}

.eyebrow {
  letter-spacing: 0.08em;
}

/* Page titles (every screen uses <h1 class="h3">) and the big dashboard
   percentages were carrying Bootstrap's/adminHMD's default sizes, which
   read as oversized once everything else on the page is this compact. */
.page-heading h1 {
  font-size: 1.5rem;
}

.metric-value {
  font-size: 1.75rem;
}

/* ---------------------------------------------------------------------
   Cards, panels, metrics — softer radius + more diffuse elevation
   ------------------------------------------------------------------- */
.metric-card,
.panel,
.auth-card,
.modal-content {
  border-radius: var(--admin-radius);
  box-shadow: var(--admin-shadow);
}

.metric-card:hover,
.panel:hover {
  box-shadow: var(--admin-shadow-lg);
}

.metric-icon,
.badge {
  border-radius: var(--admin-radius-sm);
}

.metric-icon {
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------------------------------------------------------------------
   Locked metric card — a catalog formation the student isn't enrolled in
   ------------------------------------------------------------------- */
.metric-locked {
  --metric-color: var(--admin-muted);
  opacity: 0.72;
}

.metric-locked .metric-icon {
  background: var(--admin-surface-soft);
}

.metric-locked:hover {
  transform: none;
  box-shadow: var(--admin-shadow);
}

.badge.rounded-pill {
  border-radius: 999px !important;
}

/* ---------------------------------------------------------------------
   Buttons — rounder, slightly more generous padding, gentle lift
   ------------------------------------------------------------------- */
.btn {
  border-radius: var(--admin-radius-sm);
  padding-inline: 1.1rem;
}

.btn-sm {
  border-radius: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--admin-primary), var(--admin-primary-dark));
  border-color: var(--admin-primary-dark);
}

.btn-primary:hover,
.btn-primary:focus {
  filter: brightness(1.05);
  box-shadow: 0 10px 24px -6px rgba(67, 56, 202, 0.45);
}

/* adminHMD's .btn is display:flex, so Bootstrap's .text-start (a
   text-align rule) has no effect on the flex child's own position —
   quiz answer buttons need the flex alignment set explicitly. */
.btn.text-start {
  justify-content: flex-start;
  text-align: left;
}

/* ---------------------------------------------------------------------
   Forms
   ------------------------------------------------------------------- */
.form-control,
.form-select {
  border-radius: var(--admin-radius-sm);
  border-color: var(--admin-border);
  padding-block: 0.6rem;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 4px var(--admin-primary-soft);
}

.form-check-input:checked {
  background-color: var(--admin-primary);
  border-color: var(--admin-primary);
}

.form-check-input:focus {
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 4px var(--admin-primary-soft);
}

/* ---------------------------------------------------------------------
   Sidebar — adapted from AdminKit's own sidebar component (adminkit-3.1.0)
   rather than adminHMD's. AdminKit's sidebar is a permanently-dark rail
   regardless of the app's light/dark toggle (same idea as before), with
   resting links dimmed to ~55% opacity by design and only the active
   item at full brightness — exactly the hierarchy the old adminHMD nav
   was missing. Its collapse toggle is also just a full show/hide, not a
   partial icon-only rail, which sidesteps the "every chapter row looks
   identical once the labels are gone" problem entirely. The active-state
   accent below is tied to this platform's own indigo brand color rather
   than AdminKit's default blue.
   ------------------------------------------------------------------- */
:root {
  --sidebar-bg: #1a2332;
  --sidebar-bg-end: #131b28;
  --sidebar-link-color: rgba(226, 232, 240, 0.55);
  --sidebar-link-hover-color: rgba(226, 232, 240, 0.9);
  --sidebar-link-active-color: #ffffff;
  --sidebar-accent: #818cf8;
  --sidebar-accent-strong: #a5b4fc;
  --sidebar-muted: rgba(226, 232, 240, 0.38);
  --sidebar-border: rgba(255, 255, 255, 0.08);
}

.admin-sidebar {
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-end) 100%);
}

.sidebar-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.35rem 1.25rem 1.15rem;
  border-bottom: 1px solid var(--sidebar-border);
  color: #ffffff;
  text-decoration: none;
}

.sidebar-brand:hover,
.sidebar-brand:focus {
  color: #ffffff;
}

.sidebar-brand .brand-logo-chip {
  flex: 0 0 auto;
}

.sidebar-brand-copy {
  display: grid;
  min-width: 0;
}

.sidebar-brand-title {
  font-weight: 800;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-brand-subtitle {
  font-size: 0.78rem;
  color: var(--sidebar-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-nav {
  display: block;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  list-style: none;
  margin: 0;
  padding: 0.9rem 0.85rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
  padding: 0.75rem 0.5rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--sidebar-muted);
}

.sidebar-header::after {
  content: '';
  flex: 1 1 auto;
  height: 1px;
  background: var(--sidebar-border);
}

.sidebar-item {
  min-width: 0;
  margin-bottom: 0.2rem;
}

.sidebar-link-row {
  display: flex;
  align-items: center;
  min-width: 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.6rem 0.65rem;
  border-radius: var(--admin-radius-sm);
  border-left: 3px solid transparent;
  color: var(--sidebar-link-color);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.sidebar-link i {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  font-size: 0.95rem;
  color: inherit;
  transition: color 0.16s ease;
}

.sidebar-link-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-link .badge {
  flex: 0 0 auto;
}

.sidebar-item.is-locked > .sidebar-link-row > .sidebar-link {
  opacity: 0.55;
}

.sidebar-link:hover,
.sidebar-link:focus {
  color: var(--sidebar-link-hover-color);
  background: rgba(255, 255, 255, 0.05);
  text-decoration: none;
  transform: translateX(2px);
}

.sidebar-link:focus-visible,
.sidebar-dropdown-toggle:focus-visible {
  outline: 2px solid var(--sidebar-accent);
  outline-offset: 1px;
}

.sidebar-item.active > .sidebar-link,
.sidebar-item.active > .sidebar-link-row > .sidebar-link {
  color: var(--sidebar-link-active-color);
  background: linear-gradient(90deg, color-mix(in srgb, var(--sidebar-accent) 24%, transparent), color-mix(in srgb, var(--sidebar-accent) 3%, transparent));
  border-left-color: var(--sidebar-accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.sidebar-item.active > .sidebar-link i,
.sidebar-item.active > .sidebar-link-row > .sidebar-link i {
  color: var(--sidebar-accent-strong);
  text-shadow: 0 0 12px color-mix(in srgb, var(--sidebar-accent) 50%, transparent);
}

/* A chapter you're currently browsing (but not standing exactly on its
   own root page — e.g. three levels deep in a subsection) previously
   looked identical to a chapter you've never opened: same dim resting
   color either way, no sense of "you are somewhere in here." Give it a
   lighter resting tone and a soft accent tick, one step below the full
   active treatment above. */
.sidebar-item.has-active-child > .sidebar-link-row > .sidebar-link {
  color: var(--sidebar-link-hover-color);
  border-left-color: color-mix(in srgb, var(--sidebar-accent) 35%, transparent);
}

.sidebar-item.has-active-child > .sidebar-link-row > .sidebar-link i {
  color: var(--sidebar-accent);
}

/* The chapter collapse-toggle chevron rotates to show open/closed state,
   and stays dim until hovered/focused so it doesn't compete with the
   read/unread icon right next to it. */
.sidebar-dropdown-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-inline-end: 0.15rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--sidebar-muted);
  transition: color 0.14s ease, background 0.14s ease;
}

.sidebar-dropdown-toggle:hover,
.sidebar-dropdown-toggle:focus {
  color: var(--sidebar-link-hover-color);
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-dropdown-toggle i {
  display: inline-block;
  transition: transform 0.2s ease;
}

.sidebar-dropdown-toggle[aria-expanded='true'] i {
  transform: rotate(180deg);
}

.sidebar-dropdown {
  list-style: none;
  margin: 0.1rem 0 0.4rem;
  padding: 0 0 0 1.15rem;
  border-left: 1px solid var(--sidebar-border);
  margin-left: 0.85rem;
}

.sidebar-dropdown-sub {
  padding-left: 1.15rem;
  margin-left: 0.85rem;
}

.sidebar-dropdown .sidebar-link {
  font-size: 0.86rem;
  font-weight: 500;
  padding-block: 0.45rem;
}

/* A thin scrollbar matching the dark rail, instead of the browser's
   default light one, for the (common) case where the chapter tree is
   taller than the viewport. */
.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

/* Sidebar user card */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--admin-radius);
  background: linear-gradient(135deg, color-mix(in srgb, var(--sidebar-accent) 10%, transparent), rgba(255, 255, 255, 0.03));
  border: 1px solid var(--sidebar-border);
  transition: border-color 0.16s ease;
}

.sidebar-user:hover {
  border-color: color-mix(in srgb, var(--sidebar-accent) 35%, transparent);
}

.sidebar-user-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--sidebar-accent);
  background: color-mix(in srgb, var(--sidebar-accent) 18%, transparent);
  color: #ffffff;
  font-weight: 800;
  font-size: 1rem;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sidebar-accent) 12%, transparent);
}

.sidebar-user-copy {
  display: grid;
  min-width: 0;
}

.sidebar-user-copy strong {
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-copy small {
  color: var(--sidebar-muted);
  font-size: 0.78rem;
}

/* Collapse toggle: hides the whole sidebar rather than shrinking it to
   an icon-only rail. AdminKit does the same — a formation's chapter tree
   has nothing to show but identical read/unread dots once the labels
   are gone, so a partial "mini" state was never useful; full show/hide
   is simpler and behaves identically everywhere (dashboard or formation),
   with no special-casing needed. */
@media (min-width: 992px) {
  body.sidebar-mini .admin-sidebar {
    transform: translateX(-100%);
  }

  body.sidebar-mini .admin-main {
    margin-left: 0;
  }
}

/* ---------------------------------------------------------------------
   Alerts (pedagogical callouts) — softer fills, colored left rule
   ------------------------------------------------------------------- */
.alert {
  border: none;
  border-left: 4px solid currentColor;
  border-radius: var(--admin-radius-sm);
  box-shadow: var(--admin-shadow-sm);
}

/* ---------------------------------------------------------------------
   Progress bars — rounder, softer track
   ------------------------------------------------------------------- */
.progress {
  border-radius: 999px;
  background: var(--admin-surface-soft);
  overflow: hidden;
}

.progress-bar {
  border-radius: 999px;
}

/* ---------------------------------------------------------------------
   Top navbar — subtle glass effect when scrolled content sits behind it
   ------------------------------------------------------------------- */
html,
body {
  overflow-x: hidden;
}

.profile-name {
  display: inline-block;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

@media (min-width: 992px) {
  .profile-name {
    max-width: 180px;
  }
}

.admin-navbar.bg-white {
  background: rgba(255, 255, 255, 0.86) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

html[data-theme='dark'] .admin-navbar.bg-white {
  background: rgba(31, 41, 55, 0.86) !important;
}

/* ---------------------------------------------------------------------
   Auth pages
   ------------------------------------------------------------------- */
.auth-card {
  border-radius: var(--admin-radius-lg);
}

.auth-brand .brand-icon {
  background: linear-gradient(135deg, var(--admin-primary), var(--admin-primary-dark));
}

/* adminHMD's .error-code was sized for a literal "404"/"403" number;
   we use it for a single icon glyph, which doesn't need to be this huge. */
.error-code {
  font-size: clamp(2.5rem, 8vw, 3.5rem);
}

/* ---------------------------------------------------------------------
   Brand logo — a white-background artwork, so it always sits on its own
   light chip regardless of the surrounding surface (dark sidebar, dark
   mode auth card, etc).
   ------------------------------------------------------------------- */
.brand-logo-chip {
  display: inline-flex;
  align-items: center;
  background: #ffffff;
  border-radius: var(--admin-radius-sm);
  padding: 0.3rem 0.6rem;
  box-shadow: var(--admin-shadow-sm);
  flex: 0 0 auto;
}

.brand-logo-chip img {
  display: block;
  height: 28px;
  width: auto;
}


/* ---------------------------------------------------------------------
   Marketing homepage
   ------------------------------------------------------------------- */
.marketing-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--admin-border);
}

html[data-theme='dark'] .marketing-nav {
  background: rgba(15, 23, 42, 0.86);
}

.marketing-nav-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.marketing-nav .auth-brand {
  margin-bottom: 0;
}

.marketing-hero {
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 5rem) 1.5rem 2rem;
  text-align: center;
}

.marketing-title {
  font-size: clamp(1.75rem, 3.6vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
  background: linear-gradient(135deg, var(--admin-text), var(--admin-primary-dark));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.marketing-lead {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--admin-muted);
}

.marketing-section {
  max-width: 1080px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.marketing-section-heading {
  text-align: center;
  max-width: 620px;
  margin: 0 auto 2.25rem;
}

.feature-card {
  height: 100%;
  padding: 1.75rem;
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  background: var(--admin-surface);
  box-shadow: var(--admin-shadow-sm);
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.feature-card:hover {
  box-shadow: var(--admin-shadow-lg);
  transform: translateY(-3px);
}

.feature-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  font-size: 1.3rem;
  border-radius: var(--admin-radius-sm);
  background: var(--admin-primary-soft);
  color: var(--admin-primary-dark);
  margin-bottom: 1rem;
}

.step-card {
  height: 100%;
  padding: 1.75rem;
  position: relative;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--admin-primary), var(--admin-primary-dark));
  color: #ffffff;
  font-weight: 800;
  margin-bottom: 1rem;
}

.marketing-cta-band {
  margin: 1rem 1.5rem 3rem;
  padding: clamp(2.5rem, 6vw, 3.5rem) 1.5rem;
  max-width: 1080px;
  margin-inline: auto;
  text-align: center;
  border-radius: var(--admin-radius-lg);
  background: linear-gradient(135deg, var(--admin-primary), var(--admin-primary-dark));
  color: #ffffff;
  box-shadow: var(--admin-shadow-lg);
}

.marketing-cta-band h2 {
  color: #ffffff;
}

.marketing-cta-band p {
  color: rgba(255, 255, 255, 0.85);
}

.marketing-cta-band .btn-light {
  font-weight: 700;
}

/* ---------------------------------------------------------------------
   Site footer
   ------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--admin-border);
  background: var(--admin-surface);
  padding: 3rem 1.5rem 0;
}

.site-footer-inner {
  max-width: 1080px;
  margin: 0 auto;
}

.site-footer-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  padding-bottom: 2.5rem;
}

.site-footer-brand {
  flex: 1.6 1 260px;
}

.site-footer-col {
  flex: 1 1 140px;
}

@media (max-width: 767.98px) {
  .site-footer-grid {
    flex-direction: column;
    gap: 1.75rem;
  }
}

.site-footer-brand p {
  color: var(--admin-muted);
  font-size: 0.92rem;
  margin-top: 1rem;
  max-width: 320px;
}

.site-footer-heading {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--admin-muted);
  margin-bottom: 0.9rem;
}

.site-footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.6rem;
}

.site-footer-links a {
  color: var(--admin-text);
  text-decoration: none;
  font-size: 0.95rem;
}

.site-footer-links a:hover {
  color: var(--admin-primary);
}

.site-footer-bottom {
  border-top: 1px solid var(--admin-border);
  padding: 1.1rem 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--admin-muted);
  font-size: 0.85rem;
}

/* ---------------------------------------------------------------------
   Table polish
   ------------------------------------------------------------------- */
.table > :not(caption) > * > * {
  padding-block: 0.85rem;
}

.table thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--admin-muted);
  border-bottom-width: 1px;
}

/* ---------------------------------------------------------------------
   Reading content — the course text itself (resources/views/livewire/
   reader/chapter-page.blade.php's .content wrapper) previously carried
   no typography of its own: bare Bootstrap reboot line-height (1.5) at
   full panel width, roughly 130 characters per line at this viewport.
   A taller line-height plus a comfortable measure on flowing text (not
   on images/tables/diagrams, which keep the panel's full width) brings
   it in line with the polish the rest of the shell already has.
   ------------------------------------------------------------------- */
.content {
  line-height: 1.7;
}

.content p,
.content ul,
.content ol {
  max-width: 46rem;
}

.content p {
  margin-bottom: 1.15rem;
}

.content ul,
.content ol {
  margin-bottom: 1.15rem;
}

.content li + li {
  margin-top: 0.35rem;
}

/* The "label" content block (a short sub-heading within a page, e.g.
   "Ce que vous allez apprendre") — was mb-1 in the markup, essentially
   sitting flush against the paragraph before it. */
.content .fw-semibold.text-muted.small {
  display: block;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

/* Rich text editor (admin content editor's paragraph/label/list-item
   fields) — a contenteditable div styled like a .form-control, with a
   CSS-only placeholder since contenteditable has no native one. */
.rich-text-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.375rem;
}

.rich-text-link-prompt {
  max-width: 320px;
  margin-bottom: 0.375rem;
}

.rich-text-editable {
  overflow-y: auto;
}

.rich-text-editable:empty::before {
  content: attr(data-placeholder);
  color: var(--bs-secondary-color);
}

[x-cloak] {
  display: none !important;
}

/* Floating "chat bubble" assistant, embedded once in layouts.admin-shell
   for every learner-facing formation page. Fixed above the viewport's
   content so it survives scrolling; the panel opens upward from the
   button since the button sits at the bottom of the screen. */
.assistant-widget {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 1045;
}

.assistant-widget-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--bs-primary);
  color: #fff;
  font-size: 1.4rem;
  box-shadow: var(--admin-shadow, 0 0.5rem 1rem rgba(0, 0, 0, 0.15));
  display: flex;
  align-items: center;
  justify-content: center;
}

.assistant-widget-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.75rem);
  width: min(360px, calc(100vw - 2.5rem));
  max-height: min(520px, calc(100vh - 8rem));
  display: flex;
  flex-direction: column;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  background: var(--admin-surface);
  box-shadow: var(--admin-shadow, 0 0.5rem 1rem rgba(0, 0, 0, 0.15));
  overflow: hidden;
}

.assistant-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.9rem;
  background: var(--bs-primary);
  color: #fff;
  font-weight: 600;
}

.assistant-widget-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.75rem 0.9rem;
}

.assistant-widget-form {
  padding: 0.65rem 0.9rem;
  border-top: 1px solid var(--admin-border);
}

.assistant-widget-form textarea {
  resize: none;
}

/*
 * Fil de discussion façon messagerie : la question de l'apprenant à
 * droite, la réponse de l'assistant à gauche, chacune avec son propre
 * avatar — utilisé à la fois par la page Assistant IA pleine page et par
 * le widget flottant (voir chat-thread--compact pour la variante plus
 * dense du widget).
 */
.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-message {
  display: flex;
  align-items: flex-end;
  gap: 0.55rem;
  max-width: 82%;
}

.chat-message--user {
  flex-direction: row-reverse;
  align-self: flex-end;
  margin-left: auto;
}

.chat-message--ai {
  align-self: flex-start;
  margin-right: auto;
}

.chat-avatar {
  flex-shrink: 0;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
}

.chat-avatar--user {
  background: var(--admin-primary);
}

.chat-avatar--ai {
  background: linear-gradient(135deg, #7c3aed, #4338ca);
  font-size: 1rem;
}

.chat-bubble {
  padding: 0.6rem 0.85rem;
  border-radius: 1.1rem;
  font-size: 0.92rem;
  line-height: 1.5;
  word-break: break-word;
}

.chat-message--user .chat-bubble {
  background: var(--admin-primary);
  color: #fff;
  border-bottom-right-radius: 0.3rem;
}

.chat-message--ai .chat-bubble {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  color: var(--admin-text);
  border-bottom-left-radius: 0.3rem;
}

.chat-message--error .chat-bubble {
  background: rgba(220, 38, 38, 0.1);
  border-color: #dc2626;
  color: var(--admin-danger, #dc2626);
}

/* Variante compacte pour le widget flottant : avatars et bulles plus petits. */
.chat-thread--compact {
  gap: 0.65rem;
}

.chat-thread--compact .chat-message {
  max-width: 88%;
  gap: 0.4rem;
}

.chat-thread--compact .chat-avatar {
  width: 1.6rem;
  height: 1.6rem;
  font-size: 0.7rem;
}

.chat-thread--compact .chat-avatar--ai {
  font-size: 0.8rem;
}

.chat-thread--compact .chat-bubble {
  padding: 0.45rem 0.65rem;
  font-size: 0.82rem;
}

@media (max-width: 575.98px) {
  .chat-message {
    max-width: 92%;
  }
}
