/* ==========================================================================
   Lectocourse — Modern Design System
   Built on Bootstrap 5, refined with custom tokens and utilities.
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  --lc-radius-sm: 8px;
  --lc-radius-md: 14px;
  --lc-radius-lg: 20px;
  --lc-radius-xl: 28px;
  --lc-shadow-xs: 0 1px 2px rgba(0,0,0,.04);
  --lc-shadow-sm: 0 2px 8px rgba(0,0,0,.06);
  --lc-shadow-md: 0 4px 16px rgba(0,0,0,.08);
  --lc-shadow-lg: 0 12px 40px rgba(0,0,0,.10);
  --lc-shadow-xl: 0 20px 60px rgba(0,0,0,.12);
  --lc-transition: 0.25s cubic-bezier(.4,0,.2,1);
  --lc-bg-page: #f8f9fc;
  --lc-bg-surface: #ffffff;
  --lc-bg-subtle: #f1f3f9;
  --lc-border: #e5e7ee;
  --lc-text: #1a1d2e;
  --lc-text-muted: #6b7088;
  --lc-navbar-height: 64px;
  --lc-course-header-height: 52px;
}

/* ---------- Base ---------- */
html {
  font-size: 14px;
  scroll-behavior: smooth;
}
@media (min-width: 768px) {
  html { font-size: 16px; }
}

html, body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--lc-font, 'Inter', sans-serif);
  color: var(--lc-text);
  background: var(--lc-bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.011em;
}

::selection {
  background: rgba(var(--lc-primary-rgb, 79,70,229), .15);
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--lc-text);
}

.lead { font-weight: 400; color: var(--lc-text-muted); }

/* ---------- Links ---------- */
a { color: var(--lc-primary, #4F46E5); transition: color var(--lc-transition); }
a:hover { color: color-mix(in srgb, var(--lc-primary, #4F46E5) 80%, black); }

/* ---------- Navbar ---------- */
.lc-navbar {
  height: var(--lc-navbar-height);
  background: #0d0d14 !important;
  border-bottom: 1px solid rgba(255, 120, 30, .18);
  box-shadow: 0 1px 24px rgba(0,0,0,.28);
  position: relative;
  overflow: hidden;
  z-index: 1030;
}
/* subtle left-side orange glow */
.lc-navbar::before {
  content: '';
  position: absolute;
  top: 50%;
  left: -40px;
  transform: translateY(-50%);
  width: 220px;
  height: 80px;
  background: radial-gradient(ellipse at center, rgba(255, 125, 30, .13) 0%, transparent 70%);
  pointer-events: none;
}
/* bottom accent line */
.lc-navbar::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 145, 40, .0) 5%,
    rgba(255, 145, 40, .65) 30%,
    rgba(255, 210, 80, .95) 50%,
    rgba(255, 145, 40, .65) 70%,
    rgba(255, 145, 40, .0) 95%,
    transparent 100%
  );
  animation: lc-nav-glow 4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes lc-nav-glow {
  0%, 100% { opacity: .45; }
  50%       { opacity: .9; }
}
.lc-navbar .navbar-brand {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  gap: .5rem;
  display: flex;
  align-items: center;
  background: linear-gradient(90deg, #ffffff 0%, #ffd585 60%, #ff8c30 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
  z-index: 1;
}
.lc-navbar .navbar-brand .brand-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, rgba(255,140,48,.25) 0%, rgba(255,200,80,.15) 100%);
  border: 1px solid rgba(255, 140, 48, .3);
  border-radius: var(--lc-radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  -webkit-text-fill-color: initial;
}
.lc-navbar .nav-link {
  font-weight: 500;
  font-size: .9rem;
  padding: .5rem .85rem !important;
  border-radius: var(--lc-radius-sm);
  color: rgba(255,255,255,.6) !important;
  transition: color .2s ease, background .2s ease;
  position: relative;
  z-index: 1;
}
.lc-navbar .nav-link:hover,
.lc-navbar .nav-link:focus-visible {
  background: rgba(255, 120, 30, .1);
  color: rgba(255, 185, 65, .95) !important;
}

/* ---------- Footer ---------- */
.lc-footer {
  background: var(--lc-bg-surface);
  border-top: 1px solid var(--lc-border);
  color: var(--lc-text-muted);
  font-size: .875rem;
  padding: 2rem 0;
  margin-top: auto;           /* flexbox sticky footer */
}
.lc-footer a { color: var(--lc-text-muted); text-decoration: none; }
.lc-footer a:hover { color: var(--lc-primary, #4F46E5); }

/* ---------- Cards ---------- */
.card {
  border: 1px solid var(--lc-border);
  border-radius: var(--lc-radius-md);
  box-shadow: var(--lc-shadow-sm);
  overflow: hidden;
  transition: transform var(--lc-transition), box-shadow var(--lc-transition);
  background: var(--lc-bg-surface);
}
.card-body  { padding: 1.5rem; }
.card-footer { background: var(--lc-bg-subtle); border-top: 1px solid var(--lc-border); }

/* -- Course card hover -- */
.course-card { cursor: pointer; }
.course-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--lc-shadow-lg) !important;
}
.course-card .card-img-top,
.course-card .card-img-placeholder {
  transition: transform var(--lc-transition);
}
.course-card:hover .card-img-top,
.course-card:hover .card-img-placeholder {
  transform: scale(1.04);
}
.course-card .card-img-placeholder {
  background: linear-gradient(135deg, var(--lc-primary, #4F46E5) 0%, var(--lc-secondary, #7C3AED) 100%);
}

/* ---------- Badges ---------- */
.badge {
  font-weight: 600;
  font-size: .75rem;
  letter-spacing: .02em;
  padding: .35em .7em;
  border-radius: 999px;
}

/* ---------- Buttons ---------- */
.btn {
  font-weight: 600;
  border-radius: var(--lc-radius-sm);
  padding: .55rem 1.25rem;
  transition: all var(--lc-transition);
  letter-spacing: -0.01em;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: var(--lc-primary, #4F46E5);
  border-color: var(--lc-primary, #4F46E5);
  box-shadow: 0 2px 8px rgba(var(--lc-primary-rgb, 79,70,229), .30);
}
.btn-primary:hover {
  background: color-mix(in srgb, var(--lc-primary, #4F46E5) 88%, black);
  border-color: color-mix(in srgb, var(--lc-primary, #4F46E5) 88%, black);
  box-shadow: 0 4px 14px rgba(var(--lc-primary-rgb, 79,70,229), .35);
}
.btn-outline-primary {
  border-color: var(--lc-border);
  color: var(--lc-text);
}
.btn-outline-primary:hover {
  background: var(--lc-bg-subtle);
  border-color: var(--lc-primary, #4F46E5);
  color: var(--lc-primary, #4F46E5);
}
.btn-accent {
  background: var(--lc-accent, #F59E0B);
  border-color: var(--lc-accent, #F59E0B);
  color: #fff;
  box-shadow: 0 2px 8px rgba(245,158,11,.30);
}
.btn-accent:hover {
  background: color-mix(in srgb, var(--lc-accent, #F59E0B) 88%, black);
  color: #fff;
}

/* ---------- Forms ---------- */
.form-control, .form-select {
  border: 1.5px solid var(--lc-border);
  border-radius: var(--lc-radius-sm);
  padding: .6rem 1rem;
  font-size: .925rem;
  transition: border-color var(--lc-transition), box-shadow var(--lc-transition);
  background: var(--lc-bg-surface);
}
.form-control:focus, .form-select:focus {
  border-color: var(--lc-primary, #4F46E5);
  box-shadow: 0 0 0 3px rgba(var(--lc-primary-rgb, 79,70,229), .12);
}
.form-control::placeholder { color: var(--lc-text-muted); opacity: .6; }
.form-label { font-weight: 500; font-size: .875rem; color: var(--lc-text); margin-bottom: .35rem; }

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}
.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* ---------- Auth card ---------- */
.auth-card {
  border-radius: var(--lc-radius-lg);
  box-shadow: var(--lc-shadow-lg);
  border: 1px solid var(--lc-border);
  overflow: hidden;
}
.auth-card::before {
  content: '';
  display: block;
  height: 4px;
  background: linear-gradient(90deg, var(--lc-primary, #4F46E5), var(--lc-secondary, #7C3AED), var(--lc-accent, #F59E0B));
}
.auth-card .card-body { padding: 2.25rem; }

.auth-bg {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(var(--lc-primary-rgb, 79,70,229), .06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(124,58,237,.05) 0%, transparent 50%),
    var(--lc-bg-page);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--lc-text-muted);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 600;
  margin: 1.5rem 0;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--lc-border);
}

.oauth-btn {
  display: flex;
  align-items: center;
  gap: .75rem;
  justify-content: center;
  font-weight: 600;
  border: 1.5px solid var(--lc-border);
  border-radius: var(--lc-radius-sm);
  padding: .6rem 1rem;
  background: var(--lc-bg-surface);
  color: var(--lc-text);
  transition: all var(--lc-transition);
  text-decoration: none;
  width: 100%;
}
.oauth-btn:hover {
  border-color: var(--lc-primary, #4F46E5);
  background: var(--lc-bg-subtle);
  color: var(--lc-text);
  box-shadow: var(--lc-shadow-sm);
}
.oauth-btn svg { flex-shrink: 0; }

/* ---------- Course header bar ---------- */
.lc-course-header {
  height: var(--lc-course-header-height, 52px);
  background: #0d0d14;
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  gap: .75rem;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  z-index: 5;
}
/* ambient glow orb on the left */
.lc-course-header::before {
  content: '';
  position: absolute;
  top: 50%;
  left: -60px;
  transform: translateY(-50%);
  width: 260px;
  height: 100px;
  background: radial-gradient(ellipse at center, rgba(255, 120, 30, .18) 0%, transparent 70%);
  pointer-events: none;
}
/* animated shine sweep */
.lc-course-header::after {
  content: '';
  position: absolute;
  top: 0;
  left: -60%;
  width: 45%;
  height: 100%;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 165, 60, .08) 50%, transparent 100%);
  animation: lc-header-shine 6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes lc-header-shine {
  0%   { left: -60%; }
  55%  { left: 120%; }
  100% { left: 120%; }
}
.lc-course-header-glow {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 130, 30, .0) 8%,
    rgba(255, 145, 40, .75) 35%,
    rgba(255, 210, 80, 1.0) 50%,
    rgba(255, 145, 40, .75) 65%,
    rgba(255, 130, 30, .0) 92%,
    transparent 100%
  );
  animation: lc-glow-pulse 3.5s ease-in-out infinite;
}
@keyframes lc-glow-pulse {
  0%, 100% { opacity: .55; }
  50%       { opacity: 1; }
}
.lc-course-header-back {
  color: rgba(255,255,255,.38);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .35rem .65rem;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: color .2s ease, background .2s ease, border-color .2s ease;
  flex-shrink: 0;
  font-size: .78rem;
  font-weight: 500;
  position: relative;
  z-index: 1;
}
.lc-course-header-back:hover {
  color: rgba(255, 185, 65, .9);
  background: rgba(255, 120, 30, .1);
  border-color: rgba(255, 120, 30, .28);
}
.lc-course-header-sep {
  width: 1px;
  height: 18px;
  background: rgba(255,255,255,.07);
  flex-shrink: 0;
}
.lc-course-header-title {
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #ffffff 0%, #ffd585 55%, #ff8c30 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin: 0;
  line-height: 1;
  position: relative;
  z-index: 1;
}
.lc-course-header-progress {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: .5rem;
  position: relative;
  z-index: 1;
}
.lc-course-header-progress-label {
  font-size: .7rem;
  color: rgba(255,255,255,.35);
  white-space: nowrap;
}
.lc-course-header-progress-bar {
  width: 68px;
  height: 3px;
  background: rgba(255,255,255,.09);
  border-radius: 2px;
  overflow: hidden;
}
.lc-course-header-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff8c30, #ffcc50);
  border-radius: 2px;
  transition: width .6s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 0 5px rgba(255, 160, 50, .55);
}

/* ---------- Course sidebar ---------- */
.lc-sidebar {
  background: var(--lc-bg-surface);
  border-right: 1px solid var(--lc-border);
}
.lc-sidebar-header {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--lc-border);
  background: var(--lc-bg-subtle);
}
.sidebar-section-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--lc-text-muted);
  padding: .75rem 1rem .35rem;
}
.sidebar-page-link {
  font-size: .875rem;
  padding: .55rem 1rem;
  border-radius: var(--lc-radius-sm);
  margin: 1px .5rem;
  transition: all var(--lc-transition);
  color: var(--lc-text);
  border-left: 3px solid transparent;
}
.sidebar-page-link:hover,
.sidebar-page-link:focus-visible {
  background: var(--lc-bg-subtle);
  color: var(--lc-primary, #4F46E5);
  border-left-color: rgba(var(--lc-primary-rgb, 79,70,229), .3);
}
.sidebar-page-link.active {
  background: rgba(var(--lc-primary-rgb, 79,70,229), .08);
  color: var(--lc-primary, #4F46E5);
  font-weight: 600;
  border-left-color: var(--lc-primary, #4F46E5);
}

/* ---------- Catalog ---------- */
.catalog-heading {
  position: relative;
  display: inline-block;
}
.catalog-heading::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 48px;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--lc-primary, #4F46E5), var(--lc-accent, #F59E0B));
}
.catalog-filters {
  background: var(--lc-bg-surface);
  border: 1px solid var(--lc-border);
  border-radius: var(--lc-radius-md);
  padding: 1rem 1.25rem;
  box-shadow: var(--lc-shadow-xs);
}
.search-input-wrap {
  position: relative;
}
.search-input-wrap .search-icon {
  position: absolute;
  left: .85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--lc-text-muted);
  pointer-events: none;
  opacity: .5;
}
.search-input-wrap .form-control {
  padding-left: 2.6rem;
}

/* ---------- Hero / Landing ---------- */
.lc-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--lc-primary, #4F46E5) 0%, var(--lc-secondary, #7C3AED) 50%, color-mix(in srgb, var(--lc-accent, #F59E0B) 60%, var(--lc-secondary, #7C3AED)) 100%);
  color: #fff;
}
.lc-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(255,255,255,.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255,255,255,.06) 0%, transparent 50%);
  pointer-events: none;
}
.lc-hero-content { position: relative; z-index: 1; }

.feature-card {
  background: var(--lc-bg-surface);
  border: 1px solid var(--lc-border);
  border-radius: var(--lc-radius-md);
  padding: 2rem;
  text-align: center;
  transition: all var(--lc-transition);
  height: 100%;
}
.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--lc-shadow-md);
}
.feature-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--lc-radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
  background: rgba(var(--lc-primary-rgb, 79,70,229), .08);
  color: var(--lc-primary, #4F46E5);
}

/* ---------- Quiz ---------- */
.quiz-feedback.correct  { color: #059669; font-weight: 600; }
.quiz-feedback.incorrect { color: #dc2626; font-weight: 600; }

/* ---------- Lightbox ---------- */
.cursor-zoom { cursor: zoom-in; }

/* ---------- HTMX indicators ---------- */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-block; }

/* Pulse skeleton for HTMX loads */
@keyframes lc-pulse {
  0%, 100% { opacity: .5; }
  50% { opacity: 1; }
}
.lc-skeleton {
  background: var(--lc-bg-subtle);
  border-radius: var(--lc-radius-sm);
  animation: lc-pulse 1.5s ease-in-out infinite;
}

/* ---------- Hero block (course content) ---------- */
.hero-block { scroll-snap-align: start; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--lc-border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--lc-text-muted);
}

/* ---------- Utilities ---------- */
.text-gradient {
  background: linear-gradient(135deg, var(--lc-primary, #4F46E5), var(--lc-secondary, #7C3AED));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---------- Error pages ---------- */
.error-page {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.error-icon {
  width: 80px; height: 80px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin-bottom: 1.5rem;
  background: rgba(220,38,38,.08);
  color: #dc2626;
}