/* ===== CSS VARIABLES ===== */
:root {
  --yellow: #FFD93D;
  --yellow-dark: #F0C000;
  --purple: #6C3CE1;
  --purple-light: #9B6DFF;
  --purple-dark: #4A1FA8;
  --pink: #FF6B9D;
  --green: #06D6A0;
  --orange: #FF8C42;
  --red: #FF4757;
  --bg: #F7F3FF;
  --bg-card: #FFFFFF;
  --text-dark: #1A0A3C;
  --text-mid: #4A3B6B;
  --text-light: #8B7BAB;
  --border: #E8DEFF;
  --shadow: 0 4px 20px rgba(108, 60, 225, 0.12);
  --shadow-hover: 0 8px 32px rgba(108, 60, 225, 0.22);
  --radius: 20px;
  --radius-sm: 12px;
  --font-display: 'Bricolage Grotesque', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-dark);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== HEADER ===== */
.header {
  background: linear-gradient(135deg, var(--purple-dark) 0%, var(--purple) 60%, var(--purple-light) 100%);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 24px rgba(74, 31, 168, 0.35);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.logo-text {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}

.logo-accent {
  color: var(--yellow);
  font-style: italic;
}

.streak-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50px;
  padding: 6px 16px;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  backdrop-filter: blur(8px);
}

/* ===== NAV TABS ===== */
.nav-tabs {
  background: #fff;
  border-bottom: 3px solid var(--border);
  display: flex;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
  position: sticky;
  top: 73px;
  z-index: 99;
  box-shadow: 0 2px 12px rgba(108,60,225,0.08);
}

.nav-tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  flex: 1;
  min-width: 130px;
  padding: 14px 20px;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.25s ease;
  border-bottom: 3px solid transparent;
  margin-bottom: -3px;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--purple);
  background: var(--bg);
}

.tab-btn.active {
  color: var(--purple);
  border-bottom-color: var(--purple);
  background: var(--bg);
}

/* ===== MAIN CONTENT ===== */
.main-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

/* ===== TAB SECTIONS ===== */
.tab-section { display: none; animation: fadeIn 0.35s ease; }
.tab-section.active { display: block; }

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

/* ===== SECTION HEADER ===== */
.section-header {
  margin-bottom: 28px;
}

.section-header h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.badge {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--yellow);
  color: var(--text-dark);
  padding: 4px 12px;
  border-radius: 50px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.section-sub {
  color: var(--text-mid);
  font-size: 0.95rem;
  font-weight: 500;
}

/* ===== CATEGORY FILTER ===== */
.category-filter {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.cat-btn {
  padding: 8px 18px;
  border: 2px solid var(--border);
  border-radius: 50px;
  background: #fff;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-mid);
  cursor: pointer;
  transition: all 0.2s ease;
}

.cat-btn:hover {
  border-color: var(--purple-light);
  color: var(--purple);
}

.cat-btn.active {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
}

/* ===== FLASHCARD GRID ===== */
.flashcard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.flashcard {
  background: #fff;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  padding: 24px 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: var(--shadow);
}

.flashcard::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
  background: var(--card-color, var(--purple));
  border-radius: var(--radius) var(--radius) 0 0;
}

.flashcard:hover {
  transform: translateY(-6px) rotate(-1deg);
  box-shadow: var(--shadow-hover);
  border-color: var(--purple-light);
}

.flashcard.flipped .card-front { display: none; }
.flashcard.flipped .card-back { display: flex; }

.card-front, .card-back {
  width: 100%;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.card-back { display: none; }

.card-emoji { font-size: 2.4rem; margin-bottom: 4px; }

.card-english {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-dark);
}

.card-hindi {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--purple);
}

.card-example {
  font-size: 0.8rem;
  color: var(--text-mid);
  font-style: italic;
  margin-top: 4px;
  line-height: 1.4;
}

.card-hint {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 8px;
}

.card-category-tag {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg);
  color: var(--text-light);
  padding: 2px 8px;
  border-radius: 50px;
}

/* ===== PHRASES ===== */
.phrases-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.phrase-card {
  background: #fff;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  padding: 20px 24px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  box-shadow: var(--shadow);
  transition: all 0.25s ease;
  cursor: pointer;
}

.phrase-card:hover {
  border-color: var(--purple-light);
  transform: translateX(6px);
  box-shadow: var(--shadow-hover);
}

.phrase-icon {
  font-size: 2rem;
  width: 52px;
  height: 52px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.phrase-content { flex: 1; }

.phrase-english {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 4px;
}

.phrase-hindi {
  font-size: 0.9rem;
  color: var(--purple);
  font-weight: 600;
  margin-bottom: 4px;
}

.phrase-usage {
  font-size: 0.8rem;
  color: var(--text-light);
  font-style: italic;
}

.phrase-speak-btn {
  background: var(--purple);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.phrase-speak-btn:hover {
  background: var(--purple-dark);
  transform: scale(1.1);
}

/* ===== GRAMMAR ===== */
.grammar-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.grammar-card {
  background: #fff;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all 0.25s ease;
}

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

.grammar-card-header {
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.grammar-card-icon {
  font-size: 1.8rem;
}

.grammar-card-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
}

.grammar-card-subtitle {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.8);
  font-weight: 500;
}

.grammar-card-body {
  padding: 20px 22px;
}

.grammar-rule {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 12px;
  border-left: 4px solid var(--purple);
}

.grammar-rule-title {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-dark);
  margin-bottom: 4px;
}

.grammar-rule-hindi {
  font-size: 0.8rem;
  color: var(--text-mid);
  margin-bottom: 8px;
}

.grammar-examples {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.grammar-example {
  font-size: 0.82rem;
  color: var(--text-mid);
  padding: 4px 0;
  border-bottom: 1px dashed var(--border);
}

.grammar-example:last-child { border-bottom: none; }

.grammar-example strong {
  color: var(--purple);
}

/* ===== QUIZ ===== */
.quiz-container {
  max-width: 680px;
  margin: 0 auto;
}

.quiz-score-bar {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 24px;
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
}

.score-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-weight: 600;
  color: var(--text-mid);
  font-size: 0.9rem;
}

.score-info strong { color: var(--purple); font-size: 1.1rem; }

.progress-bar {
  height: 10px;
  background: var(--border);
  border-radius: 50px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--purple), var(--purple-light));
  border-radius: 50px;
  transition: width 0.4s ease;
  width: 0%;
}

.quiz-card {
  background: #fff;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  padding: 36px 32px;
  text-align: center;
  box-shadow: var(--shadow);
}

.quiz-question-label {
  font-size: 0.9rem;
  color: var(--text-light);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 16px;
}

.quiz-word {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 800;
  color: var(--purple);
  margin-bottom: 32px;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quiz-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.quiz-option {
  padding: 16px 20px;
  border: 2.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
  transition: all 0.2s ease;
}

.quiz-option:hover:not(:disabled) {
  border-color: var(--purple);
  background: #fff;
  transform: scale(1.02);
}

.quiz-option.correct {
  background: #E8FFF5;
  border-color: var(--green);
  color: #0A7A5A;
}

.quiz-option.wrong {
  background: #FFF0F0;
  border-color: var(--red);
  color: var(--red);
}

.quiz-option:disabled { cursor: not-allowed; }

/* Quiz Result */
.quiz-result {
  background: #fff;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  padding: 48px 32px;
  text-align: center;
  box-shadow: var(--shadow);
}

.quiz-result.hidden { display: none; }

.result-emoji { font-size: 4rem; margin-bottom: 16px; }

.result-title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 12px;
}

.result-score {
  font-size: 1.1rem;
  color: var(--text-mid);
  font-weight: 600;
  margin-bottom: 28px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 14px 36px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 16px rgba(108,60,225,0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(108,60,225,0.45);
}

/* ===== PRONUNCIATION ===== */
.pronun-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.pronun-card {
  background: #fff;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: all 0.25s ease;
}

.pronun-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--purple-light);
}

.pronun-word {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 4px;
}

.pronun-phonetic {
  font-size: 1rem;
  color: var(--purple);
  font-weight: 600;
  margin-bottom: 8px;
  font-style: italic;
}

.pronun-hindi-tip {
  font-size: 0.85rem;
  color: var(--text-mid);
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 14px;
  border-left: 3px solid var(--yellow);
  line-height: 1.5;
}

.pronun-speak-btn {
  width: 100%;
  padding: 10px;
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.pronun-speak-btn:hover {
  opacity: 0.9;
  transform: scale(1.02);
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text-dark);
  color: #fff;
  padding: 14px 28px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.95rem;
  z-index: 999;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ===== FOOTER ===== */
.footer {
  background: var(--text-dark);
  color: rgba(255,255,255,0.6);
  text-align: center;
  padding: 20px;
  font-size: 0.85rem;
}

.footer strong { color: var(--yellow); }

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  .header-inner { padding: 12px 16px; }
  .logo-text { font-size: 1.3rem; }
  .main-content { padding: 20px 16px 60px; }
  .section-header h2 { font-size: 1.5rem; }
  .flashcard-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
  .quiz-options { grid-template-columns: 1fr; }
  .quiz-word { font-size: 2.2rem; }
  .phrase-card { grid-template-columns: auto 1fr; }
  .phrase-speak-btn { display: none; }
  .grammar-cards { grid-template-columns: 1fr; }
  .tab-btn { min-width: 110px; font-size: 0.8rem; padding: 12px 14px; }
}