/* ==========================================================================
   Neon dark theme
   - Navbar + footer styles apply on every page (dark frame).
   - Page-level dark styles apply only under body.theme-dark (home page).
   ========================================================================== */

:root {
  --bg: #0b1220;
  --bg-raised: #0d1424;
  --surface: rgba(255, 255, 255, 0.045);
  --border: rgba(255, 255, 255, 0.08);
  --neon: #1dd3a7;
  --neon-strong: #2de0b0;
  --neon-glow: rgba(29, 211, 167, 0.35);
  --text: #e8eef7;
  --muted: #94a3b8;
}

/* --------------------------------------------------------------------------
   Navbar (all pages)
   -------------------------------------------------------------------------- */
.neon-navbar {
  background: rgba(13, 20, 36, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1030;
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}

.neon-navbar .navbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text) !important;
  font-size: 1.25rem;
}

.neon-navbar .brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  margin-left: 8px;
}

.neon-navbar .nav-link {
  color: rgba(232, 238, 247, 0.75) !important;
  transition: color 0.15s ease;
}

.neon-navbar .nav-link:hover {
  color: var(--neon-strong) !important;
}

.neon-navbar .btn-auth {
  color: var(--neon) !important;
  border: 1px solid var(--neon);
  border-radius: 999px;
  padding: 6px 18px !important;
  transition: all 0.15s ease;
}

.neon-navbar .btn-auth:hover {
  background: var(--neon);
  color: #07231b !important;
  box-shadow: 0 0 18px var(--neon-glow);
}

/* --------------------------------------------------------------------------
   Footer (all pages)
   -------------------------------------------------------------------------- */
.neon-footer {
  background: #0a101c;
  border-top: 1px solid var(--border);
  color: var(--muted);
  margin-top: 4rem;
  padding: 3rem 0 0;
}

.neon-footer .footer-brand {
  display: flex;
  align-items: center;
  color: var(--text);
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
}

.neon-footer .footer-brand img {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  margin-left: 8px;
}

.neon-footer h6 {
  color: var(--text);
  margin-bottom: 1rem;
}

.neon-footer a {
  color: var(--muted);
  display: inline-block;
  margin-bottom: 0.5rem;
}

.neon-footer a:hover {
  color: var(--neon-strong);
  text-decoration: none;
}

.neon-footer .social-links a {
  font-size: 1.35rem;
  margin-left: 14px;
}

.neon-footer .footer-bottom {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 1rem 0;
  margin-top: 2rem;
  font-size: 0.9rem;
}

/* --------------------------------------------------------------------------
   Dark page base (home only)
   -------------------------------------------------------------------------- */
body.theme-dark {
  background-color: var(--bg);
  color: var(--text);
}

body.theme-dark h1,
body.theme-dark h2,
body.theme-dark h3,
body.theme-dark h4,
body.theme-dark h5,
body.theme-dark h6 {
  color: var(--text);
}

body.theme-dark .text-muted {
  color: var(--muted) !important;
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  min-height: 440px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 4.5rem 1rem 5rem;
  background:
    radial-gradient(600px 300px at 80% 10%, rgba(29, 211, 167, 0.14), transparent 60%),
    radial-gradient(500px 280px at 15% 85%, rgba(56, 189, 248, 0.1), transparent 60%),
    linear-gradient(180deg, #0d1424 0%, #0b1220 100%);
}

.hero-title {
  font-size: 2.6rem;
  font-weight: bold;
  color: var(--text);
}

.hero-title .tag {
  color: var(--neon);
  text-shadow: 0 0 18px var(--neon-glow);
  font-family: Consolas, Monaco, monospace;
}

.hero-sub {
  color: var(--muted);
  font-size: 1.15rem;
  max-width: 560px;
  margin: 1rem auto 0;
}

.hero-code {
  direction: ltr;
  font-family: Consolas, Monaco, "Courier New", monospace;
  color: var(--neon-strong);
  background: rgba(29, 211, 167, 0.07);
  border: 1px solid rgba(29, 211, 167, 0.25);
  border-radius: 8px;
  padding: 8px 18px;
  margin-top: 1.5rem;
  font-size: 0.95rem;
}

.hero-code .caret {
  display: inline-block;
  width: 8px;
  margin-left: 2px;
  background: var(--neon-strong);
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.hero-actions {
  margin-top: 2rem;
}

/* Hero typewriter line */
.hero-type {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--text);
  margin-top: 0.75rem;
  min-height: 1.6em;
}

.hero-type .typed {
  color: var(--neon-strong);
  text-shadow: 0 0 16px var(--neon-glow);
}

.hero-type .type-caret {
  display: inline-block;
  width: 3px;
  background: var(--neon-strong);
  margin: 0 1px;
  animation: blink 1.1s steps(1) infinite;
}

/* Floating decorative code tokens in the hero */
.hero-token {
  position: absolute;
  font-family: Consolas, Monaco, monospace;
  font-size: 2rem;
  color: rgba(29, 211, 167, 0.16);
  user-select: none;
  pointer-events: none;
  animation: floatToken 7s ease-in-out infinite;
}

.hero-token:nth-child(2) { animation-delay: 0.8s; }
.hero-token:nth-child(3) { animation-delay: 1.6s; }
.hero-token:nth-child(4) { animation-delay: 2.4s; }
.hero-token:nth-child(5) { animation-delay: 3.2s; }
.hero-token:nth-child(6) { animation-delay: 1.1s; }

@keyframes floatToken {
  0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.5; }
  50% { transform: translateY(-16px) rotate(6deg); opacity: 1; }
}

/* Stats band */
.stats-band {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin: -2.5rem auto 2rem;
  position: relative;
  z-index: 2;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem 1rem;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.stats-band .stat {
  text-align: center;
  border-right: 1px solid var(--border);
}

.stats-band .stat:first-child {
  border-right: 0;
}

.stats-band .stat i {
  color: var(--neon);
  font-size: 1.4rem;
  margin-bottom: 0.4rem;
  display: block;
}

.stats-band .stat-num {
  display: block;
  font-size: 2rem;
  font-weight: bold;
  color: var(--text);
  line-height: 1.2;
}

.stats-band .stat-label {
  color: var(--muted);
  font-size: 0.85rem;
}

/* YouTube free-courses band */
.youtube-band {
  text-align: center;
  margin: 2.5rem auto 0;
  padding: 2.5rem 1.5rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 0, 0, 0.28);
  background:
    radial-gradient(500px 220px at 50% 0%, rgba(255, 0, 0, 0.1), transparent 70%),
    var(--surface);
}

.youtube-icon i {
  font-size: 2.6rem;
  color: #ff0000;
  filter: drop-shadow(0 0 14px rgba(255, 0, 0, 0.45));
  margin-bottom: 0.9rem;
}

.youtube-text {
  color: var(--text);
  max-width: 640px;
  margin: 0 auto 1.5rem;
  line-height: 2.1;
  font-size: 1.02rem;
}

.btn-youtube {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ff0000;
  color: #fff !important;
  border-radius: 8px;
  padding: 10px 26px;
  border: 1px solid #ff0000;
  transition: all 0.15s ease;
}

.btn-youtube:hover {
  background: #cc0000;
  border-color: #cc0000;
  box-shadow: 0 0 22px rgba(255, 0, 0, 0.4);
  color: #fff;
  text-decoration: none;
}

/* Feature cards */
.features {
  margin-bottom: 1rem;
}

.feature-card {
  height: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.6rem 1.2rem;
  text-align: center;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.feature-card:hover {
  transform: translateY(-5px);
  border-color: rgba(29, 211, 167, 0.4);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4), 0 0 22px rgba(29, 211, 167, 0.1);
}

.feature-card i {
  font-size: 1.9rem;
  color: var(--neon);
  margin-bottom: 0.8rem;
  filter: drop-shadow(0 0 10px var(--neon-glow));
}

.feature-card h5 {
  color: var(--text);
  margin-bottom: 0.5rem;
}

.feature-card p {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0;
}

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .hero-token,
  .hero-type .type-caret,
  .caret {
    animation: none;
  }
}

@media (max-width: 767px) {
  .stats-band {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-top: 1.5rem;
  }
  .stats-band .stat:nth-child(odd) {
    border-right: 0;
  }
  .hero-type {
    font-size: 1.1rem;
  }
  .hero-token {
    display: none;
  }
}

/* Buttons */
.btn-neon {
  background: var(--neon);
  color: #07231b !important;
  border-radius: 8px;
  padding: 10px 28px;
  border: 1px solid var(--neon);
  transition: all 0.15s ease;
}

.btn-neon:hover {
  background: var(--neon-strong);
  box-shadow: 0 0 24px var(--neon-glow);
  color: #07231b;
  text-decoration: none;
}

.btn-neon-outline {
  background: transparent;
  color: var(--text) !important;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 28px;
  transition: all 0.15s ease;
}

.btn-neon-outline:hover {
  border-color: var(--neon);
  color: var(--neon-strong) !important;
  box-shadow: 0 0 18px rgba(29, 211, 167, 0.15);
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   Section titles
   -------------------------------------------------------------------------- */
.section-title {
  text-align: center;
  margin-top: 4rem;
  margin-bottom: 1rem;
  position: relative;
}

.section-title::after {
  content: "";
  display: block;
  width: 64px;
  height: 3px;
  margin: 10px auto 0;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--neon), transparent);
}

/* --------------------------------------------------------------------------
   Course cards
   base = safe on light pages (/course listing) ; glass variant under .theme-dark
   -------------------------------------------------------------------------- */
.course-card {
  border-radius: 14px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.course-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.15);
}

.course-card .card-img-top {
  display: block;
}

.course-card .badge-free {
  background: #1dd3a7;
  color: #07231b;
  padding: 6px 12px;
  border-radius: 999px;
}

.course-card.is-soon {
  opacity: 0.55;
}

body.theme-dark .course-card {
  background: var(--surface);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
}

body.theme-dark .course-card:hover {
  border-color: rgba(29, 211, 167, 0.4);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 0 24px rgba(29, 211, 167, 0.12);
}

body.theme-dark .course-card .card-title {
  color: var(--text);
}

/* Light pages (/course listing): keep titles dark, not link-colored */
body:not(.theme-dark) .course-card .card-title {
  color: #212529;
}

/* --------------------------------------------------------------------------
   Article cards (home page only — scoped to .theme-dark)
   -------------------------------------------------------------------------- */
body.theme-dark .article-card {
  background: var(--surface);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
}

body.theme-dark .article-card hr {
  display: none;
}

.article-thumb {
  width: 100%;
  border-radius: 12px;
  padding: 0;
}

.author-chip {
  display: inline-flex;
  align-items: center;
}

.author-chip img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.author-chip span {
  margin-right: 8px;
}

body.theme-dark .author-chip,
body.theme-dark .author-chip span {
  color: var(--text);
}

/* --------------------------------------------------------------------------
   CTA band (before footer, home page)
   -------------------------------------------------------------------------- */
.cta-band {
  margin: 4rem auto 0;
  text-align: center;
  padding: 3rem 1.5rem;
  border-radius: 16px;
  border: 1px solid rgba(29, 211, 167, 0.25);
  background:
    radial-gradient(400px 200px at 50% 0%, rgba(29, 211, 167, 0.12), transparent 70%),
    var(--surface);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  .hero {
    min-height: 360px;
    padding: 3rem 1rem;
  }

  .hero-title {
    font-size: 1.8rem;
  }

  .hero-sub {
    font-size: 1rem;
  }

  .hero-actions .btn-neon,
  .hero-actions .btn-neon-outline {
    display: block;
    margin: 10px auto;
    max-width: 260px;
  }

  .neon-footer {
    text-align: center;
  }
}

/* ==========================================================================
   Generic dark overrides — applied to every page carrying body.theme-dark
   (all public + auth pages). Neutralizes Bootstrap's light components so the
   inner page bodies match the dark frame without editing each view.
   ========================================================================== */

/* ---- Text ---- */
body.theme-dark,
body.theme-dark p,
body.theme-dark span,
body.theme-dark li,
body.theme-dark label {
  color: var(--text);
}

body.theme-dark a.text-dark,
body.theme-dark .text-dark {
  color: var(--text) !important;
}

/* ---- Listing hero (.header-section + .glow title) ---- */
body.theme-dark .header-section {
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0 0 18px 18px;
  background:
    radial-gradient(600px 260px at 72% 20%, rgba(29, 211, 167, 0.16), transparent 60%),
    radial-gradient(460px 240px at 15% 90%, rgba(56, 189, 248, 0.1), transparent 60%),
    linear-gradient(180deg, #0d1424 0%, #0b1220 100%);
}

body.theme-dark .header-section h1,
body.theme-dark .glow {
  color: var(--text);
  text-shadow: 0 0 22px var(--neon-glow), 0 0 44px rgba(29, 211, 167, 0.25);
}

/* ---- Cards / surfaces / list groups ---- */
body.theme-dark .card,
body.theme-dark .list-group-item {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

/* Modals sit over a translucent backdrop, so they need a SOLID (opaque)
   background — the glass --surface would read as see-through. */
body.theme-dark .modal-content {
  background: #111a2c;
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

body.theme-dark .card-header,
body.theme-dark .card-footer,
body.theme-dark .modal-header,
body.theme-dark .modal-footer {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border);
}

body.theme-dark .list-group-item-primary {
  background: rgba(29, 211, 167, 0.12);
  border-color: rgba(29, 211, 167, 0.25);
  color: var(--text);
}

/* .jumbotron defaults to a light-gray box — dark-theme it (e.g. admin issues) */
body.theme-dark .jumbotron {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}

/* Targeted: course.ejs hardcodes bg-white on block containers/headers.
   (Do NOT blanket-override .bg-white — profile avatar ring relies on it.) */
body.theme-dark .container.bg-white {
  background: transparent !important;
}

body.theme-dark .card-header.bg-white {
  background: rgba(255, 255, 255, 0.03) !important;
}

body.theme-dark .border {
  border-color: var(--border) !important;
}

/* ---- Modals ---- */
body.theme-dark .modal .close {
  color: var(--text);
  opacity: 0.75;
  text-shadow: none;
}

body.theme-dark .modal .close:hover {
  color: var(--neon-strong);
  opacity: 1;
}

/* ---- Form controls ---- */
body.theme-dark .form-control {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
  color: var(--text);
}

body.theme-dark .form-control:focus {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--neon);
  color: var(--text);
  box-shadow: 0 0 0 0.15rem var(--neon-glow);
}

body.theme-dark .form-control::placeholder {
  color: var(--muted);
}

body.theme-dark select.form-control option {
  background: var(--bg-raised);
  color: var(--text);
}

body.theme-dark .input-group-text.bg-info {
  background: var(--neon) !important;
  border-color: var(--neon);
  color: #07231b;
}

/* ---- Buttons: map Bootstrap "info" (brand teal) to neon ---- */
body.theme-dark .btn-info {
  background: var(--neon);
  border-color: var(--neon);
  color: #07231b;
}

body.theme-dark .btn-info:hover {
  background: var(--neon-strong);
  color: #07231b;
  box-shadow: 0 0 18px var(--neon-glow);
}

body.theme-dark .btn-outline-info {
  color: var(--neon);
  border-color: var(--neon);
  background: transparent;
}

/* Active/pressed state — !important + :not() to beat Bootstrap's own
   .btn-outline-info:not(:disabled):not(.disabled).active (higher specificity) */
body.theme-dark .btn-outline-info:hover,
body.theme-dark .btn-outline-info.active,
body.theme-dark .btn-outline-info:not(:disabled):not(.disabled).active,
body.theme-dark .btn-outline-info:not(:disabled):not(.disabled):active,
body.theme-dark .nav-pills .active > .btn-outline-info {
  background: var(--neon) !important;
  color: #07231b !important;
  border-color: var(--neon) !important;
  box-shadow: 0 0 18px var(--neon-glow) !important;
}

/* Kill Bootstrap's blue focus ring on info buttons */
body.theme-dark .btn-info:focus,
body.theme-dark .btn-outline-info:focus {
  box-shadow: 0 0 0 0.2rem var(--neon-glow) !important;
}

/* ---- Pagination: spaced, rounded pills ---- */
body.theme-dark .pagination {
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

body.theme-dark .page-link {
  min-width: 42px;
  height: 42px;
  padding: 0 12px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px !important;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: bold;
  transition: transform 0.15s ease, background 0.15s ease,
    border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

body.theme-dark .page-link:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--neon-strong);
  border-color: rgba(29, 211, 167, 0.4);
  transform: translateY(-2px);
}

body.theme-dark .page-item.active .page-link {
  background: var(--neon);
  border-color: var(--neon);
  color: #07231b;
  box-shadow: 0 6px 18px var(--neon-glow);
}

body.theme-dark .page-item.disabled .page-link {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
  opacity: 0.5;
  transform: none;
}

/* ---- Rich-text (CKEditor) content bodies ---- */
body.theme-dark .article-card p,
body.theme-dark .tab-content,
body.theme-dark .tab-content p,
body.theme-dark .card-body p {
  color: var(--text);
}

body.theme-dark .tab-content img,
body.theme-dark .article-card img {
  max-width: 100%;
}

/* ---- Auth card ---- */
.auth-card {
  max-width: 520px;
  margin: 3rem auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.auth-card .auth-illustration {
  width: 150px;
  opacity: 0.85;
}

/* ALTCHA widget dark palette (custom element exposes CSS vars) */
body.theme-dark altcha-widget {
  --altcha-color-base: var(--bg-raised);
  --altcha-color-border: var(--border);
  --altcha-color-text: var(--text);
  --altcha-color-border-focus: var(--neon);
}

/* ==========================================================================
   Dashboard panels (admin/user) — .panel-dark
   These masters load user-panel.css (white nav/sidebar, #f5f4f4 body) which
   we override here. Content lives in .user-box and reuses the generic
   .theme-dark component overrides above (cards, forms, tables, buttons).
   ========================================================================== */

body.panel-dark {
  background: var(--bg) !important;
  color: var(--text);
}

/* Top bar */
body.panel-dark .user-nav {
  background: rgba(13, 20, 36, 0.95);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
}

body.panel-dark .user-nav .right span.text-dark {
  color: var(--text) !important;
}

body.panel-dark .user-nav .right img {
  border: 2px solid var(--border);
}

body.panel-dark .user-nav .left i {
  color: var(--muted);
  transition: color 0.15s ease;
}

body.panel-dark .user-nav .left a:hover i {
  color: var(--neon-strong);
}

/* Sidebar menu */
body.panel-dark .user-menu ul li {
  background: var(--bg-raised);
  border-right: 3px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}

body.panel-dark .user-menu ul li:hover {
  background: rgba(255, 255, 255, 0.04);
}

body.panel-dark .user-menu ul li a {
  color: var(--text);
}

body.panel-dark .user-menu ul li i {
  color: var(--muted);
}

body.panel-dark .user-menu ul .active {
  background-image: none !important;
  background: rgba(29, 211, 167, 0.12) !important;
  border-right: 3px solid var(--neon);
}

body.panel-dark .user-menu ul .active a,
body.panel-dark .user-menu ul .active i {
  color: var(--neon-strong);
}

/* Content wrapper */
body.panel-dark .user-box {
  color: var(--text);
}

/* File-upload label (defined in global-css as dark purple — invisible on dark) */
body.panel-dark .custom-file-upload {
  border-color: var(--neon);
  color: var(--neon);
}

/* Raw textarea fallback (CKEditor target before it initializes) */
body.panel-dark .input-area {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 8px;
}

/* Plain (non table-dark) tables, if any */
body.theme-dark .table:not(.table-dark) {
  color: var(--text);
}

body.theme-dark .table:not(.table-dark) td,
body.theme-dark .table:not(.table-dark) th {
  border-color: var(--border);
}

/* Dashboard welcome card */
.dash-welcome {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.dash-welcome .dash-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--neon);
  box-shadow: 0 0 18px var(--neon-glow);
}

.dash-quick a {
  margin: 4px;
}

/* ==========================================================================
   Forum (course Q&A) — uniform, minimal comment boxes
   Comment bodies are arbitrary CKEditor HTML (inline colors, centered text,
   oversized headings). The .forum-text reset neutralizes all of that so every
   comment renders identically.
   ========================================================================== */
.forum-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  margin-top: 12px;
}

.forum-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.forum-author {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: bold;
}

.forum-author:hover {
  color: var(--neon-strong);
  text-decoration: none;
}

.forum-author img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
}

.forum-date {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.forum-title {
  font-size: 0.98rem;
  font-weight: bold;
  margin: 2px 0 6px;
  color: var(--text);
}

/* --- The normalizer: forces every comment body to one uniform shape --- */
.forum-text,
.forum-text * {
  font-size: 0.88rem !important;
  line-height: 1.85 !important;
  color: #cbd5e1 !important;
  background: transparent !important;
  text-align: right !important;
  font-weight: normal !important;
  font-family: inherit !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  max-width: 100% !important;
}

.forum-text p {
  margin-bottom: 6px !important;
}

.forum-text img {
  max-width: 100% !important;
  height: auto !important;
  border-radius: 6px;
  margin: 6px 0 !important;
}

.forum-text a {
  color: var(--neon) !important;
}

/* Keep code/monospace left-to-right and legible (override the reset above) */
.forum-text code,
.forum-text pre {
  direction: ltr !important;
  text-align: left !important;
  font-family: Consolas, Monaco, monospace !important;
  background: rgba(255, 255, 255, 0.06) !important;
  border-radius: 5px !important;
  padding: 1px 6px !important;
  color: var(--neon-strong) !important;
}

.forum-text pre {
  display: block !important;
  padding: 10px 12px !important;
  overflow-x: auto !important;
}

/* Answers: lighter, indented, minimal */
.forum-answer {
  margin-top: 10px;
  padding: 8px 12px;
  border-right: 2px solid rgba(29, 211, 167, 0.35);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 6px;
}

.forum-answer .forum-author img {
  width: 26px;
  height: 26px;
}

.forum-actions {
  margin-top: 10px;
}

/* ==========================================================================
   Admin statistics page
   ========================================================================== */
.stats-page-title {
  color: var(--text);
  margin-bottom: 1.5rem;
}

.stats-page-title i {
  color: var(--neon);
  margin-left: 6px;
}

.stats-section-title {
  color: var(--muted);
  font-weight: bold;
  margin: 0 0 0.9rem;
  padding-right: 10px;
  border-right: 3px solid var(--neon);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

.stat-grid--income {
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}

.stat-tile,
.income-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1rem;
  text-align: center;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.stat-tile:hover,
.income-tile:hover {
  transform: translateY(-3px);
  border-color: rgba(29, 211, 167, 0.35);
}

.stat-tile i,
.income-tile i {
  color: var(--neon);
  font-size: 1.5rem;
  display: block;
  margin-bottom: 0.5rem;
}

.stat-tile .num,
.income-tile .num {
  display: inline-block;
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--text);
  line-height: 1.2;
}

.income-tile .unit {
  color: var(--muted);
  font-size: 0.8rem;
  margin-right: 4px;
}

.stat-tile .lbl,
.income-tile .lbl {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 0.35rem;
}

.income-tile--primary {
  background:
    radial-gradient(300px 120px at 50% 0%, rgba(29, 211, 167, 0.16), transparent 70%),
    var(--surface);
  border-color: rgba(29, 211, 167, 0.35);
}

.income-tile--primary .num {
  color: var(--neon-strong);
  font-size: 2rem;
}

/* Top courses bars */
.top-course-row {
  margin-bottom: 1rem;
}

.top-course-row:last-child {
  margin-bottom: 0;
}

.top-course-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.top-course-name {
  color: var(--text);
  font-weight: bold;
}

.top-course-count {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.top-course-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.top-course-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--neon), var(--neon-strong));
  box-shadow: 0 0 12px var(--neon-glow);
}

/* ==========================================================================
   Instructor card (single course "مدرس" tab)
   ========================================================================== */
.instructor-card {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
}

.instructor-photo {
  flex: 0 0 auto;
}

.instructor-photo img {
  width: 180px;
  height: 180px;
  object-fit: cover;
  border-radius: 16px;
  border: 2px solid rgba(29, 211, 167, 0.4);
  box-shadow: 0 0 26px var(--neon-glow);
}

.instructor-info {
  flex: 1 1 300px;
}

.instructor-role {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--neon);
  font-size: 0.85rem;
  font-weight: bold;
  background: rgba(29, 211, 167, 0.1);
  border: 1px solid rgba(29, 211, 167, 0.25);
  border-radius: 999px;
  padding: 4px 14px;
}

.instructor-name {
  color: var(--text);
  margin: 0.8rem 0 0.6rem;
}

.instructor-bio {
  color: var(--muted);
  line-height: 2.1;
  margin-bottom: 1.2rem;
}

.instructor-socials {
  display: flex;
  gap: 12px;
}

.instructor-social {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
  transition: all 0.15s ease;
}

.instructor-social:hover {
  background: var(--neon);
  border-color: var(--neon);
  color: #07231b;
  box-shadow: 0 0 16px var(--neon-glow);
  transform: translateY(-3px);
  text-decoration: none;
}

@media (max-width: 767px) {
  .instructor-card {
    text-align: center;
    padding: 1.5rem;
  }
  .instructor-photo {
    margin: 0 auto;
  }
  .instructor-socials {
    justify-content: center;
  }
}

/* ==========================================================================
   Course listing filter bar (/course)
   ========================================================================== */
.filter-bar {
  position: relative;
  z-index: 2;
  margin-top: -2.5rem;
  margin-bottom: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.filter-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.filter-search {
  flex: 1 1 260px;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.filter-search:focus-within {
  border-color: var(--neon);
  box-shadow: 0 0 0 3px var(--neon-glow);
}

.filter-search > i {
  color: var(--muted);
}

.filter-search input {
  flex: 1;
  min-width: 0;
  width: 0;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
  padding: 9px 0;
}

.filter-search input::placeholder {
  color: var(--muted);
}

.filter-search-btn {
  background: var(--neon);
  color: #07231b;
  border: 0;
  border-radius: 8px;
  padding: 8px 20px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-search-btn:hover {
  background: var(--neon-strong);
  box-shadow: 0 0 16px var(--neon-glow);
}

.filter-select {
  flex: 0 1 190px;
  min-width: 0;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 11px 14px;
  padding-left: 34px;
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.filter-select:focus {
  outline: none;
  border-color: var(--neon);
  box-shadow: 0 0 0 3px var(--neon-glow);
}

.filter-select option {
  background: var(--bg-raised);
  color: var(--text);
}

@media (max-width: 767px) {
  .filter-bar {
    margin-top: -1.5rem;
  }
  .filter-search,
  .filter-select {
    flex: 1 1 100%;
  }
}

/* ==========================================================================
   Course type badges (crash / master / hero / sweet) + their explainer modals
   ========================================================================== */
.course-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid;
  border-radius: 999px;
  padding: 7px 18px;
  font-weight: bold;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.course-badge:hover {
  transform: translateY(-2px);
}

.course-badge img {
  width: 26px;
  height: 20px;
  object-fit: contain;
}

.course-badge--crash {
  color: #ff7a7a;
  border-color: rgba(255, 122, 122, 0.4);
  background: rgba(255, 122, 122, 0.1);
}
.course-badge--crash:hover {
  background: rgba(255, 122, 122, 0.18);
  box-shadow: 0 6px 18px rgba(255, 122, 122, 0.22);
}

.course-badge--master {
  color: #f5c451;
  border-color: rgba(245, 196, 81, 0.4);
  background: rgba(245, 196, 81, 0.1);
}
.course-badge--master:hover {
  background: rgba(245, 196, 81, 0.18);
  box-shadow: 0 6px 18px rgba(245, 196, 81, 0.22);
}

.course-badge--hero {
  color: #c79bff;
  border-color: rgba(199, 155, 255, 0.4);
  background: rgba(199, 155, 255, 0.1);
}
.course-badge--hero:hover {
  background: rgba(199, 155, 255, 0.18);
  box-shadow: 0 6px 18px rgba(199, 155, 255, 0.22);
}

.course-badge--sweet {
  color: var(--neon-strong);
  border-color: rgba(29, 211, 167, 0.4);
  background: rgba(29, 211, 167, 0.1);
}
.course-badge--sweet:hover {
  background: rgba(29, 211, 167, 0.18);
  box-shadow: 0 6px 18px var(--neon-glow);
}

/* Badge explainer dialog */
.badge-modal {
  border-radius: 16px !important;
}

.badge-modal .modal-body {
  padding: 2rem 1.75rem;
}

.badge-modal-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
}

.badge-modal-icon img {
  width: 40px;
  height: 32px;
  object-fit: contain;
}

.badge-modal-icon--crash {
  color: #ff7a7a;
  background: rgba(255, 122, 122, 0.12);
  box-shadow: 0 0 26px rgba(255, 122, 122, 0.3);
}
.badge-modal-icon--master {
  color: #f5c451;
  background: rgba(245, 196, 81, 0.12);
  box-shadow: 0 0 26px rgba(245, 196, 81, 0.3);
}
.badge-modal-icon--hero {
  background: rgba(199, 155, 255, 0.12);
  box-shadow: 0 0 26px rgba(199, 155, 255, 0.3);
}
.badge-modal-icon--sweet {
  color: var(--neon-strong);
  background: rgba(29, 211, 167, 0.12);
  box-shadow: 0 0 26px var(--neon-glow);
}

.badge-modal-title {
  color: var(--text);
  font-weight: bold;
  margin-bottom: 0.9rem;
}

.badge-modal-text {
  color: var(--muted);
  line-height: 2.1;
  margin-bottom: 1.5rem;
}

/* ==========================================================================
   Dark-tinted Bootstrap alerts (used in modals/forms, e.g. the code hint)
   ========================================================================== */
body.theme-dark .alert-success {
  background: rgba(29, 211, 167, 0.1);
  border-color: rgba(29, 211, 167, 0.3);
  color: var(--text);
}

body.theme-dark .alert-info {
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.3);
  color: var(--text);
}

body.theme-dark .alert-warning {
  background: rgba(234, 179, 8, 0.1);
  border-color: rgba(234, 179, 8, 0.3);
  color: var(--text);
}

body.theme-dark .alert-danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: var(--text);
}

/* ==========================================================================
   CKEditor 4 dark chrome — matches the rich-text editor (forum comment box,
   admin/user forms) to the dark theme. The editing surface itself is themed
   via config.contentsCss (public/css/ckeditor-content.css).
   ========================================================================== */
body.theme-dark .cke,
body.theme-dark .cke_chrome {
  border-color: var(--border) !important;
  border-radius: 8px !important;
  overflow: hidden;
  box-shadow: none !important;
}

body.theme-dark .cke_top,
body.theme-dark .cke_bottom {
  background: #0d1424 !important;
  border-color: var(--border) !important;
  box-shadow: none !important;
}

body.theme-dark .cke_inner,
body.theme-dark .cke_wysiwyg_frame,
body.theme-dark .cke_wysiwyg_div {
  background: #111a2c !important;
}

body.theme-dark .cke_toolgroup,
body.theme-dark .cke_combo_button {
  background: rgba(255, 255, 255, 0.03) !important;
  border-color: var(--border) !important;
}

body.theme-dark .cke_button,
body.theme-dark .cke_combo_text,
body.theme-dark .cke_path_item,
body.theme-dark .cke_toolbar_break {
  color: var(--text) !important;
}

body.theme-dark .cke_button:hover,
body.theme-dark .cke_button:focus,
body.theme-dark .cke_button_on {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: var(--border) !important;
}

/* CKEditor icons are dark monochrome sprites — invert them to read on dark */
body.theme-dark .cke_button_icon {
  filter: invert(0.85) !important;
}

body.theme-dark .cke_button_arrow {
  border-top-color: var(--muted) !important;
}

/* Dropdown panels (appended to body) */
body.theme-dark .cke_panel {
  background: #111a2c !important;
  border-color: var(--border) !important;
}

body.theme-dark .cke_panel_list a,
body.theme-dark .cke_panel_listItem a {
  color: var(--text) !important;
}

body.theme-dark .cke_panel_listItem a:hover {
  background: rgba(255, 255, 255, 0.08) !important;
}
