/* ============================================================
   Saudi PharmTech Exam Prep System – UI Design
   Theme: Saudi Green (#006C35) + Gold (#C9A84C)
   ============================================================ */

:root {
  --green:   #006C35;
  --green-d: #004d26;
  --green-l: #00a050;
  --gold:    #C9A84C;
  --gold-l:  #e4c46a;
  --dark:    #1a1a2e;
  --gray:    #6b7280;
  --light:   #f3f4f6;
  --white:   #ffffff;
  --danger:  #dc2626;
  --success: #16a34a;
  --info:    #2563eb;
  --warn:    #d97706;
  --radius:  12px;
  --shadow:  0 4px 24px rgba(0,0,0,0.10);
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--light);
  color: var(--dark);
  min-height: 100vh;
}

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── NAV ────────────────────────────────────────────────── */
nav {
  background: linear-gradient(135deg, var(--green-d) 0%, var(--green) 60%, var(--green-l) 100%);
  color: #fff;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  box-shadow: 0 2px 12px rgba(0,108,53,0.4);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: #fff;
  text-decoration: none;
}

.nav-brand .nav-icon {
  width: 40px; height: 40px;
  background: var(--gold);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.nav-brand small {
  display: block;
  font-size: 0.65rem;
  font-weight: 400;
  opacity: 0.85;
  letter-spacing: 0.03em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-links a {
  color: rgba(255,255,255,0.88);
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  font-size: 0.9rem;
  transition: background 0.2s;
  text-decoration: none;
}

.nav-links a:hover, .nav-links a.active {
  background: rgba(255,255,255,0.15);
  color: #fff;
  text-decoration: none;
}

.nav-links a.logout {
  background: rgba(220,38,38,0.2);
  color: #fca5a5;
}
.nav-links a.logout:hover { background: rgba(220,38,38,0.4); color: #fff; }

/* ── LAYOUT ─────────────────────────────────────────────── */
.wrap     { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem; }
.wrap-sm  { max-width: 700px;  margin: 0 auto; padding: 2rem 1.5rem; }
.wrap-md  { max-width: 900px;  margin: 0 auto; padding: 2rem 1.5rem; }

/* ── HERO / DASHBOARD HEADER ───────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--green-d) 0%, var(--green) 50%, var(--green-l) 100%);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  color: #fff;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  overflow: hidden;
  position: relative;
}

.hero::before {
  content: '';
  position: absolute;
  right: -60px; top: -60px;
  width: 260px; height: 260px;
  border-radius: 50%;
  background: rgba(201,168,76,0.15);
}

.hero::after {
  content: '';
  position: absolute;
  right: 40px; bottom: -80px;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
}

.hero h1 { font-size: 1.8rem; font-weight: 700; margin-bottom: 0.4rem; }
.hero p   { font-size: 1rem; opacity: 0.88; }
.hero-emoji { font-size: 5rem; line-height: 1; flex-shrink: 0; position: relative; z-index: 1; }

/* ── STAT CARDS ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  border-radius: var(--radius);
  padding: 1.5rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-3px); }

.stat-card-icon {
  font-size: 2.2rem;
  background: rgba(255,255,255,0.2);
  width: 56px; height: 56px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.stat-card-body h3 { font-size: 1.9rem; font-weight: 800; line-height: 1; }
.stat-card-body p  { font-size: 0.82rem; opacity: 0.88; margin-top: 3px; }

.sc-green   { background: linear-gradient(135deg, #006C35, #00a050); }
.sc-gold    { background: linear-gradient(135deg, #a07020, #C9A84C); }
.sc-blue    { background: linear-gradient(135deg, #1d4ed8, #3b82f6); }
.sc-purple  { background: linear-gradient(135deg, #6d28d9, #8b5cf6); }
.sc-red     { background: linear-gradient(135deg, #b91c1c, #ef4444); }
.sc-teal    { background: linear-gradient(135deg, #0f766e, #14b8a6); }

/* ── SUBJECT CARDS ──────────────────────────────────────── */
.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.subject-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border-left: 5px solid var(--green);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  color: var(--dark);
}
.subject-card:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(0,0,0,0.14); text-decoration: none; }

.subject-icon {
  font-size: 2.5rem;
  background: var(--light);
  width: 60px; height: 60px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.subject-body h3 { font-weight: 700; font-size: 1rem; }
.subject-body p  { font-size: 0.82rem; color: var(--gray); margin-top: 3px; }

/* ── CARD ───────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.card h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--light);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── TABLE ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

table.table th {
  background: var(--light);
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray);
}

table.table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #f0f0f0;
}

table.table tr:hover td { background: #fafafa; }

/* ── BADGES / PILLS ─────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.badge-green  { background: #dcfce7; color: #15803d; }
.badge-red    { background: #fee2e2; color: #b91c1c; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-gold   { background: #fef3c7; color: #92400e; }
.badge-gray   { background: #f3f4f6; color: #4b5563; }
.badge-purple { background: #ede9fe; color: #6d28d9; }

.difficulty-Easy   { background: #dcfce7; color: #15803d; }
.difficulty-Medium { background: #fef3c7; color: #92400e; }
.difficulty-Hard   { background: #fee2e2; color: #b91c1c; }

/* ── BUTTONS ────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.55rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
  line-height: 1;
}

.btn-primary {
  background: var(--green);
  color: #fff;
}
.btn-primary:hover { background: var(--green-d); color: #fff; text-decoration: none; }

.btn-gold {
  background: var(--gold);
  color: #fff;
}
.btn-gold:hover { background: #b8923a; color: #fff; text-decoration: none; }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #b91c1c; text-decoration: none; }

.btn-light {
  background: var(--light);
  color: var(--dark);
}
.btn-light:hover { background: #e5e7eb; text-decoration: none; }

.btn-outline {
  background: transparent;
  color: var(--green);
  border: 2px solid var(--green);
}
.btn-outline:hover { background: var(--green); color: #fff; text-decoration: none; }

.btn-sm { padding: 0.35rem 0.85rem; font-size: 0.8rem; }
.btn-lg { padding: 0.85rem 2rem; font-size: 1.05rem; }

/* ── FORMS ──────────────────────────────────────────────── */
.form-group { margin-bottom: 1.2rem; }

label {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 0.4rem;
  color: #374151;
}

input[type="text"], input[type="password"], input[type="number"],
input[type="email"], select, textarea {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--dark);
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0,108,53,0.12);
}

textarea { min-height: 90px; resize: vertical; }

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

/* ── ALERTS ─────────────────────────────────────────────── */
.alert {
  padding: 1rem 1.25rem;
  border-radius: 8px;
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.alert-danger  { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

/* ── LOGIN PAGE ─────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--green-d) 0%, var(--green) 50%, #00c060 100%);
  padding: 1.5rem;
}

.login-box {
  background: #fff;
  border-radius: 20px;
  padding: 2.5rem 2.25rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

.login-header { text-align: center; margin-bottom: 2rem; }
.login-header .logo { font-size: 3.5rem; margin-bottom: 0.5rem; }
.login-header h1 { font-size: 1.5rem; font-weight: 800; color: var(--green); }
.login-header p  { font-size: 0.85rem; color: var(--gray); margin-top: 0.25rem; }

.login-box .btn { width: 100%; text-align: center; margin-top: 0.5rem; }

.login-footer { text-align: center; margin-top: 1.5rem; font-size: 0.8rem; color: var(--gray); }
.login-footer strong { color: var(--green); }

/* ── EXAM QUESTION CARD ──────────────────────────────────── */
.question-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
  border-top: 4px solid var(--green);
}

.question-card.study-mode { border-top-color: var(--info); }

.q-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  background: var(--green);
  color: #fff;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  flex-shrink: 0;
}

.q-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--dark);
  line-height: 1.5;
  margin-bottom: 1.1rem;
}

.options { display: flex; flex-direction: column; gap: 0.6rem; }

.option-label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.18s;
  font-size: 0.95rem;
  line-height: 1.4;
}

.option-label:hover { border-color: var(--green); background: #f0fdf4; }

.option-label input[type="radio"] {
  width: auto;
  margin-top: 2px;
  accent-color: var(--green);
  flex-shrink: 0;
}

.option-label input[type="radio"]:checked + span,
.option-label:has(input:checked) {
  color: var(--green-d);
}

.option-label:has(input:checked) {
  border-color: var(--green);
  background: #f0fdf4;
}

/* Answer review colours */
.option-correct  { border-color: #16a34a; background: #dcfce7; }
.option-wrong    { border-color: #dc2626; background: #fee2e2; }
.option-missed   { border-color: #16a34a; background: #f0fdf4; }

.explanation-box {
  margin-top: 1rem;
  padding: 1rem;
  background: #fffbeb;
  border-left: 4px solid var(--gold);
  border-radius: 0 8px 8px 0;
  font-size: 0.9rem;
  color: #78350f;
  line-height: 1.6;
}

.explanation-box strong { color: #92400e; }

/* ── TIMER ──────────────────────────────────────────────── */
.timer-bar {
  position: sticky;
  top: 64px;
  z-index: 90;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

.timer-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.2rem;
}

.timer-display.warning { color: #d97706; }
.timer-display.danger  { color: #dc2626; animation: pulse 1s infinite; }

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }

/* ── RESULT PAGE ─────────────────────────────────────────── */
.result-hero {
  border-radius: var(--radius);
  padding: 2.5rem;
  text-align: center;
  color: #fff;
  margin-bottom: 1.5rem;
}

.result-hero.pass { background: linear-gradient(135deg, #15803d, #22c55e); }
.result-hero.fail { background: linear-gradient(135deg, #b91c1c, #ef4444); }

.result-icon { font-size: 4rem; margin-bottom: 0.5rem; }
.result-title { font-size: 1.8rem; font-weight: 800; }
.result-score { font-size: 3.5rem; font-weight: 900; line-height: 1; margin: 0.5rem 0; }
.result-sub   { font-size: 1rem; opacity: 0.9; }

/* ── PROGRESS BAR ────────────────────────────────────────── */
.progress { height: 10px; background: #e5e7eb; border-radius: 999px; overflow: hidden; margin-top: 0.4rem; }
.progress-bar { height: 100%; border-radius: 999px; transition: width 0.6s ease; }
.progress-bar-green  { background: linear-gradient(90deg, var(--green), var(--green-l)); }
.progress-bar-gold   { background: linear-gradient(90deg, #a07020, var(--gold)); }
.progress-bar-red    { background: linear-gradient(90deg, #b91c1c, #ef4444); }

/* ── BREADCRUMB ──────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--gray);
  margin-bottom: 1.25rem;
}
.breadcrumb a { color: var(--green); }
.breadcrumb span { color: #9ca3af; }

/* ── PAGE HEADER ─────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-header h1 { font-size: 1.5rem; font-weight: 800; }

/* ── SCFHS INFO BOX ─────────────────────────────────────── */
.scfhs-box {
  background: linear-gradient(135deg, var(--green-d), var(--green));
  color: #fff;
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.scfhs-box .scfhs-icon { font-size: 3rem; flex-shrink: 0; }

.scfhs-box h3  { font-size: 1.1rem; font-weight: 700; }
.scfhs-box p   { font-size: 0.85rem; opacity: 0.9; margin-top: 0.25rem; }

/* ── EXAM START CARD ────────────────────────────────────── */
.exam-meta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.exam-meta-item {
  text-align: center;
  background: var(--light);
  border-radius: 10px;
  padding: 1rem;
}

.exam-meta-item .meta-icon { font-size: 1.8rem; margin-bottom: 0.3rem; }
.exam-meta-item .meta-val  { font-size: 1.3rem; font-weight: 800; color: var(--green); }
.exam-meta-item .meta-lbl  { font-size: 0.78rem; color: var(--gray); }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .wrap, .wrap-md, .wrap-sm { padding: 1rem; }
  .hero { flex-direction: column; text-align: center; }
  .hero-emoji { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  nav { padding: 0 1rem; }
  .nav-brand span.nav-subtitle { display: none; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  table.table { font-size: 0.8rem; }
  table.table th, table.table td { padding: 0.6rem 0.7rem; }
}

/* ── MISC ────────────────────────────────────────────────── */
.text-muted  { color: var(--gray); font-size: 0.88rem; }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.d-flex { display: flex; }
.gap-1 { gap: 0.5rem; }
.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray);
}
.empty-state .empty-icon { font-size: 3.5rem; margin-bottom: 0.75rem; }
.empty-state p { font-size: 0.95rem; }
