:root {
  --background: 245 247 250;
  --foreground: 20 23 30;
  --card: 255 255 255;
  --card-foreground: 20 23 30;
  --primary: 14 165 233;
  --primary-foreground: 255 255 255;
  --secondary: 234 236 240;
  --secondary-foreground: 20 23 30;
  --muted: 234 236 240;
  --muted-foreground: 100 116 139;
  --accent: 14 165 233;
  --accent-foreground: 255 255 255;
  --destructive: 220 38 38;
  --destructive-foreground: 255 255 255;
  --border: 222 226 230;
  --input: 222 226 230;
  --ring: 14 165 233;
  --radius: 0.75rem;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", sans-serif;
  background-color: rgb(var(--background));
  color: rgb(var(--foreground));
  line-height: 1.6;
}

/* Navigation */
.navbar {
  background-color: rgb(var(--card));
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: rgb(var(--primary));
}

.nav-links {
  display: flex;
  gap: 0.5rem;
}

.nav-btn {
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  color: rgb(var(--foreground));
  cursor: pointer;
  font-size: 0.95rem;
  border-radius: var(--radius);
  transition: all 0.2s;
}

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

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

/* Container */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* Pages */
.page {
  display: none;
  animation: fadeIn 0.3s ease-in;
}

.page.active {
  display: block;
}

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

/* Hero Section */
.hero {
  text-align: center;
  margin-bottom: 3rem;
}

.hero h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: rgb(var(--foreground));
}

.hero p {
  font-size: 1.1rem;
  color: rgb(var(--muted-foreground));
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background-color: rgb(var(--card));
  padding: 1.5rem;
  border-radius: var(--radius);
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  border: 1px solid rgb(var(--border));
}

.stat-card h3 {
  font-size: 2rem;
  color: rgb(var(--primary));
  margin-bottom: 0.5rem;
}

.stat-card p {
  color: rgb(var(--muted-foreground));
  font-size: 0.9rem;
}

/* CTA Buttons */
.cta-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 3rem;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

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

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.btn-secondary {
  background-color: rgb(var(--secondary));
  color: rgb(var(--secondary-foreground));
}

.btn-secondary:hover {
  opacity: 0.8;
  transform: translateY(-2px);
}

.button-group {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Info Section */
.info-section {
  margin-top: 3rem;
}

.info-section h3 {
  margin-bottom: 1.5rem;
  text-align: center;
}

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

.info-card {
  background-color: rgb(var(--card));
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid rgb(var(--border));
  text-align: center;
}

.info-number {
  display: inline-block;
  width: 40px;
  height: 40px;
  background-color: rgb(var(--primary));
  color: white;
  border-radius: 50%;
  line-height: 40px;
  font-weight: bold;
  margin-bottom: 1rem;
}

.info-card h4 {
  margin: 1rem 0 0.5rem 0;
}

.info-card p {
  color: rgb(var(--muted-foreground));
  font-size: 0.9rem;
}

/* Forms */
.form-section {
  background-color: rgb(var(--card));
  padding: 1.5rem;
  border-radius: var(--radius);
  margin-bottom: 2rem;
  border: 1px solid rgb(var(--border));
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.form-field {
  display: flex;
  flex-direction: column;
}

.form-field label {
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: rgb(var(--foreground));
}

.input {
  padding: 0.75rem;
  border: 1px solid rgb(var(--input));
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  background-color: rgb(var(--card));
  color: rgb(var(--foreground));
}

.input:focus {
  outline: none;
  border-color: rgb(var(--primary));
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

/* Words Section */
.words-section {
  margin-top: 2rem;
}

.words-section h3 {
  margin-bottom: 1rem;
}

.words-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

.word-card {
  background-color: rgb(var(--card));
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid rgb(var(--border));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.word-content {
  margin-bottom: 1rem;
}

.word-english {
  font-size: 1.2rem;
  font-weight: 600;
  color: rgb(var(--primary));
  margin-bottom: 0.5rem;
}

.word-language {
  font-size: 0.85rem;
  color: rgb(var(--muted-foreground));
  margin-bottom: 0.5rem;
}

.word-translation {
  font-size: 1rem;
  color: rgb(var(--foreground));
}

.word-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  flex: 1;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-delete {
  background-color: rgb(var(--destructive));
  color: white;
}

.btn-delete:hover {
  opacity: 0.9;
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: rgb(var(--muted-foreground));
}

/* Quiz */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.mode-card {
  background-color: rgb(var(--card));
  padding: 2rem;
  border-radius: var(--radius);
  border: 1px solid rgb(var(--border));
  text-align: center;
  transition: all 0.3s;
}

.mode-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(14, 165, 233, 0.15);
}

.mode-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.mode-card h3 {
  margin-bottom: 0.5rem;
}

.mode-card p {
  color: rgb(var(--muted-foreground));
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

/* Quiz Header */
.quiz-header {
  margin-bottom: 2rem;
}

.quiz-progress {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background-color: rgb(var(--secondary));
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background-color: rgb(var(--primary));
  transition: width 0.3s ease;
}

/* Quiz Container */
.quiz-container {
  background-color: rgb(var(--card));
  padding: 2rem;
  border-radius: var(--radius);
  border: 1px solid rgb(var(--border));
}

.question {
  margin-bottom: 2rem;
}

.question p {
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
}

.question strong {
  color: rgb(var(--primary));
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1rem;
}

.input-group .input {
  padding: 0.75rem;
  font-size: 1rem;
}

/* Options Grid for Multiple Choice */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.option-btn {
  padding: 1rem;
  border: 2px solid rgb(var(--border));
  background-color: rgb(var(--card));
  color: rgb(var(--foreground));
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s;
  text-align: center;
  word-break: break-word;
}

.option-btn:hover {
  border-color: rgb(var(--primary));
}

.option-btn.selected {
  background-color: rgb(var(--primary));
  color: white;
  border-color: rgb(var(--primary));
}

.option-btn.correct {
  background-color: #10b981;
  color: white;
  border-color: #10b981;
}

.option-btn.incorrect {
  background-color: rgb(var(--destructive));
  color: white;
  border-color: rgb(var(--destructive));
}

.option-btn:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

/* Feedback */
.feedback {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  min-height: 20px;
}

.feedback.correct {
  color: #10b981;
}

.feedback.incorrect {
  color: rgb(var(--destructive));
}

/* Results */
.results-card {
  background-color: rgb(var(--card));
  padding: 2rem;
  border-radius: var(--radius);
  border: 1px solid rgb(var(--border));
  text-align: center;
  max-width: 500px;
  margin: 0 auto;
}

.score-display {
  margin: 2rem 0;
}

.score-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgb(var(--primary)), #06b6d4);
  color: white;
  font-size: 2.5rem;
  font-weight: bold;
}

.score-message {
  font-size: 1.1rem;
  margin: 1.5rem 0;
  color: rgb(var(--foreground));
}

.results-details {
  background-color: rgb(var(--secondary));
  padding: 1.5rem;
  border-radius: var(--radius);
  margin: 1.5rem 0;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.detail-item:last-child {
  margin-bottom: 0;
}

.detail-label {
  color: rgb(var(--muted-foreground));
}

.detail-value {
  font-weight: 600;
  color: rgb(var(--primary));
}

/* Alerts */
.alert {
  padding: 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  border-left: 4px solid;
}

.alert-warning {
  background-color: #fef3c7;
  color: #92400e;
  border-color: #f59e0b;
}

/* Responsive */
@media (max-width: 640px) {
  .navbar-container {
    flex-direction: column;
    gap: 1rem;
  }

  .nav-links {
    width: 100%;
    justify-content: space-around;
  }

  .hero h2 {
    font-size: 1.5rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .cta-buttons {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .score-circle {
    width: 120px;
    height: 120px;
    font-size: 2rem;
  }

  .button-group {
    flex-direction: column;
  }

  .button-group .btn {
    width: 100%;
  }
}

/* --- Footer Styles --- */
footer {
  border-top: 1px solid rgb(var(--border));
  padding: 1rem 0;
  margin-top: 3rem; /* Add some space above the footer */
  text-align: center;
}

footer .container {
  padding: 0.5rem 1rem;
  max-width: 1000px;
  margin: 0 auto;
}

footer p {
  font-size: 0.85rem;
  color: rgb(var(--muted-foreground));
}

footer a {
  color: rgb(var(--primary));
  text-decoration: none;
  transition: color 0.2s;
}

footer a:hover {
  text-decoration: underline;
  color: rgb(var(--foreground));
}