/* ========================================
   Ebbinghaus Memory Learning Platform
   Global Styles - Modern Minimalist Design
   ======================================== */

/* CSS Variables */
:root {
  /* Primary Colors */
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --primary-bg: #eef2ff;

  /* Accent Colors */
  --success: #10b981;
  --success-bg: #d1fae5;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --danger: #ef4444;
  --danger-bg: #fee2e2;
  --info: #3b82f6;
  --info-bg: #dbeafe;

  /* Neutral Colors */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Layout */
  --sidebar-width: 260px;
  --header-height: 64px;
  --border-radius: 12px;
  --border-radius-sm: 8px;
  --border-radius-lg: 16px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  /* Transitions */
  --transition: all 0.2s ease;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--gray-800);
  background-color: var(--gray-50);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-dark);
}

img {
  max-width: 100%;
  height: auto;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--gray-900);
}

h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--gray-500); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }

/* ========================================
   Layout Components
   ======================================== */

/* App Container */
.app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: white;
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--gray-100);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--gray-900);
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.25rem;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 1.5rem;
}

.nav-section-title {
  padding: 0.5rem 1.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-400);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1.5rem;
  color: var(--gray-600);
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
}

.nav-item:hover {
  background-color: var(--gray-50);
  color: var(--gray-900);
}

.nav-item.active {
  background-color: var(--primary-bg);
  color: var(--primary);
}

.nav-item-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
}

.nav-item-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
}

/* Role-based visibility */
.role-admin-only {
  display: none;
}

.is-admin .role-admin-only {
  display: flex;
}

.is-admin .role-teacher-only {
  display: flex;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--gray-100);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-bg);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.user-details {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-weight: 600;
  color: var(--gray-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.75rem;
  color: var(--gray-500);
}

/* Main Content */
.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  height: var(--header-height);
  background: white;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Role Switcher (for prototype demo) */
.role-switcher {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem;
  background: var(--gray-100);
  border-radius: var(--border-radius-sm);
}

.role-switcher-btn {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  border: none;
  background: transparent;
  color: var(--gray-600);
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.role-switcher-btn.active {
  background: white;
  color: var(--gray-900);
  box-shadow: var(--shadow-sm);
}

/* Content Area */
.content {
  flex: 1;
  padding: 2rem;
}

/* ========================================
   UI Components
   ======================================== */

/* Cards */
.card {
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
}

.card-body {
  padding: 1.5rem;
}

.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
  border-radius: 0 0 var(--border-radius) var(--border-radius);
}

/* Stat Cards */
.stat-card {
  background: white;
  border-radius: var(--border-radius);
  padding: 1.5rem;
  border: 1px solid var(--gray-200);
}

.stat-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.stat-card-icon.primary {
  background: var(--primary-bg);
  color: var(--primary);
}

.stat-card-icon.success {
  background: var(--success-bg);
  color: var(--success);
}

.stat-card-icon.warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.stat-card-icon.info {
  background: var(--info-bg);
  color: var(--info);
}

.stat-card-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.25rem;
}

.stat-card-label {
  font-size: 0.875rem;
  color: var(--gray-500);
}

.stat-card-trend {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8125rem;
  margin-top: 0.5rem;
}

.stat-card-trend.up {
  color: var(--success);
}

.stat-card-trend.down {
  color: var(--danger);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--border-radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
}

.btn-secondary:hover {
  background: var(--gray-200);
}

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

.btn-success:hover {
  background: #059669;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
}

.btn-outline:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
}

.btn-lg {
  padding: 0.875rem 1.75rem;
  font-size: 1rem;
}

.btn-sm {
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--border-radius-sm);
}

/* Form Elements */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
}

.form-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.9375rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--border-radius-sm);
  background: white;
  transition: var(--transition);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}

.form-input::placeholder {
  color: var(--gray-400);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

/* Tables */
.table-container {
  overflow-x: auto;
}

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

.table th,
.table td {
  padding: 0.875rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--gray-100);
}

.table th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  background: var(--gray-50);
}

.table tbody tr:hover {
  background: var(--gray-50);
}

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

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 9999px;
}

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

.badge-success {
  background: var(--success-bg);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-gray {
  background: var(--gray-100);
  color: var(--gray-600);
}

/* Progress Bar */
.progress {
  height: 8px;
  background: var(--gray-100);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 9999px;
  transition: width 0.3s ease;
}

.progress-bar.success {
  background: var(--success);
}

.progress-bar.warning {
  background: var(--warning);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 1.5rem;
}

.tab {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-500);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: var(--transition);
}

.tab:hover {
  color: var(--gray-700);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Avatar */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--gray-600);
  font-size: 0.875rem;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 0.75rem;
}

.avatar-lg {
  width: 56px;
  height: 56px;
  font-size: 1.25rem;
}

.avatar-group {
  display: flex;
}

.avatar-group .avatar {
  border: 2px solid white;
  margin-left: -0.5rem;
}

.avatar-group .avatar:first-child {
  margin-left: 0;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
}

.empty-state-icon {
  font-size: 3rem;
  color: var(--gray-300);
  margin-bottom: 1rem;
}

.empty-state-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
}

.empty-state-desc {
  color: var(--gray-500);
  margin-bottom: 1.5rem;
}

/* ========================================
   Specific Components
   ======================================== */

/* Word Card */
.word-card {
  background: white;
  border-radius: var(--border-radius-lg);
  padding: 2.5rem;
  text-align: center;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--gray-200);
  max-width: 500px;
  margin: 0 auto;
}

.word-card-word {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
}

.word-card-phonetic {
  font-size: 1.125rem;
  color: var(--gray-500);
  margin-bottom: 1.5rem;
}

.word-card-meaning {
  font-size: 1.25rem;
  color: var(--gray-700);
  padding: 1.5rem;
  background: var(--gray-50);
  border-radius: var(--border-radius-sm);
  margin-bottom: 1.5rem;
}

.word-card-example {
  font-size: 0.9375rem;
  color: var(--gray-600);
  font-style: italic;
  line-height: 1.8;
}

.word-card-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
}

/* Review Calendar */
.review-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
}

.calendar-header {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-500);
  text-align: center;
  padding: 0.5rem;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-sm);
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition);
}

.calendar-day:hover {
  background: var(--gray-100);
}

.calendar-day.today {
  background: var(--primary);
  color: white;
}

.calendar-day.has-review {
  background: var(--primary-bg);
  color: var(--primary);
}

.calendar-day.completed {
  background: var(--success-bg);
  color: var(--success);
}

.calendar-day-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  margin-top: 0.25rem;
}

/* Ebbinghaus Curve */
.ebbinghaus-curve {
  position: relative;
  height: 200px;
  background: var(--gray-50);
  border-radius: var(--border-radius-sm);
  padding: 1rem;
}

/* Task List */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius-sm);
  transition: var(--transition);
}

.task-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.task-item-checkbox {
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-300);
  border-radius: 50%;
  flex-shrink: 0;
  cursor: pointer;
  transition: var(--transition);
}

.task-item-checkbox.checked {
  background: var(--success);
  border-color: var(--success);
}

.task-item-content {
  flex: 1;
  min-width: 0;
}

.task-item-title {
  font-weight: 500;
  color: var(--gray-900);
  margin-bottom: 0.25rem;
}

.task-item-meta {
  font-size: 0.8125rem;
  color: var(--gray-500);
}

.task-item-action {
  flex-shrink: 0;
}

/* Course Card */
.course-card {
  background: white;
  border-radius: var(--border-radius);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  transition: var(--transition);
}

.course-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.course-card-image {
  height: 140px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 2.5rem;
}

.course-card-body {
  padding: 1.25rem;
}

.course-card-title {
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
}

.course-card-desc {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-bottom: 1rem;
}

.course-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--gray-500);
}

/* Listening Player */
.audio-player {
  background: white;
  border-radius: var(--border-radius);
  padding: 1.5rem;
  border: 1px solid var(--gray-200);
}

.audio-player-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.audio-player-cover {
  width: 80px;
  height: 80px;
  border-radius: var(--border-radius-sm);
  background: linear-gradient(135deg, var(--info), var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 2rem;
}

.audio-player-details h4 {
  margin-bottom: 0.25rem;
}

.audio-player-details p {
  font-size: 0.875rem;
  color: var(--gray-500);
}

.audio-player-progress {
  margin-bottom: 1rem;
}

.audio-player-time {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-top: 0.5rem;
}

.audio-player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.audio-player-controls .btn-icon {
  width: 48px;
  height: 48px;
  font-size: 1.25rem;
}

.audio-player-controls .btn-play {
  width: 64px;
  height: 64px;
  font-size: 1.5rem;
  background: var(--primary);
  color: white;
  border-radius: 50%;
}

/* ========================================
   Grid System
   ======================================== */

.grid {
  display: grid;
  gap: 1.5rem;
}

.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-center {
  justify-content: center;
}

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

/* ========================================
   Utility Classes
   ======================================== */

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }

.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.rounded { border-radius: var(--border-radius); }
.rounded-sm { border-radius: var(--border-radius-sm); }
.rounded-lg { border-radius: var(--border-radius-lg); }

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

.hidden { display: none; }

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 1024px) {
  .grid-cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-cols-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
  }

  .header {
    padding: 0 1rem;
  }

  .content {
    padding: 1rem;
  }

  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: 1fr;
  }

  .word-card {
    padding: 1.5rem;
  }

  .word-card-word {
    font-size: 1.75rem;
  }
}

/* Mobile Menu Toggle */
.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--gray-600);
  cursor: pointer;
}

@media (max-width: 768px) {
  .menu-toggle {
    display: flex;
  }
}

/* Overlay */
.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

.overlay.active {
  display: block;
}

/* ========================================
   Login Page Specific
   ======================================== */

.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-bg), white);
  padding: 2rem;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: white;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 2rem;
  margin: 0 auto 1rem;
}

.login-title {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.login-subtitle {
  color: var(--gray-500);
}

.login-tabs {
  display: flex;
  margin-bottom: 1.5rem;
  background: var(--gray-100);
  border-radius: var(--border-radius-sm);
  padding: 0.25rem;
}

.login-tab {
  flex: 1;
  padding: 0.625rem;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-500);
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.login-tab.active {
  background: white;
  color: var(--gray-900);
  box-shadow: var(--shadow-sm);
}

.login-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.875rem;
  color: var(--gray-500);
}

/* ========================================
   Animation
   ======================================== */

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

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

.animate-fade-in {
  animation: fadeIn 0.3s ease;
}

.animate-slide-up {
  animation: slideUp 0.3s ease;
}

/* ========================================
   Modal System
   ======================================== */

#modal-container {
  display: none;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: white;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--gray-100);
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-900);
  margin: 0;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--gray-100);
  border-radius: 50%;
  font-size: 1.25rem;
  color: var(--gray-500);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--gray-200);
  color: var(--gray-700);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
}

.modal-form .form-group {
  margin-bottom: 1rem;
}

.modal-form .form-group:last-child {
  margin-bottom: 0;
}

/* ========================================
   Toast Notifications
   ======================================== */

#toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  background: white;
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--gray-400);
  pointer-events: auto;
  max-width: 360px;
}

.toast-success {
  border-left-color: var(--success);
}

.toast-success .toast-icon {
  color: var(--success);
  background: var(--success-bg);
}

.toast-error {
  border-left-color: var(--danger);
}

.toast-error .toast-icon {
  color: var(--danger);
  background: var(--danger-bg);
}

.toast-warning {
  border-left-color: var(--warning);
}

.toast-warning .toast-icon {
  color: var(--warning);
  background: var(--warning-bg);
}

.toast-info {
  border-left-color: var(--info);
}

.toast-info .toast-icon {
  color: var(--info);
  background: var(--info-bg);
}

.toast-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.toast-message {
  font-size: 0.875rem;
  color: var(--gray-700);
}

.toast-hide {
  animation: slideOut 0.3s ease forwards;
}

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

/* ========================================
   Loading States
   ======================================== */

.loading {
  position: relative;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.7);
  border-radius: inherit;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

/* ========================================
   Dropdown Menu
   ======================================== */

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 180px;
  background: white;
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-200);
  padding: 0.5rem 0;
  z-index: 100;
  display: none;
}

.dropdown-menu.show {
  display: block;
  animation: slideUp 0.2s ease;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  color: var(--gray-700);
  cursor: pointer;
  transition: var(--transition);
}

.dropdown-item:hover {
  background: var(--gray-50);
  color: var(--gray-900);
}

.dropdown-divider {
  height: 1px;
  background: var(--gray-100);
  margin: 0.5rem 0;
}

/* ========================================
   Table Enhancements
   ======================================== */

.table tbody tr.selected {
  background: var(--primary-bg);
}

.table tbody tr.highlighted {
  background: var(--gray-50);
}

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

/* ========================================
   Form Enhancements
   ======================================== */

.form-group.focused .form-label {
  color: var(--primary);
}

textarea.form-input {
  min-height: 100px;
  resize: vertical;
}

/* ========================================
   Interactive Elements
   ======================================== */

.clickable {
  cursor: pointer;
  transition: var(--transition);
}

.clickable:hover {
  opacity: 0.8;
}

.selectable {
  cursor: pointer;
  transition: var(--transition);
}

.selectable:hover {
  background: var(--gray-50);
}

.selectable.selected {
  background: var(--primary-bg);
  border-color: var(--primary);
}

/* Player Extra Button Active State */
.player-extra-btn.active {
  color: var(--primary);
}

.player-extra-btn.active span:first-child {
  background: var(--primary-bg);
  border-radius: 50%;
  padding: 0.25rem;
}

/* ========================================
   WeChat Mini Program Style (Student)
   ======================================== */

/* Mini Program Variables */
body.mini-program {
  --mp-primary: #07C160;
  --mp-primary-light: #09D166;
  --mp-primary-dark: #06AD56;
  --mp-primary-bg: #e7f7ef;
  --mp-bg: #f6f6f6;
  --mp-white: #ffffff;
  --mp-black: #000000;
  --mp-gray-1: #f7f7f7;
  --mp-gray-2: #ededed;
  --mp-gray-3: #d1d1d1;
  --mp-gray-4: #9a9a9a;
  --mp-gray-5: #646566;
  --mp-gray-6: #323233;
  --mp-tabbar-height: 50px;
  --mp-navbar-height: 44px;
  --mp-status-bar: 20px;
  --mp-safe-bottom: env(safe-area-inset-bottom, 0);
  --mp-device-width: 375px;
  --mp-device-height: 812px;
}

body.mini-program {
  background: #1a1a2e;
  padding-bottom: 0;
  max-width: 100%;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Phone Frame Wrapper for Desktop */
body.mini-program .mp-device-frame {
  position: relative;
  width: var(--mp-device-width);
  height: var(--mp-device-height);
  background: var(--mp-bg);
  border-radius: 40px;
  box-shadow:
    0 0 0 12px #1a1a2e,
    0 0 0 14px #333,
    0 25px 50px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  /* Create stacking context for fixed children */
  transform: translateZ(0);
}

/* Notch */
body.mini-program .mp-device-frame::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 150px;
  height: 28px;
  background: #1a1a2e;
  border-radius: 0 0 20px 20px;
  z-index: 200;
}

/* Home Indicator */
body.mini-program .mp-device-frame::after {
  content: '';
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 134px;
  height: 5px;
  background: var(--mp-gray-6);
  border-radius: 3px;
  z-index: 200;
}

/* Mobile: Remove frame, full screen */
@media (max-width: 500px) {
  body.mini-program {
    background: var(--mp-bg);
    display: block;
    padding-bottom: calc(var(--mp-tabbar-height) + var(--mp-safe-bottom));
  }

  body.mini-program .mp-device-frame {
    width: 100%;
    height: auto;
    min-height: 100vh;
    border-radius: 0;
    box-shadow: none;
  }

  body.mini-program .mp-device-frame::before,
  body.mini-program .mp-device-frame::after {
    display: none;
  }
}

/* Hide desktop sidebar in mini-program */
body.mini-program .sidebar,
body.mini-program .overlay,
body.mini-program .menu-toggle {
  display: none !important;
}

/* Mini Program App Container */
body.mini-program .app {
  display: block;
}

body.mini-program .main {
  margin-left: 0;
  min-height: 100vh;
}

/* Mini Program Navigation Bar */
.mp-navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--mp-white);
  height: calc(var(--mp-navbar-height) + var(--mp-status-bar));
  padding-top: var(--mp-status-bar);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--mp-gray-2);
}

.mp-navbar-back {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(calc(-50% + var(--mp-status-bar) / 2));
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--mp-gray-6);
  cursor: pointer;
}

.mp-navbar-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--mp-black);
}

.mp-navbar-action {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(calc(-50% + var(--mp-status-bar) / 2));
  display: flex;
  gap: 12px;
}

/* Mini Program Tab Bar */
.mp-tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--mp-white);
  height: calc(var(--mp-tabbar-height) + var(--mp-safe-bottom));
  padding-bottom: var(--mp-safe-bottom);
  display: flex;
  border-top: 1px solid var(--mp-gray-2);
}

.mp-tabbar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 0;
  cursor: pointer;
  text-decoration: none;
  color: var(--mp-gray-4);
  transition: color 0.2s;
}

.mp-tabbar-item.active {
  color: var(--mp-primary);
}

.mp-tabbar-icon {
  font-size: 22px;
  margin-bottom: 2px;
  line-height: 1;
}

.mp-tabbar-label {
  font-size: 10px;
  line-height: 1.2;
}

.mp-tabbar-badge {
  position: absolute;
  top: 2px;
  right: 50%;
  transform: translateX(12px);
  min-width: 16px;
  height: 16px;
  background: #fa5151;
  color: white;
  font-size: 10px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* Mini Program Content Area */
.mp-content {
  padding-top: calc(var(--mp-navbar-height) + var(--mp-status-bar));
  padding-bottom: 16px;
  min-height: 100vh;
}

.mp-content.no-navbar {
  padding-top: 0;
}

/* Mini Program Page */
.mp-page {
  padding: 12px;
}

/* Mini Program Cards */
.mp-card {
  background: var(--mp-white);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}

.mp-card-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--mp-gray-1);
}

.mp-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--mp-gray-6);
}

.mp-card-body {
  padding: 16px;
}

.mp-card-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--mp-gray-1);
}

/* Mini Program Cells */
.mp-cells {
  background: var(--mp-white);
  border-radius: 12px;
  overflow: hidden;
}

.mp-cell {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--mp-white);
  border-bottom: 1px solid var(--mp-gray-1);
}

.mp-cell:last-child {
  border-bottom: none;
}

.mp-cell-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-right: 12px;
  flex-shrink: 0;
}

.mp-cell-bd {
  flex: 1;
  min-width: 0;
}

.mp-cell-title {
  font-size: 15px;
  color: var(--mp-gray-6);
  margin-bottom: 2px;
}

.mp-cell-desc {
  font-size: 12px;
  color: var(--mp-gray-4);
}

.mp-cell-ft {
  margin-left: 12px;
  display: flex;
  align-items: center;
  color: var(--mp-gray-4);
  font-size: 14px;
}

.mp-cell-arrow::after {
  content: '›';
  margin-left: 4px;
  font-size: 18px;
  color: var(--mp-gray-3);
}

/* Mini Program Button */
.mp-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 24px;
  font-size: 16px;
  font-weight: 500;
  border-radius: 22px;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s;
}

.mp-btn:active {
  opacity: 0.7;
}

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

.mp-btn-default {
  background: var(--mp-gray-1);
  color: var(--mp-gray-6);
}

.mp-btn-mini {
  height: 28px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 14px;
}

.mp-btn-block {
  width: 100%;
}

/* Mini Program Stats Grid */
.mp-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 16px;
}

.mp-stat-item {
  text-align: center;
  padding: 12px 4px;
  background: var(--mp-gray-1);
  border-radius: 8px;
}

.mp-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--mp-gray-6);
  margin-bottom: 4px;
}

.mp-stat-label {
  font-size: 11px;
  color: var(--mp-gray-4);
}

/* Mini Program Progress */
.mp-progress {
  height: 6px;
  background: var(--mp-gray-2);
  border-radius: 3px;
  overflow: hidden;
}

.mp-progress-bar {
  height: 100%;
  background: var(--mp-primary);
  border-radius: 3px;
  transition: width 0.3s;
}

/* Mini Program Badge */
.mp-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 4px;
  background: var(--mp-gray-1);
  color: var(--mp-gray-5);
}

.mp-badge-primary {
  background: var(--mp-primary-bg);
  color: var(--mp-primary);
}

.mp-badge-success {
  background: #e7f7ef;
  color: var(--mp-primary);
}

.mp-badge-warning {
  background: #fef3c7;
  color: #f59e0b;
}

.mp-badge-danger {
  background: #fee2e2;
  color: #ef4444;
}

/* Mini Program Welcome Banner */
.mp-banner {
  background: linear-gradient(135deg, var(--mp-primary), var(--mp-primary-light));
  border-radius: 12px;
  padding: 20px 16px;
  color: white;
  margin-bottom: 12px;
}

.mp-banner-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.mp-banner-desc {
  font-size: 13px;
  opacity: 0.9;
}

.mp-banner-stats {
  display: flex;
  gap: 24px;
  margin-top: 16px;
}

.mp-banner-stat {
  text-align: center;
}

.mp-banner-stat-value {
  font-size: 24px;
  font-weight: 700;
}

.mp-banner-stat-label {
  font-size: 11px;
  opacity: 0.85;
}

/* Mini Program Task Item */
.mp-task-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  background: var(--mp-white);
  border-bottom: 1px solid var(--mp-gray-1);
}

.mp-task-item:last-child {
  border-bottom: none;
}

.mp-task-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-right: 12px;
  flex-shrink: 0;
}

.mp-task-content {
  flex: 1;
  min-width: 0;
}

.mp-task-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--mp-gray-6);
  margin-bottom: 2px;
}

.mp-task-meta {
  font-size: 12px;
  color: var(--mp-gray-4);
}

/* Mini Program Quick Actions */
.mp-quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 16px;
  background: var(--mp-white);
  border-radius: 12px;
}

.mp-quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--mp-gray-6);
}

.mp-quick-action-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 8px;
}

.mp-quick-action-label {
  font-size: 12px;
  color: var(--mp-gray-5);
}

/* Mini Program Section Title */
.mp-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 12px 12px;
}

.mp-section-title h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--mp-gray-6);
  margin: 0;
}

.mp-section-title a {
  font-size: 13px;
  color: var(--mp-gray-4);
  text-decoration: none;
}

/* Mini Program Word Card (Learn Page) */
.mp-word-card {
  background: var(--mp-white);
  border-radius: 16px;
  padding: 32px 20px;
  text-align: center;
  margin: 12px;
}

.mp-word-card-word {
  font-size: 32px;
  font-weight: 700;
  color: var(--mp-gray-6);
  margin-bottom: 8px;
}

.mp-word-card-phonetic {
  font-size: 16px;
  color: var(--mp-gray-4);
  margin-bottom: 24px;
}

.mp-word-card-meaning {
  font-size: 18px;
  color: var(--mp-gray-5);
  background: var(--mp-gray-1);
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 16px;
}

.mp-word-card-example {
  font-size: 14px;
  color: var(--mp-gray-4);
  line-height: 1.6;
  font-style: italic;
}

/* Mini Program Rating Buttons */
.mp-rating-buttons {
  display: flex;
  gap: 12px;
  padding: 16px;
  justify-content: center;
}

.mp-rating-btn {
  flex: 1;
  max-width: 80px;
  padding: 12px 8px;
  text-align: center;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-size: 12px;
}

.mp-rating-btn-forgot {
  background: #fee2e2;
  color: #ef4444;
}

.mp-rating-btn-hard {
  background: #fef3c7;
  color: #f59e0b;
}

.mp-rating-btn-good {
  background: #dbeafe;
  color: #3b82f6;
}

.mp-rating-btn-easy {
  background: var(--mp-primary-bg);
  color: var(--mp-primary);
}

/* Mini Program Test Options */
.mp-test-option {
  display: flex;
  align-items: center;
  padding: 16px;
  background: var(--mp-white);
  border-radius: 12px;
  margin-bottom: 12px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}

.mp-test-option:active {
  background: var(--mp-gray-1);
}

.mp-test-option.selected {
  border-color: var(--mp-primary);
  background: var(--mp-primary-bg);
}

.mp-test-option-label {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--mp-gray-1);
  color: var(--mp-gray-5);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
}

.mp-test-option.selected .mp-test-option-label {
  background: var(--mp-primary);
  color: white;
}

.mp-test-option-text {
  font-size: 15px;
  color: var(--mp-gray-6);
}

/* Mini Program Timeline (Review) */
.mp-timeline {
  position: relative;
  padding: 16px 12px 16px 32px;
}

.mp-timeline::before {
  content: '';
  position: absolute;
  left: 19px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--mp-gray-2);
}

.mp-timeline-item {
  position: relative;
  padding: 12px 0;
}

.mp-timeline-dot {
  position: absolute;
  left: -20px;
  top: 16px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--mp-gray-3);
  border: 3px solid var(--mp-bg);
}

.mp-timeline-item.active .mp-timeline-dot {
  background: var(--mp-primary);
  box-shadow: 0 0 0 4px var(--mp-primary-bg);
}

.mp-timeline-item.completed .mp-timeline-dot {
  background: var(--mp-primary);
}

.mp-timeline-content {
  background: var(--mp-white);
  border-radius: 10px;
  padding: 12px 14px;
}

.mp-timeline-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--mp-gray-6);
  margin-bottom: 4px;
}

.mp-timeline-desc {
  font-size: 12px;
  color: var(--mp-gray-4);
}

/* Mini Program Audio Player */
.mp-player {
  background: var(--mp-white);
  border-radius: 16px;
  padding: 20px;
  margin: 12px;
}

.mp-player-cover {
  width: 120px;
  height: 120px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--mp-primary), var(--mp-primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 48px;
}

.mp-player-title {
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  color: var(--mp-gray-6);
  margin-bottom: 4px;
}

.mp-player-desc {
  text-align: center;
  font-size: 13px;
  color: var(--mp-gray-4);
  margin-bottom: 20px;
}

.mp-player-progress {
  margin-bottom: 8px;
}

.mp-player-time {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--mp-gray-4);
  margin-bottom: 20px;
}

.mp-player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.mp-player-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--mp-gray-1);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--mp-gray-6);
  cursor: pointer;
}

.mp-player-btn-play {
  width: 64px;
  height: 64px;
  background: var(--mp-primary);
  color: white;
  font-size: 28px;
}

/* Mini Program Empty State */
.mp-empty {
  padding: 60px 40px;
  text-align: center;
}

.mp-empty-icon {
  font-size: 64px;
  color: var(--mp-gray-3);
  margin-bottom: 16px;
}

.mp-empty-text {
  font-size: 14px;
  color: var(--mp-gray-4);
}

/* Mini Program Flip Card */
.mp-flip-container {
  perspective: 1000px;
  margin: 12px;
}

.mp-flip-card {
  position: relative;
  width: 100%;
  min-height: 300px;
  transform-style: preserve-3d;
  transition: transform 0.6s;
}

.mp-flip-card.flipped {
  transform: rotateY(180deg);
}

.mp-flip-card-front,
.mp-flip-card-back {
  position: absolute;
  width: 100%;
  backface-visibility: hidden;
  background: var(--mp-white);
  border-radius: 16px;
  padding: 32px 20px;
  text-align: center;
}

.mp-flip-card-back {
  transform: rotateY(180deg);
}

/* Mini Program Course List */
.mp-course-item {
  display: flex;
  padding: 12px 16px;
  background: var(--mp-white);
  border-bottom: 1px solid var(--mp-gray-1);
}

.mp-course-item:last-child {
  border-bottom: none;
}

.mp-course-cover {
  width: 80px;
  height: 60px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--mp-primary), var(--mp-primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  margin-right: 12px;
  flex-shrink: 0;
}

.mp-course-info {
  flex: 1;
  min-width: 0;
}

.mp-course-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--mp-gray-6);
  margin-bottom: 4px;
}

.mp-course-meta {
  font-size: 12px;
  color: var(--mp-gray-4);
  margin-bottom: 6px;
}

.mp-course-progress {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mp-course-progress-bar {
  flex: 1;
  height: 4px;
  background: var(--mp-gray-2);
  border-radius: 2px;
  overflow: hidden;
}

.mp-course-progress-bar-inner {
  height: 100%;
  background: var(--mp-primary);
}

.mp-course-progress-text {
  font-size: 11px;
  color: var(--mp-gray-4);
}

/* ========================================
   动效和反馈样式
   ======================================== */

/* 动画关键帧 */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

@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); }
}

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

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

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

/* 动画类 */
.animate-fade-in { animation: fadeIn 0.3s ease-out; }
.animate-slide-up { animation: slideUp 0.4s ease-out; }
.animate-slide-down { animation: slideDown 0.4s ease-out; }
.animate-bounce-in { animation: bounceIn 0.6s ease-out; }
.animate-pulse { animation: pulse 2s infinite; }
.animate-shake { animation: shake 0.5s ease-out; }
.animate-spin { animation: spin 1s linear infinite; }

/* Toast 容器 */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Toast 样式 */
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  font-size: 14px;
  min-width: 200px;
  max-width: 400px;
}

.toast-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
}

.toast-success .toast-icon { background: var(--success-bg); color: var(--success); }
.toast-error .toast-icon { background: #fee2e2; color: var(--danger); }
.toast-warning .toast-icon { background: var(--warning-bg); color: var(--warning); }
.toast-info .toast-icon { background: var(--info-bg); color: var(--info); }

.toast-hide {
  opacity: 0;
  transform: translateX(20px);
  transition: all 0.3s ease;
}

/* Modal 样式增强 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  font-size: 24px;
  cursor: pointer;
  color: var(--gray-400);
  border-radius: 4px;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--gray-100);
  color: var(--gray-600);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* 表单样式（Modal 内） */
.modal-form .form-group {
  margin-bottom: 16px;
}

.modal-form .form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-700);
}

.modal-form .form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.modal-form .form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}

/* 空状态样式 */
.empty-state {
  padding: 60px 20px;
  text-align: center;
}

.empty-state-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.empty-state-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 8px;
}

.empty-state-desc {
  font-size: 14px;
  color: var(--gray-400);
  margin-bottom: 20px;
}

.empty-state-btn {
  margin-top: 8px;
}

/* 骨架屏样式 */
.skeleton-card,
.skeleton-list,
.skeleton-table {
  padding: 20px;
}

.skeleton-header {
  height: 20px;
  background: var(--gray-200);
  border-radius: 4px;
  margin-bottom: 16px;
  width: 60%;
}

.skeleton-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skeleton-line {
  height: 14px;
  background: var(--gray-100);
  border-radius: 4px;
}

.skeleton-line.short {
  width: 40%;
}

.skeleton-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gray-200);
  flex-shrink: 0;
}

.skeleton-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skeleton-row {
  height: 48px;
  background: var(--gray-100);
  border-radius: 4px;
  margin-bottom: 8px;
}

/* 引导提示样式 */
.guide-highlight {
  box-shadow: 0 0 0 4px var(--primary), 0 0 20px rgba(99, 102, 241, 0.4) !important;
  border-radius: 8px;
}

.guide-tooltip-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 8px;
  color: var(--gray-800);
}

.guide-tooltip-text {
  font-size: 13px;
  color: var(--gray-600);
  line-height: 1.5;
  margin-bottom: 12px;
}

.guide-tooltip-btn {
  width: 100%;
  padding: 8px 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

.guide-tooltip-btn:hover {
  background: var(--primary-dark);
}

/* 成就弹窗样式 */
.achievement-icon {
  font-size: 32px;
}

.achievement-title {
  font-weight: 600;
  font-size: 16px;
}

.achievement-desc {
  font-size: 13px;
  opacity: 0.9;
}

/* 加载状态 */
.loading {
  position: relative;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* 按钮悬停效果增强 */
.btn {
  transition: all 0.2s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary:hover {
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-success:hover {
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* 卡片悬停效果 */
.card {
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

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

/* 表格行悬停 */
.table tbody tr {
  transition: background 0.2s ease;
}

.table tbody tr:hover {
  background: var(--gray-50);
}

.table tbody tr.selected {
  background: var(--primary-bg);
}

/* 输入框焦点效果 */
.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}

/* 进度条动画 */
.progress-bar {
  transition: width 0.5s ease;
}

/* 徽章动画 */
.badge {
  transition: all 0.2s ease;
}

/* 数字变化动画 */
.stat-card-value {
  transition: all 0.3s ease;
}

/* 移动端适配 */
@media (max-width: 768px) {
  #toast-container {
    top: auto;
    bottom: 80px;
    right: 16px;
    left: 16px;
  }

  .toast {
    min-width: auto;
    width: 100%;
  }

  .modal-content {
    margin: 16px;
    max-height: calc(100vh - 32px);
  }
}

/* 小程序端动效 */
.mp-btn {
  transition: all 0.2s ease;
}

.mp-btn:active {
  transform: scale(0.96);
  opacity: 0.9;
}

.mp-card {
  transition: box-shadow 0.3s ease;
}

.mp-cell {
  transition: background 0.2s ease;
}

.mp-cell:active {
  background: var(--mp-gray-1);
}

/* 翻转卡片增强动效 */
.mp-flip-card {
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 评分按钮动效 */
.mp-rating-btn {
  transition: all 0.2s ease;
}

.mp-rating-btn:active {
  transform: scale(0.9);
}

/* 选项选中效果 */
.mp-test-option {
  transition: all 0.2s ease;
}

.mp-test-option.selected {
  border-color: var(--mp-primary);
  background: var(--mp-primary-bg);
}
