/* ==========================================================================
   JLEARN MODERN DESIGN ENHANCEMENTS
   Smooth animations, modern layout, responsive improvements, loading states
   Load after styles.css to enhance and override
   ========================================================================== */

/* --------------------------------------------------------------------------
   ERROR MODAL STYLES
   -------------------------------------------------------------------------- */
.error-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 100000;
    backdrop-filter: blur(4px);
}

.error-modal-content {
    background: white;
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn var(--duration-normal) var(--ease-out);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.error-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid #e5e7eb;
}

.error-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: #1f2937;
}

.error-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: background var(--duration-fast);
}

.error-modal-close:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.error-modal-body {
    padding: var(--space-6);
    text-align: center;
}

.error-icon {
    font-size: 3rem;
    color: #ef4444;
    margin-bottom: var(--space-4);
}

.error-modal-body p {
    margin: 0 0 var(--space-4);
    color: #4b5563;
    font-size: 1rem;
    line-height: 1.5;
}

.error-details {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-sm);
    padding: var(--space-3);
    margin-top: var(--space-4);
    text-align: left;
    font-family: monospace;
    font-size: 0.875rem;
    color: #6b7280;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.error-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid #e5e7eb;
}

.error-modal-footer .btn {
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration-fast);
    border: none;
}

.error-modal-footer .btn-primary {
    background: #4f46e5;
    color: white;
}

.error-modal-footer .btn-primary:hover {
    background: #4338ca;
}

.error-modal-footer .btn-secondary {
    background: #f3f4f6;
    color: #1f2937;
}

.error-modal-footer .btn-secondary:hover {
    background: #e5e7eb;
}

/* --------------------------------------------------------------------------
   KEYBOARD SHORTCUTS MODAL STYLES
   -------------------------------------------------------------------------- */
.help-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100001;
    backdrop-filter: blur(4px);
}

.help-modal-content {
    background: white;
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn var(--duration-normal) var(--ease-out);
}

.help-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid #e5e7eb;
}

.help-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #1f2937;
}

.help-modal-header .close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: background var(--duration-fast);
}

.help-modal-header .close-btn:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.help-modal-body {
    padding: var(--space-6);
    overflow-y: auto;
}

.help-modal-body table {
    width: 100%;
    border-collapse: collapse;
}

.help-modal-body thead {
    background: #f9fafb;
}

.help-modal-body th,
.help-modal-body td {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.help-modal-body th {
    font-weight: 600;
    color: #1f2937;
}

.help-modal-body td {
    color: #4b5563;
}

.help-modal-body kbd {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 2px 6px;
    font-family: monospace;
    font-size: 0.875rem;
    color: #1f2937;
}

.quick-search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 20vh;
    z-index: 100001;
    backdrop-filter: blur(4px);
}

.quick-search-content {
    background: white;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn var(--duration-normal) var(--ease-out);
}

.quick-search-content input {
    width: 100%;
    padding: var(--space-4);
    border: none;
    border-bottom: 1px solid #e5e7eb;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    font-size: 1rem;
    outline: none;
}

.quick-search-results {
    max-height: 300px;
    overflow-y: auto;
    padding: var(--space-3);
}

/* --------------------------------------------------------------------------
   1. MODERN DESIGN TOKENS (CSS Variables)
   -------------------------------------------------------------------------- */
:root {
  /* Smooth easing curves */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);

  /* Animation durations */
  --duration-fast: 0.15s;
  --duration-normal: 0.3s;
  --duration-slow: 0.5s;
  --duration-page: 0.6s;

  /* Modern shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 0 3px rgba(79, 70, 229, 0.15);

  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.5);
  --glass-blur: 16px;

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

  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* Typography */
  --font-sans: 'Inter', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;

  /* Z-index scale */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  --z-toast: 1080;
  --z-loader: 1090;
}

[data-theme="dark"] {
  --glass-bg: rgba(15, 23, 42, 0.72);
  --glass-border: rgba(255, 255, 255, 0.08);
}

/* --------------------------------------------------------------------------
   2. GLOBAL BASE STYLES
   -------------------------------------------------------------------------- */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-sans);
  min-height: 100vh;
  overflow-x: hidden;
  /* Prevent layout shifts */
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* Smooth scrolling for anchor links without jumping */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   3. MODERN SCROLLBAR
   -------------------------------------------------------------------------- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-color);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-color);
  transition: background var(--duration-fast) var(--ease-smooth);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--text-muted) var(--bg-color);
}

/* --------------------------------------------------------------------------
   4. SMOOTH PAGE TRANSITIONS
   -------------------------------------------------------------------------- */
.page {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

.page.active {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered children animation for active pages */
.page.active > * {
  animation: fadeInUp 0.5s var(--ease-out) both;
}

.page.active > *:nth-child(1) { animation-delay: 0.05s; }
.page.active > *:nth-child(2) { animation-delay: 0.1s; }
.page.active > *:nth-child(3) { animation-delay: 0.15s; }
.page.active > *:nth-child(4) { animation-delay: 0.2s; }
.page.active > *:nth-child(5) { animation-delay: 0.25s; }
.page.active > *:nth-child(6) { animation-delay: 0.3s; }

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

/* Slide in from different directions */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Page transition classes */
.page-transition-enter {
  animation: fadeInUp 0.4s var(--ease-out) forwards;
}

.page-transition-exit {
  animation: fadeOut 0.3s var(--ease-in) forwards;
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* --------------------------------------------------------------------------
   5. GLOBAL LOADING STATES
   -------------------------------------------------------------------------- */
#global-loader,
.global-loader {
  position: fixed;
  inset: 0;
  background: var(--bg-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  z-index: var(--z-loader);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-slow) var(--ease-smooth),
              visibility var(--duration-slow) var(--ease-smooth);
}

#global-loader.active,
.global-loader.active {
  opacity: 1;
  visibility: visible;
}

/* Enhanced dual-ring spinner */
.loader-spinner {
  width: 56px;
  height: 56px;
  position: relative;
}

.loader-spinner::before,
.loader-spinner::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 4px solid transparent;
}

.loader-spinner::before {
  border-top-color: var(--primary-color);
  border-right-color: var(--primary-color);
  animation: spin 0.8s linear infinite;
}

.loader-spinner::after {
  border-bottom-color: var(--secondary-color);
  border-left-color: var(--secondary-color);
  animation: spin 0.8s linear infinite reverse;
  opacity: 0.6;
}

/* Dots loading animation */
.loader-dots {
  display: flex;
  gap: 0.5rem;
}

.loader-dots span {
  width: 12px;
  height: 12px;
  background: var(--primary-color);
  border-radius: 50%;
  animation: bounce 1.4s ease-in-out infinite both;
}

.loader-dots span:nth-child(1) { animation-delay: -0.32s; }
.loader-dots span:nth-child(2) { animation-delay: -0.16s; }
.loader-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes bounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Progress bar loader */
.loader-progress {
  width: 200px;
  height: 4px;
  background: var(--border-color);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.loader-progress::after {
  content: '';
  display: block;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  border-radius: var(--radius-full);
  animation: progress 1.5s ease-in-out infinite;
}

@keyframes progress {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

.loader-text {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 500;
  animation: pulse 1.5s ease-in-out infinite;
}

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

@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* --------------------------------------------------------------------------
   6. SKELETON LOADING SCREENS
   -------------------------------------------------------------------------- */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-color) 25%,
    var(--hover-bg) 50%,
    var(--bg-color) 75%
  );
  background-size: 200% 100%;
  border-radius: var(--radius-md);
  animation: skeleton-loading 1.5s ease-in-out infinite;
  color: transparent !important;
  pointer-events: none;
  user-select: none;
}

.skeleton * {
  visibility: hidden;
}

/* Skeleton variants */
.skeleton-text {
  height: 1em;
  margin-bottom: 0.5em;
}

.skeleton-text.sm { height: 0.75em; }
.skeleton-text.lg { height: 1.5em; }

.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.skeleton-card {
  min-height: 120px;
}

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

/* --------------------------------------------------------------------------
   7. MODERN CARDS & SURFACES
   -------------------------------------------------------------------------- */
.card,
.feature-card,
.login-card,
.lesson-card,
.stat-card,
.results-card,
.completion-card,
.video-card,
.video-info-card,
.material-card,
.instruction-item,
.question-card,
.answer-option {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration-normal) var(--ease-spring),
              box-shadow var(--duration-normal) var(--ease-spring),
              border-color var(--duration-fast) var(--ease-smooth);
  will-change: transform, box-shadow;
  position: relative;
  overflow: hidden;
}

.card:hover,
.feature-card:hover,
.lesson-card:hover,
.stat-card:hover,
.material-card:hover,
.question-card:hover,
.answer-option:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: var(--shadow-xl);
}

/* Card shine effect */
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  transform: skewX(-25deg);
  transition: left 0.5s;
  pointer-events: none;
}

.card:hover::before {
  left: 150%;
}

/* 3D tilt effect on cards */
.card-3d {
  transform-style: preserve-3d;
  perspective: 1000px;
}

.card-3d:hover {
  transform: rotateX(5deg) rotateY(5deg) translateY(-4px);
}

/* --------------------------------------------------------------------------
   8. MODERN BUTTONS
   -------------------------------------------------------------------------- */
.btn,
button,
[role="button"] {
  border-radius: var(--radius-md);
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: transform var(--duration-fast) var(--ease-spring),
              background-color var(--duration-fast) var(--ease-smooth),
              box-shadow var(--duration-fast) var(--ease-smooth),
              color var(--duration-fast) var(--ease-smooth);
  will-change: transform, box-shadow;
  position: relative;
  overflow: hidden;
}

.btn:hover,
button:hover,
[role="button"]:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn:active,
button:active,
[role="button"]:active {
  transform: translateY(0) scale(0.98);
}

.btn:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: var(--shadow-glow);
  border-color: var(--primary-color);
}

/* Enhanced ripple effect */
.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.4) 0%, transparent 70%);
  opacity: 0;
  transform: scale(0.5);
  transition: opacity var(--duration-fast) var(--ease-smooth),
              transform var(--duration-fast) var(--ease-smooth);
  pointer-events: none;
}

.btn:active::before {
  opacity: 1;
  transform: scale(2);
  transition: opacity 0s, transform 0s;
}

/* Magnetic button effect */
.btn.magnetic {
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Glow effect on hover */
.btn-glow:hover {
  box-shadow: 0 0 20px rgba(79, 70, 229, 0.4),
              0 0 40px rgba(79, 70, 229, 0.2);
}

/* Shimmer effect */
.btn-shimmer {
  position: relative;
  overflow: hidden;
}

.btn-shimmer::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transition: left 0.5s;
}

.btn-shimmer:hover::after {
  left: 100%;
}

/* --------------------------------------------------------------------------
   9. MODERN FORMS
   -------------------------------------------------------------------------- */
input,
textarea,
select,
.form-control {
  border-radius: var(--radius-md);
  border: 2px solid var(--border-color);
  padding: 0.875rem 1rem;
  font-size: 1rem;
  transition: border-color var(--duration-fast) var(--ease-smooth),
              box-shadow var(--duration-fast) var(--ease-smooth),
              background-color var(--duration-fast) var(--ease-smooth);
}

input:hover,
textarea:hover,
select:hover,
.form-control:hover {
  border-color: var(--text-muted);
}

input:focus,
textarea:focus,
select:focus,
.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
  outline: none;
}

/* Floating labels support */
.form-group {
  position: relative;
}

.form-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

/* --------------------------------------------------------------------------
   10. MODERN NAVBAR
   -------------------------------------------------------------------------- */
.navbar {
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  background: var(--glass-bg);
  border-bottom: 1px solid var(--glass-border);
  transition: background var(--duration-normal) var(--ease-smooth),
              box-shadow var(--duration-normal) var(--ease-smooth);
}

.navbar.scrolled {
  box-shadow: var(--shadow-md);
}

.nav-brand {
  font-weight: 800;
  letter-spacing: -0.02em;
  transition: transform var(--duration-fast) var(--ease-spring);
}

.nav-brand:hover {
  transform: scale(1.02);
}

/* --------------------------------------------------------------------------
   11. MODERN HERO SECTION
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.15) 0%, transparent 40%),
              radial-gradient(circle at 70% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 40%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero h1 {
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.hero p {
  font-size: 1.25rem;
  opacity: 0.92;
}

/* --------------------------------------------------------------------------
   12. MODERN TABLES
   -------------------------------------------------------------------------- */
table {
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

thead {
  background: var(--hover-bg);
}

th {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  padding: 1rem;
}

td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  transition: background-color var(--duration-fast) var(--ease-smooth);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background-color: var(--hover-bg);
}

/* --------------------------------------------------------------------------
   13. MODERN MODALS
   -------------------------------------------------------------------------- */
.modal {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background-color: rgba(0, 0, 0, 0.5);
  transition: opacity var(--duration-normal) var(--ease-smooth);
}

.modal-content {
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  transform: scale(0.96) translateY(10px);
  transition: transform var(--duration-normal) var(--ease-spring),
              opacity var(--duration-normal) var(--ease-smooth);
}

.modal.active .modal-content {
  transform: scale(1) translateY(0);
}

/* --------------------------------------------------------------------------
   14. MODERN TOASTS & NOTIFICATIONS
   -------------------------------------------------------------------------- */
.toast,
.notification {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.4s var(--ease-out) both;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* --------------------------------------------------------------------------
   15. ASSESSMENT MODERNIZATION
   -------------------------------------------------------------------------- */
.assessment-section {
  background: var(--surface-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
}

.question-card {
  background: var(--bg-color);
  border: 2px solid var(--border-color);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.answer-option {
  background: var(--surface-color);
  border: 2px solid var(--border-color);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.answer-option:hover {
  border-color: var(--primary-color);
  background: var(--primary-light);
}

.answer-option.selected {
  border-color: var(--primary-color);
  background: var(--primary-light);
  box-shadow: var(--shadow-glow);
}

/* --------------------------------------------------------------------------
   16. PROGRESS BARS & TIMERS
   -------------------------------------------------------------------------- */
.progress-bar,
.quiz-timer {
  border-radius: var(--radius-full);
  overflow: hidden;
  transition: width var(--duration-slow) var(--ease-smooth);
}

.progress-fill {
  border-radius: var(--radius-full);
  transition: width var(--duration-slow) var(--ease-smooth);
}

/* --------------------------------------------------------------------------
   17. RESPONSIVE IMPROVEMENTS
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .container {
    padding: 0 1rem;
  }

  .hero {
    padding: 3rem 0;
  }

  .hero h1 {
    font-size: 2.5rem;
  }
}

@media (max-width: 768px) {
  :root {
    --radius-lg: 14px;
    --radius-xl: 18px;
  }

  .hero {
    padding: 2.5rem 0;
  }

  .hero h1 {
    font-size: 2rem;
  }

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

  .login-card {
    padding: 1.75rem;
    margin: 0 1rem;
  }

  .assessment-section {
    padding: 1.25rem;
    margin: 0.5rem;
  }

  .question-card {
    padding: 1rem;
  }

  .answer-option {
    padding: 0.875rem 1rem;
  }

  .btn {
    min-height: 44px;
    min-width: 44px;
  }

  .btn-block {
    width: 100%;
  }

  .feature-grid,
  .materials-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .modal-content {
    margin: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    min-height: 50vh;
    max-height: 90vh;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 15px;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .hero p {
    font-size: 0.95rem;
  }

  .login-card {
    padding: 1.5rem;
    margin: 0;
    border-radius: 0;
    min-height: 100vh;
  }

  .btn {
    width: 100%;
    padding: 0.75rem 1rem;
  }

  .hero-buttons {
    flex-direction: column;
  }

  .hero-buttons .btn {
    width: 100%;
  }
}

/* --------------------------------------------------------------------------
   18. NOTIFICATION & TOAST ANIMATIONS
   -------------------------------------------------------------------------- */
.toast,
.notification,
.alert,
.banner {
  animation: slideInRight 0.4s var(--ease-spring) both;
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-md);
}

.toast.dismissing,
.notification.dismissing {
  animation: slideOutRight 0.3s var(--ease-in) forwards;
}

@keyframes slideOutRight {
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* Success notification animation */
.toast-success {
  border-left: 4px solid #10b981;
  animation: slideInRight 0.4s var(--ease-spring) both;
}

/* Error notification animation */
.toast-error {
  border-left: 4px solid #ef4444;
  animation: slideInRight 0.4s var(--ease-spring) both;
}

/* Warning notification animation */
.toast-warning {
  border-left: 4px solid #f59e0b;
  animation: slideInRight 0.4s var(--ease-spring) both;
}

/* Info notification animation */
.toast-info {
  border-left: 4px solid #3b82f6;
  animation: slideInRight 0.4s var(--ease-spring) both;
}

/* --------------------------------------------------------------------------
   19. MODAL & DROPDOWN ANIMATIONS
   -------------------------------------------------------------------------- */
.modal-backdrop {
  animation: fadeIn 0.3s var(--ease-smooth) both;
}

.modal-content {
  animation: scaleIn 0.3s var(--ease-spring) both;
  transform-origin: center;
}

.modal.closing .modal-backdrop {
  animation: fadeOut 0.2s var(--ease-in) forwards;
}

.modal.closing .modal-content {
  animation: scaleOut 0.2s var(--ease-in) forwards;
}

@keyframes scaleOut {
  to {
    opacity: 0;
    transform: scale(0.95);
  }
}

/* Dropdown animations */
.dropdown-menu {
  animation: dropdownIn 0.2s var(--ease-spring) both;
  transform-origin: top;
}

.dropdown-menu.closing {
  animation: dropdownOut 0.15s var(--ease-in) forwards;
}

@keyframes dropdownIn {
  from {
    opacity: 0;
    transform: scaleY(0.95) translateY(-8px);
  }
  to {
    opacity: 1;
    transform: scaleY(1) translateY(0);
  }
}

@keyframes dropdownOut {
  to {
    opacity: 0;
    transform: scaleY(0.95) translateY(-8px);
  }
}

/* --------------------------------------------------------------------------
   20. FLOATING ELEMENTS & PARTICLES
   -------------------------------------------------------------------------- */
.floating {
  animation: float 6s ease-in-out infinite;
}

.floating-delayed {
  animation: float 6s ease-in-out infinite;
  animation-delay: -3s;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
}

/* Particle effect */
.particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--primary-color);
  border-radius: 50%;
  opacity: 0.3;
  animation: particleFloat 8s linear infinite;
}

@keyframes particleFloat {
  0% {
    transform: translateY(100vh) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.3;
  }
  90% {
    opacity: 0.3;
  }
  100% {
    transform: translateY(-100vh) rotate(720deg);
    opacity: 0;
  }
}

/* Glow pulse effect */
.glow-pulse {
  animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 0 5px rgba(79, 70, 229, 0.3);
  }
  50% {
    box-shadow: 0 0 20px rgba(79, 70, 229, 0.6),
                0 0 40px rgba(79, 70, 229, 0.3);
  }
}

/* Shimmer effect for loading states */
.shimmer {
  position: relative;
  overflow: hidden;
}

.shimmer::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  100% {
    left: 100%;
  }
}

/* --------------------------------------------------------------------------
   21. UTILITY CLASSES
   -------------------------------------------------------------------------- */
.fade-in {
  animation: fadeIn 0.5s var(--ease-out) both;
}

.slide-up {
  animation: fadeInUp 0.5s var(--ease-out) both;
}

.scale-in {
  animation: scaleIn 0.4s var(--ease-spring) both;
}

.slide-in-left {
  animation: slideInLeft 0.4s var(--ease-spring) both;
}

.slide-in-right {
  animation: slideInRight 0.4s var(--ease-spring) both;
}

.bounce-in {
  animation: bounceIn 0.6s var(--ease-spring) both;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Stagger children */
.stagger-children > * {
  animation: fadeInUp 0.4s var(--ease-out) both;
}

.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.4s; }

/* --------------------------------------------------------------------------
   22. MODERN LESSON CARDS
   -------------------------------------------------------------------------- */
.modern-lesson-card {
  background: var(--bg-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  overflow: hidden;
  transition: transform var(--duration-normal) var(--ease-spring),
              box-shadow var(--duration-normal) var(--ease-spring),
              border-color var(--duration-fast) var(--ease-smooth);
}

.modern-lesson-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--primary-color);
}

.lesson-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: linear-gradient(135deg, var(--hover-bg) 0%, var(--bg-color) 100%);
  border-bottom: 1px solid var(--border-color);
}

.lesson-code-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lesson-code-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-color);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  border: 2px solid var(--primary-color);
  font-family: var(--font-mono);
}

.code-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
}

.code-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary-color);
  letter-spacing: 0.1em;
}

.btn-copy-code {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--primary-color);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--duration-fast) var(--ease-spring),
              background-color var(--duration-fast) var(--ease-smooth);
}

.btn-copy-code:hover {
  transform: scale(1.1);
  background: var(--secondary-color);
}

.btn-copy-code:active {
  transform: scale(0.95);
}

.lesson-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.countdown-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  background: #ff6b6b;
  color: white;
}

.countdown-badge.urgent {
  background: #000;
  animation: pulse 1s ease-in-out infinite;
}

.lesson-card-content {
  padding: 1.25rem;
}

.lesson-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  color: var(--text-primary);
  line-height: 1.3;
}

.lesson-subject {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0 0 1rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lesson-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.meta-item i {
  color: var(--primary-color);
}

.lesson-dates {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.lesson-dates i {
  color: var(--text-secondary);
}

.lesson-card-actions {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--hover-bg);
  border-top: 1px solid var(--border-color);
}

.btn-action {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.75rem 0.5rem;
  border-radius: var(--radius-md);
  border: none;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-spring),
              box-shadow var(--duration-fast) var(--ease-smooth);
}

.btn-action i {
  font-size: 1rem;
}

.btn-action:hover {
  transform: translateY(-2px);
}

.btn-action:active {
  transform: translateY(0) scale(0.98);
}

.btn-edit {
  background: var(--primary-color);
  color: white;
}

.btn-edit:hover {
  background: #5a4fcf;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.btn-export {
  background: #3b82f6;
  color: white;
}

.btn-export:hover {
  background: #2563eb;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-delete {
  background: #ef4444;
  color: white;
}

.btn-delete:hover {
  background: #dc2626;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* Responsive lesson cards */
@media (max-width: 768px) {
  .lesson-card-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  
  .lesson-code-section {
    width: 100%;
    justify-content: space-between;
  }
  
  .lesson-status {
    width: 100%;
  }
  
  .lesson-meta {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .lesson-card-actions {
    flex-direction: row;
  }
  
  .btn-action {
    padding: 0.6rem 0.4rem;
    font-size: 0.75rem;
  }
  
  .btn-action span {
    display: none;
  }
  
  .btn-action i {
    font-size: 1.1rem;
  }
}

/* --------------------------------------------------------------------------
   24. AI ASSISTANT CHAT INTERFACE
   -------------------------------------------------------------------------- */
.ai-assistant-btn {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: var(--shadow-lg);
  z-index: 9998;
  transition: transform var(--duration-fast) var(--ease-spring),
              box-shadow var(--duration-fast) var(--ease-smooth);
  animation: bounceIn 0.6s var(--ease-spring);
}

.ai-assistant-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 0 30px rgba(79, 70, 229, 0.5);
}

.ai-assistant-btn:active {
  transform: scale(0.95);
}

.ai-chat-modal {
  position: fixed;
  bottom: 6rem;
  left: 2rem;
  width: 400px;
  max-width: calc(100vw - 4rem);
  height: 500px;
  max-height: calc(100vh - 8rem);
  background: var(--bg-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-color);
  display: none;
  flex-direction: column;
  z-index: 9999;
  animation: slideInLeft 0.3s var(--ease-spring);
}

.ai-chat-modal.active {
  display: flex;
}

.ai-chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.ai-chat-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1rem;
}

.ai-chat-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--duration-fast) var(--ease-smooth);
}

.ai-chat-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ai-message {
  display: flex;
  gap: 0.75rem;
  max-width: 85%;
}

.ai-message-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.ai-message-assistant {
  align-self: flex-start;
}

.ai-message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ai-message-user .ai-message-avatar {
  background: var(--primary-color);
  color: white;
}

.ai-message-assistant .ai-message-avatar {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
}

.ai-message-content {
  background: var(--hover-bg);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-primary);
}

.ai-message-user .ai-message-content {
  background: var(--primary-color);
  color: white;
}

.ai-message-content p {
  margin: 0 0 0.5rem 0;
}

.ai-message-content p:last-child {
  margin-bottom: 0;
}

.ai-message-content ul {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}

.ai-message-content li {
  margin-bottom: 0.25rem;
}

.ai-message-content code {
  background: rgba(0, 0, 0, 0.1);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.85em;
}

.ai-message-content pre {
  background: rgba(0, 0, 0, 0.05);
  padding: 0.75rem;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 0.5rem 0;
}

.ai-message-content pre code {
  background: none;
  padding: 0;
}

.ai-chat-input-area {
  padding: 1rem;
  border-top: 1px solid var(--border-color);
  background: var(--hover-bg);
}

.ai-chat-input-wrapper {
  display: flex;
  gap: 0.5rem;
}

.ai-chat-input-wrapper input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  background: var(--bg-color);
  color: var(--text-primary);
}

.ai-chat-input-wrapper input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.ai-send-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--primary-color);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--duration-fast) var(--ease-spring),
              background var(--duration-fast) var(--ease-smooth);
}

.ai-send-btn:hover {
  transform: scale(1.05);
  background: var(--secondary-color);
}

.ai-send-btn:active {
  transform: scale(0.95);
}

.ai-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ai-voice-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--hover-bg);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--duration-fast) var(--ease-spring),
              background var(--duration-fast) var(--ease-smooth);
}

.ai-voice-btn:hover {
  transform: scale(1.05);
  background: var(--border-color);
}

.ai-voice-btn.recording {
  background: #ef4444;
  color: white;
  animation: pulse 1s ease-in-out infinite;
}

.ai-quick-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.ai-quick-action {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--hover-bg);
  color: var(--text-primary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-spring),
              background var(--duration-fast) var(--ease-smooth);
}

.ai-quick-action:hover {
  transform: translateY(-2px);
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.troubleshoot-wizard {
  background: var(--hover-bg);
  padding: 1rem;
  border-radius: var(--radius-md);
  margin: 0.5rem 0;
}

.troubleshoot-wizard h3 {
  margin: 0 0 0.5rem 0;
  color: var(--text-primary);
  font-size: 1rem;
}

.troubleshoot-wizard p {
  margin: 0 0 0.75rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.troubleshoot-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.troubleshoot-options button {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-color);
  color: var(--text-primary);
  font-size: 0.85rem;
  cursor: pointer;
  text-align: left;
  transition: transform var(--duration-fast) var(--ease-spring),
              background var(--duration-fast) var(--ease-smooth);
}

.troubleshoot-options button:hover {
  transform: translateX(4px);
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.deadline-notification {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: 1rem;
  max-width: 400px;
  z-index: 10000;
  animation: slideInRight 0.3s var(--ease-spring);
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.notification-content {
  flex: 1;
}

.notification-content strong {
  display: block;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  font-size: 0.95rem;
}

.notification-content p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.notification-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background var(--duration-fast) var(--ease-smooth);
}

.notification-close:hover {
  background: var(--hover-bg);
  color: var(--text-primary);
}

.ai-typing-indicator {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem;
}

.ai-typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typingBounce 1.4s ease-in-out infinite;
}

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

@keyframes typingBounce {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-8px);
  }
}

/* Loading Animation Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease-smooth), visibility 0.3s var(--ease-smooth);
}

.loading-overlay.active {
  opacity: 1;
  visibility: visible;
}

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

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

.loading-text {
  position: absolute;
  margin-top: 70px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
}

/* Button Loading State */
.btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-top: -8px;
  margin-left: -8px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.btn-loading .btn-text {
  visibility: hidden;
}

/* Responsive AI chat */
@media (max-width: 768px) {
  .ai-assistant-btn {
    bottom: 1.5rem;
    left: 1.5rem;
    width: 50px;
    height: 50px;
    font-size: 1.25rem;
  }
  
  .ai-chat-modal {
    bottom: 5rem;
    left: 1rem;
    right: 1rem;
    width: auto;
    max-width: none;
    height: calc(100vh - 7rem);
    max-height: none;
  }
  
  .ai-message {
    max-width: 90%;
  }
}

/* --------------------------------------------------------------------------
   25. PRINT STYLES
   -------------------------------------------------------------------------- */
img,
video,
iframe,
embed,
object {
  max-width: 100%;
  height: auto;
}

/* --------------------------------------------------------------------------
   20. LAYOUT STABILITY FIXES
   -------------------------------------------------------------------------- */
/* Prevent layout shift from scrollbars */
html {
  overflow-y: scroll;
}

/* Consistent box model */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Remove tap highlight on mobile */
button,
a,
input,
textarea,
select,
label {
  -webkit-tap-highlight-color: transparent;
}

/* Better text rendering */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --------------------------------------------------------------------------
   21. CONNECTION LOST OVERLAY ENHANCEMENT
   -------------------------------------------------------------------------- */
#connection-lost-overlay {
  animation: fadeIn 0.3s var(--ease-out) both;
}

#connection-lost-overlay > div {
  background: rgba(15, 23, 42, 0.92);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-xl);
}

/* --------------------------------------------------------------------------
   22. DASHBOARD MODERNIZATION
   -------------------------------------------------------------------------- */
.dashboard-sidebar {
  background: linear-gradient(180deg, var(--surface-color) 0%, var(--bg-color) 100%);
  border-right: 1px solid var(--border-color);
}

.sidebar-menu .menu-item {
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) var(--ease-spring);
}

.sidebar-menu .menu-item:hover,
.sidebar-menu .menu-item.active {
  background: var(--primary-light);
  color: var(--primary-color);
  transform: translateX(4px);
}

.stat-card {
  border-radius: var(--radius-lg);
  background: var(--surface-color);
  border: 1px solid var(--border-color);
}

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

/* --------------------------------------------------------------------------
   23. EMPTY STATES & ILLUSTRATIONS
   -------------------------------------------------------------------------- */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-secondary);
  animation: fadeInUp 0.5s var(--ease-out) both;
}

.empty-state i {
  font-size: 4rem;
  opacity: 0.3;
  margin-bottom: 1rem;
}

/* --------------------------------------------------------------------------
   24. SELECTION COLORS
   -------------------------------------------------------------------------- */
::selection {
  background: var(--primary-color);
  color: white;
}

::-moz-selection {
  background: var(--primary-color);
  color: white;
}

/* --------------------------------------------------------------------------
   25. PREVENT LAYOUT SHIFTS & GLITCHES
   -------------------------------------------------------------------------- */
/* Ensure images don't cause layout shifts */
img {
  height: auto;
  max-width: 100%;
}

/* Prevent horizontal overflow on mobile */
html, body {
  overflow-x: hidden;
}

/* Smooth width transitions for containers */
.container {
  width: 100%;
  max-width: min(1200px, 95%);
  margin-left: auto;
  margin-right: auto;
}

/* Fix any inline-styled buttons to be responsive */
button[style*="width: 100%"],
.btn[style*="width: 100%"] {
  width: 100% !important;
}

/* --------------------------------------------------------------------------
   26. ASSESSMENT MOBILE STICKY TIMER ENHANCEMENT
   -------------------------------------------------------------------------- */
#mobile-sticky-timer,
.mobile-sticky-timer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-top: 1px solid var(--glass-border);
  padding: 0.75rem 1rem;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
  transition: transform var(--duration-normal) var(--ease-out);
}

/* --------------------------------------------------------------------------
   27. DASHBOARD TABLE MOBILE SCROLL
   -------------------------------------------------------------------------- */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.table-responsive table {
  min-width: 600px;
  width: 100%;
}

/* --------------------------------------------------------------------------
   28. BETTER BADGES & TAGS
   -------------------------------------------------------------------------- */
.badge,
.tag,
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  transition: transform var(--duration-fast) var(--ease-spring);
}

.badge:hover,
.tag:hover {
  transform: scale(1.05);
}

/* --------------------------------------------------------------------------
   29. SILENT DATA UPDATE TRANSITIONS
   -------------------------------------------------------------------------- */
tbody, .lesson-grid, .materials-grid, .stats-grid, .feature-grid {
  transition: opacity 0.2s ease;
}

/* Subtle highlight on updated rows */
@keyframes flashUpdate {
  0% { background-color: rgba(79, 70, 229, 0.15); }
  100% { background-color: transparent; }
}

.row-updated {
  animation: flashUpdate 0.6s ease;
}

/* --------------------------------------------------------------------------
   30. PRINT STYLES
   -------------------------------------------------------------------------- */
@media print {
  .navbar,
  .btn,
  .no-print {
    display: none !important;
  }

  .page {
    display: block !important;
    opacity: 1 !important;
  }
}
