/* =========================================================
   Online Quiz & Result Management System
   Stylesheet (CSS) — design + responsive layout
   ========================================================= */

:root {
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --accent: #06b6d4;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --success: #16a34a;
  --danger: #dc2626;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #eef2ff 0%, #f1f5f9 100%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ---------- Navbar ---------- */
.navbar {
  background: var(--card);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar .nav-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-links { display: flex; gap: 6px; flex-wrap: wrap; }
.nav-links a {
  text-decoration: none;
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.95rem;
  transition: background 0.2s, color 0.2s;
}
.nav-links a:hover { background: var(--bg); color: var(--primary); }

/* ---------- Layout ---------- */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 30px 20px;
}
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px;
  margin-bottom: 24px;
}
.card h2 { margin-bottom: 14px; color: var(--primary-dark); }
.muted { color: var(--muted); font-size: 0.9rem; }

/* ---------- Hero (home) ---------- */
.hero {
  text-align: center;
  padding: 50px 20px;
}
.hero h1 { font-size: 2.4rem; margin-bottom: 12px; color: var(--primary-dark); }
.hero p { color: var(--muted); max-width: 600px; margin: 0 auto 26px; font-size: 1.05rem; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 30px;
}
.feature {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  text-align: center;
}
.feature .icon { font-size: 2rem; margin-bottom: 10px; }
.feature h3 { color: var(--primary-dark); margin-bottom: 6px; }
.feature p { color: var(--muted); font-size: 0.92rem; }

/* ---------- Forms ---------- */
form label {
  display: block;
  margin: 14px 0 6px;
  font-weight: 600;
  font-size: 0.92rem;
}
input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  transition: border 0.2s, box-shadow 0.2s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}
textarea { resize: vertical; min-height: 80px; }

.form-narrow { max-width: 440px; margin: 40px auto; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 11px 22px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, transform 0.1s;
  margin-top: 8px;
}
.btn:hover { background: var(--primary-dark); }
.btn:active { transform: translateY(1px); }
.btn-secondary { background: var(--muted); }
.btn-secondary:hover { background: #475569; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #15803d; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-block { width: 100%; text-align: center; }

/* ---------- Alerts ---------- */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.95rem;
}
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-info    { background: #e0f2fe; color: #075985; border: 1px solid #bae6fd; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}
th, td {
  padding: 11px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
th { background: var(--bg); color: var(--primary-dark); font-weight: 700; }
tr:hover td { background: #f8fafc; }

/* ---------- Quiz ---------- */
.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.timer {
  background: var(--primary);
  color: #fff;
  padding: 10px 18px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 1.05rem;
}
.timer.warning { background: var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }

.progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 20px;
  overflow: hidden;
  margin-bottom: 24px;
}
.progress-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.3s;
}

.question-block { display: none; }
.question-block.active { display: block; animation: fade 0.3s; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.question-text { font-size: 1.15rem; font-weight: 600; margin-bottom: 18px; }
.q-count { color: var(--muted); font-weight: 600; margin-bottom: 6px; }

.options { display: grid; gap: 12px; }
.option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border 0.2s, background 0.2s;
}
.option:hover { border-color: var(--primary); background: #f5f3ff; }
.option input { width: auto; }
.option.selected { border-color: var(--primary); background: #eef2ff; }

.quiz-nav { display: flex; justify-content: space-between; margin-top: 24px; gap: 10px; }

/* ---------- Result ---------- */
.result-score {
  text-align: center;
  padding: 20px;
}
.score-circle {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  margin: 0 auto 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
}
.score-circle .pct { font-size: 2.2rem; }
.score-circle .lbl { font-size: 0.85rem; opacity: 0.9; }
.pass { background: linear-gradient(135deg, #16a34a, #22c55e); }
.fail { background: linear-gradient(135deg, #dc2626, #f87171); }

.stats { display: flex; justify-content: center; gap: 30px; flex-wrap: wrap; margin-top: 16px; }
.stat { text-align: center; }
.stat .num { font-size: 1.6rem; font-weight: 700; color: var(--primary); }
.stat .lbl { color: var(--muted); font-size: 0.85rem; }

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  padding: 24px;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  .hero h1 { font-size: 1.8rem; }
  .card { padding: 20px; }
  .quiz-nav { flex-direction: column; }
  .quiz-nav .btn { width: 100%; text-align: center; }
  .stats { gap: 18px; }
}
