.lesson-container {
  max-width: 1200px;
  margin: 100px auto 3rem;
  padding: 0 1.5rem;
}

/* Accessibility - Screen Reader Only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Focus styles for better keyboard navigation */
button:focus,
a:focus,
.preset-btn:focus,
.timer-btn:focus,
.reveal-btn:focus,
.generate-topic-btn:focus {
  outline: 3px solid #0ea5e9;
  outline-offset: 2px;
}

/* Skip to main content link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #0ea5e9;
  color: white;
  padding: 8px;
  text-decoration: none;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

.lesson-header {
  background: linear-gradient(135deg, #0ea5e9 0%, #0369a1 100%);
  color: white;
  padding: 3rem 2rem;
  border-radius: 1rem;
  margin-bottom: 3rem;
  box-shadow: 0 10px 30px rgba(14, 165, 233, 0.2);
}

.lesson-title {
  font-family: "Poppins", sans-serif;
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.lesson-subtitle {
  font-size: 1.2rem;
  opacity: 0.95;
  margin-bottom: 1.5rem;
}

.lesson-meta {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

.lesson-meta-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
}

.lesson-section {
  background: white;
  padding: 2.5rem;
  border-radius: 1rem;
  margin-bottom: 2rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.section-title {
  font-family: "Poppins", sans-serif;
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--secondary-color);
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-icon {
  font-size: 2rem;
}

.grammar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1.5rem;
}

.grammar-card {
  background: var(--bg-secondary);
  padding: 1.5rem;
  border-radius: 0.75rem;
  border-left: 4px solid var(--primary-color);
}

.grammar-card h3 {
  color: var(--primary-color);
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.grammar-card p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

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

.example-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.example-item strong {
  color: var(--primary-color);
  min-width: 20px;
  font-weight: 600;
}

.tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.tip-card {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  padding: 1.5rem;
  border-radius: 0.75rem;
  border: 1px solid #bae6fd;
}

.tip-card h4 {
  color: var(--secondary-color);
  font-size: 1.15rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.tip-card ul {
  list-style: none;
  padding: 0;
}

.tip-card li {
  padding: 0.5rem 0;
  padding-left: 1.5rem;
  position: relative;
  color: var(--text-secondary);
}

.tip-card li:before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--success-color);
  font-weight: bold;
}

.phrase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.phrase-card {
  background: var(--bg-secondary);
  padding: 1.5rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.phrase-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  border-color: var(--primary-color);
}

.phrase-title {
  color: var(--primary-color);
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.phrase-meaning {
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 0.75rem;
}

.phrase-example {
  background: white;
  padding: 0.75rem;
  border-radius: 0.5rem;
  border-left: 3px solid var(--success-color);
  font-size: 0.95rem;
}

.phrase-content {
  margin-top: 0.75rem;
  animation: slideDown 0.3s ease;
}

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

.reveal-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  width: 100%;
  justify-content: center;
}

.reveal-btn:hover {
  background: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

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

.reveal-btn.revealed:hover {
  background: #059669;
}

.timer-section {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
  padding: 2.5rem;
  border-radius: 1rem;
  margin-bottom: 2rem;
  box-shadow: 0 10px 30px rgba(3, 105, 161, 0.2);
}

.topic-display {
  background: white;
  padding: 2rem;
  border-radius: 0.75rem;
  margin-bottom: 2rem;
  text-align: center;
}

.topic-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.75rem;
}

.topic-text {
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 1.5rem;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.generate-topic-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.75rem 2rem;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.generate-topic-btn:hover {
  background: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.timer-display {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  padding: 2rem;
  border-radius: 0.75rem;
  text-align: center;
}

.timer-value {
  font-size: 4rem;
  font-weight: 700;
  color: white;
  margin-bottom: 1.5rem;
  font-family: "Poppins", monospace;
}

.timer-value.warning {
  color: var(--warning-color);
}

.timer-value.danger {
  color: var(--danger-color);
  animation: pulse 0.5s ease-in-out infinite;
}

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

.timer-value.ding-animation {
  animation: ding 1.5s ease-in-out;
}

@keyframes ding {
  0%,
  100% {
    transform: scale(1);
  }
  25% {
    transform: scale(1.2);
  }
  50% {
    transform: scale(1.1);
  }
  75% {
    transform: scale(1.15);
  }
}

.time-presets {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.preset-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
}

.preset-btn:hover,
.preset-btn.active {
  background: white;
  color: var(--secondary-color);
  border-color: white;
}

.timer-controls {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.timer-btn {
  background: white;
  color: var(--secondary-color);
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.timer-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.timer-btn.reset {
  background: var(--danger-color);
  color: white;
}

.progress-section {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  padding: 2rem;
  border-radius: 0.75rem;
  margin-bottom: 2rem;
}

.progress-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.stat-item {
  text-align: center;
  background: white;
  padding: 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .lesson-container {
    margin-top: 80px;
    padding: 0 1rem;
  }

  .lesson-header {
    padding: 2rem 1.5rem;
  }

  .lesson-title {
    font-size: 1.75rem;
    line-height: 1.2;
  }

  .lesson-subtitle {
    font-size: 1rem;
  }

  .lesson-meta {
    gap: 1rem;
  }

  .lesson-meta-item {
    font-size: 0.9rem;
  }

  .lesson-section {
    padding: 1.5rem;
  }

  .section-title {
    font-size: 1.4rem;
  }

  .section-icon {
    font-size: 1.5rem;
  }

  .grammar-grid,
  .phrase-grid,
  .tips-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .grammar-card,
  .phrase-card,
  .tip-card {
    padding: 1.25rem;
  }

  .timer-value {
    font-size: 2.5rem;
  }

  .topic-display {
    padding: 1.5rem;
  }

  .topic-text {
    font-size: 1.2rem;
    min-height: 60px;
  }

  .timer-controls {
    flex-direction: column;
    width: 100%;
  }

  .timer-btn {
    width: 100%;
    justify-content: center;
    padding: 1rem 1.5rem;
  }

  .time-presets {
    gap: 0.5rem;
  }

  .preset-btn {
    flex: 1;
    min-width: 60px;
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
  }

  .generate-topic-btn {
    width: 100%;
    justify-content: center;
    padding: 1rem 2rem;
  }

  .progress-stats {
    gap: 1rem;
  }

  .stat-item {
    padding: 1.25rem;
  }

  .stat-value {
    font-size: 2rem;
  }

  /* Improve touch targets */
  button,
  .reveal-btn,
  .timer-btn,
  .preset-btn,
  .generate-topic-btn {
    min-height: 44px;
    min-width: 44px;
  }

  /* Better spacing for mobile */
  .example-item {
    padding: 0.5rem 0;
  }

  .tip-card li {
    padding: 0.6rem 0;
    padding-left: 1.5rem;
  }
}

/* Extra small devices */
@media (max-width: 480px) {
  .lesson-header {
    padding: 1.5rem 1rem;
  }

  .lesson-title {
    font-size: 1.5rem;
  }

  .lesson-subtitle {
    font-size: 0.9rem;
  }

  .lesson-section {
    padding: 1.25rem;
    margin-bottom: 1.5rem;
  }

  .section-title {
    font-size: 1.25rem;
  }

  .timer-value {
    font-size: 2rem;
  }

  .topic-text {
    font-size: 1.1rem;
  }

  .time-presets {
    flex-direction: column;
    width: 100%;
  }

  .preset-btn {
    width: 100%;
  }
}

/* Ensure mobile dropdowns work properly */
@media (max-width: 768px) {
  /* FORCE mobile menu to display full width */
  .nav-links,
  #navLinks,
  ul.nav-links {
    display: flex !important;
    position: fixed !important;
    top: 70px !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: auto !important;
    min-height: calc(100vh - 70px) !important;
  }

  .nav-links.active,
  #navLinks.active,
  ul.nav-links.active {
    display: flex !important;
    max-height: calc(100vh - 70px) !important;
    height: auto !important;
  }

  /* Make sure nav links with dropdowns are clearly tappable */
  .nav-item .nav-link {
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: rgba(70, 187, 229, 0.2);
    cursor: pointer;
  }

  /* Ensure chevron is visible and clickable */
  .nav-link .fa-chevron-down {
    transition: transform 0.3s ease !important;
    opacity: 1 !important;
    pointer-events: none; /* Let clicks go through to parent link */
  }

  /* Visual feedback when dropdown is open */
  .nav-item.mobile-open > .nav-link,
  .nav-item.mobile-dropdown-open > .nav-link {
    background: rgba(70, 187, 229, 0.15) !important;
    border-color: var(--primary-color, #46bbe5) !important;
  }

  /* Make dropdowns smoother */
  .dropdown {
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
      padding 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }

  /* Ensure dropdown items are visible when parent is open */
  .nav-item.mobile-open .dropdown,
  .nav-item.mobile-dropdown-open .dropdown {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  /* Ensure dropdown items are clickable */
  .dropdown-item,
  .dropdown > a {
    pointer-events: auto !important;
    touch-action: manipulation !important;
    user-select: none;
    -webkit-user-select: none;
  }
}
