/* =====================================================================
   CRESTMAS HUB — core stylesheet
   Converted 1:1 from the original oklch()-based design tokens.
   oklch() is supported in all current evergreen browsers (Chrome 111+,
   Safari 15.4+, Firefox 113+); no fallback is included by design brief.
   ===================================================================== */

@font-face {
  font-family: 'Sora';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url(https://fonts.gstatic.com/s/sora/v12/xMQOuFFYT72X5wkB_18qmnndmSdSnk-NKQI.woff2) format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url(https://fonts.gstatic.com/s/inter/v18/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuLyfAZ9hiJ-Ek-_EeA.woff2) format('woff2');
}

:root {
  --radius: 1rem;

  /* CRESTMAS HUB brand palette (sampled from logo) */
  --brand-purple: oklch(0.42 0.24 295);
  --brand-violet: oklch(0.28 0.22 290);
  --brand-gold: oklch(0.78 0.17 75);
  --brand-peach: oklch(0.75 0.12 60);
  --brand-ink: oklch(0.18 0.06 280);
  --brand-cream: oklch(0.98 0.015 80);

  --background: oklch(0.99 0.005 295);
  --foreground: oklch(0.20 0.06 265);
  --card: oklch(1 0 0);
  --muted-foreground: oklch(0.50 0.04 265);
  --border: oklch(0.92 0.02 295);

  --gradient-brand: linear-gradient(135deg, oklch(0.42 0.24 295), oklch(0.28 0.22 290));
  --gradient-gold: linear-gradient(135deg, oklch(0.82 0.17 80), oklch(0.72 0.16 65));
  --gradient-hero: radial-gradient(ellipse at top right, oklch(0.78 0.17 75 / 0.22), transparent 55%),
                   radial-gradient(ellipse at bottom left, oklch(0.42 0.24 295 / 0.32), transparent 60%),
                   oklch(0.18 0.06 280);
  --gradient-soft: linear-gradient(180deg, oklch(0.99 0.005 295), oklch(0.96 0.02 295 / 0.5));

  --shadow-card: 0 1px 2px oklch(0.18 0.06 280 / 0.05), 0 8px 24px -12px oklch(0.18 0.06 280 / 0.10);
  --shadow-elegant: 0 20px 50px -20px oklch(0.42 0.24 295 / 0.35);
  --shadow-glow: 0 0 40px oklch(0.42 0.24 295 / 0.40);

  --font-heading: 'Sora', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --ease-crest: cubic-bezier(0.22, 1, 0.36, 1);
}

* { border-color: var(--border); }

html { scroll-behavior: smooth; }

body {
  background-color: var(--background);
  color: var(--foreground);
  font-family: var(--font-body);
}

h1, h2, h3, h4, h5, h6 { font-family: var(--font-heading); }

a { text-decoration: none; color: inherit; }

.container-hub { max-width: 80rem; margin-inline: auto; padding-inline: 1.5rem; }

/* ---- Utility color/bg classes (mirrors the Tailwind brand-* tokens) ---- */
.text-brand-ink { color: var(--brand-ink); }
.text-brand-gold { color: var(--brand-gold); }
.text-brand-purple { color: var(--brand-purple); }
.text-muted { color: var(--muted-foreground); }
.bg-brand-cream { background-color: var(--brand-cream); }
.bg-brand-ink { background-color: var(--brand-ink); }
.bg-gradient-brand { background: var(--gradient-brand); }
.bg-gradient-gold { background: var(--gradient-gold); }
.bg-gradient-hero { background: var(--gradient-hero); }
.gold-text-gradient {
  background-image: var(--gradient-gold);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---- Buttons ---- */
.btn-gold {
  background: var(--brand-gold);
  color: var(--brand-ink);
  font-weight: 600;
  border: none;
}
.btn-gold:hover { background: oklch(0.78 0.17 75 / 0.9); color: var(--brand-ink); }
.btn-purple {
  background: var(--brand-purple);
  color: #fff;
  font-weight: 600;
  border: none;
}
.btn-purple:hover { background: var(--brand-violet); color: #fff; }
.btn-outline-light-hub {
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  background: transparent;
}
.btn-outline-light-hub:hover { background: rgba(255,255,255,.1); color: #fff; }
.btn-rounded { border-radius: 999px; padding: .65rem 1.5rem; }

/* ---- Header ---- */
#site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1030;
  background: rgba(255,255,255,.6);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: all .3s var(--ease-crest);
}
#site-header.scrolled {
  background: rgba(255,255,255,.92);
  border-bottom-color: var(--border);
  box-shadow: 0 4px 20px -12px oklch(0.18 0.06 280 / 0.15);
}
#site-header .nav-link-hub {
  font-size: .875rem;
  font-weight: 500;
  color: var(--muted-foreground);
  position: relative;
  padding: .25rem 0;
}
#site-header .nav-link-hub::after {
  content: "";
  position: absolute;
  left: 0; bottom: -6px;
  height: 2px; width: 0;
  background: var(--brand-gold);
  transition: width .25s var(--ease-crest);
}
#site-header .nav-link-hub:hover,
#site-header .nav-link-hub.active {
  color: var(--brand-purple);
}
#site-header .nav-link-hub:hover::after,
#site-header .nav-link-hub.active::after { width: 100%; }

main { padding-top: 4rem; }

/* ---- Hero ---- */
.hero-section {
  position: relative;
  padding: 8rem 0 5rem;
  overflow: hidden;
  background: var(--gradient-hero);
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  border: 1px solid oklch(0.78 0.17 75 / 0.4);
  background: oklch(0.78 0.17 75 / 0.1);
  padding: .4rem 1rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--brand-gold);
}
.hero-badge .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--brand-gold);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }
.hero-title { color: #fff; font-weight: 700; line-height: 1.05; letter-spacing: -0.02em; }
.hero-orbit-ring { position: absolute; border-radius: 50%; border: 1px solid; }

/* ---- Cards ---- */
.hub-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1.5rem;
  transition: all .25s var(--ease-crest);
}
.hub-card:hover {
  border-color: oklch(0.42 0.24 295 / 0.4);
  box-shadow: var(--shadow-card);
  transform: translateY(-2px);
}
.icon-tile {
  width: 3rem; height: 3rem;
  border-radius: 1rem;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700;
}

/* ---- Footer ---- */
#site-footer {
  background: var(--brand-ink);
  color: rgba(255,255,255,.6);
  padding: 4rem 0 2rem;
  position: relative;
  overflow: hidden;
}
#site-footer a { color: rgba(255,255,255,.6); }
#site-footer a:hover { color: var(--brand-gold); }
#site-footer .footer-heading {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--brand-gold);
  font-weight: 600;
}
.social-icon {
  width: 2.25rem; height: 2.25rem;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: .75rem;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.6);
}
.social-icon:hover { color: var(--brand-gold); border-color: oklch(0.78 0.17 75 / 0.4); }

/* ---- Section spacing ---- */
.section-pad { padding-block: 6rem; }
.section-eyebrow {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--brand-purple);
  font-weight: 600;
}

/* ---- Swiper testimonial tweaks ---- */
.testimonial-swiper .swiper-pagination-bullet-active { background: var(--brand-purple); }

/* ---- Misc ---- */
.code-block {
  background: #0e0830;
  color: #f5f0ff;
  padding: 1rem;
  border-radius: .75rem;
  overflow-x: auto;
  font-size: .875rem;
}

@media (max-width: 991.98px) {
  .hero-section { padding-top: 6.5rem; }
}

/* =====================================================================
   Phase 6 — modernization & responsiveness polish
   ===================================================================== */

/* Smooth, consistent interactive feel across the app */
a, button, .btn, .nav-link, .hub-card { transition: all .2s var(--ease-crest); }

/* Accessible, on-brand focus rings (replaces the default blue outline) */
a:focus-visible, button:focus-visible, .btn:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--brand-purple);
  outline-offset: 2px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand-purple);
  box-shadow: 0 0 0 3px oklch(0.42 0.24 295 / 0.15);
}

/* Buttons: subtle lift + shadow on hover/press, disabled state that reads clearly */
.btn { transition: transform .15s var(--ease-crest), box-shadow .15s var(--ease-crest), background-color .15s var(--ease-crest); }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled, .btn.disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-purple:hover:not(:disabled) { box-shadow: 0 8px 20px -8px oklch(0.42 0.24 295 / 0.5); }
.btn-gold:hover:not(:disabled) { box-shadow: 0 8px 20px -8px oklch(0.78 0.17 75 / 0.5); }

/* Cards: a touch more lift on hover, consistent everywhere hub-card is used */
.hub-card { transition: transform .2s var(--ease-crest), box-shadow .2s var(--ease-crest), border-color .2s var(--ease-crest); }

/* Slim, on-brand scrollbar (Chromium/WebKit + Firefox) */
* { scrollbar-width: thin; scrollbar-color: oklch(0.42 0.24 295 / .35) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: oklch(0.42 0.24 295 / .3); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: oklch(0.42 0.24 295 / .5); }

/* Skeleton loading shimmer (used by data-viz / async widgets) */
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
.skeleton {
  background: linear-gradient(90deg, oklch(0.94 0.01 295) 25%, oklch(0.97 0.01 295) 37%, oklch(0.94 0.01 295) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: .5rem;
}

/* Inline button spinner, toggled by assets/js/main.js on form submit */
.btn-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn-loading::after {
  content: "";
  position: absolute; top: 50%; left: 50%;
  width: 1rem; height: 1rem;
  margin: -0.5rem 0 0 -0.5rem;
  border: 2px solid rgba(255,255,255,.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin .6s linear infinite;
}
.btn-outline-secondary.btn-loading::after,
.btn-outline-light-hub.btn-loading::after { border-color: rgba(0,0,0,.25); border-top-color: var(--brand-purple); }
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* Toast notifications (assets/js/main.js) — lightweight, no extra library */
#toast-stack {
  position: fixed; top: 5rem; right: 1rem; z-index: 1080;
  display: flex; flex-direction: column; gap: .5rem;
  max-width: calc(100vw - 2rem);
}
.toast-item {
  background: #fff; border: 1px solid var(--border); border-radius: .75rem;
  box-shadow: var(--shadow-card); padding: .75rem 1rem; font-size: .85rem;
  display: flex; align-items: center; gap: .5rem;
  animation: toast-in .25s var(--ease-crest);
  max-width: 22rem;
}
.toast-item.toast-success { border-left: 3px solid var(--brand-purple); }
.toast-item.toast-error { border-left: 3px solid #dc3545; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* Responsive type scale so headings don't overflow on small phones */
@media (max-width: 575.98px) {
  .display-3 { font-size: 2.25rem; }
  .display-4 { font-size: 1.9rem; }
  .display-5 { font-size: 1.6rem; }
  .display-6 { font-size: 1.35rem; }
  .hero-section { padding-top: 6rem; padding-bottom: 3rem; }
  .section-pad { padding-block: 3.5rem; }
}

/* Admin data tables: comfortable on mobile via horizontal scroll, not clipped text */
@media (max-width: 767.98px) {
  .table { font-size: .8rem; white-space: nowrap; }
}

/* Sticky admin sub-nav so long pages keep section tabs reachable */
#site-header ~ div > .container-hub > nav,
.container-hub nav[id] {
  scroll-margin-top: 5rem;
}


/* =====================================================================
   APP SHELL — sidebar + topbar layout for the authenticated learner app
   (dashboard, courses, admin, etc). Public marketing-style pages keep
   using #site-header/#site-footer above; this is a separate system.
   ===================================================================== */
:root {
  --sidebar-w: 16rem;
  --sidebar-w-collapsed: 4.75rem;
  --topbar-h: 4rem;
}

.app-shell { display: flex; min-height: 100vh; background: var(--gradient-soft); }

.app-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1045;
  background: var(--brand-ink);
  color: rgba(255,255,255,.75);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: width .2s var(--ease-crest), transform .25s var(--ease-crest);
}
.app-sidebar::-webkit-scrollbar { width: 6px; }
.app-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 999px; }

.app-sidebar-brand {
  display: flex; align-items: center; gap: .65rem;
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
  min-height: var(--topbar-h);
}
.app-sidebar-brand img { height: 28px; flex-shrink: 0; }
.app-sidebar-brand .brand-name {
  font-family: var(--font-heading); font-weight: 700; color: #fff;
  font-size: .95rem; line-height: 1.15; white-space: nowrap;
}
.app-sidebar-brand .brand-name span { color: var(--brand-gold); }

.app-nav { flex: 1; padding: 1rem .75rem; }
.app-nav-section + .app-nav-section { margin-top: 1.35rem; }
.app-nav-section-label {
  font-size: .72rem; font-weight: 600; color: rgba(255,255,255,.4);
  padding: 0 .75rem; margin-bottom: .4rem; white-space: nowrap;
}
.app-nav-link {
  display: flex; align-items: center; gap: .85rem;
  padding: .6rem .75rem; margin-bottom: .15rem;
  border-radius: .7rem;
  font-size: .875rem; font-weight: 500;
  color: rgba(255,255,255,.72);
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.app-nav-link .nav-icon { flex-shrink: 0; opacity: .85; }
.app-nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.app-nav-link.active { background: var(--brand-purple); color: #fff; }
.app-nav-link.active .nav-icon { opacity: 1; }

.app-sidebar-footer {
  padding: .75rem; border-top: 1px solid rgba(255,255,255,.08); flex-shrink: 0;
}
.app-sidebar-collapse-btn {
  display: flex; align-items: center; gap: .85rem;
  width: 100%; padding: .6rem .75rem;
  background: none; border: none; border-radius: .7rem;
  color: rgba(255,255,255,.55); font-size: .8rem; font-weight: 500;
  cursor: pointer; white-space: nowrap;
}
.app-sidebar-collapse-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.app-sidebar-collapse-btn .nav-icon { flex-shrink: 0; transition: transform .2s ease; }

.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0; z-index: 1040;
  background: rgba(11,10,20,.5);
}

.app-main {
  flex: 1; min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column; min-height: 100vh;
  transition: margin-left .2s var(--ease-crest);
}

.app-topbar {
  position: sticky; top: 0; z-index: 1020;
  min-height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0 1.5rem;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.app-topbar-title { font-family: var(--font-heading); font-weight: 700; font-size: 1.05rem; color: var(--brand-ink); }
.app-topbar-btn {
  display: flex; align-items: center; justify-content: center;
  width: 2.4rem; height: 2.4rem; border-radius: 999px;
  border: none; background: transparent; color: var(--brand-ink);
  position: relative; cursor: pointer;
}
.app-topbar-btn:hover { background: var(--brand-cream); }
.app-topbar-badge {
  position: absolute; top: 2px; right: 2px;
  min-width: 1.05rem; height: 1.05rem; padding: 0 .25rem;
  display: flex; align-items: center; justify-content: center;
  background: #dc3545; color: #fff; font-size: .62rem; font-weight: 700;
  border-radius: 999px; border: 2px solid #fff;
}
.app-topbar-menu-btn { display: none; }

.app-avatar-btn {
  display: flex; align-items: center; gap: .6rem;
  padding: .3rem .6rem .3rem .3rem; border-radius: 999px;
  border: 1px solid var(--border); background: #fff; cursor: pointer;
}
.app-avatar-btn:hover { border-color: oklch(0.42 0.24 295 / 0.35); }
.app-avatar-circle {
  width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--gradient-brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; flex-shrink: 0;
}

.app-content { flex: 1; padding-bottom: 3rem; }

.app-notif-item { display: block; padding: .7rem .9rem; border-bottom: 1px solid var(--border); text-decoration: none; }
.app-notif-item:last-child { border-bottom: none; }
.app-notif-item.unread { background: var(--brand-cream); }
.app-notif-title { font-size: .82rem; font-weight: 600; color: var(--brand-ink); }
.app-notif-body { font-size: .78rem; color: var(--muted-foreground); margin-top: .1rem; }
.app-notif-time { font-size: .68rem; color: var(--muted-foreground); margin-top: .2rem; }

/* ---- Collapsed desktop sidebar: icons only ---- */
html.sidebar-collapsed .app-sidebar { width: var(--sidebar-w-collapsed); }
html.sidebar-collapsed .app-main { margin-left: var(--sidebar-w-collapsed); }
html.sidebar-collapsed .app-sidebar-brand .brand-name,
html.sidebar-collapsed .app-nav-link span.label,
html.sidebar-collapsed .app-nav-section-label,
html.sidebar-collapsed .app-sidebar-collapse-btn span.label { display: none; }
html.sidebar-collapsed .app-sidebar-collapse-btn .nav-icon { transform: rotate(180deg); }
html.sidebar-collapsed .app-nav-link,
html.sidebar-collapsed .app-sidebar-collapse-btn { justify-content: center; }

/* ---- Mobile: sidebar becomes an off-canvas drawer ---- */
@media (max-width: 991.98px) {
  .app-sidebar {
    width: var(--sidebar-w) !important;
    transform: translateX(-100%);
  }
  .app-sidebar.mobile-open { transform: translateX(0); box-shadow: var(--shadow-elegant); }
  .app-sidebar .app-sidebar-brand .brand-name,
  .app-sidebar .app-nav-link span.label,
  .app-sidebar .app-nav-section-label { display: block !important; }
  .app-main { margin-left: 0 !important; }
  .app-topbar-menu-btn { display: flex; }
  .app-sidebar-footer .app-sidebar-collapse-btn { display: none; }
  .sidebar-backdrop.show { display: block; }
}

