:root {
  --sp-primary: #059669;
  --sp-primary-dark: #047857;
  --sp-primary-darker: #064e3b;
  --sp-primary-light: #ecfdf5;
  --sp-primary-lighter: #d1fae5;
  --sp-text: #0f172a;
  --sp-text-secondary: #475569;
  --sp-bg-light: #f8fafc;
  --sp-accent: #f59e0b;
  --sp-white: #ffffff;
  --sp-border: #e2e8f0;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 88px; }

body {
  font-family: 'Inter', sans-serif;
  color: var(--sp-text);
  background-color: var(--sp-white);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--sp-bg-light); }
::-webkit-scrollbar-thumb { background: var(--sp-primary); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--sp-primary-dark); }

/* Typography */
h1, h2, h3, h4, h5, h6 { font-weight: 700; letter-spacing: -0.02em; }
.text-gradient {
  background: linear-gradient(135deg, var(--sp-primary-dark) 0%, var(--sp-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Buttons */
.btn-primary {
  background-color: var(--sp-primary);
  border-color: var(--sp-primary);
  color: #fff;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  border-radius: 0.5rem;
  transition: all 0.3s ease;
}
.btn-primary:hover, .btn-primary:focus {
  background-color: var(--sp-primary-dark);
  border-color: var(--sp-primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -5px color-mix(in srgb, var(--sp-primary) 30%, transparent);
}
.btn-outline-primary {
  color: var(--sp-primary);
  border-color: var(--sp-primary);
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  border-radius: 0.5rem;
  transition: all 0.3s ease;
}
.btn-outline-primary:hover {
  background-color: var(--sp-primary);
  border-color: var(--sp-primary);
  color: #fff;
  transform: translateY(-2px);
}
.btn-sm.btn-primary,
.btn-sm.btn-outline-primary {
  padding: 0.4rem 0.9rem;
  font-size: 0.875rem;
}
.btn-white {
  background: #fff;
  color: var(--sp-primary-dark);
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  border: none;
  transition: all 0.3s ease;
}
.btn-white:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -5px rgba(0,0,0,0.15);
}

/* Navbar */
.navbar {
  padding: 1.25rem 0;
  transition: all 0.35s ease;
  z-index: 1040;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 30px rgba(0,0,0,0.04);
}
.navbar.scrolled {
  padding: 0.75rem 0;
}
.navbar-brand {
  font-weight: 800;
  font-size: 1.6rem;
  color: var(--sp-text) !important;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.navbar-brand i {
  color: var(--sp-primary);
  font-size: 1.75rem;
}
.navbar .nav-link {
  font-weight: 500;
  color: var(--sp-text-secondary) !important;
  margin: 0 0.5rem;
  position: relative;
  padding: 0.5rem 0 !important;
}
.navbar .nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--sp-primary);
  transition: width 0.3s ease;
}
.navbar .nav-link:hover, .navbar .nav-link.active {
  color: var(--sp-primary) !important;
}
.navbar .nav-link:hover::after, .navbar .nav-link.active::after {
  width: 100%;
}
.navbar-toggler {
  border: none;
  padding: 0.5rem;
  color: var(--sp-text);
}
.navbar-toggler:focus { box-shadow: none; }

/* Page header (interior pages) */
.page-header {
  background: linear-gradient(135deg, color-mix(in srgb, var(--sp-primary) 9%, #fff) 0%, #ffffff 50%, color-mix(in srgb, var(--sp-primary) 5%, #fff) 100%);
  padding: 150px 0 60px;
  position: relative;
  overflow: hidden;
}
.header-shape {
  position: absolute;
  border-radius: 50%;
  opacity: 0.12;
  pointer-events: none;
}
.header-shape-1 {
  width: 300px; height: 300px;
  background: var(--sp-primary);
  top: -80px; right: -80px;
  filter: blur(60px);
}
.header-shape-2 {
  width: 250px; height: 250px;
  background: var(--sp-accent);
  bottom: -60px; left: -60px;
  filter: blur(60px);
  opacity: 0.1;
}
.page-header .breadcrumb { margin-bottom: 0.75rem; }
.page-header .breadcrumb-item a {
  color: var(--sp-text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}
.page-header .breadcrumb-item a:hover { color: var(--sp-primary); }
.page-header .breadcrumb-item.active { color: var(--sp-primary); font-weight: 700; }

/* Hero */
.hero {
  position: relative;
  padding: 160px 0 100px;
  overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--sp-primary) 9%, #fff) 0%, #ffffff 50%, color-mix(in srgb, var(--sp-primary) 5%, #fff) 100%);
}
.hero-shapes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.shape {
  position: absolute;
  border-radius: 50%;
  opacity: 0.15;
}
.shape-1 {
  width: 400px; height: 400px;
  background: var(--sp-primary);
  top: -100px; right: -100px;
  filter: blur(60px);
}
.shape-2 {
  width: 300px; height: 300px;
  background: var(--sp-accent);
  bottom: -50px; left: -50px;
  filter: blur(60px);
  opacity: 0.12;
}
.hero-content { position: relative; z-index: 1; }
.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  line-height: 1.15;
  margin-bottom: 1.25rem;
}
.hero p.lead {
  font-size: 1.15rem;
  color: var(--sp-text-secondary);
  max-width: 90%;
}
.hero-img-wrapper {
  position: relative;
  border-radius: 1.5rem;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px color-mix(in srgb, var(--sp-primary) 20%, transparent);
}
.hero-img-wrapper img {
  width: 100%;
  height: auto;
  display: block;
}
.floating-badge {
  position: absolute;
  background: var(--sp-white);
  border-radius: 1rem;
  padding: 0.75rem 1.25rem;
  box-shadow: 0 10px 30px -5px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 2;
  animation: float 4s ease-in-out infinite;
}
.floating-badge i {
  font-size: 1.25rem;
  color: var(--sp-primary);
}
.badge-1 { bottom: 30px; left: -20px; animation-delay: 0s; }
.badge-2 { top: 30px; right: -10px; animation-delay: 2s; }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Stats */
.stats-section {
  background: var(--sp-white);
  padding: 60px 0;
}
.stat-card {
  text-align: center;
  padding: 1.5rem;
}
.stat-number {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--sp-primary);
  line-height: 1;
}
.stat-label {
  color: var(--sp-text-secondary);
  font-size: 0.95rem;
  margin-top: 0.5rem;
}

/* Courses */
.section-header {
  margin-bottom: 3rem;
}
.section-header h2 {
  font-size: 2.25rem;
}
.section-header p {
  color: var(--sp-text-secondary);
  font-size: 1.1rem;
  max-width: 600px;
}
.section-eyebrow {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--sp-primary);
}
.accent-badge {
  background: var(--sp-primary-light) !important;
  color: var(--sp-primary-dark) !important;
}
.course-img-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, var(--sp-primary-light) 0%, color-mix(in srgb, var(--sp-primary) 8%, #fff) 100%);
  color: var(--sp-primary);
  padding: 1rem;
  text-align: center;
}
.course-img-fallback .fallback-icon {
  font-size: 2rem;
  opacity: 0.5;
}
.course-img-fallback .fallback-name {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.filter-btn {
  border: 1.5px solid var(--sp-border);
  background: transparent;
  color: var(--sp-text-secondary);
  padding: 0.5rem 1.25rem;
  border-radius: 2rem;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.3s;
  margin: 0 0.25rem 0.5rem;
}
.filter-btn:hover, .filter-btn.active {
  background: var(--sp-primary);
  border-color: var(--sp-primary);
  color: #fff;
}
.course-card {
  border: 1px solid var(--sp-border);
  border-radius: 1rem;
  overflow: hidden;
  background: var(--sp-white);
  transition: all 0.35s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.course-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px -10px color-mix(in srgb, var(--sp-primary) 12%, transparent);
  border-color: var(--sp-primary-lighter);
}
.course-img {
  position: relative;
  height: 200px;
  overflow: hidden;
}
.course-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.course-card:hover .course-img img {
  transform: scale(1.08);
}
.course-tag {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: var(--sp-white);
  color: var(--sp-primary-dark);
  padding: 0.35rem 0.85rem;
  border-radius: 2rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.course-body { padding: 1.5rem; flex: 1; display: flex; flex-direction: column; }
.course-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--sp-text-secondary);
  margin-bottom: 0.75rem;
}
.course-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  line-height: 1.35;
}
.course-desc {
  font-size: 0.95rem;
  color: var(--sp-text-secondary);
  margin-bottom: 1.25rem;
  flex: 1;
}
.course-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid var(--sp-border);
}
.course-price {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--sp-primary-dark);
}
.course-price small {
  font-size: 0.85rem;
  color: var(--sp-text-secondary);
  text-decoration: line-through;
  margin-left: 0.25rem;
  font-weight: 500;
}
.stars { color: var(--sp-accent); font-size: 0.85rem; }
.category-badge {
  display: inline-flex; align-items: center; gap: 0.45rem;
  background: var(--sp-primary-light); color: var(--sp-primary-dark);
  border: 1px solid var(--sp-primary-lighter);
  padding: 0.45rem 0.95rem; border-radius: 2rem; font-size: 0.8rem; font-weight: 700;
}

/* Bundle rows (catalog) */
.bundle-row {
  border: 1px solid var(--sp-border);
  border-radius: 1.1rem;
  background: var(--sp-white);
  transition: all 0.35s ease;
  overflow: hidden;
}
.bundle-row:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px -12px color-mix(in srgb, var(--sp-primary) 14%, transparent);
  border-color: var(--sp-primary-lighter);
}
.bundle-row-inner {
  display: flex;
  text-decoration: none;
  color: inherit;
  height: 100%;
}
@media (max-width: 767.98px) {
  .bundle-row-inner { flex-direction: column; }
}
.bundle-thumb {
  position: relative;
  width: 320px;
  flex-shrink: 0;
  min-height: 210px;
  overflow: hidden;
  background: var(--sp-primary-light);
}
@media (max-width: 767.98px) {
  .bundle-thumb { width: 100%; min-height: 200px; }
}
.bundle-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.bundle-row:hover .bundle-thumb img { transform: scale(1.06); }
.bundle-thumb-fallback {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--sp-primary); font-size: 3rem;
}
.bundle-badge {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: var(--sp-primary);
  color: #fff;
  padding: 0.35rem 0.85rem;
  border-radius: 2rem;
  font-size: 0.75rem;
  font-weight: 700;
  box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--sp-primary) 45%, transparent);
}
.bundle-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.75rem;
}
.bundle-title {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  color: var(--sp-text);
}
.bundle-desc {
  color: var(--sp-text-secondary);
  font-size: 0.95rem;
  margin-bottom: 0.9rem;
}
.bundle-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--sp-text-secondary);
  margin-bottom: 1.1rem;
}
.bundle-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--sp-border);
}
.bundle-footer .course-price { font-size: 1.1rem; }

/* Features */
.features-section { background: var(--sp-bg-light); }
.feature-box {
  background: var(--sp-white);
  padding: 2rem;
  border-radius: 1rem;
  border: 1px solid var(--sp-border);
  transition: all 0.3s ease;
  height: 100%;
}
.feature-box:hover {
  box-shadow: 0 15px 30px -10px color-mix(in srgb, var(--sp-primary) 8%, transparent);
  transform: translateY(-4px);
  border-color: var(--sp-primary-lighter);
}
.feature-icon {
  width: 56px; height: 56px;
  border-radius: 1rem;
  background: var(--sp-primary-light);
  color: var(--sp-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1.25rem;
}

/* How it works timeline style */
.step-number {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--sp-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* Testimonials */
.testimonial-card {
  background: var(--sp-white);
  border: 1px solid var(--sp-border);
  border-radius: 1rem;
  padding: 2rem;
  height: 100%;
  transition: all 0.3s ease;
}
.testimonial-card:hover {
  box-shadow: 0 15px 30px -10px rgba(0,0,0,0.06);
}
.quote-icon {
  color: var(--sp-primary-lighter);
  font-size: 2.5rem;
  line-height: 1;
  margin-bottom: 0.5rem;
}
.testimonial-text {
  font-size: 1rem;
  color: var(--sp-text-secondary);
  margin-bottom: 1.5rem;
  font-style: italic;
}
.testimonial-author {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.author-avatar {
  width: 50px; height: 50px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--sp-primary-light);
}

/* CTA */
.cta-section {
  background: linear-gradient(135deg, var(--sp-primary-dark) 0%, var(--sp-primary) 100%);
  border-radius: 2rem;
  margin: 0 1rem;
  position: relative;
  overflow: hidden;
}
.cta-section .shape {
  opacity: 0.1;
  background: #fff;
}
.cta-content { position: relative; z-index: 2; }

/* FAQ */
.accordion-item {
  border: 1px solid var(--sp-border);
  border-radius: 0.75rem !important;
  margin-bottom: 1rem;
  overflow: hidden;
}
.accordion-button {
  font-weight: 600;
  padding: 1.25rem 1.5rem;
  color: var(--sp-text);
}
.accordion-button:not(.collapsed) {
  background: var(--sp-primary-light);
  color: var(--sp-primary-dark);
  box-shadow: none;
}
.accordion-button:focus { box-shadow: none; border-color: var(--sp-border); }

/* Footer */
.footer {
  background: var(--sp-text);
  color: #94a3b8;
  padding-top: 80px;
}
.footer-brand {
  color: #fff;
  font-weight: 800;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  text-decoration: none;
}
.footer-brand i { color: var(--sp-primary); }
.footer-heading {
  color: #fff;
  font-weight: 700;
  margin-bottom: 1.25rem;
  font-size: 1.1rem;
}
.footer-link {
  display: block;
  color: #94a3b8;
  text-decoration: none;
  margin-bottom: 0.75rem;
  transition: color 0.2s;
}
.footer-link:hover { color: var(--sp-primary-light); }
.social-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 0.5rem;
  transition: all 0.3s;
  text-decoration: none;
}
.social-icon:hover {
  background: var(--sp-primary);
  transform: translateY(-3px);
  color: #fff;
}
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.08);
  margin-top: 60px;
  padding: 1.5rem 0;
  text-align: center;
  font-size: 0.9rem;
}

/* Reveal Animation */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: all 0.8s cubic-bezier(0.5, 0, 0, 1);
}
.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive tweaks */
@media (max-width: 991.98px) {
  .hero { padding: 140px 0 80px; }
  .page-header { padding: 130px 0 50px; }
  .navbar-collapse {
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(12px);
    padding: 1.5rem;
    border-radius: 1rem;
    margin-top: 1rem;
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.08);
  }
  .floating-badge { display: none; }
}

/* Auth pages (Register / Login) */
.auth-section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 140px 0 80px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--sp-primary) 9%, #fff) 0%, #ffffff 50%, color-mix(in srgb, var(--sp-primary) 5%, #fff) 100%);
  position: relative;
  overflow: hidden;
}
.auth-section .shape-1 {
  width: 420px; height: 420px;
  background: var(--sp-primary);
  top: -120px; right: -120px;
  filter: blur(70px);
}
.auth-section .shape-2 {
  width: 320px; height: 320px;
  background: var(--sp-accent);
  bottom: -80px; left: -80px;
  filter: blur(70px);
  opacity: 0.12;
}
.auth-card {
  background: var(--sp-white);
  border: 1px solid var(--sp-border);
  border-radius: 1.5rem;
  box-shadow: 0 25px 60px -15px color-mix(in srgb, var(--sp-primary) 18%, transparent);
  padding: 2.5rem;
  position: relative;
  z-index: 1;
}
.auth-card .auth-icon {
  width: 64px; height: 64px;
  border-radius: 1rem;
  background: var(--sp-primary-light);
  color: var(--sp-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin: 0 auto 1.25rem;
}
.auth-card .form-control {
  border-radius: 0.6rem;
  padding: 0.75rem 1rem;
  border-color: var(--sp-border);
}
.auth-card .form-control:focus {
  border-color: var(--sp-primary);
  box-shadow: 0 0 0 0.25rem color-mix(in srgb, var(--sp-primary) 12%, transparent);
}
.auth-card .form-label {
  font-weight: 600;
  color: var(--sp-text);
  font-size: 0.9rem;
}
.auth-card .input-group-text {
  background: var(--sp-bg-light);
  color: var(--sp-primary);
  border-color: var(--sp-border);
  border-radius: 0.6rem 0 0 0.6rem;
}
.auth-card .input-group .form-control {
  border-radius: 0 0.6rem 0.6rem 0;
}
.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  border-radius: 0.75rem;
  padding: 0.85rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
}

/* Dashboard */
.dashboard-section {
  min-height: 100vh;
  padding: 140px 0 80px;
  background: var(--sp-bg-light);
}
.dashboard-header {
  background: linear-gradient(135deg, var(--sp-primary-dark) 0%, var(--sp-primary) 100%);
  border-radius: 1.5rem;
  padding: 2.5rem;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.dashboard-header .shape {
  opacity: 0.12;
  background: #fff;
}
.dashboard-header h1 { color: #fff; }
.dashboard-header .lead { opacity: 0.92; }
.stat-box {
  background: var(--sp-white);
  border: 1px solid var(--sp-border);
  border-radius: 1rem;
  padding: 1.5rem;
  height: 100%;
  transition: all 0.3s ease;
}
.stat-box:hover {
  transform: translateY(-4px);
  box-shadow: 0 15px 30px -10px color-mix(in srgb, var(--sp-primary) 12%, transparent);
}
.stat-box .stat-box-icon {
  width: 48px; height: 48px;
  border-radius: 0.85rem;
  background: var(--sp-primary-light);
  color: var(--sp-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 1rem;
}
.stat-box .stat-box-number {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--sp-primary-dark);
  line-height: 1;
}
.stat-box .stat-box-label {
  color: var(--sp-text-secondary);
  font-size: 0.9rem;
  margin-top: 0.35rem;
}
.dash-card {
  background: var(--sp-white);
  border: 1px solid var(--sp-border);
  border-radius: 1rem;
  padding: 1.5rem;
  height: 100%;
}
.dash-card h5 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.dash-card h5 i { color: var(--sp-primary); }
.role-badge {
  background: var(--sp-primary-light);
  color: var(--sp-primary-dark);
  border: 1px solid var(--sp-primary-lighter);
  border-radius: 2rem;
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.list-group-item {
  border-color: var(--sp-border);
  background: transparent;
}
.btn-outline-light { color: #fff; }
.btn-outline-light:hover { background: #fff; color: var(--sp-primary-dark); }

/* ============================================
   Dashboard layout with sidebar
   ============================================ */
.dashboard-layout {
  min-height: 100vh;
  background: var(--sp-bg-light);
}
.min-w-0 { min-width: 0; }

/* Fixed sidebar on desktop, Bootstrap offcanvas on mobile */
.sidebar {
  width: 264px;
  --bs-offcanvas-width: 264px;
  position: fixed;
  inset: 0 auto 0 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--bd-primary) 45%, #043a2d) 0%, color-mix(in srgb, var(--bd-primary) 18%, #043a2d) 100%);
  color: rgba(255, 255, 255, 0.92);
  display: flex;
  flex-direction: column;
  z-index: 1050;
  border-right: 0;
  transition: transform 0.3s ease, visibility 0.3s ease;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.25); border-radius: 3px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #fff;
  text-decoration: none;
  padding: 1.4rem 1.35rem 1.1rem;
}
.sidebar-brand-icon {
  width: 42px; height: 42px;
  border-radius: 0.8rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: color-mix(in srgb, var(--bd-primary) 42%, #ffffff);
  font-size: 1.35rem;
  flex-shrink: 0;
}
.sidebar-brand-name { color: #fff; font-weight: 800; font-size: 1.15rem; line-height: 1.15; }
.sidebar-brand-sub {
  font-size: 0.66rem;
  color: rgba(255, 255, 255, 0.55);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
}
.sidebar-nav { padding: 0.25rem 0.85rem 1rem; flex: 1; }
.sidebar-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.45);
  padding: 1rem 0.75rem 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
}
.sidebar-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: color-mix(in srgb, var(--bd-primary) 40%, #d1fae5);
  text-decoration: none;
  padding: 0.68rem 0.8rem;
  border-radius: 0.7rem;
  font-weight: 500;
  font-size: 0.94rem;
  margin-bottom: 0.25rem;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}
.sidebar-link i { font-size: 1.15rem; width: 1.4rem; text-align: center; flex-shrink: 0; }
.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  transform: translateX(2px);
}
.sidebar-link.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-left-color: color-mix(in srgb, var(--bd-primary) 42%, #ffffff);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.06);
  margin-bottom: 0.75rem;
}
.sidebar-user .avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bd-primary) 0%, color-mix(in srgb, var(--bd-primary) 32%, #ffffff) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}
.sidebar-user small { color: rgba(255, 255, 255, 0.7); display: block; line-height: 1.2; }
.sidebar-user .fw-semibold { color: #fff; line-height: 1.2; }
.sidebar-logout {
  width: 100%;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: color-mix(in srgb, var(--bd-primary) 40%, #d1fae5);
  border-radius: 0.65rem;
  padding: 0.6rem;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}
.sidebar-logout:hover {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
}

.main-content {
  margin-left: 264px;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.topbar {
  flex-shrink: 0;
  background: #ffffff;
  border-bottom: 1px solid var(--sp-border);
  padding: 0.8rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.topbar h1 {
  font-size: 1.2rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.topbar-user-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0.75rem;
  padding: 0.3rem 0.5rem;
  transition: all 0.2s ease;
}
.topbar-user-btn:hover {
  background: var(--sp-bg-light);
  border-color: var(--sp-border);
}
.topbar-user-btn .avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--sp-primary-light);
  color: var(--sp-primary-dark);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--sp-border);
  border-radius: 0.6rem;
  padding: 0.45rem 0.7rem;
  color: var(--sp-text);
  font-size: 1.15rem;
  line-height: 1;
}
.content {
  padding: 2rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.content-title {
  font-size: 1.6rem;
  margin-bottom: 0.25rem;
}
.breadcrumb {
  --bs-breadcrumb-margin-bottom: 0;
  font-size: 0.82rem;
}
.breadcrumb-item a { color: var(--sp-text-secondary); transition: color 0.15s ease; }
.breadcrumb-item a:hover { color: var(--sp-primary); }
.breadcrumb-item.active { color: var(--sp-text-secondary); }
.content-subtitle {
  color: var(--sp-text-secondary);
  margin-bottom: 2rem;
}
.dashboard-header .role-badge { flex-shrink: 0; }

/* Keep the offcanvas sidebar pinned and visible on desktop */
@media (min-width: 992px) {
  .sidebar.offcanvas {
    transform: none !important;
    visibility: visible !important;
  }
}

@media (max-width: 991.98px) {
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: inline-flex; }
  .content { padding: 1.5rem; }
  .topbar { padding: 0.8rem 1.25rem; }
}

/* ============================================
   Admin management pages
   ============================================ */
.cursor-pointer { cursor: pointer; }

/* Success flash */
.alert-success-custom {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #047857;
  border-radius: 0.75rem;
  padding: 0.85rem 1.25rem;
  font-weight: 500;
  font-size: 0.95rem;
}

/* Filter info box */
.alert-filter {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  color: #1d4ed8;
}

/* Filter tabs */
.dash-card .nav-tabs { border-bottom: 1px solid var(--sp-border); }
.dash-card .nav-tabs .nav-link {
  color: var(--sp-text-secondary);
  font-weight: 500;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 0.85rem 1rem;
}
.dash-card .nav-tabs .nav-link:hover {
  color: var(--sp-text);
  border-bottom-color: var(--sp-border);
}
.dash-card .nav-tabs .nav-link.active {
  color: var(--sp-primary);
  background: transparent;
  border-bottom: 2px solid var(--sp-primary);
}
.dash-card .nav-tabs .badge { font-weight: 600; }
.bg-purple { background: #a855f7 !important; }

/* Table card */
.table-card { overflow: hidden; }
.table-card .table { min-width: 700px; }
.table-card .table thead th {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.75rem;
  border-bottom: 1px solid var(--sp-border);
  background: var(--sp-bg-light);
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}
.table-card .table tbody tr:hover { background: #f8fafc; }

/* Role pills */
.role-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.85rem;
  border-radius: 2rem;
  font-size: 0.78rem;
  font-weight: 600;
}
.role-pill-purple { background: #f3e8ff; color: #7e22ce; }
.role-pill-blue { background: #dbeafe; color: #1d4ed8; }
.role-pill-green { background: #d1fae5; color: #047857; }
.role-pill-gray { background: #f1f5f9; color: #475569; }
.role-pill-orange { background: #ffedd5; color: #c2410c; }

/* Action buttons */
.btn-action {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  background: transparent;
  transition: all 0.2s ease;
  text-decoration: none;
}
.action-green { color: #059669; }
.action-green:hover { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.action-indigo { color: #4f46e5; }
.action-indigo:hover { background: #eef2ff; border-color: #c7d2fe; color: #4338ca; }
.action-blue { color: #2563eb; }
.action-blue:hover { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.action-teal { color: #0d9488; }
.action-teal:hover { background: #f0fdfa; border-color: #99f6e4; color: #0f766e; }
.action-purple { color: #9333ea; }
.action-purple:hover { background: #faf5ff; border-color: #e9d5ff; color: #7e22ce; }
.action-red { color: #dc2626; }
.action-red:hover { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }

/* Avatars */
.avatar-sm {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--sp-primary-light);
  color: var(--sp-primary-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.avatar-lg {
  width: 54px; height: 54px;
  border-radius: 50%;
  background: var(--sp-primary-light);
  color: var(--sp-primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.3rem;
  flex-shrink: 0;
}

/* Permission checkbox rows */
.perm-item {
  background: #f8fafc;
  border: 1px solid var(--sp-border);
  border-radius: 0.65rem;
  padding: 0.75rem 1rem;
  transition: all 0.2s ease;
}
.perm-item:hover { background: #f1f5f9; }
.perm-item .form-check-input:checked { background-color: var(--sp-primary); border-color: var(--sp-primary); }

/* Enroll modal button */
.btn-indigo {
  background: #4f46e5;
  border-color: #4f46e5;
  color: #fff;
  font-weight: 600;
}
.btn-indigo:hover { background: #4338ca; border-color: #4338ca; color: #fff; }
.text-indigo { color: #4f46e5; }

/* Reports bar chart */
.bar-fill {
  width: 100%;
  max-width: 42px;
  background: linear-gradient(180deg, var(--sp-primary) 0%, var(--sp-primary-dark) 100%);
  border-radius: 0.5rem 0.5rem 0 0;
  transition: height 0.5s ease;
}

/* Course thumb placeholder */
.course-thumb { border: 1px solid var(--sp-border); }

/* ============================================
   Impersonation banner
   ============================================ */
.impersonation-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2000;
  background: linear-gradient(90deg, #991b1b 0%, #dc2626 50%, #ef4444 100%);
  color: #fff;
  font-size: 0.9rem;
  box-shadow: 0 4px 14px -2px rgba(185, 28, 28, 0.4);
}
.impersonation-banner .btn-light {
  color: #991b1b;
  border: none;
}
.impersonation-banner .btn-light:hover {
  background: #fee2e2;
}

/* Shift fixed/sticky bars down when the banner is present */
body:has(.impersonation-banner) .navbar { top: 46px; }
body:has(.impersonation-banner) .main-content { margin-top: 46px; height: calc(100vh - 46px); }
body:has(.impersonation-banner) .sidebar { padding-top: 46px; }
body:has(.impersonation-banner) .auth-section { padding-top: 190px; }

/* Pagination styling */
.table-card .pagination { margin-bottom: 0; }
.table-card .page-link { color: var(--sp-primary); border-color: var(--sp-border); }
.table-card .page-item.active .page-link { background-color: var(--sp-primary); border-color: var(--sp-primary); }

/* Professional users page */
.stat-icon-lg {
  width: 52px; height: 52px;
  border-radius: 1rem;
  background: var(--sp-primary-light);
  color: var(--sp-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.bg-purple-soft { background: #f3e8ff; color: #7e22ce; }
.bg-green-soft { background: #d1fae5; color: #047857; }
.action-dark { color: #334155; }
.action-dark:hover { background: #f1f5f9; border-color: #cbd5e1; color: #0f172a; }

.nav-pills .nav-link {
  color: var(--sp-text-secondary);
  font-weight: 500;
  border-radius: 2rem;
  padding: 0.5rem 1.1rem;
  font-size: 0.9rem;
}
.nav-pills .nav-link:hover { color: var(--sp-primary); background: var(--sp-primary-light); }
.nav-pills .nav-link.active {
  background: var(--sp-primary);
  color: #fff;
  box-shadow: 0 8px 18px -6px color-mix(in srgb, var(--sp-primary) 50%, transparent);
}
.nav-pills .nav-link .badge { font-weight: 600; }

/* Card-based table */
.card { border-radius: 1rem; }
.card .table thead th {
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--sp-text-secondary);
  border-bottom: 1px solid var(--sp-border);
}
.card .table td { border-bottom-color: #f1f5f9; }
.card .table tbody tr:last-child td { border-bottom: none; }
.card .pagination { margin-bottom: 0; }
.card .page-link { color: var(--sp-primary); border-color: var(--sp-border); }
.card .page-item.active .page-link { background-color: var(--sp-primary); border-color: var(--sp-primary); }
.alert-success-custom strong { color: inherit; }

/* Rich-text content inside quiz explanation blocks */
.explanation-body > :last-child { margin-bottom: 0; }
.explanation-body p:last-child { margin-bottom: 0; }
.explanation-body ul, .explanation-body ol { padding-left: 1.25rem; margin: 0.4rem 0 0.6rem; }
.explanation-body li { margin-bottom: 0.3rem; }
.explanation-body a { color: var(--sp-primary-dark); text-decoration: underline; }
