/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Declare Tailwind v4's layer order up-front so component rules registered
   in @layer components below sit BELOW @layer utilities — utility classes
   like .md\:hidden then win against component defaults. */
@layer properties, theme, base, components, utilities;

html, body {
  overflow-x: hidden;
}

/* ===== Micro-interactions & Animations ===== */

/* Progress bar fill animation */
.animate-progress {
  animation: progress-fill 1s ease-out forwards;
}
@keyframes progress-fill {
  from { width: 0%; }
}

/* Slide-down entrance for flash messages */
.animate-slide-down {
  animation: slide-down 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes slide-down {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade-in entrance for overlays */
.animate-fade-in {
  animation: fade-in 0.2s ease-out forwards;
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Fade-up entrance for page sections */
.animate-fade-up {
  animation: fade-up 0.5s ease-out forwards;
  opacity: 0;
}
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Stagger delay utilities */
.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }

/* Card hover lift (supplement Tailwind's hover:shadow) */
.card-hover {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card-hover:hover {
  transform: translateY(-2px);
}

/* Dropdown menu animation */
.dropdown-enter {
  animation: dropdown-open 0.15s ease-out forwards;
}
@keyframes dropdown-open {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-4px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Mobile menu slide animation */
.mobile-menu-enter {
  animation: mobile-menu-slide 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.mobile-menu-leave {
  animation: mobile-menu-slide 0.2s cubic-bezier(0.16, 1, 0.3, 1) reverse forwards;
}
@keyframes mobile-menu-slide {
  from {
    opacity: 0;
    max-height: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    max-height: 500px;
    transform: translateY(0);
  }
}

/* Mobile menu touch feedback — press-in effect on nav links */
@media (max-width: 767px) {
  [data-mobile-menu-target="menu"] a {
    transition: background-color 150ms ease, transform 100ms ease, border-color 150ms ease;
    -webkit-tap-highlight-color: transparent;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  [data-mobile-menu-target="menu"] a:active {
    background-color: rgb(238 242 255); /* indigo-50 */
    transform: scale(0.98);
  }
  .dark [data-mobile-menu-target="menu"] a:active {
    background-color: rgba(99, 102, 241, 0.15);
  }
}

/* ============================================================
   Navbar — buttons, links, states
   In @layer components so Tailwind utilities (e.g. md:hidden) override.
   ============================================================ */
@layer components {

/* Shared interactive base for nav buttons.
   Display is set per-component below. The Tailwind utility `.md\:hidden`
   (loaded after this file) wins on cascade order for tied specificity. */
.nav-link,
.nav-icon-btn,
.nav-ghost-btn,
.nav-cta-btn,
.nav-user-btn,
.mode-pill,
.mobile-nav-link {
  align-items: center;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease,
              box-shadow 150ms ease, transform 150ms ease, border-color 150ms ease;
  -webkit-tap-highlight-color: transparent;
}
.nav-link:focus,
.nav-icon-btn:focus,
.nav-ghost-btn:focus,
.nav-cta-btn:focus,
.nav-user-btn:focus,
.mode-pill:focus,
.mobile-nav-link:focus { outline: none; }

.nav-link:focus-visible,
.nav-icon-btn:focus-visible,
.nav-ghost-btn:focus-visible,
.nav-cta-btn:focus-visible,
.nav-user-btn:focus-visible,
.mode-pill:focus-visible,
.mobile-nav-link:focus-visible {
  outline: 2px solid var(--brand-primary, #D32F2F);
  outline-offset: 2px;
  border-radius: 0.5rem;
}
.dark .nav-link:focus-visible,
.dark .nav-icon-btn:focus-visible,
.dark .nav-ghost-btn:focus-visible,
.dark .nav-cta-btn:focus-visible,
.dark .nav-user-btn:focus-visible,
.dark .mode-pill:focus-visible,
.dark .mobile-nav-link:focus-visible {
  outline-color: #f87171;
}

/* Disabled state — apply via :disabled, [aria-disabled="true"], .is-disabled */
.nav-link:disabled, .nav-link[aria-disabled="true"], .nav-link.is-disabled,
.nav-icon-btn:disabled, .nav-icon-btn[aria-disabled="true"], .nav-icon-btn.is-disabled,
.nav-ghost-btn:disabled, .nav-ghost-btn[aria-disabled="true"], .nav-ghost-btn.is-disabled,
.nav-cta-btn:disabled, .nav-cta-btn[aria-disabled="true"], .nav-cta-btn.is-disabled,
.nav-user-btn:disabled, .nav-user-btn[aria-disabled="true"], .nav-user-btn.is-disabled,
.mode-pill:disabled, .mode-pill[aria-disabled="true"], .mode-pill.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* --- Desktop nav links (top-level) --- */
.nav-link {
  display: inline-flex;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgb(55 65 81); /* gray-700 */
  position: relative;
  white-space: nowrap;
}
.dark .nav-link { color: rgb(209 213 219); }
.nav-link:hover { color: var(--brand-primary, #D32F2F); background-color: rgb(249 250 251); }
.dark .nav-link:hover { color: #f87171; background-color: rgb(31 41 55); }
.nav-link:active { transform: scale(0.97); }
.nav-link--active,
.nav-link[aria-current="page"] {
  color: var(--brand-primary, #D32F2F);
  background-color: rgba(var(--brand-primary-rgb, 211, 47, 47), 0.08);
}
.dark .nav-link--active,
.dark .nav-link[aria-current="page"] {
  color: #f87171;
  background-color: rgb(127 29 29 / 0.35);
}

/* --- Round icon buttons (theme, bell, hamburger) --- */
.nav-icon-btn {
  display: inline-flex;
  padding: 0.5rem;
  border-radius: 9999px;
  color: rgb(107 114 128);
  background-color: transparent;
  border: 0;
  justify-content: center;
}
.dark .nav-icon-btn { color: rgb(156 163 175); }
.nav-icon-btn:hover { color: var(--brand-primary, #D32F2F); background-color: rgb(243 244 246); }
.dark .nav-icon-btn:hover { color: #f87171; background-color: rgb(31 41 55); }
.nav-icon-btn:active { transform: scale(0.92); background-color: rgb(229 231 235); }
.dark .nav-icon-btn:active { background-color: rgb(55 65 81); }

/* --- Ghost (Sign In) --- */
.nav-ghost-btn {
  display: inline-flex;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgb(55 65 81);
  background-color: transparent;
}
.dark .nav-ghost-btn { color: rgb(209 213 219); }
.nav-ghost-btn:hover { color: var(--brand-primary, #D32F2F); background-color: rgb(249 250 251); }
.dark .nav-ghost-btn:hover { color: #f87171; background-color: rgb(31 41 55); }
.nav-ghost-btn:active { transform: scale(0.97); }

/* --- Primary CTA (Sign Up / Get Started) --- */
.nav-cta-btn {
  display: inline-flex;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #ffffff;
  background-color: var(--brand-primary, #D32F2F);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}
.nav-cta-btn:hover {
  background-color: var(--brand-accent, #B71C1C);
  box-shadow: 0 4px 8px -2px rgba(var(--brand-primary-rgb, 211, 47, 47), 0.4);
}
.nav-cta-btn:active { transform: scale(0.97); filter: brightness(0.9); }

/* --- User dropdown trigger --- */
.nav-user-btn {
  display: inline-flex;
  padding: 0.375rem 0.75rem;
  gap: 0.5rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgb(55 65 81);
  background-color: transparent;
  border: 0;
}
.dark .nav-user-btn { color: rgb(209 213 219); }
.nav-user-btn:hover { background-color: rgb(243 244 246); }
.dark .nav-user-btn:hover { background-color: rgb(31 41 55); }
.nav-user-btn[aria-expanded="true"] {
  background-color: rgb(243 244 246);
  box-shadow: inset 0 0 0 1px rgb(229 231 235);
}
.dark .nav-user-btn[aria-expanded="true"] {
  background-color: rgb(31 41 55);
  box-shadow: inset 0 0 0 1px rgb(55 65 81);
}
.nav-user-btn__chevron { transition: transform 200ms ease; }
.nav-user-btn[aria-expanded="true"] .nav-user-btn__chevron { transform: rotate(180deg); }

/* --- Mode pill (Learn / Teach / Admin) --- */
.mode-pill {
  display: inline-flex;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: rgb(107 114 128);
  background-color: transparent;
  white-space: nowrap;
}
.dark .mode-pill { color: rgb(156 163 175); }
.mode-pill:hover { color: rgb(55 65 81); }
.dark .mode-pill:hover { color: rgb(209 213 219); }
.mode-pill--active,
.mode-pill[aria-current="page"] {
  background-color: #ffffff;
  color: rgb(17 24 39);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.06), 0 1px 1px 0 rgb(0 0 0 / 0.04);
}
.dark .mode-pill--active,
.dark .mode-pill[aria-current="page"] {
  background-color: rgb(55 65 81);
  color: #ffffff;
}

/* --- Mobile menu links --- */
.mobile-nav-link {
  display: block;
  width: 100%;
  padding: 0.625rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 1rem;
  font-weight: 500;
  color: rgb(55 65 81);
  border-left: 3px solid transparent;
  min-height: 44px; /* touch target */
}
.dark .mobile-nav-link { color: rgb(209 213 219); }
.mobile-nav-link:hover { background-color: rgb(243 244 246); }
.dark .mobile-nav-link:hover { background-color: rgb(31 41 55); }
.mobile-nav-link:active { background-color: rgb(229 231 235); transform: scale(0.99); }
.dark .mobile-nav-link:active { background-color: rgb(55 65 81); }
.mobile-nav-link--active,
.mobile-nav-link[aria-current="page"] {
  color: var(--brand-primary, #D32F2F);
  background-color: rgba(var(--brand-primary-rgb, 211, 47, 47), 0.08);
  border-left-color: var(--brand-primary, #D32F2F);
}
.dark .mobile-nav-link--active,
.dark .mobile-nav-link[aria-current="page"] {
  color: #f87171;
  background-color: rgb(127 29 29 / 0.35);
  border-left-color: #f87171;
}
.mobile-nav-link--teach { color: rgb(4 120 87); }
.dark .mobile-nav-link--teach { color: rgb(52 211 153); }
.mobile-nav-link--teach:hover { background-color: rgb(236 253 245); }
.dark .mobile-nav-link--teach:hover { background-color: rgb(6 78 59 / 0.4); }
.mobile-nav-link--admin { color: rgb(180 83 9); }
.dark .mobile-nav-link--admin { color: rgb(251 191 36); }
.mobile-nav-link--admin:hover { background-color: rgb(255 251 235); }
.dark .mobile-nav-link--admin:hover { background-color: rgb(120 53 15 / 0.4); }
.mobile-nav-link--danger { color: #dc2626; }
.dark .mobile-nav-link--danger { color: #f87171; }
.mobile-nav-link--danger:hover { background-color: rgb(254 242 242); }
.dark .mobile-nav-link--danger:hover { background-color: rgb(127 29 29 / 0.35); }

} /* end @layer components */

/* Notification bell shake animation */
.animate-bell-shake {
  animation: bell-shake 0.6s ease-in-out;
  animation-iteration-count: 1;
}
.bell-ring {
  animation: bell-shake 0.6s ease-in-out infinite;
  animation-delay: 3s;
  animation-iteration-count: 3;
}
@keyframes bell-shake {
  0%   { transform: rotate(0deg); }
  15%  { transform: rotate(12deg); }
  30%  { transform: rotate(-10deg); }
  45%  { transform: rotate(8deg); }
  60%  { transform: rotate(-6deg); }
  75%  { transform: rotate(3deg); }
  100% { transform: rotate(0deg); }
}

/* Save button scale pulse */
.animate-save-pulse {
  animation: save-pulse 0.35s cubic-bezier(0.17, 0.67, 0.21, 1.69) forwards;
}
@keyframes save-pulse {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* Leaderboard podium tinting for top 3 */
.podium-gold {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.08) 0%, rgba(245, 158, 11, 0.04) 100%);
  border-left: 3px solid #f59e0b;
}
.podium-silver {
  background: linear-gradient(135deg, rgba(156, 163, 175, 0.1) 0%, rgba(107, 114, 128, 0.04) 100%);
  border-left: 3px solid #9ca3af;
}
.podium-bronze {
  background: linear-gradient(135deg, rgba(180, 83, 9, 0.06) 0%, rgba(217, 119, 6, 0.03) 100%);
  border-left: 3px solid #b45309;
}

/* Quiz option interactive hover + selected state */
.quiz-option {
  transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease, transform 100ms ease;
}
.quiz-option:hover {
  background-color: rgb(238 242 255); /* indigo-50 */
  border-color: rgb(165 180 252);     /* indigo-300 */
  box-shadow: 0 1px 3px 0 rgb(99 102 241 / 0.08);
}
.quiz-option:active {
  transform: scale(0.98);
}
.quiz-option:has(input:checked) {
  background-color: rgb(238 242 255); /* indigo-50 */
  border-color: rgb(99 102 241);      /* indigo-500 */
  box-shadow: 0 0 0 1px rgb(99 102 241 / 0.3);
  color: rgb(55 48 163);              /* indigo-800 */
  font-weight: 500;
}
.quiz-option:has(input:focus-visible) {
  outline: 2px solid rgb(99 102 241);
  outline-offset: 2px;
}

/* Tab transition for leaderboard and similar components */
.tab-link {
  transition: background-color 200ms ease, color 200ms ease, box-shadow 200ms ease;
}
.tab-link:hover {
  background-color: rgb(238 242 255); /* indigo-50 */
}

/* ===== Pass 4: Learning Momentum Micro-interactions ===== */

/* Lesson completion celebration — checkmark draws in + ring expands */
.lesson-complete-celebrate {
  animation: celebrate-pop 0.5s cubic-bezier(0.17, 0.67, 0.21, 1.69) forwards;
}
@keyframes celebrate-pop {
  0%   { transform: scale(0); opacity: 0; }
  50%  { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

/* XP counter count-up glow effect */
.xp-toast-enter {
  animation: xp-float-up 2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes xp-float-up {
  0%   { opacity: 0; transform: translateY(12px) scale(0.8); }
  15%  { opacity: 1; transform: translateY(0) scale(1.1); }
  25%  { transform: translateY(0) scale(1); }
  75%  { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-24px); }
}

/* Badge unlock reveal — spins in from nothing */
.badge-unlock {
  animation: badge-reveal 0.8s cubic-bezier(0.17, 0.67, 0.21, 1.25) forwards;
}
@keyframes badge-reveal {
  0%   { opacity: 0; transform: scale(0) rotate(-180deg); }
  60%  { opacity: 1; transform: scale(1.15) rotate(10deg); }
  80%  { transform: scale(0.95) rotate(-3deg); }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Quiz answer reveal — staggered fade with color */
.quiz-answer-correct {
  animation: answer-correct 0.4s ease-out forwards;
}
@keyframes answer-correct {
  0%   { background-color: transparent; border-color: #e5e7eb; }
  40%  { background-color: #dcfce7; border-color: #86efac; transform: scale(1.02); }
  100% { background-color: #f0fdf4; border-color: #bbf7d0; transform: scale(1); }
}
.quiz-answer-incorrect {
  animation: answer-incorrect 0.4s ease-out forwards;
}
@keyframes answer-incorrect {
  0%   { background-color: transparent; }
  30%  { transform: translateX(-3px); }
  50%  { transform: translateX(3px); }
  70%  { transform: translateX(-2px); }
  100% { background-color: #fef2f2; border-color: #fecaca; transform: translateX(0); }
}

/* Score percentage count-up container */
.score-reveal {
  animation: score-grow 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes score-grow {
  0%   { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Streak flame pulse — gentle throb for active streaks */
.streak-flame-pulse {
  animation: flame-pulse 2s ease-in-out infinite;
}
@keyframes flame-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.15); }
}

/* Level up shimmer effect */
.level-up-shimmer {
  position: relative;
  overflow: hidden;
}
.level-up-shimmer::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.4) 50%,
    transparent 100%
  );
  animation: shimmer-sweep 1.5s ease-in-out;
  pointer-events: none;
}
@keyframes shimmer-sweep {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Progress ring draw animation (SVG) */
.progress-ring-animate {
  animation: ring-draw 1.2s ease-out forwards;
  stroke-dashoffset: 100;
}
@keyframes ring-draw {
  from { stroke-dashoffset: 100; }
}

/* Scroll-triggered reveal — elements below the fold */
.scroll-reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.scroll-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Course completion banner celebration */
.course-complete-banner {
  animation: banner-celebrate 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 50%, #f0fdf4 100%);
  background-size: 200% 200%;
}
@keyframes banner-celebrate {
  0%   { opacity: 0; transform: translateY(-10px); background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { opacity: 1; transform: translateY(0); background-position: 0% 50%; }
}

/* Enrollment button success morph */
.enroll-success {
  animation: enroll-morph 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes enroll-morph {
  0%   { transform: scale(1); }
  30%  { transform: scale(0.95); }
  60%  { transform: scale(1.05); background-color: #16a34a; }
  100% { transform: scale(1); background-color: #16a34a; }
}

/* Onboarding step slide transition */
.onboarding-step-enter {
  animation: step-slide-in 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.onboarding-step-exit {
  animation: step-slide-out 0.25s ease-in forwards;
}
@keyframes step-slide-in {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes step-slide-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(-30px); }
}

/* Skeleton loading shimmer for lazy-loaded content */
.skeleton-shimmer {
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
}
@keyframes skeleton-loading {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Number counter animation (for stats on profile/dashboard) */
.counter-animate {
  display: inline-block;
  animation: counter-pop 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes counter-pop {
  0%   { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Smooth check mark draw for lesson nav */
.check-draw svg {
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
  animation: draw-check 0.4s ease-out 0.1s forwards;
}
@keyframes draw-check {
  to { stroke-dashoffset: 0; }
}

/* Nav active indicator underline transition */
.nav-link-active-indicator {
  position: relative;
}
.nav-link-active-indicator::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background-color: #dc2626;
  transition: width 0.25s ease, left 0.25s ease;
}
.nav-link-active-indicator:hover::after,
.nav-link-active-indicator.active::after {
  width: 100%;
  left: 0;
}


/* ===== Dark Mode Overrides ===== */

/* Skeleton shimmer — dark variant */
.dark .skeleton-shimmer {
  background: linear-gradient(90deg, #1f2937 25%, #374151 50%, #1f2937 75%);
  background-size: 200% 100%;
}

/* Quiz answer colors in dark mode */
.dark .quiz-answer-correct {
  animation-name: answer-correct-dark;
}
@keyframes answer-correct-dark {
  0%   { background-color: transparent; border-color: #374151; }
  40%  { background-color: rgba(34, 197, 94, 0.2); border-color: #22c55e; transform: scale(1.02); }
  100% { background-color: rgba(34, 197, 94, 0.1); border-color: rgba(34, 197, 94, 0.4); transform: scale(1); }
}
.dark .quiz-answer-incorrect {
  animation-name: answer-incorrect-dark;
}
@keyframes answer-incorrect-dark {
  0%   { background-color: transparent; }
  30%  { transform: translateX(-3px); }
  50%  { transform: translateX(3px); }
  70%  { transform: translateX(-2px); }
  100% { background-color: rgba(239, 68, 68, 0.15); border-color: rgba(239, 68, 68, 0.4); transform: translateX(0); }
}

/* Podium tinting — dark */
.dark .podium-gold {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.15) 0%, rgba(245, 158, 11, 0.08) 100%);
  border-left-color: #f59e0b;
}
.dark .podium-silver {
  background: linear-gradient(135deg, rgba(156, 163, 175, 0.15) 0%, rgba(107, 114, 128, 0.08) 100%);
  border-left-color: #9ca3af;
}
.dark .podium-bronze {
  background: linear-gradient(135deg, rgba(180, 83, 9, 0.12) 0%, rgba(217, 119, 6, 0.06) 100%);
  border-left-color: #b45309;
}

/* Course complete banner — dark */
.dark .course-complete-banner {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(34, 197, 94, 0.2) 50%, rgba(34, 197, 94, 0.1) 100%);
  background-size: 200% 200%;
}

/* Quiz option hover + selected — dark */
.dark .quiz-option:hover {
  background-color: rgba(99, 102, 241, 0.15);
  border-color: rgba(129, 140, 248, 0.5);
  box-shadow: 0 1px 3px 0 rgb(99 102 241 / 0.15);
}
.dark .quiz-option:has(input:checked) {
  background-color: rgba(99, 102, 241, 0.2);
  border-color: rgba(129, 140, 248, 0.7);
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.4);
  color: rgb(165 180 252); /* indigo-300 */
}
.dark .quiz-option:has(input:focus-visible) {
  outline: 2px solid rgb(129 140 248);
  outline-offset: 2px;
}

/* Tab link hover — dark */
.dark .tab-link:hover {
  background-color: rgba(99, 102, 241, 0.15);
}

/* Level up shimmer — dark */
.dark .level-up-shimmer::after {
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.15) 50%, transparent 100%);
}

/* Nav active indicator — dark */
.dark .nav-link-active-indicator::after {
  background-color: #818cf8;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .animate-progress,
  .animate-slide-down,
  .animate-fade-up,
  .card-hover,
  .dropdown-enter,
  .mobile-menu-enter,
  .mobile-menu-leave,
  .animate-bell-shake,
  .bell-ring,
  .animate-save-pulse,
  .quiz-option,
  .tab-link,
  .lesson-complete-celebrate,
  .xp-toast-enter,
  .badge-unlock,
  .quiz-answer-correct,
  .quiz-answer-incorrect,
  .score-reveal,
  .streak-flame-pulse,
  .level-up-shimmer::after,
  .progress-ring-animate,
  .scroll-reveal,
  .course-complete-banner,
  .enroll-success,
  .onboarding-step-enter,
  .onboarding-step-exit,
  .skeleton-shimmer,
  .counter-animate,
  .check-draw svg,
  .app-rise-1,
  .app-rise-2,
  .app-rise-3,
  .app-rise-4,
  .app-rise-5,
  .app-float-a,
  .app-float-b,
  .app-float-c,
  .app-feat-card,
  .app-cta-breathe,
  .app-pulse-dot {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
    stroke-dashoffset: 0 !important;
  }
  .scroll-reveal,
  .scroll-reveal-scale {
    opacity: 1 !important;
    transform: none !important;
  }
}


/* ===== Focus Mode / Zen Mode ===== */
/* Strips visual noise for distraction-free learning.
   Activated by toggling .zen-mode on <body>. */

/* Hide gamification elements */
.zen-mode .streak-flame-pulse,
.zen-mode [data-gamification],
.zen-mode #xp_display,
.zen-mode #xp_display_mobile {
  display: none !important;
}

/* Hide notification badge */
.zen-mode #notification_badge {
  display: none !important;
}

/* Hide activity feed links and social elements */
.zen-mode [data-social],
.zen-mode [data-feed-link] {
  display: none !important;
}

/* Maximize content area */
.zen-mode main {
  max-width: 100% !important;
}

/* Subdued color palette */
.zen-mode {
  --zen-bg: #fafafa;
  --zen-text: #374151;
}

.zen-mode.dark {
  --zen-bg: #0f0f0f;
  --zen-text: #d1d5db;
}

/* Kill all animations */
.zen-mode,
.zen-mode *,
.zen-mode *::before,
.zen-mode *::after {
  animation-duration: 0s !important;
  animation-delay: 0s !important;
  transition-duration: 0s !important;
}

/* Simplify nav - keep functional links, reduce visual weight */
.zen-mode nav {
  border-bottom-color: transparent !important;
  box-shadow: none !important;
}

/* Hide leaderboard and feed nav links */
.zen-mode a[href="/leaderboard"],
.zen-mode a[href="/feed"] {
  display: none !important;
}

/* Reduce footer visual noise */
.zen-mode footer {
  opacity: 0.5;
}

/* Focus indicator for the toggle button */
.focus-toggle-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  background: white;
  color: #4b5563;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.15s ease;
}

.focus-toggle-btn:hover {
  background: #f3f4f6;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.dark .focus-toggle-btn {
  background: #1f2937;
  color: #d1d5db;
  border-color: #374151;
}

.dark .focus-toggle-btn:hover {
  background: #374151;
}

/* Active zen mode toggle style */
.zen-mode .focus-toggle-btn {
  background: #4f46e5;
  color: white;
  border-color: #4338ca;
}

.zen-mode .focus-toggle-btn:hover {
  background: #4338ca;
}

.zen-mode.dark .focus-toggle-btn {
  background: #6366f1;
  border-color: #818cf8;
}

.zen-mode.dark .focus-toggle-btn:hover {
  background: #4f46e5;
}

/* ===== Advanced Animations — Floating Elements ===== */

@keyframes app-float-a {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  33%      { transform: translateY(-9px) rotate(0.5deg); }
  66%      { transform: translateY(-4px) rotate(-0.5deg); }
}
@keyframes app-float-b {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  40%      { transform: translateY(-7px) rotate(-0.4deg); }
  70%      { transform: translateY(-3px) rotate(0.4deg); }
}
@keyframes app-float-c {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50%      { transform: translateY(-11px) rotate(0.3deg); }
}
.app-float-a { animation: app-float-a 3.8s ease-in-out infinite; }
.app-float-b { animation: app-float-b 4.4s ease-in-out infinite; animation-delay: 0.9s; }
.app-float-c { animation: app-float-c 3.2s ease-in-out infinite; animation-delay: 1.7s; }

/* ===== Staggered Rise Entrance ===== */

@keyframes app-rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
.app-rise-1 { animation: app-rise 0.7s ease-out both; }
.app-rise-2 { animation: app-rise 0.7s ease-out 0.12s both; }
.app-rise-3 { animation: app-rise 0.7s ease-out 0.24s both; }
.app-rise-4 { animation: app-rise 0.7s ease-out 0.36s both; }
.app-rise-5 { animation: app-rise 0.7s ease-out 0.48s both; }
.app-rise-card { animation: app-rise 0.8s cubic-bezier(0.22,1,0.36,1) 0.2s both; }

/* ===== Hero Text Shadow ===== */

.app-hero-shadow {
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.28);
}

/* ===== CTA Breathing Pulse ===== */

@keyframes app-breathe {
  0%, 100% { transform: scale(1); box-shadow: 0 8px 28px rgba(220,38,38,0.32), 0 2px 8px rgba(0,0,0,0.06); }
  50%      { transform: scale(1.03); box-shadow: 0 12px 36px rgba(220,38,38,0.42), 0 4px 12px rgba(0,0,0,0.08); }
}
.app-cta-breathe {
  animation: app-breathe 3s ease-in-out infinite;
}
.app-cta-breathe:hover {
  animation: none;
}

/* ===== CTA Shine Sweep ===== */

@keyframes app-shine {
  0%   { left: -100%; }
  100% { left: 150%; }
}
.app-cta-shine { position: relative; overflow: hidden; }
.app-cta-shine::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 60px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  transform: skewX(-20deg);
  left: -100%;
  pointer-events: none;
}
.app-cta-shine:hover::after {
  animation: app-shine 0.6s ease-out;
}

/* ===== Hero Gradient Shift ===== */

@keyframes app-gradient-shift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.app-gradient-bg {
  background-size: 200% 200%;
  animation: app-gradient-shift 12s ease-in-out infinite;
}

/* ===== Noise Texture Overlay ===== */

.app-noise-overlay {
  isolation: isolate;
}

.app-noise-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
  pointer-events: none;
  opacity: 0.18;
}

/* ===== Gradient Text ===== */

.app-gradient-text {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 50%, #fca5a5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== Stat Number Glow ===== */

.app-stat-glow {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 8px rgba(220,38,38,0.3));
}

/* ===== Pulse Dot (eyebrow badges) ===== */

@keyframes app-pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(0.85); }
}
.app-pulse-dot { animation: app-pulse-dot 2s ease-in-out infinite; }

/* ===== Animated Bar Growth ===== */

@keyframes app-bar-grow {
  from { height: 0%; }
}
.app-bar-grow {
  animation: app-bar-grow 1.5s ease-out both;
}

/* ===== Logo / Feature Carousel ===== */

.app-logo-carousel {
  overflow: hidden;
  width: 100%;
  padding: 0.5rem 0;
  mask-image: linear-gradient(to right, transparent 0%, black 8%, black 92%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 8%, black 92%, transparent 100%);
}
.app-logo-track {
  display: flex;
  gap: 1.25rem;
  width: max-content;
  will-change: transform;
}
.is-visible .app-logo-track {
  animation: app-scroll 35s linear infinite;
}
.app-logo-slide {
  flex-shrink: 0;
}
@keyframes app-scroll {
  0%   { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-50%, 0, 0); }
}
.is-visible .app-logo-track:hover {
  animation-play-state: paused;
}

/* ===== Step Connectors (How It Works) ===== */

.app-step-connector {
  position: absolute;
  top: 2rem;
  left: calc(50% + 2rem);
  width: calc(100% - 4rem);
  height: 2px;
  background: linear-gradient(90deg, #fca5a5, #ef4444);
  z-index: 0;
  pointer-events: none;
}

.app-step-num {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.125rem;
  color: white;
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  position: relative;
  z-index: 1;
}

/* ===== Feature Card Hover (elevated shadow) ===== */

.app-feat-card {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.app-feat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(220,38,38,0.12);
}

/* ===== Tilt Card (3D hover) ===== */

.app-tilt-card {
  transition: transform 0.15s ease;
  transform-style: preserve-3d;
  will-change: transform;
}

/* ===== Testimonial Quote Mark ===== */

.app-quote::before {
  content: '\201C';
  font-family: 'Bricolage Grotesque', serif;
  font-size: 4rem;
  line-height: 1;
  color: #c7d2fe;
  position: absolute;
  top: -0.5rem;
  left: 1rem;
}

/* ===== Typewriter Cursor ===== */

@keyframes app-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}
.app-typewriter-cursor::after {
  content: '|';
  animation: app-blink 1s step-end infinite;
  color: #6366f1;
  font-weight: 300;
}

/* ===== Carousel viewport — hide native scrollbar but keep scrollability ===== */
.app-carousel-viewport {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE 10+ */
  /* Make sure focused cards inside aren't clipped at the edges. */
  scroll-padding-inline: 1rem;
}
.app-carousel-viewport::-webkit-scrollbar { display: none; } /* Chromium, Safari */

/* ===== Sticky Mobile CTA ===== */

.app-sticky-cta {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding: 0.75rem 1rem;
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0));
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
  transform: translateY(100%);
  animation: app-slide-up 0.5s ease-out 2s both;
  gap: 0.75rem;
}
.app-sticky-cta__dismiss {
  flex-shrink: 0;
  margin-left: 0.5rem;
  /* 44×44 minimum touch target (Apple HIG, WCAG 2.5.5 Level AAA). */
  width: 2.75rem;
  height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  color: rgba(255,255,255,0.85);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}
.app-sticky-cta__dismiss:hover { background: rgba(255,255,255,0.15); color: #fff; }
.app-sticky-cta__dismiss:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.app-sticky-cta--dismissed { display: none !important; }
@keyframes app-slide-up {
  to { transform: translateY(0); }
}
/* Reserve room at the bottom of the viewport so the CTA never covers content */
body:has(.app-sticky-cta) main {
  padding-bottom: 5rem;
}
/* Sticky CTA hides at the same breakpoint where the top nav exposes its
 * Sign Up button (lg, 1024px). Below that, the top nav is the hamburger and
 * the CTA is the primary signup affordance. */
@media (min-width: 1024px) {
  .app-sticky-cta { display: none !important; }
  body:has(.app-sticky-cta) main { padding-bottom: 0; }
}

/* ===== Enhanced Scroll Reveal Variants ===== */

.scroll-reveal-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.scroll-reveal-left.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.scroll-reveal-right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.scroll-reveal-right.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.scroll-reveal-scale {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.scroll-reveal-scale.is-visible {
  opacity: 1;
  transform: scale(1);
}

/* ===== Dark Mode — Advanced Animations ===== */

.dark .app-gradient-text {
  background: linear-gradient(135deg, #818cf8 0%, #a78bfa 50%, #c4b5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.dark .app-stat-glow {
  background: linear-gradient(135deg, #818cf8 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 8px rgba(129,140,248,0.4));
}

.dark .app-quote::before {
  color: #4338ca;
}

.dark .app-step-connector {
  background: linear-gradient(90deg, #6366f1, #7c3aed);
}

.dark .app-cta-breathe {
  box-shadow: 0 8px 28px rgba(129,140,248,0.25), 0 2px 8px rgba(0,0,0,0.2);
}

/* ===== Teacher label swap — "English Teacher" → "Swiss German Teacher" ===== */
/*
 * Plays once on mount: the old label gets a red strike-through that draws
 * across, shakes, and flies off; sparks pop; the new label springs in.
 * Total runtime ≈ 2.7s; honors prefers-reduced-motion.
 */
.app-teacher-swap {
  position: relative;
  display: inline-flex;
  align-items: center;
  line-height: 1.2;
}

.app-teacher-swap__old {
  position: relative;
  display: inline-block;
  color: #4f46e5; /* indigo-600 */
  font-weight: 500;
  animation: app-swap-shake-and-go 1.0s ease-in 1.2s forwards;
}

.dark .app-teacher-swap__old { color: #818cf8; /* indigo-400 */ }

.app-teacher-swap__strike {
  position: absolute;
  left: -2%;
  top: 50%;
  height: 2px;
  width: 0;
  background: #ef4444; /* red-500 */
  transform: translateY(-50%) rotate(-3deg);
  transform-origin: left center;
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
  animation: app-swap-strike 0.4s cubic-bezier(.6,.0,.2,1) 0.8s forwards;
}

.app-teacher-swap__sparks {
  position: absolute;
  left: 38%;
  top: 50%;
  pointer-events: none;
  font-size: 0.95em;
}

.app-teacher-swap__spark {
  position: absolute;
  left: 0;
  top: 0;
  display: inline-block;
  color: #fbbf24; /* amber-400 */
  filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.75));
  opacity: 0;
  animation: app-swap-spark 0.7s ease-out calc(1.4s + var(--app-spark-d, 0s)) forwards;
}

.app-teacher-swap__new {
  position: absolute;
  inset: 0;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  color: #e11d48; /* rose-600 */
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  animation: app-swap-spring 0.7s cubic-bezier(.2, 1.5, .4, 1) 2.0s forwards;
}

.dark .app-teacher-swap__new { color: #fb7185; /* rose-400 */ }

@keyframes app-swap-strike {
  0%   { width: 0; opacity: 0; }
  10%  { opacity: 1; }
  100% { width: 104%; opacity: 1; }
}

@keyframes app-swap-shake-and-go {
  0%, 30% { transform: translate(0, 0) rotate(0); opacity: 1; }
  40% { transform: translate(-2px, 0) rotate(-2deg); }
  50% { transform: translate(2px, 0) rotate(2deg); }
  60% { transform: translate(-3px, -1px) rotate(-3deg); }
  70% { transform: translate(3px, 1px) rotate(3deg); }
  80% { transform: translate(0, 0) rotate(0); opacity: 1; }
  100% { transform: translate(6px, -14px) rotate(-8deg); opacity: 0; }
}

@keyframes app-swap-spark {
  0%   { transform: translate(0, 0) scale(0); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: translate(var(--app-spark-x, 0), var(--app-spark-y, 0)) scale(0.4); opacity: 0; }
}

@keyframes app-swap-spring {
  0%   { transform: translateY(14px) rotate(8deg) scale(0.6); opacity: 0; }
  60%  { transform: translateY(-3px) rotate(-3deg) scale(1.08); opacity: 1; }
  80%  { transform: translateY(1px)  rotate(1deg)  scale(0.97); }
  100% { transform: translateY(0)    rotate(0)    scale(1);    opacity: 1; }
}

/* ===== Reduced Motion — Advanced Animations ===== */

@media (prefers-reduced-motion: reduce) {
  .app-float-a,
  .app-float-b,
  .app-float-c,
  .app-rise-1,
  .app-rise-2,
  .app-rise-3,
  .app-rise-4,
  .app-rise-5,
  .app-rise-card,
  .app-cta-breathe,
  .app-cta-shine::after,
  .app-gradient-bg,
  .app-pulse-dot,
  .app-bar-grow,
  .is-visible .app-logo-track,
  .app-sticky-cta,
  .app-typewriter-cursor::after,
  .scroll-reveal-left,
  .scroll-reveal-right,
  .scroll-reveal-scale {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  /* Teacher label swap: skip the show; render only the new label. */
  .app-teacher-swap__old,
  .app-teacher-swap__strike,
  .app-teacher-swap__sparks {
    display: none !important;
  }
  .app-teacher-swap__new {
    position: static !important;
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }
}
