/* ============================================
   Design System – Component Classes
   Import design-tokens.css before this file.
   ============================================ */

/* ---- Base ---- */
body {
  font-family: var(--font-family);
  background-color: var(--brand-dark);
  color: var(--text-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background-color: #14B8A6;
  color: #000000;
}

/* ---- Ambient Glow Backgrounds ---- */
.glow-bg-1 {
  background: var(--glow-teal);
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.glow-bg-2 {
  background: var(--glow-blue);
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

/* ---- Glass Panel ---- */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
}

/* ---- Card Base ---- */
.card {
  background: var(--brand-card);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-xl);
  padding: var(--card-padding);
}
.card-glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--card-padding);
}

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

/* ---- Gradient Border (for profile pics, containers) ---- */
.gradient-border {
  padding: 3px;
  border-radius: var(--radius-full);
  background: var(--gradient-border);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}
.gradient-border > * {
  border-radius: inherit;
  border: 4px solid var(--brand-dark);
}

/* ---- Buttons ---- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  color: #0F172A;
  font-weight: var(--font-bold);
  font-size: 0.875rem;
  transition: all 0.2s ease;
}
.btn-primary:hover {
  box-shadow: 0 10px 15px -3px rgba(20, 184, 166, 0.2);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-weight: var(--font-medium);
  font-size: 0.875rem;
  transition: color 0.2s ease;
}
.btn-ghost:hover {
  color: var(--accent-teal);
}

/* ---- Badges / Tags ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-teal {
  background: rgba(20, 184, 166, 0.1);
  color: var(--accent-teal);
}
.badge-blue {
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-blue);
}

/* ---- Section Label ---- */
.section-label {
  font-size: 0.75rem;
  font-weight: var(--font-bold);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent-teal);
}

/* ---- Section Title ---- */
.section-title {
  font-size: 1.875rem;
  font-weight: var(--font-bold);
  color: var(--text-heading);
}
@media (min-width: 768px) {
  .section-title {
    font-size: 2.25rem;
  }
}

/* ---- Icon Box ---- */
.icon-box {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-box-teal {
  background: rgba(20, 184, 166, 0.1);
  color: var(--accent-teal);
}
.icon-box-sky {
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent-sky);
}
.icon-box-blue {
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-blue);
}

/* ---- Live Dot (pulsing) ---- */
.live-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: var(--radius-full);
  background-color: var(--accent-teal);
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ---- Header / Nav ---- */
.page-header {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--brand-border);
}
.page-header-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
}
@media (min-width: 640px) {
  .page-header-inner {
    flex-direction: row;
  }
}

.lang-select {
  background: var(--glass-bg, rgba(255,255,255,0.05));
  color: var(--text, #e2e8f0);
  border: 1px solid var(--brand-border, rgba(255,255,255,0.12));
  border-radius: 0.5rem;
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.lang-select:focus {
  border-color: var(--brand-teal, #14b8a6);
}

/* ---- Main Content Container ---- */
.content-container {
  position: relative;
  z-index: 10;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

/* ---- Section Spacing ---- */
.section {
  margin-bottom: var(--section-gap);
}

/* ---- Grid Helpers ---- */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 768px) {
  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}
.grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 768px) {
  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ---- Footer ---- */
.page-footer {
  margin-top: 6rem;
  border-top: 1px solid var(--brand-border);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  padding: 2rem 1.5rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.page-footer-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
@media (min-width: 640px) {
  .page-footer-inner {
    flex-direction: row;
  }
}

/* ---- Lesson / Course Specific ---- */

/* Lesson card – used for activity blocks */
.lesson-card {
  background: var(--brand-card);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: border-color 0.2s ease;
}
.lesson-card:hover {
  border-color: rgba(20, 184, 166, 0.3);
}

/* Activity step number circle */
.step-number {
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-full);
  background: rgba(20, 184, 166, 0.1);
  color: var(--accent-teal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: var(--font-bold);
  flex-shrink: 0;
}

/* Vocabulary word chip */
.vocab-chip {
  display: inline-block;
  background: rgba(20, 27, 45, 0.7);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-md);
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  color: var(--text-heading);
  font-weight: var(--font-medium);
}
.vocab-chip.has-audio {
  cursor: pointer;
  position: relative;
  padding-right: 1.8rem;
  animation: chip-pulse 3s ease-in-out infinite;
  transition: all 0.3s ease;
}
.vocab-chip.has-audio::after {
  content: "\25B6";
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  color: var(--accent-teal);
  opacity: 0.6;
  transition: opacity 0.2s ease;
}
.vocab-chip.has-audio:hover {
  animation: none;
  background: rgba(20, 184, 166, 0.12);
  border-color: var(--accent-teal);
}
.vocab-chip.has-audio:hover::after {
  opacity: 1;
}
@keyframes chip-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.4);
    background: rgba(20, 27, 45, 0.7);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(20, 184, 166, 0);
    background: rgba(20, 184, 166, 0.15);
  }
}

/* Quiz option (multiple choice) */
.quiz-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(20, 27, 45, 0.5);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}
.quiz-option:hover {
  border-color: var(--accent-teal);
  background: rgba(20, 184, 166, 0.05);
}
.quiz-option.selected {
  border-color: var(--accent-teal);
  background: rgba(20, 184, 166, 0.1);
}
.quiz-option.selected span {
  border-color: var(--accent-teal);
  background: var(--accent-teal);
}
.quiz-option.correct {
  border-color: #22C55E;
  background: rgba(34, 197, 94, 0.1);
}
.quiz-option.correct span {
  border-color: #22C55E;
  background: #22C55E;
}
.quiz-option.incorrect {
  border-color: #EF4444;
  background: rgba(239, 68, 68, 0.1);
}
.quiz-option.incorrect span {
  border-color: #EF4444;
  background: #EF4444;
}

/* Dialogue box */
.dialogue {
  padding: 1rem;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  line-height: 1.7;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.dialogue-speaker-a {
  background: rgba(20, 184, 166, 0.08);
  border-left: 3px solid var(--accent-teal);
}
.dialogue-speaker-a:hover {
  background: rgba(20, 184, 166, 0.14);
  border-color: rgba(20, 184, 166, 0.8);
}
.dialogue-speaker-b {
  background: rgba(59, 130, 246, 0.08);
  border-left: 3px solid var(--accent-blue);
}
.dialogue-speaker-b:hover {
  background: rgba(59, 130, 246, 0.14);
  border-color: rgba(59, 130, 246, 0.8);
}

/* ---- Interactive Exercise States ---- */

/* Match game cards */
.match-item {
  cursor: pointer;
  transition: all 0.2s ease;
}
.match-item.selected {
  border-color: var(--accent-teal);
  background: rgba(20, 184, 166, 0.15);
  box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.4);
}
.match-item.matched-correct {
  border-color: #22C55E;
  background: rgba(34, 197, 94, 0.12);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.4);
  cursor: default;
  pointer-events: none;
}
.match-item.matched-wrong {
  border-color: #EF4444;
  background: rgba(239, 68, 68, 0.12);
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.4);
}

/* Match status icons (CSS-only, no Lucide re-rendering needed) */
.match-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 2px solid #64748b;
  transition: all 0.3s ease;
}
.match-icon.correct {
  background: #22C55E;
  border-color: #22C55E;
}
.match-icon.correct::after {
  content: "\2713";
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
}
.match-icon.wrong {
  background: #EF4444;
  border-color: #EF4444;
}
.match-icon.wrong::after {
  content: "\2715";
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
}

/* Fill-in-the-blanks */
.fill-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.5rem;
  height: 2rem;
  border-bottom: 2px dashed var(--accent-teal);
  vertical-align: middle;
  font-weight: 700;
  color: var(--accent-teal);
  transition: all 0.3s ease;
}
.fill-slot.filled-correct {
  border-bottom-color: #22C55E;
  color: #22C55E;
}
.fill-slot.filled-wrong {
  border-bottom-color: #EF4444;
  color: #EF4444;
}
.fill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 600;
  background: rgba(20, 27, 45, 0.5);
  border: 1px solid var(--brand-border);
  color: var(--text-body);
  cursor: pointer;
  transition: all 0.15s ease;
}
.fill-btn:hover {
  border-color: var(--accent-teal);
  color: var(--accent-teal);
}
.fill-btn:active {
  transform: scale(0.95);
}
.fill-btn.selected {
  border-color: var(--accent-teal);
  background: rgba(20, 184, 166, 0.15);
  color: var(--accent-teal);
}
.fill-btn.used {
  opacity: 0.4;
  pointer-events: none;
}
.fill-card.correct {
  border-color: #22C55E;
  background: rgba(34, 197, 94, 0.06);
}
.fill-card.wrong {
  border-color: #EF4444;
  background: rgba(239, 68, 68, 0.06);
}

/* Vocabulary card audio button */
.vocab-audio-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 1px solid var(--brand-border);
  background: rgba(20, 184, 166, 0.1);
  color: var(--accent-teal);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 0.5rem;
}
.vocab-audio-btn:hover {
  background: rgba(20, 184, 166, 0.2);
  border-color: var(--accent-teal);
  transform: scale(1.1);
}

/* Nav active state */
.nav-link-active {
  color: var(--accent-teal) !important;
}
