/* Lesson Learning Styles */

.lesson-learning {
  min-height: 100vh;
  background: var(--gray-50);
}

/* Lesson Header */
.lesson-header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 2rem 0;
  margin-bottom: 2rem;
}

.lesson-header__nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  margin-bottom: 1.5rem;
}

.lesson-nav-link {
  color: var(--gray-600);
  text-decoration: none;
  font-size: var(--font-size-sm);
  transition: color 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.lesson-nav-link:hover {
  color: var(--primary-color);
}

.lesson-header__info {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3rem;
  align-items: start;
}

.lesson-header__main {
  min-width: 0; /* Prevents flex item from overflowing */
}

.lesson-header__course {
  margin-bottom: 1rem;
}

.course-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: var(--white);
  border-radius: var(--border-radius);
  font-size: var(--font-size-sm);
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.2s;
}

.course-badge:hover {
  transform: translateY(-1px);
  color: var(--white);
}

.lesson-header__title {
  font-size: var(--font-size-3xl);
  font-weight: 700;
  margin: 0 0 1.5rem 0;
  color: var(--gray-900);
  line-height: 1.2;
}

.lesson-header__stats {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-width: 300px;
}

.lesson-header__meta {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.lesson-meta-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--font-size-sm);
  color: var(--gray-600);
  background: var(--gray-50);
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
}

.lesson-meta-icon {
  font-size: 1.125rem;
}

/* Progress Bar Styles */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  border-radius: 4px;
  transition: width 0.3s ease;
  position: relative;
}

.progress-bar__fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2s infinite;
}

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

.progress-bar--lg {
  height: 12px;
  border-radius: 6px;
}

.progress-bar--sm {
  height: 6px;
  border-radius: 3px;
}

/* Progress Info Styling */
.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.progress-label {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--gray-700);
}

.progress-percentage {
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--primary-color);
  background: color-mix(in srgb, var(--primary-color) 10%, transparent);
  padding: 0.25rem 0.5rem;
  border-radius: var(--border-radius);
}
.lesson-body {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

@media (min-width: 768pxpx) {
  .lesson-content {
    display: block;
    padding: 1rem;
  }
}
/* Mobile-friendly base styles */
.lesson-learning {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

.lesson-learning * {
  -webkit-tap-highlight-color: transparent;
}
/* Lesson Content Layout */
.lesson-content {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  align-items: start;
}

.lesson-main {
  background: var(--white);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  grid-area: main;
  width: 100%;
}

.lesson-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  grid-area: sidebar;
  position: sticky;
  top: 2rem;
  align-self: start;
  width: 300px;
  min-width: 300px;
}

/* Lesson Objectives */
.lesson-objectives {
  padding: 2rem;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}

.lesson-objectives__title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin: 0 0 1rem 0;
  color: var(--gray-900);
}

/* Lesson Description */
.lesson-description {
  padding: 2rem;
  border-bottom: 1px solid var(--gray-200);
}

.lesson-description__content {
  line-height: 1.6;
  color: var(--gray-700);
}

/* Exercise Container */
.exercise-container {
  padding: 2rem;
  background: var(--white);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow);
}

.exercise-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--gray-200);
}

.exercise-header__title {
  font-size: var(--font-size-xl);
  font-weight: 600;
  margin: 0;
  color: var(--gray-900);
}

.exercise-counter {
  font-size: var(--font-size-sm);
  color: var(--gray-600);
  font-weight: 500;
  background: var(--gray-100);
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
}

/* Exercise Styles */
.exercise {
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: var(--border-radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  transition: border-color 0.2s;
}

/* Dark mode for exercises */
.dark .exercise {
  background: var(--bg-primary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

.exercise:focus-within {
  border-color: var(--primary-color);
}

.exercise__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.exercise__title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin: 0;
  color: var(--gray-900);
}

.dark .exercise__title {
  color: var(--text-primary) !important;
}

.points-badge {
  padding: 0.25rem 0.75rem;
  background: var(--primary-color);
  color: var(--white);
  border-radius: var(--border-radius);
  font-size: var(--font-size-sm);
  font-weight: 600;
}

.exercise__question {
  margin-bottom: 1.5rem;
}

.question-text {
  font-size: var(--font-size-base);
  font-weight: 500;
  color: var(--gray-800);
  margin: 0;
}

/* Multiple Choice Exercise */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.option-item {
  display: flex;
  align-items: center;
  padding: 1rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.2s;
  min-height: 48px; /* Minimum touch target size */
  -webkit-tap-highlight-color: transparent;
}

.option-item:hover {
  border-color: var(--primary-color);
  background-color: var(--gray-50);
}

.option-item:has(.option-input:checked) {
  border-color: var(--primary-color);
  background-color: color-mix(in srgb, var(--primary-color) 10%, transparent);
}

.option-input {
  display: none;
}

.option-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.option-marker {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gray-200);
  color: var(--gray-700);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: var(--font-size-sm);
  flex-shrink: 0;
}

.option-item:has(.option-input:checked) .option-marker {
  background: var(--primary-color);
  color: var(--white);
}

.option-text {
  font-size: var(--font-size-base);
  color: var(--gray-800);
  line-height: 1.5;
}

.exercise__actions {
  margin-top: 1.5rem;
  display: flex;
  gap: 1rem;
}

/* Fill in the Blank Exercise */
.sentence-container {
  margin-bottom: 1.5rem;
}

.sentence-text {
  font-size: var(--font-size-lg);
  line-height: 1.6;
  color: var(--gray-800);
}

.blank-input {
  display: inline-block;
  min-width: 120px;
  padding: 0.5rem;
  border: none;
  border-bottom: 2px solid var(--primary-color);
  background: transparent;
  font-size: inherit;
  font-family: inherit;
  text-align: center;
  margin: 0 0.25rem;
}

.blank-input:focus {
  outline: none;
  border-bottom-color: var(--primary-dark);
}

/* Translation Exercise */
.translation-source {
  margin-bottom: 1rem;
}

.translation-target {
  margin-top: 1rem;
}

.source-language,
.target-language {
  margin-bottom: 0.5rem;
}

.language-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.75rem;
  background: var(--gray-100);
  color: var(--gray-700);
  border-radius: var(--border-radius);
  font-size: var(--font-size-sm);
  font-weight: 600;
}

.source-text {
  padding: 1rem;
  background: var(--gray-50);
  border-radius: var(--border-radius);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--gray-800);
  border-left: 4px solid var(--gray-300);
}

.translation-arrow {
  text-align: center;
  font-size: var(--font-size-xl);
  color: var(--gray-400);
  margin: 1rem 0;
}

.translation-input {
  width: 100%;
  padding: 1rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--border-radius);
  font-size: var(--font-size-base);
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
}

.translation-input:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* Exercise Feedback */
.exercise__feedback {
  margin-top: 1.5rem;
  padding: 1rem;
  border-radius: var(--border-radius);
}

.exercise__feedback--correct {
  background: color-mix(in srgb, var(--secondary-color) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--secondary-color) 30%, transparent);
  color: var(--secondary-color);
}

.exercise__feedback--incorrect {
  background: color-mix(in srgb, var(--danger-color) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger-color) 30%, transparent);
  color: var(--danger-color);
}

.feedback-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.feedback-icon {
  font-size: 1.25rem;
}

.feedback-message {
  font-weight: 500;
}

/* Exercise Hints */
.exercise__hint {
  margin-top: 1rem;
  padding: 1rem;
  background: color-mix(in srgb, var(--accent-color) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-color) 30%, transparent);
  border-radius: var(--border-radius);
}

.hint-content {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.hint-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.hint-text {
  color: var(--gray-700);
  line-height: 1.5;
}

.hint-button {
  background: none;
  border: 1px solid var(--gray-300);
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: var(--font-size-sm);
  color: var(--gray-600);
  transition: all 0.2s;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}

.hint-button:hover,
.hint-button:focus {
  border-color: var(--primary-color);
  color: var(--primary-color);
  outline: none;
}

/* Exercise Navigation */
.exercise-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--gray-200);
}

.exercise-actions {
  display: flex;
  gap: 1rem;
}

/* Sidebar Components */
.exercise-progress-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.exercise-progress-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--border-radius);
  transition: background-color 0.2s;
}

.exercise-progress-item--current {
  background: color-mix(in srgb, var(--primary-color) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary-color) 30%, transparent);
}

.exercise-progress-item--completed {
  background: color-mix(in srgb, var(--secondary-color) 10%, transparent);
}

.exercise-progress-number {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--gray-200);
  color: var(--gray-700);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  font-weight: 600;
  flex-shrink: 0;
}

.exercise-progress-item--completed .exercise-progress-number {
  background: var(--secondary-color);
  color: var(--white);
}

.exercise-progress-item--current .exercise-progress-number {
  background: var(--primary-color);
  color: var(--white);
}

.exercise-progress-info {
  flex: 1;
}

.exercise-progress-title {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--gray-900);
  margin-bottom: 0.25rem;
}

.exercise-progress-points {
  color: var(--gray-600);
  font-weight: 500;
}

/* Lesson Navigation */
.lesson-nav-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.lesson-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
}

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

.lesson-nav-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--gray-600);
}

.lesson-nav-info {
  flex: 1;
}

.lesson-nav-label {
  font-size: var(--font-size-sm);
  color: var(--gray-500);
  margin-bottom: 0.25rem;
}

.lesson-nav-title {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--gray-900);
}

/* Lesson Stats */
.lesson-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.lesson-stat {
  text-align: center;
}

.lesson-stat__value {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--primary-color);
  line-height: 1;
}

.lesson-stat__label {
  font-size: var(--font-size-sm);
  color: var(--gray-600);
  margin-top: 0.25rem;
}

/* Lesson Header Stats Grid */
.lesson-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.lesson-stat-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  padding: 1rem;
  text-align: center;
  transition: all 0.2s;
}

.lesson-stat-card:hover {
  border-color: var(--primary-color);
  transform: translateY(-1px);
}

.lesson-stat-card__value {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--primary-color);
  line-height: 1;
  display: block;
}

.lesson-stat-card__label {
  font-size: var(--font-size-sm);
  color: var(--gray-600);
  margin-top: 0.5rem;
  font-weight: 500;
}

/* Completion Modal */
.completion-modal {
  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;
}

.completion-modal__content {
  background: var(--white);
  border-radius: var(--border-radius-lg);
  padding: 3rem;
  max-width: 500px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.completion-modal__icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.completion-modal__title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  margin: 0 0 1rem 0;
  color: var(--gray-900);
}

.completion-modal__message {
  color: var(--gray-600);
  margin: 0 0 2rem 0;
  line-height: 1.6;
}

.completion-modal__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.completion-stat {
  text-align: center;
}

.completion-stat__value {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--primary-color);
  line-height: 1;
}

.completion-stat__label {
  font-size: var(--font-size-sm);
  color: var(--gray-600);
  margin-top: 0.5rem;
}

.completion-modal__actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

/* No Exercises State */
.no-exercises {
  text-align: center;
  padding: 3rem;
}

.no-exercises__icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.no-exercises__title {
  font-size: var(--font-size-xl);
  font-weight: 600;
  margin: 0 0 1rem 0;
  color: var(--gray-900);
}

.no-exercises__text {
  color: var(--gray-600);
  margin: 0;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .lesson-header__info {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  
  .lesson-header__stats {
    min-width: auto;
  }
  
  .lesson-content {
    grid-template-columns: 1fr 280px;
    gap: 1.5rem;
  }
  
  .lesson-sidebar {
    width: 280px;
    min-width: 280px;
  }
}

@media (max-width: 768px) {
  /* Mobile-first optimizations */
  .lesson-learning {
    padding-bottom: 2rem;
  }
  
  .lesson-header {
    padding: 1rem 0;
    margin-bottom: 1rem;
  }
  
  .lesson-header__nav {
    padding: 0 0.75rem;
    margin-bottom: 1rem;
  }
  
  .lesson-nav-link {
    padding: 0.75rem;
    margin: -0.75rem;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  
  .lesson-header__info {
    padding: 0 0.75rem;
  }
  
  .lesson-header__title {
    font-size: var(--font-size-2xl);
    margin-bottom: 1rem;
    line-height: 1.3;
  }
  
  .lesson-header__meta {
    gap: 0.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  
  .lesson-meta-item {
    font-size: 0.75rem;
    padding: 0.5rem 0.75rem;
    justify-content: center;
    text-align: center;
  }
  
  .lesson-stats-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .lesson-content {
    grid-template-columns: 1fr;
    grid-template-areas: "main";
    gap: 1rem;
    padding: 0 0.75rem;
  }
  
  .lesson-sidebar {
    display: none;
  }
  
  .lesson-main {
    border-radius: var(--border-radius);
  }
  
  /* Exercise optimizations */
  .exercise-container {
    padding: 1rem;
  }
  
  .exercise-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
  }
  
  .exercise-header__title {
    font-size: var(--font-size-lg);
  }
  
  .exercise {
    padding: 1rem;
    margin-bottom: 1.5rem;
  }
  
  /* Touch-friendly buttons and inputs */
  .btn {
    min-height: 44px;
    padding: 0.75rem 1.5rem;
    font-size: var(--font-size-base);
  }
  
  .option-item {
    padding: 1rem;
    min-height: 56px;
  }
  
  .option-marker {
    width: 44px;
    height: 44px;
    font-size: var(--font-size-base);
  }
  
  .blank-input {
    min-width: 100px;
    padding: 0.75rem 0.5rem;
    font-size: var(--font-size-base);
    min-height: 44px;
  }
  
  .translation-input {
    padding: 1rem;
    font-size: var(--font-size-base);
    min-height: 100px;
  }
  
  /* Exercise navigation */
  .exercise-navigation {
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
  }
  
  .exercise-actions {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }
  
  .exercise-actions .btn {
    flex: 1;
    min-width: 120px;
  }
  
  /* Sidebar optimizations */
  .card {
    border-radius: var(--border-radius);
  }
  
  .card__header {
    padding: 1rem;
  }
  
  .card__content {
    padding: 1rem;
  }
  
  .exercise-progress-item {
    padding: 1rem;
    min-height: 60px;
  }
  
  .exercise-progress-number {
    width: 32px;
    height: 32px;
    font-size: var(--font-size-base);
  }
  
  .lesson-nav-item {
    padding: 1rem;
    min-height: 60px;
  }
  
  .lesson-nav-icon {
    width: 40px;
    height: 40px;
    font-size: var(--font-size-base);
  }
  
  /* Modal optimizations */
  .completion-modal__content {
    padding: 1.5rem;
    margin: 1rem;
    width: calc(100% - 2rem);
    max-width: none;
  }
  
  .completion-modal__stats {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .completion-modal__actions {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .completion-modal__actions .btn {
    width: 100%;
  }
  
  /* Typography improvements */
  .question-text {
    font-size: var(--font-size-lg);
    line-height: 1.6;
  }
  
  .sentence-text {
    font-size: var(--font-size-base);
    line-height: 1.7;
  }
  
  .source-text {
    padding: 1rem;
    font-size: var(--font-size-base);
    line-height: 1.6;
  }
}

/* Small mobile devices */
@media (max-width: 480px) {
  .lesson-content {
    padding: 0 0.5rem;
  }
  
  .lesson-header__info {
    padding: 0 0.5rem;
  }
  
  .lesson-header__nav {
    padding: 0 0.5rem;
  }
  
  .lesson-header__meta {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  
  .exercise-container {
    padding: 0.75rem;
  }
  
  .exercise {
    padding: 0.75rem;
  }
  
  .option-item {
    padding: 0.75rem;
  }
  
  .completion-modal__content {
    padding: 1rem;
    margin: 0.5rem;
    width: calc(100% - 1rem);
  }
}

/* Mobile scroll improvements */
@media (max-width: 768px) {
  .lesson-learning {
    overflow-x: hidden;
  }
  
  .lesson-sidebar {
    -webkit-overflow-scrolling: touch;
  }
  
  /* Improved form inputs for mobile */
  .blank-input:focus,
  .translation-input:focus {
    transform: none;
    zoom: 1;
  }
  
  /* Prevent zoom on input focus for iOS */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  textarea,
  select {
    font-size: 16px;
  }
  
  /* Better spacing for mobile cards */
  .card + .card {
    margin-top: 1rem;
  }
  
  /* Improved touch targets for progress items */
  .exercise-progress-item,
  .lesson-nav-item {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    tap-highlight-color: rgba(0, 0, 0, 0.1);
  }
  
  /* Better modal positioning on mobile */
  .completion-modal {
    padding: 1rem;
    align-items: flex-start;
    padding-top: 2rem;
  }
  
  /* Improved button spacing */
  .exercise-actions {
    gap: 0.75rem;
  }
  
  /* Better text selection on mobile */
  .option-text,
  .question-text,
  .sentence-text {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
  }
  
  .translation-input,
  .blank-input {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
  }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .option-marker,
  .exercise-progress-number,
  .lesson-nav-icon {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .lesson-header {
    padding: 0.75rem 0;
  }
  
  .lesson-header__title {
    font-size: var(--font-size-xl);
    margin-bottom: 0.75rem;
  }
  
  .completion-modal {
    padding-top: 1rem;
  }
  
  .completion-modal__content {
    max-height: 90vh;
    overflow-y: auto;
  }
}
/* Completion Content (for turbo stream replacement) */
.completion-content {
  padding: 2rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.completion-card {
  background: var(--white);
  border-radius: var(--border-radius-lg);
  padding: 2rem;
  max-width: 500px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-200);
}

.completion-card__icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.completion-card__title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  margin: 0 0 1rem 0;
  color: var(--gray-900);
}

.completion-card__message {
  color: var(--gray-600);
  margin: 0 0 2rem 0;
  line-height: 1.6;
}

.completion-card__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.completion-card__actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Mobile optimizations for completion card */
@media (max-width: 768px) {
  .completion-content {
    padding: 1rem;
    min-height: 50vh;
  }
  
  .completion-card {
    padding: 1.5rem;
    margin: 0;
  }
  
  .completion-card__icon {
    font-size: 3rem;
  }
  
  .completion-card__title {
    font-size: var(--font-size-xl);
  }
  
  .completion-card__stats {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
  }
  
  .completion-card__actions {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .completion-card__actions .btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .completion-content {
    padding: 0.5rem;
  }
  
  .completion-card {
    padding: 1rem;
    border-radius: var(--border-radius-md);
  }
  
  .completion-card__icon {
    font-size: 2.5rem;
  }
  
  .completion-card__title {
    font-size: var(--font-size-lg);
  }
  
  .completion-card__message {
    font-size: var(--font-size-sm);
    margin-bottom: 1.5rem;
  }
}
/* Mobile/Desktop Control for Sidebar Components */
.exercise-progress-mobile,
.lesson-navigation-mobile,
.quick-stats-mobile {
  display: none;
}

.exercise-progress-desktop,
.lesson-navigation-desktop,
.quick-stats-desktop {
  display: block;
}

/* Mobile: Show mobile versions in main content, hide desktop sidebar versions */
@media (max-width: 768px) {
  .exercise-progress-mobile,
  .lesson-navigation-mobile,
  .quick-stats-mobile {
    display: block;
    margin-bottom: 1.5rem;
  }
  
  .exercise-progress-desktop,
  .lesson-navigation-desktop,
  .quick-stats-desktop {
    display: none;
  }
}
/* Dark Mode Support */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --border-color: #e5e7eb;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}

.dark {
  --bg-primary: #1f2937;
  --bg-secondary: #111827;
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --border-color: #374151;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.3), 0 1px 2px -1px rgb(0 0 0 / 0.3);
}

/* Update existing components for dark mode */
.lesson-learning {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

.lesson-main,
.card {
  background-color: var(--bg-primary);
  border-color: var(--border-color);
  box-shadow: var(--shadow);
}

.card__title,
.lesson-objectives__title,
.exercise-header__title {
  color: var(--text-primary);
}

.card__content,
.lesson-description__content,
.objective-text {
  color: var(--text-secondary);
}

/* Exercise progress items */
.exercise-progress-item {
  border-color: var(--border-color);
}

.exercise-progress-item:hover {
  background-color: var(--bg-secondary);
}

.exercise-progress-item--completed {
  background-color: color-mix(in srgb, var(--secondary-color) 10%, var(--bg-primary));
  border-color: var(--secondary-color);
}

.dark .exercise-progress-item--completed {
  background-color: color-mix(in srgb, var(--secondary-color) 20%, var(--bg-primary));
}

.exercise-progress-item--current {
  background-color: color-mix(in srgb, var(--primary-color) 10%, var(--bg-primary));
  border-color: var(--primary-color);
}

.dark .exercise-progress-item--current {
  background-color: color-mix(in srgb, var(--primary-color) 20%, var(--bg-primary));
}

/* Lesson navigation */
.lesson-nav-item {
  background-color: var(--bg-primary);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.lesson-nav-item:hover {
  background-color: var(--bg-secondary);
}

/* Stats */
.lesson-stat__value {
  color: var(--text-primary);
}

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

/* Buttons dark mode support */
.btn {
  transition: all 0.2s ease-in-out;
}

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

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

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

.dark .btn--primary:hover {
  background-color: color-mix(in srgb, var(--primary-color) 80%, var(--black));
}

.btn--secondary {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn--secondary:hover {
  background-color: var(--border-color);
}

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

.btn--success:hover {
  background-color: color-mix(in srgb, var(--secondary-color) 90%, var(--black));
}

.dark .btn--success {
  background-color: color-mix(in srgb, var(--secondary-color) 90%, var(--black));
}

.dark .btn--success:hover {
  background-color: color-mix(in srgb, var(--secondary-color) 80%, var(--black));
}
/* Enhanced Dark Mode Support for Lesson Components */

/* Lesson Header Dark Mode */
.lesson-header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.lesson-header__title {
  color: var(--text-primary);
  transition: color 0.2s ease;
}

.lesson-header__meta {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.lesson-meta-item {
  color: var(--text-secondary);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.lesson-meta-item:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

.course-badge {
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  color: var(--primary-color);
  transition: all 0.2s ease;
}

.course-badge:hover {
  background: var(--bg-hover);
  transform: translateY(-1px);
}

/* Exercise Components Dark Mode */
.exercise-container {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* Ensure dark mode is applied specifically */
.dark .exercise-container {
  background: var(--bg-primary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

.exercise-header {
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.dark .exercise-header {
  background: var(--bg-tertiary) !important;
  border-bottom-color: var(--border-color) !important;
}

.exercise-header__title {
  color: var(--text-primary);
  transition: color 0.2s ease;
}

.dark .exercise-header__title {
  color: var(--text-primary) !important;
}

.exercise-counter {
  background: var(--accent-bg);
  color: var(--primary-color);
  border: 1px solid var(--accent-border);
  transition: all 0.2s ease;
}

.dark .exercise-counter {
  background: var(--accent-bg) !important;
  color: var(--primary-color) !important;
  border-color: var(--accent-border) !important;
}

/* Exercise Progress Enhanced */
.exercise-progress-item {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.exercise-progress-item:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
  transform: translateX(4px);
}

.exercise-progress-item--completed {
  background: color-mix(in srgb, var(--secondary-color) 15%, var(--bg-primary));
  border-color: var(--secondary-color);
  box-shadow: 0 2px 4px color-mix(in srgb, var(--secondary-color) 20%, transparent);
}

.exercise-progress-item--current {
  background: color-mix(in srgb, var(--primary-color) 15%, var(--bg-primary));
  border-color: var(--primary-color);
  box-shadow: 0 2px 4px var(--accent-bg);
  animation: pulse-current 2s infinite;
}

@keyframes pulse-current {
  0%, 100% { 
    box-shadow: 0 2px 4px var(--accent-bg);
  }
  50% { 
    box-shadow: 0 4px 8px color-mix(in srgb, var(--primary-color) 30%, transparent);
  }
}

.exercise-progress-number {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.exercise-progress-item--completed .exercise-progress-number {
  background: var(--secondary-color);
  color: var(--white);
  border-color: var(--secondary-color);
}

.exercise-progress-item--current .exercise-progress-number {
  background: var(--primary-color);
  color: var(--white);
  border-color: var(--primary-color);
}

.exercise-progress-title {
  color: var(--text-primary);
  transition: color 0.2s ease;
}

.exercise-progress-type {
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.exercise-progress-points {
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

/* Lesson Navigation Enhanced */
.lesson-nav-item {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.lesson-nav-item:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.lesson-nav-item--prev:hover {
  transform: translateX(-2px) translateY(-2px);
}

.lesson-nav-item--next:hover {
  transform: translateX(2px) translateY(-2px);
}

.lesson-nav-icon {
  background: var(--bg-tertiary);
  color: var(--primary-color);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.lesson-nav-item:hover .lesson-nav-icon {
  background: var(--primary-color);
  color: var(--white);
  border-color: var(--primary-color);
}

.lesson-nav-label {
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.lesson-nav-title {
  color: var(--text-primary);
  transition: color 0.2s ease;
}

/* Stats Enhanced */
.lesson-stat-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.lesson-stat-card:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.lesson-stat-card__value {
  color: var(--primary-color);
  transition: color 0.2s ease;
}

.lesson-stat-card__label {
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

/* Learning Objectives Enhanced */
.lesson-objectives {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary-color);
  transition: all 0.2s ease;
}

.lesson-objectives__title {
  color: var(--text-primary);
  transition: color 0.2s ease;
}

.objective-item {
  border-bottom: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.objective-item:hover {
  background: var(--bg-hover);
  padding-left: 1.5rem;
}

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

.objective-icon {
  color: var(--primary-color);
  transition: color 0.2s ease;
}

.objective-text {
  color: var(--text-primary);
  transition: color 0.2s ease;
}

/* Lesson Description Enhanced */
.lesson-description {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.lesson-description__content {
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

/* Progress Bar Enhanced */
.lesson-progress {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.lesson-progress__bar {
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  transition: width 0.3s ease;
}

.lesson-progress__text {
  color: var(--text-primary);
  font-weight: 600;
  transition: color 0.2s ease;
}

/* Enhanced Button Hover Effects */
.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn:active {
  transform: translateY(0);
}

/* Mobile Dark Mode Optimizations */
@media (max-width: 768px) {
  .lesson-header {
    background: var(--bg-secondary);
  }
  
  .exercise-progress-item:hover {
    transform: none;
  }
  
  .lesson-nav-item:hover {
    transform: none;
  }
  
  .lesson-stat-card:hover {
    transform: none;
  }
}

/* Focus States for Accessibility */
.btn:focus,
.lesson-nav-item:focus,
.exercise-progress-item:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Smooth Scrolling */
html {
  scroll-behavior: smooth;
}

/* Selection Colors */
::selection {
  background: var(--accent-bg);
  color: var(--primary-color);
}

.dark ::selection {
  background: color-mix(in srgb, var(--primary-color) 30%, var(--bg-primary));
  color: var(--primary-color);
}
/* Text Color Fixes for Dark Mode */

/* Ensure all lesson text uses dynamic colors */
.lesson-learning * {
  color: inherit;
}

/* Override any remaining hardcoded colors */
.lesson-header__title,
.lesson-objectives__title,
.exercise-header__title {
  color: var(--text-primary) !important;
}

.lesson-description__content,
.objective-text,
.exercise-counter,
.lesson-meta-text {
  color: var(--text-secondary) !important;
}

.exercise-progress-type,
.lesson-nav-label,
.completion-stat__label {
  color: var(--text-muted) !important;
}

/* Ensure proper text colors in dark mode */
.dark .lesson-learning,
.dark .lesson-learning * {
  color: var(--text-primary);
}

.dark .lesson-description__content,
.dark .objective-text,
.dark .exercise-counter,
.dark .lesson-meta-text,
.dark .exercise-progress-type,
.dark .lesson-nav-label,
.dark .completion-stat__label {
  color: var(--text-secondary);
}

/* Fix any text that might be too dark in dark mode */
.dark .exercise-question,
.dark .option-text,
.dark .exercise-text {
  color: var(--text-primary) !important;
}

/* Ensure buttons have proper text colors */
.dark .btn {
  color: inherit;
}

.dark .btn--primary {
  color: var(--white) !important;
}

.dark .btn--secondary {
  color: var(--text-primary) !important;
}

.dark .btn--success {
  color: var(--white) !important;
}
/* AI Conversation Exercise Styles */

.ai-conversation-exercise {
  background: var(--bg-primary);
  border-radius: var(--border-radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.exercise-header__subtitle {
  color: var(--text-secondary);
  font-size: var(--font-size-base);
  margin-top: 0.5rem;
  font-style: italic;
}

/* Conversation Context */
.conversation-context {
  background: var(--bg-tertiary);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  margin: 1.5rem 0;
  border-left: 4px solid var(--primary-color);
}

.conversation-context h4 {
  color: var(--text-primary);
  margin: 0 0 0.5rem 0;
  font-size: var(--font-size-lg);
}

.context-vocabulary {
  margin-top: 1rem;
}

.vocab-word {
  display: inline-block;
  background: var(--accent-bg);
  color: var(--primary-color);
  padding: 0.25rem 0.75rem;
  border-radius: var(--border-radius);
  margin: 0.25rem;
  font-size: var(--font-size-sm);
  font-weight: 500;
}

/* Learning Goals */
.learning-goals {
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  margin: 1.5rem 0;
}

.learning-goals h4 {
  color: var(--text-primary);
  margin: 0 0 1rem 0;
}

.learning-goals ul {
  margin: 0;
  padding-left: 1.5rem;
}

.learning-goals li {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

/* Conversation Area */
.conversation-area {
  background: var(--bg-secondary);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
  margin: 2rem 0;
  min-height: 400px;
  display: flex;
  flex-direction: column;
}

.conversation-messages {
  flex: 1;
  /* max-height: 300px; - Removed to allow flexible height based on viewport */
  overflow-y: auto;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--bg-primary);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
}

/* Message Styles */
.message {
  display: flex;
  align-items: flex-start;
  margin-bottom: 1rem;
  gap: 0.75rem;
}

.message--user {
  flex-direction: row-reverse;
}

.message__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

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

.message__content {
  background: var(--bg-tertiary);
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius-lg);
  max-width: 70%;
  color: var(--text-primary);
  line-height: 1.5;
}

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

.message__timestamp {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-top: 0.25rem;
  align-self: flex-end;
}

/* Voice Input Section */
.voice-input-section {
  background: var(--bg-primary);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  text-align: center;
}

.voice-status {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  margin-bottom: 1rem;
  font-weight: 500;
}

/* Voice Waveform Animation */
.voice-waveform {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  height: 40px;
  margin: 1rem 0;
}

.wave {
  width: 4px;
  height: 10px;
  background: var(--primary-color);
  border-radius: 2px;
  opacity: 0.3;
  transition: all 0.3s ease;
}

.voice-waveform.active .wave {
  animation: wave-animation 1.5s ease-in-out infinite;
}

.voice-waveform.active .wave:nth-child(1) { animation-delay: 0s; }
.voice-waveform.active .wave:nth-child(2) { animation-delay: 0.1s; }
.voice-waveform.active .wave:nth-child(3) { animation-delay: 0.2s; }
.voice-waveform.active .wave:nth-child(4) { animation-delay: 0.3s; }
.voice-waveform.active .wave:nth-child(5) { animation-delay: 0.4s; }

@keyframes wave-animation {
  0%, 100% { 
    height: 10px; 
    opacity: 0.3; 
  }
  50% { 
    height: 30px; 
    opacity: 1; 
  }
}

/* Voice Transcript */
.voice-transcript {
  background: var(--bg-tertiary);
  border-radius: var(--border-radius);
  padding: 1rem;
  margin: 1rem 0;
  min-height: 60px;
  color: var(--text-primary);
  font-size: var(--font-size-base);
  line-height: 1.5;
  border: 2px dashed var(--border-color);
}

.voice-transcript:empty::before {
  content: "Your speech will appear here...";
  color: var(--text-muted);
  font-style: italic;
}

.voice-transcript .interim {
  color: var(--text-muted);
  font-style: italic;
}

/* Voice Button */
.voice-button {
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 1rem 2rem;
  font-size: var(--font-size-lg);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  margin: 1rem 0;
}

.voice-button:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.voice-button.recording {
  background: #ef4444;
  animation: pulse-recording 1.5s ease-in-out infinite;
}

@keyframes pulse-recording {
  0%, 100% { 
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
  }
  50% { 
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.6);
  }
}

/* Text Input Alternative */
.text-input-alternative {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.text-input {
  flex: 1;
  padding: 1 rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: var(--font-size-base);
}

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

.send-button {
  background: var(--secondary-color);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  padding: 0.75rem 1.5rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.send-button:hover {
  background: color-mix(in srgb, var(--secondary-color) 90%, var(--black));
}

/* Feedback Panel */
.feedback-panel {
  background: var(--bg-primary);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
  margin: 1.5rem 0;
  border: 1px solid var(--border-color);
}

.feedback-panel h4 {
  color: var(--text-primary);
  margin: 0 0 1rem 0;
  font-size: var(--font-size-lg);
}

.feedback-scores {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.score-item {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.score-label {
  min-width: 80px;
  color: var(--text-secondary);
  font-weight: 500;
}

.score-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
}

.score-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.score-fill--excellent { background: #22c55e; }
.score-fill--good { background: #3b82f6; }
.score-fill--fair { background: #f59e0b; }
.score-fill--needs-improvement { background: #ef4444; }

.score-value {
  min-width: 40px;
  text-align: right;
  color: var(--text-primary);
  font-weight: 600;
}

.feedback-encouragement {
  background: var(--accent-bg);
  color: var(--primary-color);
  padding: 1rem;
  border-radius: var(--border-radius);
  margin-top: 1rem;
  font-weight: 500;
  text-align: center;
}

/* Feedback Corrections as Flash Message at Top */
.feedback-corrections {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  max-width: 600px;
  width: 90%;
  padding: 1rem;
  background: #bac0f4;
  color: white;
  border-radius: var(--border-radius-lg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: slideDown 0.3s ease-out;
  border: none;
}

.dark .feedback-corrections {
  background: color-mix(in srgb, var(--primary-color) 90%, var(--white));
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

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

.feedback-corrections h5 {
  margin: 0 0 0.5rem 0;
  font-weight: 600;
  font-size: var(--font-size-base);
  color: white;
}

.feedback-corrections ul {
  margin: 0;
  padding-left: 1.5rem;
  list-style-type: disc;
}

.feedback-corrections li {
  margin: 0.25rem 0;
  color: white;
  font-size: var(--font-size-sm);
  line-height: 1.5;
}

.feedback-corrections button {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: opacity 0.2s;
  position: absolute;
  top: 1rem;
  right: 1rem;
}

.feedback-corrections button:hover {
  opacity: 0.8;
}

/* Fade out animation for feedback corrections */
.feedback-corrections.fade-out {
  opacity: 0;
  transition: opacity 0.3s ease-out;
}

/* Mobile optimizations for feedback corrections */
@media (max-width: 768px) {
  .feedback-corrections {
    top: 10px;
    width: 95%;
    max-width: none;
    padding: 0.875rem;
  }
  
  .feedback-corrections h5 {
    font-size: var(--font-size-sm);
  }
  
  .feedback-corrections li {
    font-size: 0.8125rem;
  }
}

/* Final Feedback Modal */
.conversation-feedback-modal {
  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;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.conversation-feedback-modal.show {
  opacity: 1;
}

.modal-content {
  background: var(--bg-primary);
  border-radius: var(--border-radius-lg);
  padding: 2rem;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header h3 {
  color: var(--text-primary);
  margin: 0 0 1.5rem 0;
  text-align: center;
}

.final-score {
  text-align: center;
  margin-bottom: 2rem;
}

.score-circle {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  margin: 0 auto;
}

.score-number {
  font-size: 2rem;
  font-weight: 700;
}

.score-label {
  font-size: var(--font-size-sm);
  opacity: 0.9;
}

.detailed-feedback {
  margin-bottom: 2rem;
}

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

.feedback-section h4 {
  color: var(--text-primary);
  margin: 0 0 0.5rem 0;
  font-size: var(--font-size-base);
}

.feedback-section p {
  color: var(--text-secondary);
  margin: 0.5rem 0 0 0;
  font-size: var(--font-size-sm);
}

.overall-feedback,
.strengths,
.improvements {
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

.overall-feedback h4,
.strengths h4,
.improvements h4 {
  color: var(--text-primary);
  margin: 0 0 0.5rem 0;
}

.strengths ul,
.improvements ul {
  margin: 0;
  padding-left: 1.5rem;
}

.strengths li,
.improvements li {
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.points-earned {
  background: var(--accent-bg);
  color: var(--primary-color);
  padding: 1rem;
  border-radius: var(--border-radius);
  text-align: center;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.points-icon {
  font-size: 1.5rem;
  margin-right: 0.5rem;
}

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

/* Mobile Optimizations */
@media (max-width: 768px) {
  .ai-conversation-exercise {
    padding: 1rem;
  }
  
  .conversation-area {
    padding: 1rem;
  }
  
  /* Removed max-height constraint to allow full viewport usage */
  .conversation-messages {
    /* max-height: 250px; - Commented out to allow flexible height */
  }
  
  .message__content {
    max-width: 90%;
  }
  
  .feedback-scores {
    gap: 0.75rem;
  }
  
  .score-item {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  
  .score-label {
    min-width: auto;
  }
  
  .text-input-alternative {
    flex-direction: column;
  }
  
  .modal-content {
    padding: 1.5rem;
    width: 95%;
  }
  
  .score-circle {
    width: 100px;
    height: 100px;
  }
  
  .score-number {
    font-size: 1.5rem;
  }
}