/* Shared CSS Variables */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary: #f8fafc;
  --bg: #ffffff;
  --bg-alt: #f1f5f9;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --card-bg: #ffffff;
  --success: #22c55e;
  --error: #ef4444;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --border-radius: 12px;
  --border-radius-lg: 20px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-alt);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration: none;
  color: inherit;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.2;
}

/* Navbar */
.navbar {
  background-color: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.nav-brand {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav-link {
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.2s;
}

.nav-link:hover {
  color: var(--primary);
}

.btn-primary {
  background-color: var(--primary);
  color: white;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
}

.btn-secondary {
  background-color: white;
  color: var(--text-main);
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  font-weight: 600;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Hero Section */
.hero {
  background: white;
  padding: 5rem 2rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.hero h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  margin-bottom: 1rem;
  color: var(--text-main);
}

.hero p {
  font-size: 1.2rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 2rem;
}

.search-bar {
  max-width: 500px;
  margin: 0 auto;
  display: flex;
  gap: 0.5rem;
  background: var(--bg-alt);
  padding: 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  outline: none;
  color: var(--text-main);
}

/* Sections */
.section {
  padding: 4rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.section-title {
  font-size: 2rem;
}

/* Grids */
.grid-topics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.topic-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
}

.topic-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.topic-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.topic-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.grid-quizzes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

.quiz-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.quiz-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.quiz-card-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background-color: var(--bg-alt);
}

.quiz-card-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.quiz-card-title {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.quiz-card-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  display: flex;
  gap: 1rem;
}

.quiz-card-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

/* ------- Quiz Page Specific Styles (Adapted from original dark theme to light theme) ------- */

.quiz-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px 60px;
  min-height: 100vh;
}

.quiz-header {
  width: 100%;
  max-width: 760px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.back-btn {
  color: var(--text-muted);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  transition: color 0.2s;
}

.back-btn:hover {
  color: var(--text-main);
}

.quiz-title-badge {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--bg-alt);
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.progress-wrap {
  width: 100%;
  max-width: 760px;
  margin-bottom: 32px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.progress-bar-bg {
  height: 10px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  width: 10%;
}

.question-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--border-radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 760px;
  box-shadow: var(--shadow-md);
  animation: slideIn 0.4s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.q-number {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 16px;
}

.q-text {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 32px;
  color: var(--text-main);
}

.options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .options {
    grid-template-columns: 1fr;
  }

  .question-card {
    padding: 30px 20px;
  }
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-alt);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 16px 20px;
  color: var(--text-main);
  font-size: 1rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.option-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.opt-letter {
  min-width: 36px;
  height: 36px;
  border-radius: 50%;
  background: white;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: all 0.2s;
  flex-shrink: 0;
}

.option-btn.selected {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.05);
}

.option-btn.selected .opt-letter {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.option-btn.correct {
  border-color: var(--success);
  background: rgba(34, 197, 94, 0.05);
}

.option-btn.correct .opt-letter {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

.option-btn.wrong {
  border-color: var(--error);
  background: rgba(239, 68, 68, 0.05);
}

.option-btn.wrong .opt-letter {
  background: var(--error);
  color: white;
  border-color: var(--error);
}

.option-btn:disabled {
  cursor: default;
  transform: none;
  box-shadow: none;
}

.next-wrap {
  margin-top: 32px;
  display: flex;
  justify-content: flex-end;
}

.btn-next {
  background-color: var(--text-main);
  color: white;
  font-size: 1rem;
  font-weight: 700;
  padding: 14px 40px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: transform 0.2s, background-color 0.2s;
  display: none;
}

.btn-next:hover {
  transform: translateY(-2px);
  background-color: #000;
}

.btn-next.visible {
  display: block;
}

/* Result Screen */
#result-screen {
  display: none;
  text-align: center;
  width: 100%;
  max-width: 640px;
  animation: slideIn 0.5s ease;
}

.result-ring {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto 32px;
}

.result-ring svg {
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 12;
}

.ring-fill {
  fill: none;
  stroke: var(--primary);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 565.48;
  stroke-dashoffset: 565.48;
  transition: stroke-dashoffset 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.pct-value {
  font-size: 3rem;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
}

.pct-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 4px;
  font-weight: 600;
}

.result-title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 12px;
  color: var(--text-main);
}

.result-subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 40px;
}

.score-breakdown {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.score-pill {
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 28px;
  min-width: 120px;
  box-shadow: var(--shadow-sm);
}

.score-pill-val {
  font-size: 1.8rem;
  font-weight: 800;
}

.score-pill-val.c {
  color: var(--success);
}

.score-pill-val.w {
  color: var(--error);
}

.score-pill-lbl {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-top: 4px;
}

.result-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-retry,
.btn-home {
  font-size: 1rem;
  font-weight: 700;
  padding: 16px 40px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-retry {
  background: var(--primary);
  color: white;
  border: none;
  box-shadow: var(--shadow-md);
}

.btn-retry:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
}

.btn-home {
  background: white;
  color: var(--text-main);
  border: 2px solid var(--border);
}

.btn-home:hover {
  border-color: var(--text-main);
}

.iq-badge {
  display: inline-block;
  margin-top: 32px;
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.2);
  color: var(--primary);
  font-size: 1rem;
  font-weight: 700;
  padding: 12px 24px;
  border-radius: 999px;
}

/* Footer */
.footer {
  background: white;
  border-top: 1px solid var(--border);
  padding: 3rem 2rem;
  text-align: center;
  color: var(--text-muted);
  margin-top: auto;
}

/* Modal Styles */
.modal-overlay {
  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;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: white;
  border-radius: var(--border-radius-lg);
  padding: 2rem;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.modal-body {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.nav-logo {
  height: 40px;
  width: auto;
}

.footer-logo {
  height: 50px;
  width: auto;
}

/* Responsive Design */
@media (max-width: 768px) {
  .navbar {
    flex-wrap: wrap;
    padding: 1rem;
    gap: 1rem;
  }

  .nav-brand {
    font-size: 1.25rem;
  }

  .nav-logo {
    height: 32px;
  }

  .nav-links {
    order: 3;
    width: 100%;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
  }

  .nav-actions {
    margin-left: auto;
  }

  .hero {
    padding: 3rem 1rem;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .section {
    padding: 2rem 1rem;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .grid-topics,
  .grid-quizzes {
    grid-template-columns: 1fr;
  }

  .footer {
    padding: 3rem 1rem;
  }

  .footer>div {
    grid-template-columns: 1fr !important;
    text-align: center;
    gap: 2rem;
  }

  .footer-logo {
    margin: 0 auto 1rem !important;
  }

  .quiz-container {
    padding: 20px 10px 40px;
  }

  .question-card {
    padding: 24px 16px;
  }

  .score-breakdown {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }

  .score-pill {
    width: 100%;
    max-width: 250px;
  }

  .result-actions {
    flex-direction: column;
  }

  .btn-retry,
  .btn-home {
    width: 100%;
  }

  .contact-hero {
    padding: 3rem 1rem 4rem;
  }

  .contact-hero h1 {
    font-size: 2rem;
  }

  .search-box input {
    padding-left: 2.5rem;
  }

  .contact-cards {
    grid-template-columns: 1fr;
    margin-top: -2rem;
    padding: 0 1rem;
  }

  .faq-section {
    padding: 0 1rem 3rem;
  }

  .pricing-grid {
    grid-template-columns: 1fr;
    padding: 0 1rem;
  }
}