:root {
  --bg-0: #eaf4ff; /* very light */
  --bg-1: linear-gradient(135deg, #cfe9ff 0%, #e6f2ff 100%);
  --surface: #ffffff;
  --primary: #2563eb; /* blue-600 */
  --primary-600: #1e40af; /* blue-800 */
  --muted: #6b7280;
  --text: #0f172a;
  --accent: #0483ff;
  --radius: 10px;
  --shadow: 0 6px 18px rgba(16,24,40,0.08);
}

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

/* SAO-inspired fade-in animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.page-content {
  animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.page-transition-out {
  animation: fadeOut 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

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

/* Navbar letter animation */
.navbar-brand span,
.nav-links a span {
  display: inline-block;
  opacity: 0;
  animation: navLetterFadeUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Dashboard stats (small cards under welcome) */
.dashboard-stats {
  margin-top: 8px;
}
.dashboard-stats .stats-grid {
  display: flex;
  gap: 12px;
  align-items: stretch;
}
.dashboard-stats .stat-item {
  background: rgba(255,255,255,0.98);
  padding: 10px 14px;
  border-radius: 10px;
  min-width: 110px;
  text-align: center;
  box-shadow: 0 6px 18px rgba(16,24,40,0.04);
  border: 1px solid rgba(2,6,23,0.04);
}
.dashboard-stats .stat-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}
.dashboard-stats .stat-label {
  font-size: 0.85rem;
  margin-top: 4px;
  color: var(--muted);
}
.dashboard-stats .stat-complete {
  color: #0f9d58; /* pleasant green */
}
.dashboard-stats .stat-partial {
  color: #f59e0b; /* amber */
}

html,
body {
  height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-1);
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* --- Layout container */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

/* --- Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(6px);
  color: #fff;
  padding: 14px 0;
  box-shadow: 0 2px 8px rgba(2, 6, 23, 0.06);
}

.navbar-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px; /* keep navbar content away from screen edges */
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-brand {
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  font-size: 1.125rem;
  letter-spacing: 0.2px;
}

.nav-links {
  display: flex;
  gap: 18px;
  align-items: center;
}

.nav-links a {
  color: rgba(255, 255, 255, 0.92);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  transition: background 0.18s, color 0.18s;
}

.nav-links a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--accent);
}

.menu-toggle {
  display: none;
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
}

/* --- Main hero / welcome */
.welcome-section {
  padding: 64px 0;
  text-align: center;
  background: transparent;
}

.welcome-section h1 {
  font-size: 2.25rem;
  color: #061328;
  margin-bottom: 8px;
}

.welcome-section p {
  color: var(--muted);
  max-width: 720px;
  margin: 0 auto 20px;
}

.cta-button {
  display: inline-block;
  padding: 12px 20px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.12);
  transition: transform 0.12s ease, box-shadow 0.12s;
}

.cta-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.14);
}

/* --- Auth forms */
.auth-page {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 12px;
}

.auth-container {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: 12px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.auth-container h2 {
  margin-bottom: 10px;
  color: var(--text);
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.95rem;
  color: var(--muted);
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 1px solid #e6eefb;
  border-radius: 8px;
  background: #fbfeff;
  outline: none;
  transition: box-shadow 0.12s, border-color 0.12s;
}

.form-group input:focus {
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.06);
  border-color: var(--primary);
}

.auth-submit {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  border: none;
  font-weight: 600;
  cursor: pointer;
}

.auth-submit:hover {
  background: var(--primary-600);
}

.error-message {
  display: none;
  padding: 10px;
  border-radius: 8px;
  background: #fee2e2;
  color: #991b1b;
  margin-bottom: 12px;
}

/* Ensure the small auth toggle link has breathing room under the submit button */
.auth-toggle {
  display: block; /* makes margin-top reliable */
  margin-top: 16px; /* explicit consistent space between button and the toggle link */
  text-align: center;
  line-height: 1.3;
}

/* Ensure submit button does not add extra bottom spacing across pages */
.auth-submit { margin-bottom: 0; }

/* --- Dashboard / cards */
.dashboard {
  padding: 36px 60px; /* horizontal padding so quizzes don't touch edges */
}

.dashboard-header {
  margin-bottom: 18px;
}

.dashboard-header h1 {
  font-size: 1.6rem;
  color: var(--text);
}

.dashboard-content {
  background: rgb(255, 255, 255);
  padding: 22px;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.create-quiz-btn {
  display: inline-block;
  padding: 12px 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.create-quiz-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.quiz-list {
  display: grid;
  /* Limit to max 4 cards per row on wide screens, then wrap the rest */
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-top: 18px;
}

/* Responsive fallbacks: 3 cols -> 2 cols -> 1 col */
@media (max-width: 1100px) {
  .quiz-list { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 800px) {
  .quiz-list { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .quiz-list { grid-template-columns: 1fr; }
}

.quiz-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), var(--surface));
  padding: 18px;
  border-radius: 12px;
  border: 1px solid rgba(2, 6, 23, 0.502);
  box-shadow: 0 8px 24px rgba(2, 6, 23, 0.04);
  transition: transform 0.12s, box-shadow 0.12s;
}

.quiz-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 42px rgba(2, 6, 23, 0.08);
}

.quiz-card h3 {
  margin-bottom: 8px;
  font-size: 1.05rem;
  color: #071133;
}

.quiz-card p {
  color: var(--muted);
  font-size: 0.95rem;
}

.quiz-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
}

/* Quiz card states */
.quiz-complete { background: linear-gradient(180deg, #ecfff5 0%, #f3fff9 100%); border-color: rgba(34,139,34,0.12); }
.quiz-partial { background: linear-gradient(180deg, #fbfbfb 0%, #f7f7f8 100%); border-color: rgba(2,6,23,0.06); }
.quiz-meta { margin-top: 10px; font-size: 0.95rem; color: var(--muted); }

#up-margin {
  margin-top: 12px !important;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-weight: 600;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.12);
}

.btn-ghost {
  background: transparent;
  color: var(--primary);
  border: 1px solid rgba(37, 99, 235, 0.12);
}

/* --- Quiz page */
.quiz-container {
  /* Align quiz content with navbar text (same max width & side padding)
     and center it. On wide screens ensure it doesn't shrink below ~1/3
     of the viewport so the quiz area remains comfortably wide. */
  padding: 36px 20px; /* horizontal padding to avoid edge-to-edge content */
  width: 100%;
  max-width: 1100px; /* match .container / .navbar-container */
  margin: 0 auto;
}

/* On large viewports keep a sensible minimum width (approx 1/3 of viewport).
   This is capped by max-width above, and will not apply on small screens. */
@media (min-width: 1200px) {
  .quiz-container {
    min-width: 33.333vw; /* ~1/3 of viewport */
  }
}

.quiz-header {
  margin-bottom: 18px;
  text-align: center;
}

.quiz-header h1 {
  font-size: 1.5rem;
  margin-bottom: 6px;
}

.quiz-description {
  color: var(--muted);
}

.question {
  background: var(--surface);
  padding: 22px;
  border-radius: 12px;
  border: 1px solid rgba(2, 6, 23, 0.04);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.question h2 {
  color: #071133;
  margin-bottom: 8px;
}

.question-text {
  font-size: 1.05rem;
  color: var(--text);
  margin-bottom: 12px;
}

.choices {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(2, 6, 23, 0.05);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.choice:hover {
  background: #f6fbff;
  border-color: rgba(4, 131, 255, 0.12);
}

.choice input[type="radio"] {
  accent-color: var(--primary);
}

.quiz-navigation {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.quiz-navigation button {
  padding: 10px 16px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
}

.prev-btn {
  background: #f3f4f6;
  color: #0f172a;
}

.next-btn {
  background: var(--primary);
  color: #fff;
}

.submit-btn {
  background: #06b6d4;
  color: #fff;
}

/* --- Responsive */
@media (max-width: 900px) {
  .navbar-container {
    flex-direction: row;
  }

  .welcome-section {
    padding: 48px 0;
  }

  .quiz-container {
    padding: 24px;
  }

  .quiz-navigation {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .quiz-navigation button {
    width: 100%;
  }
}

@media (max-width: 600px) {
  .nav-links {
    display: none;
  }

  .menu-toggle {
    display: block;
  }
}

/* Small utilities */
.muted {
  color: var(--muted);
}

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

/* End */
