/* ==========================================================================
   🌟 Modern UI Enhancements for Walanda
   Animations, Glassmorphism, Scroll Effects, and Modern Styling
   ========================================================================== */

/* ============================================
   📐 CSS Custom Properties (Design Tokens)
   ============================================ */
:root {
  /* 🎨 Color Palette */
  --primary-h: 211;
  --primary-s: 100%;
  --primary-l: 50%;
  --primary: hsl(var(--primary-h), var(--primary-s), var(--primary-l));
  --primary-dark: hsl(var(--primary-h), var(--primary-s), 40%);
  --primary-light: hsl(var(--primary-h), var(--primary-s), 90%);
  --primary-gradient: linear-gradient(135deg,
    hsl(var(--primary-h), var(--primary-s), var(--primary-l)),
    hsl(calc(var(--primary-h) + 60), var(--primary-s), calc(var(--primary-l) + 10%))
  );
  --secondary-gradient: linear-gradient(135deg, hsl(45, 100%, 51%), hsl(0, 0%, 100%));
  --accent-gradient: linear-gradient(135deg, hsl(150, 100%, 40%), hsl(190, 100%, 45%));

  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.15);
  --glass-border: rgba(255, 255, 255, 0.25);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
  --glass-blur: 12px;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
  --space-2xl: 4rem;

  /* Borders */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.15);
  --shadow-glow: 0 0 24px rgba(0, 123, 255, 0.25);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;
  --transition-bounce: 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);

  /* Card / Surface — light gray for light mode */
  --card-bg: #f5f7fa;
  --modal-bg: #ffffff;
  --text-primary: #1a1a2e;
  --text-secondary: #6c757d;

  /* Typography */
  --font-primary: 'Poppins', 'Nunito', sans-serif;
  --font-display: 'Nunito', sans-serif;
}

/* Dark mode overrides */
.dark-mode {
  --glass-bg: rgba(0, 0, 0, 0.3);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.6);
  --primary-light: hsl(var(--primary-h), var(--primary-s), 15%);
  --shadow-glow: 0 0 24px rgba(102, 16, 242, 0.3);

  /* Card / Surface dark mode */
  --card-bg: hsl(240, 10%, 14%);
  --modal-bg: hsl(240, 10%, 18%);
  --text-primary: #e8e8f0;
  --text-secondary: #a0a0b0;
}

/* ============================================
   🌊 Smooth Scroll & Selection
   ============================================ */
html {
  scroll-behavior: smooth;
}

::selection {
  background: var(--primary);
  color: #fff;
}

/* Focus ring for accessibility */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ============================================
   📜 Scroll Progress Bar
   ============================================ */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: var(--primary-gradient);
  z-index: 9999;
  transition: width 0.1s ease-out;
  box-shadow: 0 0 8px rgba(0, 123, 255, 0.4);
}

/* ============================================
   🪟 Sticky Glassmorphism Navbar
   ============================================ */
#navbar {
  transition: all var(--transition-base);
  min-height: 62px;
}

/* Glass effect on scroll */
#navbar.glass-effect {
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  background: var(--glass-bg) !important;
  border-bottom: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.light-mode #navbar {
  background: var(--primary-gradient) !important;
}

.light-mode #navbar.glass-effect {
  background: rgba(255, 255, 255, 0.82) !important;
}

.light-mode #navbar.glass-effect .navbar-brand,
.light-mode #navbar.glass-effect .nav-link {
  color: #1a1a2e !important;
}

/* Old toggler icon reference - now using custom .hamburger-line instead */

/* ── Light mode nav text always white on gradient ── */
.light-mode #navbar:not(.glass-effect) .navbar-brand,
.light-mode #navbar:not(.glass-effect) .nav-link {
  color: #ffffff !important;
}

.light-mode #navbar:not(.glass-effect) .nav-link.disabled {
  color: rgba(255, 255, 255, 0.4) !important;
}

.dark-mode #navbar {
  background: #1a1a2e !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.dark-mode #navbar.glass-effect {
  background: rgba(20, 20, 35, 0.88) !important;
}

.dark-mode #navbar .navbar-brand,
.dark-mode #navbar .nav-link {
  color: #ffffff !important;
}

/* ── Nav link hover pill effect ── */
#navbar .navbar-nav .nav-link:not(.disabled) {
  position: relative;
  border-radius: var(--radius-full, 9999px);
  padding: 0.4rem 1rem;
  transition: all var(--transition-fast);
}

#navbar .navbar-nav .nav-link:not(.disabled):hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

#navbar .navbar-nav .nav-link:not(.disabled):active {
  transform: translateY(0);
}

/* ── Active page indicator ── */
#navbar .navbar-nav .nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 3px;
  background: currentColor;
  border-radius: 2px;
  opacity: 0.7;
}

/* ── Icon-only nav links (language, theme) ── */
#navbar .nav-icon-link {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full, 9999px);
  padding: 0 !important;
  font-size: 1.15rem;
}

/* ── Avatar in navbar ── */
.navbar-avatar {
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.25);
  transition: border-color var(--transition-fast);
}

.navbar-avatar:hover {
  border-color: rgba(255, 255, 255, 0.6);
}

.navbar-avatar-placeholder {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.7);
  font-size: 1rem;
  transition: all var(--transition-fast);
}

.navbar-avatar-placeholder:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* ── Dropdown menu inside navbar ── */
#navbar .dropdown-menu {
  margin-top: 0.6rem !important;
  border: none;
  border-radius: var(--radius-lg, 16px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
  padding: 0.5rem;
  min-width: 220px;
  animation: navbarDropdownIn 0.2s ease-out;
}

@keyframes navbarDropdownIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#navbar .dropdown-item {
  border-radius: var(--radius-sm, 8px);
  padding: 0.5rem 0.9rem;
  transition: all var(--transition-fast);
}

#navbar .dropdown-item:hover {
  transform: translateX(4px);
}

/* ── Dropdown caret ── */
#navbar .dropdown-toggle::after {
  vertical-align: 0.1em;
  transition: transform var(--transition-fast);
}

#navbar .dropdown-toggle[aria-expanded="true"]::after {
  transform: rotate(180deg);
}

/* ── Toggler button ── */
#navbar .navbar-toggler {
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius-sm, 8px);
  transition: all var(--transition-fast);
  border: none;
  outline: none !important;
  box-shadow: none !important;
}

#navbar .navbar-toggler:hover {
  background: rgba(255, 255, 255, 0.1);
}

#navbar .navbar-toggler:focus {
  outline: none;
  box-shadow: none;
}

/* ── 🌭 Animated Hamburger Icon ── */
.navbar-toggler-icon-custom {
  width: 28px;
  height: 20px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
}

.hamburger-line {
  display: block;
  width: 100%;
  height: 2.5px;
  background: #ffffff;
  border-radius: 2px;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  transform-origin: center;
}

/* Light mode hamburger lines */
.light-mode #navbar:not(.glass-effect) .hamburger-line {
  background: #ffffff;
}

.light-mode #navbar.glass-effect .hamburger-line {
  background: #1a1a2e;
}

.dark-mode .hamburger-line {
  background: #ffffff;
}

/* Animation when toggler is clicked (open state) */
#navbar-toggler[aria-expanded="true"] .hamburger-line:nth-child(1) {
  transform: translateY(8.75px) rotate(45deg);
}

#navbar-toggler[aria-expanded="true"] .hamburger-line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

#navbar-toggler[aria-expanded="true"] .hamburger-line:nth-child(3) {
  transform: translateY(-8.75px) rotate(-45deg);
}

/* ── 📱 Mobile collapse improvements (Enhanced) ── */
@media (max-width: 991.98px) {
  #navbar .navbar-collapse {
    background: inherit;
    border-radius: var(--radius-lg, 16px);
    padding: 0.75rem;
    margin-top: 0.75rem;
    max-height: 85vh;
    overflow-y: auto;
  }

  /* Glassmorphism collapse background with improved readability */
  .light-mode #navbar .navbar-collapse {
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.06);
  }

  .light-mode #navbar .navbar-collapse .nav-link {
    color: #1a1a2e !important;
    border-radius: var(--radius-sm, 8px);
  }

  .light-mode #navbar .navbar-collapse .nav-link.disabled {
    color: rgba(0, 0, 0, 0.25) !important;
  }

  .light-mode #navbar .navbar-collapse .dropdown-header {
    color: rgba(0, 0, 0, 0.5) !important;
  }

  .dark-mode #navbar .navbar-collapse {
    background: rgba(25, 25, 40, 0.98);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.06);
  }

  .dark-mode #navbar .navbar-collapse .nav-link {
    color: #ffffff !important;
  }

  /* Larger touch targets on mobile */
  #navbar .navbar-nav .nav-link:not(.disabled) {
    border-radius: var(--radius-sm, 8px);
    padding: 0.65rem 0.9rem;
    font-size: 0.95rem;
  }

  #navbar .navbar-nav .nav-link:not(.disabled):hover {
    background: rgba(0, 123, 255, 0.08);
    transform: none;
  }

  .dark-mode #navbar .navbar-nav .nav-link:not(.disabled):hover {
    background: rgba(102, 16, 242, 0.2);
  }

  /* Mobile dropdown adjustments */
  #navbar .dropdown-menu {
    animation: none;
    box-shadow: none;
    padding-left: 1rem;
    margin-top: 0 !important;
    border: none;
    background: transparent !important;
  }

  .light-mode #navbar .dropdown-menu {
    background: transparent !important;
  }

  .light-mode #navbar .dropdown-menu .dropdown-item {
    color: #1a1a2e !important;
  }

  .dark-mode #navbar .dropdown-menu {
    background: transparent !important;
  }

  #navbar .navbar-nav .nav-link.active::after {
    display: none;
  }

  /* Fix icon links on mobile */
  #navbar .nav-icon-link {
    width: auto;
    height: auto;
    padding: 0.6rem 0.8rem !important;
    justify-content: flex-start;
    gap: 0.6rem;
    border-radius: var(--radius-sm, 8px);
  }

  /* User dropdown and Register on mobile */
  #navbar .user-dropdown-toggle,
  #navbar .register-dropdown-toggle {
    background: transparent !important;
    border: none !important;
    padding: 0.6rem 0.8rem !important;
    border-radius: var(--radius-sm, 8px) !important;
  }

  .light-mode #navbar .user-dropdown-toggle,
  .light-mode #navbar .register-dropdown-toggle {
    background: transparent !important;
    color: #1a1a2e !important;
  }

  .light-mode #navbar .register-icon-wrapper {
    width: 24px;
    height: 24px;
    font-size: 0.8rem;
  }

  #navbar .navbar-avatar {
    width: 32px;
    height: 32px;
  }

  #navbar .navbar-avatar-placeholder {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
  }

  /* XP badge on mobile */
  #navbar #navbar-level-badge {
    margin: 0.4rem 0.8rem !important;
    display: inline-flex !important;
    width: auto !important;
  }

  /* Theme toggle on mobile */
  .theme-toggle-nav-item {
    padding: 0.5rem 0.8rem !important;
    margin: 0 !important;
  }

  .theme-toggle-nav-item #theme-toggle-react {
    display: flex;
    justify-content: flex-start;
  }

  /* Add subtle separator before theme toggle */
  .theme-toggle-nav-item::before {
    content: '';
    display: block;
    height: 1px;
    background: rgba(128, 128, 128, 0.2);
    margin-bottom: 0.5rem;
  }

  /* Smooth collapse animation */
  .navbar-collapse.collapsing {
    transition: height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* Scrollbar styling for mobile menu */
  #navbar .navbar-collapse::-webkit-scrollbar {
    width: 3px;
  }

  #navbar .navbar-collapse::-webkit-scrollbar-track {
    background: transparent;
  }

  #navbar .navbar-collapse::-webkit-scrollbar-thumb {
    background: rgba(128, 128, 128, 0.3);
    border-radius: 3px;
  }
}

/* ── 📱 Small mobile adjustments (< 576px) ── */
@media (max-width: 575.98px) {
  #navbar {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
  }

  .navbar-brand {
    font-size: 1.25rem !important;
  }

  .navbar-logo-img {
    width: 30px !important;
    height: 30px !important;
  }

  #navbar .navbar-collapse {
    margin-top: 0.5rem;
    padding: 0.5rem;
  }

  #navbar .navbar-nav .nav-link:not(.disabled) {
    padding: 0.55rem 0.75rem;
    font-size: 0.9rem;
  }
}

/* ============================================
   ✨ Page Transition Wrapper
   ============================================ */
.page-transition {
  animation: pageEnter 0.6s ease-out;
}

@keyframes pageEnter {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   🎭 Scroll Reveal Animations
   ============================================ */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-50px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal-left.revealed {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(50px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal-right.revealed {
  opacity: 1;
  transform: translateX(0);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal-scale.revealed {
  opacity: 1;
  transform: scale(1);
}

/* Staggered delay helpers */
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }

/* ============================================
   🔙 Back to Top Button
   ============================================ */
#back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--primary-gradient);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  cursor: pointer;
  opacity: 0;
  transform: translateY(20px);
  transition: all var(--transition-base);
  box-shadow: var(--shadow-md);
  z-index: 999;
}

#back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
}

#back-to-top:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

#back-to-top:active {
  transform: translateY(0);
}

/* ============================================
   🌀 Floating African-Inspired Geometric Forms
   Replaces generic circles with traditional
   West African motifs: lozenges (ˀgònì),
   Chi Wara triangles, stepped Kurukan Fuga
   patterns, and sacred spirals.
   ============================================ */
.floating-shapes {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.floating-shape {
  position: absolute;
  opacity: 0.06;
  animation: floatShape var(--float-duration, 20s) ease-in-out infinite;
  animation-delay: var(--float-delay, 0s);
}

/* ── Shape 1: Bambara Diamond / Lozenge (ˀgònì) ──
     Symbolises femininity, fertility, and the cycle of life.
     Common in Bambara mud cloth (bogolan) and Ndebele art. */
.floating-shape:nth-child(1) {
  width: 300px;
  height: 300px;
  background: var(--primary);
  top: -80px;
  left: -60px;
  --float-duration: 25s;
  --float-delay: 0s;
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

/* ── Shape 2: Chi Wara Triangle ──
     Inspired by the crest of the mythical antelope
     that taught the Bambara people to farm.
     A symbol of knowledge, agriculture, and hard work. */
.floating-shape:nth-child(2) {
  width: 220px;
  height: 200px;
  background: #6610f2;
  bottom: 10%;
  right: -40px;
  --float-duration: 20s;
  --float-delay: -3s;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

/* ── Shape 3: Kurukan Fuga Stepped Pyramid ──
     Recalls the earthen architecture of the Great Mosque of Djenné
     and the stepped shapes of the Mandé Kurukan Fuga charter—
     the world's oldest constitution. Symbol of unity and law. */
.floating-shape:nth-child(3) {
  width: 180px;
  height: 180px;
  background: #20c997;
  top: 40%;
  left: -30px;
  --float-duration: 18s;
  --float-delay: -7s;
  clip-path: polygon(
    20% 0%,  40% 0%,  40% 20%,  60% 20%,
    60% 40%, 80% 40%, 80% 60%,  100% 60%,
    100% 100%, 0% 100%, 0% 60%,  20% 60%
  );
}

/* ── Shape 4: Adinkra "Epa" / Handcuffs Shape ──
     A simplified version inspired by the symbol for justice and freedom.
     The interlocking form also evokes the Dogon "Nommo" twin motif. */
.floating-shape:nth-child(4) {
  width: 120px;
  height: 120px;
  background: #ffc107;
  bottom: 20%;
  left: 30%;
  --float-duration: 22s;
  --float-delay: -5s;
  clip-path: polygon(
    0% 35%, 35% 0%, 65% 0%, 100% 35%,
    100% 65%, 65% 100%, 35% 100%, 0% 65%
  );
}

/* ── Shape 5: Bogolan Spiral / Chevron ──
     Water and path-of-life motif from Bambara mud cloth.
     Alternating chevrons represent the flow of the Niger River. */
.floating-shape:nth-child(5) {
  width: 200px;
  height: 200px;
  background: #dc3545;
  top: 25%;
  right: 15%;
  --float-duration: 28s;
  --float-delay: -10s;
  mask-image: radial-gradient(ellipse at center, transparent 30%, #000 32%, #000 45%, transparent 47%);
  -webkit-mask-image: radial-gradient(ellipse at center, transparent 30%, #000 32%, #000 45%, transparent 47%);
  /* The colour itself subtly mimics the red earth of Mali */
}

@keyframes floatShape {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
  25% {
    transform: translate(30px, -40px) rotate(90deg) scale(1.05);
  }
  50% {
    transform: translate(-20px, 20px) rotate(180deg) scale(0.95);
  }
  75% {
    transform: translate(40px, 30px) rotate(270deg) scale(1.02);
  }
}

/* ============================================
   🏆 Modern Gradient Cards
   ============================================ */
.card-modern {
  border: none;
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-base);
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
}

.card-modern:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: var(--shadow-lg);
}

.card-modern .card-body {
  padding: var(--space-lg);
}

/* Gradient card backgrounds */
.card-gradient-1 {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
}

.card-gradient-2 {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: #fff;
}

.card-gradient-3 {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  color: #fff;
}

.card-gradient-4 {
  background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
  color: #fff;
}

.card-gradient-5 {
  background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
  color: #fff;
}

.card-gradient-6 {
  background: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%);
  color: #fff;
}

/* ============================================
   🪟 Glassmorphism Card
   ============================================ */
.card-glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  transition: all var(--transition-base);
}

.card-glass:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* ============================================
   🔘 Modern Button Styles
   ============================================ */
.btn-modern {
  position: relative;
  border: none;
  border-radius: var(--radius-full) !important;
  padding: 0.6rem 1.8rem;
  font-weight: 600;
  overflow: hidden;
  transition: all var(--transition-base);
  z-index: 1;
}

.btn-modern::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.6s ease;
  z-index: -1;
}

.btn-modern:hover::before {
  left: 100%;
}

.btn-modern.btn-primary {
  background: var(--primary-gradient);
  box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

.btn-modern.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
  transform: translateY(-2px);
}

.btn-modern.btn-success {
  background: linear-gradient(135deg, #43e97b, #38f9d7);
  box-shadow: 0 4px 15px rgba(67, 233, 123, 0.3);
  color: #1a1a2e;
}

.btn-modern.btn-warning {
  background: linear-gradient(135deg, #f093fb, #f5576c);
  box-shadow: 0 4px 15px rgba(245, 87, 108, 0.3);
}

/* Pulse animation for primary CTA */
.btn-pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 123, 255, 0.4); }
  70% { box-shadow: 0 0 0 12px rgba(0, 123, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 123, 255, 0); }
}

/* ============================================
   ⚡ Loading / Skeleton Screen
   ============================================ */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--glass-bg) 25%,
    rgba(255, 255, 255, 0.1) 50%,
    var(--glass-bg) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Page loader */
.page-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.page-loader.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--glass-border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   🌟 Animated Gradient Background for Hero
   ============================================ */
.hero-gradient {
  background: var(--primary-gradient);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  position: relative;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ============================================
   ✍️ Typewriter Effect
   ============================================ */
.typewriter {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  border-right: 2px solid var(--primary);
  animation:
    typewrite 3s steps(40) forwards,
    blink-caret 0.75s step-end infinite;
  max-width: fit-content;
}

@keyframes typewrite {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink-caret {
  from, to { border-color: transparent; }
  50% { border-color: var(--primary); }
}

/* ============================================
   🎯 Counter Animation
   ============================================ */
.counter-number {
  font-size: 2.5rem;
  font-weight: 800;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-block;
}

/* ============================================
   🖼️ Image Hover Effects
   ============================================ */
.img-reveal {
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.img-reveal img {
  transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.img-reveal:hover img {
  transform: scale(1.08);
}

/* ============================================
   🎨 Modern Badge / Tag Styles
   ============================================ */
.badge-modern {
  padding: 0.35em 0.8em;
  border-radius: var(--radius-full);
  font-weight: 500;
  font-size: 0.8rem;
  background: var(--primary-gradient);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
}

/* ============================================
   🖼 Card thumbnail image (inside list cards)
   ============================================ */
.card-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base);
}

.card-thumb:hover {
  transform: scale(1.15);
}

/* ============================================
   📱 Responsive Tweaks
   ============================================ */
@media (max-width: 768px) {
  #back-to-top {
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .floating-shape {
    opacity: 0.03;
  }

  .typewriter {
    white-space: normal;
    border-right: none;
    animation: none;
  }
}

/* ============================================
   🔄 Modern Theme Toggle (React Component)
   ============================================ */
.modern-theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: none;
  border-radius: var(--radius-full);
  background: var(--glass-bg);
  backdrop-filter: blur(4px);
  cursor: pointer;
  transition: all var(--transition-base);
  overflow: hidden;
}

.modern-theme-toggle:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-glow);
}

.modern-theme-toggle:active {
  transform: scale(0.95);
}

.theme-toggle-icons {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 1rem;
  line-height: 1;
}

.theme-icon {
  opacity: 0.3;
  transition: all var(--transition-bounce);
  transform: scale(0.7);
}

.theme-icon.active {
  opacity: 1;
  transform: scale(1);
}

.theme-icon.sun.active {
  filter: drop-shadow(0 0 4px rgba(255, 193, 7, 0.6));
}

.theme-icon.moon.active {
  filter: drop-shadow(0 0 4px rgba(102, 16, 242, 0.6));
}

.theme-toggle-track {
  position: relative;
  width: 28px;
  height: 14px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.15);
  transition: background var(--transition-base);
}

.dark-mode .theme-toggle-track {
  background: rgba(255, 255, 255, 0.2);
}

.theme-toggle-thumb {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  transition: all var(--transition-bounce);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.theme-toggle-thumb.light {
  left: 1px;
  background: linear-gradient(135deg, #ffc107, #ff9800);
}

.theme-toggle-thumb.dark {
  left: 15px;
  background: linear-gradient(135deg, #6610f2, #007bff);
}

.modern-theme-toggle.animating .theme-toggle-thumb {
  transform: scale(1.3);
}

/* ============================================
   ✨ Footer Social Icon Hover
   ============================================ */
.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  transition: all var(--transition-base);
  background: rgba(255, 255, 255, 0.05);
}

.social-icon:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-4px) scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Hover underline effect */
.hover-underline {
  position: relative;
  display: inline-block;
}

.hover-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary-gradient);
  transition: width var(--transition-base);
  border-radius: 1px;
}

.hover-underline:hover::after {
  width: 100%;
}

/* ============================================
   🛡️ Reduced Motion
   ============================================ */
/* ============================================
   📊 Modern Table Styles
   ============================================ */

/* ---------- Modern Glassmorphism Table ---------- */
.table-modern {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: box-shadow var(--transition-base);
}

.table-modern:hover {
  box-shadow: var(--shadow-lg);
}

/* Header */
.table-modern thead {
  background: var(--primary-gradient);
  position: sticky;
  top: 0;
  z-index: 2;
}

.table-modern thead th {
  padding: 0.85rem 1rem;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fff;
  border: none;
  white-space: nowrap;
  position: relative;
}

.table-modern thead th:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 0;
  top: 25%;
  height: 50%;
  width: 1px;
  background: rgba(255, 255, 255, 0.2);
}

/* Body rows */
.table-modern tbody tr {
  transition: all var(--transition-fast);
  background: var(--glass-bg);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

/* Alternating subtle rows */
.table-modern tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.08);
}

.table-modern tbody tr:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(1.005);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  position: relative;
  z-index: 1;
}

/* Active row / clicked */
.table-modern tbody tr:active {
  transform: scale(0.995);
}

/* Cells */
.table-modern tbody td {
  padding: 0.8rem 1rem;
  border: none;
  border-bottom: 1px solid var(--glass-border);
  vertical-align: middle;
  font-size: 0.95rem;
}

.table-modern tbody tr:last-child td {
  border-bottom: none;
}

/* Empty state inside table area */
.table-modern-empty {
  text-align: center;
  padding: 3rem 1rem;
  opacity: 0.6;
}

/* ---------- Table row actions ---------- */
.table-row-action {
  opacity: 0;
  transition: opacity var(--transition-fast);
}

tr:hover .table-row-action {
  opacity: 1;
}

/* ---------- Table inline badges (modern) ---------- */
.table-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.7rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.table-badge i {
  font-size: 0.7rem;
}

.table-badge-primary {
  background: var(--primary-light);
  color: var(--primary);
}

.table-badge-success {
  background: rgba(67, 233, 123, 0.15);
  color: #1a9e5c;
}

.table-badge-warning {
  background: rgba(255, 193, 7, 0.15);
  color: #b8860b;
}

tr:hover .table-badge {
  transform: scale(1.05);
}

/* ---------- Table image thumbnails ---------- */
.table-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  transition: transform var(--transition-base);
  box-shadow: var(--shadow-sm);
}

tr:hover .table-thumb {
  transform: scale(1.1);
  z-index: 10;
  position: relative;
  box-shadow: var(--shadow-lg);
}

/* ---------- Table audio button ---------- */
.table-audio-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--primary);
  transition: all var(--transition-fast);
  cursor: pointer;
  font-size: 0.85rem;
}

.table-audio-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 12px rgba(0, 123, 255, 0.3);
  transform: scale(1.1);
}

/* ---------- Table responsive wrapper improvements ---------- */
.table-responsive-modern {
  border-radius: var(--radius-lg);
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--glass-border) transparent;
}

.table-responsive-modern::-webkit-scrollbar {
  height: 6px;
}

.table-responsive-modern::-webkit-scrollbar-track {
  background: transparent;
}

.table-responsive-modern::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 3px;
}

/* Row appearing animation (when scrolling or loading) */
.table-row-enter {
  animation: tableRowEnter 0.4s ease-out both;
}

.table-row-enter:nth-child(1) { animation-delay: 0.02s; }
.table-row-enter:nth-child(2) { animation-delay: 0.04s; }
.table-row-enter:nth-child(3) { animation-delay: 0.06s; }
.table-row-enter:nth-child(4) { animation-delay: 0.08s; }
.table-row-enter:nth-child(5) { animation-delay: 0.10s; }
.table-row-enter:nth-child(6) { animation-delay: 0.12s; }
.table-row-enter:nth-child(7) { animation-delay: 0.14s; }
.table-row-enter:nth-child(8) { animation-delay: 0.16s; }
.table-row-enter:nth-child(9) { animation-delay: 0.18s; }
.table-row-enter:nth-child(10) { animation-delay: 0.20s; }
.table-row-enter:nth-child(11) { animation-delay: 0.22s; }
.table-row-enter:nth-child(12) { animation-delay: 0.24s; }
.table-row-enter:nth-child(13) { animation-delay: 0.26s; }
.table-row-enter:nth-child(14) { animation-delay: 0.28s; }
.table-row-enter:nth-child(15) { animation-delay: 0.30s; }

@keyframes tableRowEnter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Dark Mode overrides for tables ---------- */
.dark-mode .table-modern {
  --glass-bg: rgba(255, 255, 255, 0.03);
  box-shadow: var(--shadow-md);
}

.dark-mode .table-modern tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.05);
}

.dark-mode .table-modern tbody tr:hover {
  background: rgba(255, 255, 255, 0.1);
}

.dark-mode .table-badge-primary {
  background: rgba(0, 123, 255, 0.2);
  color: #6ab0ff;
}

.dark-mode .table-badge-success {
  background: rgba(67, 233, 123, 0.15);
  color: #4ade80;
}

.dark-mode .table-badge-warning {
  background: rgba(255, 193, 7, 0.15);
  color: #fbbf24;
}

/* ============================================
   🃏 Modern Card List Styles (Card View)
   ============================================ */

/* ---------- List card (for word/sentence/alphabet cards) ---------- */
.card-list {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
  cursor: pointer;
  height: 100%;
}

.card-list:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  border-color: rgba(0, 123, 255, 0.2);
}

.card-list:active {
  transform: translateY(-2px);
}

.card-list .card-body {
  padding: var(--space-lg);
}

/* Card entrance animation (staggered) */
.card-enter {
  animation: cardEnter 0.5s ease-out both;
}

.card-enter:nth-child(1) { animation-delay: 0.03s; }
.card-enter:nth-child(2) { animation-delay: 0.06s; }
.card-enter:nth-child(3) { animation-delay: 0.09s; }
.card-enter:nth-child(4) { animation-delay: 0.12s; }
.card-enter:nth-child(5) { animation-delay: 0.15s; }
.card-enter:nth-child(6) { animation-delay: 0.18s; }
.card-enter:nth-child(7) { animation-delay: 0.21s; }
.card-enter:nth-child(8) { animation-delay: 0.24s; }
.card-enter:nth-child(9) { animation-delay: 0.27s; }
.card-enter:nth-child(10) { animation-delay: 0.30s; }
.card-enter:nth-child(11) { animation-delay: 0.33s; }
.card-enter:nth-child(12) { animation-delay: 0.36s; }
.card-enter:nth-child(13) { animation-delay: 0.39s; }
.card-enter:nth-child(14) { animation-delay: 0.42s; }
.card-enter:nth-child(15) { animation-delay: 0.45s; }
.card-enter:nth-child(16) { animation-delay: 0.48s; }
.card-enter:nth-child(17) { animation-delay: 0.51s; }
.card-enter:nth-child(18) { animation-delay: 0.54s; }
.card-enter:nth-child(19) { animation-delay: 0.57s; }
.card-enter:nth-child(20) { animation-delay: 0.60s; }

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ---------- Card title bar with badges ---------- */
.card-list .card-title-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.card-list .card-title-bar .badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.25em 0.7em;
  border-radius: var(--radius-full);
}

/* ---------- Card main content ---------- */
.card-list .card-word {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.4;
}

.card-list .card-translation {
  font-size: 1rem;
  font-weight: 500;
  color: var(--bs-secondary-color, #6c757d);
  line-height: 1.4;
}

/* ---------- Card media row (audio+image) ---------- */
.card-list .card-media {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.card-list .card-media img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  transition: transform var(--transition-base);
}

.card-list:hover .card-media img {
  transform: scale(1.1);
}

/* ---------- Dark mode overrides for card-list ---------- */
.dark-mode .card-list {
  --glass-bg: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.06);
}

.dark-mode .card-list:hover {
  border-color: rgba(102, 16, 242, 0.3);
}

.dark-mode .card-list .card-translation {
  color: #aaa;
}

/* ---------- Sub-table inside accordion collapses (word_details modal) ---------- */
.table-sub {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.885rem;
  margin-top: 0.5rem;
}

.table-sub thead th {
  padding: 0.6rem 0.85rem;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--bs-secondary-color, #6c757d);
  background: rgba(0, 0, 0, 0.03);
  border-bottom: 2px solid var(--glass-border);
  white-space: nowrap;
}

.table-sub tbody tr {
  transition: background var(--transition-fast);
}

.table-sub tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.015);
}

.table-sub tbody tr:hover {
  background: rgba(0, 123, 255, 0.04);
}

.table-sub tbody td {
  padding: 0.55rem 0.85rem;
  border: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  vertical-align: middle;
}

.table-sub tbody tr:last-child td {
  border-bottom: none;
}

.table-sub .fw-semibold {
  font-weight: 600;
}

.table-sub tbody tr:active {
  transform: none;
}

/* Dark mode */
.dark-mode .table-sub thead th {
  background: rgba(255, 255, 255, 0.05);
  color: #aaa;
}

.dark-mode .table-sub tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.dark-mode .table-sub tbody tr:hover {
  background: rgba(255, 255, 255, 0.06);
}

.dark-mode .table-sub tbody td {
  border-color: rgba(255, 255, 255, 0.04);
}

/* Sub-table count badge (inside table-sub) */
.table-sub-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 700;
}

/* ---------- Compact mini table inside cards (alphabet example words) ---------- */
.table-mini-modern {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  font-size: 0.85rem;
}

.table-mini-modern tbody tr {
  transition: background var(--transition-fast);
}

.table-mini-modern tbody tr:hover {
  background: rgba(255, 255, 255, 0.1);
}

.table-mini-modern td {
  padding: 0.3rem 0.5rem;
  border: none;
  border-bottom: 1px solid var(--glass-border);
  vertical-align: middle;
}

.table-mini-modern tbody tr:last-child td {
  border-bottom: none;
}

.table-mini-modern .table-mini-audio {
  width: 32px;
}

.table-mini-modern .table-mini-word {
  font-weight: 600;
}

.dark-mode .table-mini-modern tbody tr:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* ============================================
   📄 Modern Pagination Styles
   ============================================ */

/* ---------- Pagination wrapper ---------- */
.pagination-wrapper {
  margin-top: var(--space-xl);
  margin-bottom: var(--space-lg);
}

/* ---------- Top bar: summary + per-page selector ---------- */
.pagination-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--glass-bg);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.pagination-info-text {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--bs-secondary-color, #6c757d);
  white-space: nowrap;
}

/* Per-page select */
.pagination-per-page {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.per-page-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--bs-secondary-color, #6c757d);
  margin: 0;
  white-space: nowrap;
}

.per-page-select {
  padding: 0.3rem 1.8rem 0.3rem 0.6rem;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  background: var(--glass-bg);
  color: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%236c757d' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 10px 6px;
  min-width: 70px;
}

.per-page-select:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.per-page-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* ---------- Modern pagination nav ---------- */
.pagination-modern {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
  margin: 0;
}

.pagination-modern .page-item {
  margin: 0;
}

.pagination-modern .page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0.3rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm) !important;
  background: var(--glass-bg);
  color: inherit;
  transition: all var(--transition-fast);
  position: relative;
  text-decoration: none;
  line-height: 1;
}

.pagination-modern .page-link:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  z-index: 1;
}

.pagination-modern .page-link:active {
  transform: translateY(0);
}

/* Active page */
.pagination-modern .page-item.active .page-link {
  background: var(--primary-gradient);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
  font-weight: 700;
}

/* Disabled */
.pagination-modern .page-item.disabled .page-link {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Prev / Next buttons with icons */
.page-link-prev,
.page-link-next {
  gap: 4px;
}

.page-link-prev .page-link-text,
.page-link-next .page-link-text {
  display: inline;
}

@media (max-width: 576px) {
  .page-link-prev .page-link-text,
  .page-link-next .page-link-text {
    display: none;
  }

  .page-link-prev,
  .page-link-next {
    min-width: 38px;
    padding: 0.3rem 0.5rem;
  }

  .pagination-top-bar {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .pagination-per-page {
    justify-content: center;
  }

  .pagination-modern .page-link {
    min-width: 34px;
    height: 34px;
    font-size: 0.8rem;
  }
}

/* Ellipsis */
.page-link-ellipsis {
  letter-spacing: 2px;
  cursor: default;
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

/* ---------- Dark mode overrides for pagination ---------- */
.dark-mode .pagination-top-bar {
  --glass-bg: rgba(255, 255, 255, 0.05);
  background: var(--card-bg, hsl(240, 10%, 14%));
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--text-primary, #e8e8f0);
}

.dark-mode .pagination-top-bar .pagination-info-text {
  color: var(--text-secondary, #a0a0b0);
}

.dark-mode .per-page-label {
  color: var(--text-secondary, #a0a0b0);
}

.dark-mode .per-page-select {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: #eee;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23aaa' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
}

.dark-mode .per-page-select:hover {
  border-color: #6610f2;
  box-shadow: 0 0 0 2px rgba(102, 16, 242, 0.25);
}

.dark-mode .per-page-select:focus {
  border-color: #6610f2;
  box-shadow: 0 0 0 3px rgba(102, 16, 242, 0.3);
}

.dark-mode .pagination-modern .page-link {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  color: #ddd;
}

.dark-mode .pagination-modern .page-link:hover {
  background: rgba(102, 16, 242, 0.2);
  color: #b388ff;
  border-color: #6610f2;
}

.dark-mode .pagination-modern .page-item.active .page-link {
  background: linear-gradient(135deg, #6610f2, #007bff);
  color: #fff;
  box-shadow: 0 2px 8px rgba(102, 16, 242, 0.4);
}

.dark-mode .pagination-modern .page-item.disabled .page-link {
  opacity: 0.3;
}

.dark-mode .page-link-ellipsis {
  color: #777 !important;
}


/* ============================================
   🎮 Game Components Styles
   ============================================ */

/* ── Gradient text ── */
.gradient-text {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Fade-in animation ── */
.animate-fade-in {
  animation: fadeIn 0.4s ease-out both;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Card exit animation (for question transitions) ── */
.card-exit {
  animation: cardExit 0.2s ease-in both;
}

@keyframes cardExit {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-10px) scale(0.97); }
}

/* ── Choice buttons (WordRandom) ── */
.choice-btn {
  transition: all 0.3s ease;
  font-weight: 600;
  border-radius: var(--radius-md, 12px) !important;
  position: relative;
  overflow: hidden;
}

.choice-btn:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.2);
}

.choice-btn:not(:disabled):active {
  transform: translateY(0);
}

.btn-outline-secondary.choice-btn {
  border-color: var(--glass-border);
  color: inherit;
}

.pulse-success {
  animation: pulseSuccess 0.5s ease;
}

@keyframes pulseSuccess {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.shake-danger {
  animation: shakeDanger 0.4s ease;
}

@keyframes shakeDanger {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* ── Sortable list (SentenceReorder) ── */
.sortable-list-modern {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  border: 2px dashed var(--glass-border);
  border-radius: var(--radius-lg, 16px);
  background: rgba(0, 123, 255, 0.03);
  min-height: 100px;
  transition: all 0.3s ease;
}

.dark-mode .sortable-list-modern {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.02);
}

.word-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 1.1rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-full, 9999px);
  transition: all 0.3s ease;
  position: relative;
  animation: wordChipEnter 0.3s ease-out both;
}

@keyframes wordChipEnter {
  from { opacity: 0; transform: scale(0.85) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.word-chip-draggable {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  cursor: grab;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
  user-select: none;
}

.word-chip-draggable:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.word-chip-draggable:active {
  cursor: grabbing;
  transform: scale(1.08);
}

.dark-mode .word-chip-draggable {
  background: linear-gradient(135deg, #6610f2, #007bff);
  box-shadow: 0 4px 12px rgba(102, 16, 242, 0.3);
}

.word-chip-dragover {
  transform: scale(1.1) !important;
  box-shadow: 0 0 20px rgba(0, 123, 255, 0.3);
  z-index: 2;
}

.word-chip-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  font-size: 0.75rem;
  font-weight: 700;
  margin-right: 2px;
}

/* ── Tracking wider utility ── */
.tracking-wider {
  letter-spacing: 0.08em;
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }

  .reveal,
  .reveal-left,
  .reveal-right,
  .reveal-scale {
    opacity: 1;
    transform: none;
  }

  .table-row-enter {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .card-enter {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* ============================================
   ⬆ Level-Up Animations
   ============================================ */

/* Level-up badge bounce */
.level-up-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  animation: levelUpBounce 0.6s ease-out;
}
@keyframes levelUpBounce {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.3); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); opacity: 1; }
}

/* Level-up glow pulse (for the navbar badge) */
.level-up-glow {
  animation: glowPulse 1.5s ease-in-out 3;
}
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 5px rgba(23, 162, 184, 0.5); }
  50% { box-shadow: 0 0 25px rgba(23, 162, 184, 0.9), 0 0 50px rgba(23, 162, 184, 0.4); }
}

/* Confetti-like particles for level-up */
.level-up-confetti {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}
.level-up-confetti::before,
.level-up-confetti::after {
  content: '🎉';
  position: absolute;
  font-size: 2rem;
  animation: confettiFall 2s ease-out forwards;
}
.level-up-confetti::before { left: 20%; animation-delay: 0s; }
.level-up-confetti::after { left: 75%; animation-delay: 0.3s; }

@keyframes confettiFall {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* Multi-confetti (for JS-generated particles) */
.confetti-piece {
  position: fixed;
  width: 10px;
  height: 10px;
  pointer-events: none;
  z-index: 10000;
  animation: confettiExplode 1.5s ease-out forwards;
}
@keyframes confettiExplode {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx, 100px), var(--dy, -200px)) scale(0); opacity: 0; }
}

/* XP gained — slide-up counter */
.xp-gained-fly {
  animation: xpFlyUp 1s ease-out forwards;
}
@keyframes xpFlyUp {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(-40px); opacity: 0; }
}

/* Level-up modal backdrop */
.level-up-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: overlayFadeIn 0.3s ease-out;
}
@keyframes overlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.level-up-modal {
  background: var(--glass-bg, rgba(255,255,255,0.95));
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 2.5rem;
  text-align: center;
  max-width: 400px;
  animation: modalZoomIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
@keyframes modalZoomIn {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ============================================
   🎨 Theme System — User-Selectable Color Schemes
   Applied to <body> via the "theme-*" class.
   ============================================ */

/* ── Default: Blue-Violet ──────────────────── */
body.theme-default {
  --primary-h: 211;
  --primary-s: 100%;
  --primary-l: 50%;
}

/* ── Savanna Green ──────────────────────────── */
body.theme-savanna {
  --primary-h: 142;
  --primary-s: 70%;
  --primary-l: 37%;
}

/* ── African Sunset / Orange ────────────────── */
body.theme-sunset {
  --primary-h: 18;
  --primary-s: 85%;
  --primary-l: 50%;
}

/* ── Bogolan Earth / Brown ──────────────────── */
body.theme-earth {
  --primary-h: 30;
  --primary-s: 60%;
  --primary-l: 35%;
}

/* ── Niger River / Teal ─────────────────────── */
body.theme-river {
  --primary-h: 196;
  --primary-s: 85%;
  --primary-l: 40%;
}

/* ── Kente Gold / Gold ──────────────────────── */
body.theme-gold {
  --primary-h: 45;
  --primary-s: 95%;
  --primary-l: 48%;
}

/* ── Shared: Theme-aware tokens ── */
body.theme-savanna,
body.theme-sunset,
body.theme-earth,
body.theme-river,
body.theme-gold {
  --primary: hsl(var(--primary-h), var(--primary-s), var(--primary-l));
  --primary-dark: hsl(var(--primary-h), var(--primary-s), 40%);
  --primary-light: hsl(var(--primary-h), var(--primary-s), 90%);
  --primary-gradient: linear-gradient(135deg,
    hsl(var(--primary-h), var(--primary-s), var(--primary-l)),
    hsl(calc(var(--primary-h) + 60), var(--primary-s), calc(var(--primary-l) + 10%))
  );
  --shadow-glow: 0 0 24px hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.25);
}

/* ── Smooth body transitions when switching themes ── */
body.theme-savanna,
body.theme-sunset,
body.theme-earth,
body.theme-river,
body.theme-gold {
  transition: background 0.3s ease, color 0.3s ease;
}

/* ============================================
   🪟 Word & Sentence Detail Modals — Dark Mode
   ============================================ */
.dark-mode .modal-content {
  background: var(--modal-bg, hsl(240, 10%, 18%));
  color: var(--text-primary, #e8e8f0);
}

.dark-mode .modal-content .modal-body {
  background: var(--card-bg, hsl(240, 10%, 14%)) !important;
  color: var(--text-primary, #e8e8f0);
}

.dark-mode .modal-content .modal-body .text-muted,
.dark-mode .modal-content .modal-body .text-secondary {
  color: var(--text-secondary, #a0a0b0) !important;
}

.dark-mode .modal-content .accordion-item {
  background: var(--card-bg, hsl(240, 10%, 14%));
  border-color: rgba(255, 255, 255, 0.08);
}

.dark-mode .modal-content .accordion-button {
  background: var(--card-bg, hsl(240, 10%, 14%));
  color: var(--text-primary, #e8e8f0);
}

.dark-mode .modal-content .accordion-button:not(.collapsed) {
  background: rgba(102, 16, 242, 0.15);
  color: #b388ff;
}

.dark-mode .modal-content .accordion-body {
  background: var(--card-bg, hsl(240, 10%, 14%));
  color: var(--text-primary, #e8e8f0);
}

.dark-mode .modal-content .table {
  color: var(--text-primary, #e8e8f0);
}

/* ============================================
   💬 Dialogue View — Phase 1 Improvements
   ============================================ */

/* ── Bubble entrance animation ── */
@keyframes bubbleEnter {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ── Typing indicator dots ── */
.typing-dots {
  background: var(--glass-bg, rgba(255, 255, 255, 0.2));
  border-radius: 20px;
  backdrop-filter: blur(4px);
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary, #007bff);
  display: inline-block;
  animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

/* ── Avatar speaking animation ── */
.avatar-speaking {
  animation: avatarTalk 0.3s infinite alternate ease-in-out;
}

@keyframes avatarTalk {
  from { transform: scale(1); }
  to { transform: scale(1.05); box-shadow: 0 0 0 3px #28a745, 0 2px 12px rgba(40, 167, 69, 0.3); }
}

/* ── Audio playing pulse ── */
.audio-icon.audio-playing {
  animation: audioPulse 0.8s infinite alternate;
  color: #28a745 !important;
}

@keyframes audioPulse {
  from { transform: scale(1); opacity: 0.8; }
  to { transform: scale(1.2); opacity: 1; }
}

/* ── Slow mode word highlighting ── */
.slow-word {
  transition: background 0.2s ease, color 0.2s ease;
  padding: 0 1px;
  border-radius: 3px;
}

.slow-word.word-highlighted {
  background: rgba(255, 193, 7, 0.4);
  color: inherit;
  font-weight: 700;
}

/* ── Dialogue progress bar hover ── */
.dialogue-progress div:hover {
  transform: scaleY(1.3);
  opacity: 0.8 !important;
}

/* ── Scrollbar styling for dialogue box ── */
.dialogue-box-scroll::-webkit-scrollbar {
  width: 6px;
}

.dialogue-box-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.dialogue-box-scroll::-webkit-scrollbar-thumb {
  background: rgba(0, 123, 255, 0.3);
  border-radius: 3px;
}

.dialogue-box-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 123, 255, 0.5);
}

/* ── Dark mode adjustments ── */
.dark-mode .dialogue-container-main {
  border-color: rgba(255, 255, 255, 0.1) !important;
}

.dark-mode .dialogue-bubble-content {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.dark-mode .bubble-left .dialogue-bubble-content {
  background: linear-gradient(135deg, hsl(240, 10%, 22%), hsl(240, 10%, 18%)) !important;
  color: #e8e8f0 !important;
}

.dark-mode .typing-dots {
  background: rgba(255, 255, 255, 0.08);
}

.dark-mode .dialogue-progress {
  background: rgba(255, 255, 255, 0.08) !important;
}

/* ── Dialogue ended celebration ── */
.dialogue-ended {
  animation: fadeInUp 0.6s ease-out forwards;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   🗣️ Phase 2 — Dialogue Enhancements
   ============================================ */

/* ── Speed selector ── */
.dialogue-speed-btn {
  font-size: 0.75rem !important;
  font-weight: 700 !important;
  min-width: 42px;
  transition: all 0.2s ease;
}
.dialogue-speed-btn.active-speed {
  background: var(--primary-gradient) !important;
  color: #fff !important;
  border-color: transparent !important;
  box-shadow: 0 2px 8px rgba(0,123,255,0.3);
}

/* ── Vocabulary panel (slide-out) ── */
.vocab-panel-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1040;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}
.vocab-panel-overlay.open {
  opacity: 1;
  visibility: visible;
}

.vocab-panel {
  position: fixed;
  top: 0; right: -420px;
  width: 400px;
  max-width: 90vw;
  height: 100vh;
  background: var(--modal-bg, #fff);
  z-index: 1050;
  overflow-y: auto;
  transition: right 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: -8px 0 30px rgba(0,0,0,0.15);
  padding: 20px;
}
.vocab-panel.open {
  right: 0;
}
.vocab-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--glass-border);
}
.vocab-panel-header h5 {
  margin: 0;
  font-weight: 700;
}
.vocab-word-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  cursor: default;
}
.vocab-word-item:hover {
  background: var(--glass-bg);
}
.vocab-word-item .vocab-word {
  font-weight: 700;
  flex: 1;
}
.vocab-word-item .vocab-trans {
  font-size: 0.85rem;
  opacity: 0.7;
  flex: 1;
}
.vocab-word-item .vocab-audio-btn {
  width: 30px; height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.85rem;
}
.vocab-word-item .vocab-audio-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.vocab-word-item .vocab-add-btn {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

/* ── Quiz styles ── */
.quiz-container {
  animation: fadeInUp 0.4s ease-out;
}
.quiz-question {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
  line-height: 1.5;
}
.quiz-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  margin-bottom: 8px;
  border: 2px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  transition: all 0.2s ease;
  cursor: pointer;
  font-weight: 500;
}
.quiz-option:hover:not(.quiz-option-disabled) {
  border-color: var(--primary);
  background: var(--primary-light);
}
.quiz-option.correct {
  border-color: #28a745 !important;
  background: rgba(40,167,69,0.1) !important;
  color: #28a745;
}
.quiz-option.incorrect {
  border-color: #dc3545 !important;
  background: rgba(220,53,69,0.1) !important;
  color: #dc3545;
}
.quiz-option-disabled {
  cursor: default;
  opacity: 0.7;
}
.quiz-score {
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
}
.quiz-score .score-number {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Skeleton loading ── */
.skeleton-line {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.skeleton-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
}
.skeleton-bubble {
  height: 60px;
  border-radius: var(--radius-lg);
  flex: 1;
}
.skeleton-bubble-left {
  border-bottom-left-radius: 4px;
}
.skeleton-bubble-right {
  border-bottom-right-radius: 4px;
}

/* ── Keyboard shortcuts hint ── */
.keyboard-hint {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--modal-bg, #fff);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 12px 20px;
  z-index: 1060;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  max-width: 90vw;
}
.keyboard-hint.open {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.keyboard-hint-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 20px;
}
.keyboard-hint-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 26px;
  padding: 0 6px;
  border-radius: 4px;
  background: rgba(0,0,0,0.06);
  border: 1px solid rgba(0,0,0,0.1);
  font-family: monospace;
  font-size: 0.75rem;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.dark-mode .kbd {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.15);
}

/* ── Resume prompt ── */
.resume-prompt {
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
  text-align: center;
  animation: fadeInUp 0.4s ease-out;
}

/* ── Error banner ── */
.dialogue-error {
  text-align: center;
  padding: 40px 20px;
}
.dialogue-error h4 {
  margin-bottom: 12px;
}

/* ── Responsive dialogue: full-width bubbles on mobile ── */
@media (max-width: 576px) {
  .dialogue-bubble-content {
    max-width: 90% !important;
  }
  .dialogue-container-main {
    height: 380px !important;
  }
  .vocab-panel {
    width: 100vw !important;
    max-width: 100vw !important;
    right: -100vw;
  }
  .vocab-panel.open {
    right: 0;
  }
  .quiz-option {
    font-size: 0.9rem;
    padding: 10px 14px;
  }
  .keyboard-hint {
    bottom: 70px;
    padding: 10px 14px;
  }
  .keyboard-hint-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Dark mode overrides ── */
.dark-mode .vocab-panel {
  border-left: 1px solid rgba(255,255,255,0.08);
}
.dark-mode .quiz-option {
  border-color: rgba(255,255,255,0.12);
}
.dark-mode .quiz-option:hover:not(.quiz-option-disabled) {
  background: rgba(102,16,242,0.15);
  border-color: #6610f2;
}
.dark-mode .quiz-option.correct {
  border-color: #28a745 !important;
  background: rgba(40,167,69,0.15) !important;
}
.dark-mode .quiz-option.incorrect {
  border-color: #dc3545 !important;
  background: rgba(220,53,69,0.15) !important;
}


/* ================================
   Revision Cards
   ================================ */
.revision-card {
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  background: var(--card-bg, #fff);
  height: 100%;
}
.revision-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.10);
}
.revision-card .card-body {
  display: flex;
  flex-direction: column;
}
.revision-card .card-word {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--heading-color, #2d2d2d);
}
.revision-card .card-translation {
  font-size: 0.95rem;
  color: var(--text-muted, #6c757d);
  flex-grow: 1;
}
.revision-score-badge {
  background: rgba(255,193,7,0.15);
  color: #856404;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}
.revision-next-badge {
  background: rgba(13,110,253,0.1);
  color: #0d6efd;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 20px;
}
.revision-progress {
  border-radius: 10px;
  background: rgba(0,0,0,0.06);
}

/* Dark mode overrides */
.dark-mode .revision-card {
  border-color: rgba(255,255,255,0.10);
  background: var(--card-bg-dark, #1e1e24);
}
.dark-mode .revision-card .card-word {
  color: #e8e8e8;
}
.dark-mode .revision-card .card-translation {
  color: #a0a0b0;
}
.dark-mode .revision-progress {
  background: rgba(255,255,255,0.08);
}
.dark-mode .revision-score-badge {
  background: rgba(255,193,7,0.2);
  color: #ffc107;
}
.dark-mode .revision-next-badge {
  background: rgba(13,110,253,0.2);
  color: #6ea8fe;
}

/* ── Clickable revision card ── */
.revision-card-clickable {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  border: 1px solid var(--glass-border, rgba(0,0,0,0.08));
}
.revision-card-clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border-color: var(--primary, #007bff);
}
.revision-card-clickable:focus-visible {
  outline: 2px solid var(--primary, #007bff);
  outline-offset: 2px;
}

/* ⭐ Revision star indicator in word list */
.revision-star {
  display: inline-flex;
  align-items: center;
  animation: revStarPop 0.3s ease;
}
.revision-star:hover {
  animation: revStarPop 0.3s ease;
}
@keyframes revStarPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* ============================================
   🅲 Conjugation View Styles
   ============================================ */

/* ---------- Conjugation table cells ---------- */
.conj-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.85rem;
  line-height: 1.3;
}

.conj-affirmative {
  color: var(--bs-success, #28a745);
  font-weight: 500;
}

.conj-negative {
  color: var(--bs-danger, #dc3545);
  font-weight: 500;
}

.conj-divider {
  color: var(--text-secondary, #6c757d);
  font-size: 0.75rem;
  margin: 0 2px;
}

/* Table header for conjugation columns */
.table-conjugation thead th {
  font-size: 0.75rem;
  white-space: nowrap;
}

/* ---------- Conjugation card forms (borderless table) ---------- */
.table-conj-card {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.table-conj-card td {
  padding: 3px 0;
  border: none;
  vertical-align: baseline;
  line-height: 1.4;
}

.table-conj-card td.conj-card-label {
  font-weight: 600;
  color: var(--text-secondary, #6c757d);
  width: 1%;
  white-space: nowrap;
  text-transform: capitalize;
  font-size: 0.8rem;
  padding-right: 12px;
}

.table-conj-card td.conj-card-values {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  font-size: 0.85rem;
}

/* Dark mode adjustments */
.dark-mode .conj-affirmative {
  color: #4ade80;
}

.dark-mode .conj-negative {
  color: #f87171;
}

.dark-mode .table-conj-card td.conj-card-label {
  color: #a0a0b0;
}

/* ============================================
   🌟 Student Dashboard Styles
   ============================================ */

/* ---------- Glass Card Base ---------- */
.card-glass {
  background: var(--glass-bg, rgba(255, 255, 255, 0.15));
  backdrop-filter: blur(var(--glass-blur, 12px));
  -webkit-backdrop-filter: blur(var(--glass-blur, 12px));
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.25));
  border-radius: var(--radius-md, 12px);
  box-shadow: var(--glass-shadow, 0 8px 32px 0 rgba(31, 38, 135, 0.15));
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-glass:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.2);
}

/* ---------- Gradient Text ---------- */
.gradient-text {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ---------- Modern Badge ---------- */
.badge-modern {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--radius-full, 9999px);
  font-weight: 600;
  font-size: 0.8rem;
  background: var(--primary-gradient);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.25);
  white-space: nowrap;
}

/* ---------- Modern Buttons ---------- */
.btn-modern {
  border-radius: var(--radius-full, 9999px) !important;
  font-weight: 600;
  padding: 0.5rem 1.25rem;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.btn-modern.btn-primary {
  background: var(--primary-gradient);
  border: none;
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 123, 255, 0.3);
}

.btn-modern.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

.btn-modern.btn-outline-primary {
  border: 2px solid var(--primary);
  color: var(--primary);
  background: transparent;
}

.btn-modern.btn-outline-primary:hover {
  background: var(--primary-gradient);
  color: #fff;
  border-color: transparent;
  transform: translateY(-1px);
}

.btn-modern.btn-outline-success {
  border: 2px solid #198754;
  color: #198754;
  background: transparent;
}

.btn-modern.btn-outline-success:hover {
  background: linear-gradient(135deg, #198754, #20c997);
  color: #fff;
  border-color: transparent;
  transform: translateY(-1px);
}

.btn-modern.btn-outline-info {
  border: 2px solid #0dcaf0;
  color: #0dcaf0;
  background: transparent;
}

.btn-modern.btn-outline-info:hover {
  background: linear-gradient(135deg, #0dcaf0, #0d6efd);
  color: #fff;
  border-color: transparent;
  transform: translateY(-1px);
}

/* ---------- Table Badge (small colored label) ---------- */
.table-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: var(--radius-full, 9999px);
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-secondary, #6c757d);
  white-space: nowrap;
}

.table-badge-success {
  background: rgba(25, 135, 84, 0.12);
  color: #198754;
}

/* ---------- Animations ---------- */
.animate-fade-in {
  animation: fadeIn 0.4s ease both;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Staggered card entrance */
.card-enter {
  animation: cardEnter 0.5s ease both;
}

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ---------- Avatar Circles ---------- */
.avatar-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #fff;
  font-size: 16px;
}

.avatar-circle-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
}

.avatar-circle-lg {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #fff;
  font-size: 22px;
}

.event-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.last-border-0:last-child {
  border-bottom: none !important;
}

.min-width-0 {
  min-width: 0;
}
