/* ═══════════════════════════════════════════════════════
   ezWay Innovations Quiz — Main Stylesheet
   File: assets/css/main.css
═══════════════════════════════════════════════════════ */

/* ── Reset ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red:        #c0392b;
  --dark-red:   #8B0000;
  --light-red:  #e74c3c;
  --charcoal:   #1a1a2e;
  --dark:       #16213e;
  --card-bg:    #0f3460;
  --white:      #ffffff;
  --off-white:  #f8f9fa;
  --gray-light: #e9ecef;
  --gray:       #6c757d;
  --success:    #27ae60;
  --warning:    #f39c12;
  --radius:     12px;
  --shadow:     0 4px 24px rgba(0,0,0,0.12);
  --shadow-lg:  0 8px 40px rgba(0,0,0,0.18);
  --transition: 0.22s cubic-bezier(.4,0,.2,1);
  --font:       'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
}

html, body {
  font-family: var(--font);
  background: #f0f2f5;
  color: #212529;
  min-height: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* ── Page Wrapper ───────────────────────────────────── */
.page-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 860px;
  margin: 0 auto;
  padding: 0 16px 32px;
}

/* ── Site Header ────────────────────────────────────── */
.site-header {
  text-align: center;
  padding: 28px 0 20px;
}
.site-header.compact { padding: 14px 0; }

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-wrap {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
}
.logo-wrap.small .logo-ez,
.logo-wrap.small .logo-way { font-size: 1.6rem; }

.logo-ez  { font-size: 2.4rem; font-weight: 900; color: var(--red);     letter-spacing: -1px; }
.logo-way { font-size: 2.4rem; font-weight: 900; color: var(--charcoal);letter-spacing: -1px; }
.logo-tag {
  font-size: 0.62rem; font-weight: 700;
  letter-spacing: 3px; color: var(--gray);
  text-transform: uppercase;
  display: block; margin-top: 2px;
}

.site-title { font-size: 1.25rem; font-weight: 700; color: var(--charcoal); margin-top: 10px; }
.site-sub   { font-size: 0.88rem; color: var(--gray); margin-top: 4px; }

.student-info { font-size: 0.88rem; color: var(--gray); }

/* ── Form Card ──────────────────────────────────────── */
.form-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 32px 28px;
  margin-top: 8px;
}

.form-header { margin-bottom: 24px; }
.form-header h2 { font-size: 1.3rem; font-weight: 700; color: var(--charcoal); margin-top: 8px; }
.form-header p  { font-size: 0.85rem; color: var(--gray); margin-top: 4px; }

.step-badge {
  display: inline-block;
  background: rgba(192,57,43,0.1);
  color: var(--red);
  font-size: 0.72rem; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  padding: 4px 12px; border-radius: 99px;
}

/* ── Form Grid ──────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 20px;
  margin-bottom: 24px;
}

.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-group.full-width { grid-column: 1 / -1; }

label {
  font-size: 0.83rem;
  font-weight: 600;
  color: #374151;
}

.req { color: var(--red); }

input[type="text"],
input[type="tel"],
input[type="email"],
input[type="date"],
select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.93rem;
  font-family: var(--font);
  color: #212529;
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

input:focus, select:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(192,57,43,0.12);
}

input.invalid, select.invalid {
  border-color: var(--light-red);
  box-shadow: 0 0 0 3px rgba(231,76,60,0.12);
}

.field-err {
  font-size: 0.78rem;
  color: var(--light-red);
  min-height: 16px;
}

/* ── Radio Group ────────────────────────────────────── */
.radio-group { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 4px; }

.radio-opt {
  display: flex; align-items: center; gap: 7px;
  cursor: pointer; font-size: 0.9rem; font-weight: 400;
  color: #374151;
}

.radio-opt input[type="radio"] {
  width: 17px; height: 17px;
  accent-color: var(--red);
  cursor: pointer;
}

/* ── Upload Zone ────────────────────────────────────── */
.upload-zone {
  border: 2px dashed #d1d5db;
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  background: #fafafa;
  position: relative;
  min-height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.upload-zone:hover {
  border-color: var(--red);
  background: rgba(192,57,43,0.04);
}

.upload-zone.dragover {
  border-color: var(--red);
  background: rgba(192,57,43,0.08);
}

.upload-preview .upload-icon { font-size: 2.5rem; display: block; margin-bottom: 8px; }
.upload-preview p  { font-size: 0.9rem; color: #374151; line-height: 1.5; }
.upload-preview small { color: var(--gray); font-size: 0.78rem; }

#previewImg {
  max-width: 180px;
  max-height: 180px;
  border-radius: 8px;
  object-fit: cover;
  border: 2px solid var(--gray-light);
}

/* ── Alerts ─────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.87rem;
  line-height: 1.5;
}
.alert-error {
  background: #fff0ee;
  border: 1px solid #fcc;
  color: #c0392b;
}

/* ── Buttons ─────────────────────────────────────────── */
.btn-primary {
  display: block; width: 100%;
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--dark-red), var(--red));
  color: var(--white);
  font-size: 1rem; font-weight: 700;
  border: none; border-radius: 10px;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(192,57,43,0.35);
  text-align: center;
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(192,57,43,0.45);
}
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* ── Warning Banner (App Switch) ────────────────────── */
.warning-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
  background: linear-gradient(135deg, var(--dark-red), var(--red));
  color: white; text-align: center;
  padding: 12px 20px;
  font-weight: 700; font-size: 0.93rem;
  transform: translateY(-100%);
  transition: transform 0.35s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 3px 16px rgba(0,0,0,0.3);
}
.warning-banner.show { transform: translateY(0); }

/* ── Offline Bar ────────────────────────────────────── */
.offline-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 9998;
  background: #1a1a1a; color: var(--warning);
  text-align: center; padding: 9px;
  font-size: 0.82rem; font-weight: 600;
  display: none;
}
.offline-bar.show { display: block; }

/* ── Quiz Layout ────────────────────────────────────── */
.quiz-wrap { flex: 1; margin-top: 12px; }

/* ── Progress ───────────────────────────────────────── */
.quiz-progress {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px 14px;
  margin-bottom: 16px;
}

.progress-info {
  display: flex; justify-content: space-between;
  font-size: 0.8rem; font-weight: 600; color: var(--gray);
  margin-bottom: 10px;
}

.progress-track {
  height: 6px; background: var(--gray-light);
  border-radius: 99px; overflow: hidden; margin-bottom: 12px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--dark-red), var(--red));
  border-radius: 99px;
  transition: width 0.5s ease;
}

.page-dots { display: flex; gap: 8px; justify-content: center; }
.page-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--gray-light);
  color: var(--gray);
  font-size: 0.8rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}
.page-dot.active     { background: var(--red);     color: white; }
.page-dot.completed  { background: var(--success);  color: white; }
.page-dot.partial    { background: var(--warning);  color: white; }

/* ── Question Pages ─────────────────────────────────── */
.question-page { display: none; }
.question-page.active { display: block; }

.question-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 20px;
  margin-bottom: 14px;
}

.q-number {
  font-size: 0.72rem; font-weight: 700;
  color: var(--red); letter-spacing: 1px;
  text-transform: uppercase; margin-bottom: 8px;
}

.q-text {
  font-size: 1.03rem; font-weight: 600;
  color: var(--charcoal); line-height: 1.5;
  margin-bottom: 16px;
}

/* ── Options ────────────────────────────────────────── */
.options-grid { display: flex; flex-direction: column; gap: 10px; }

.option-label {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border: 1.5px solid #e5e7eb;
  border-radius: 9px;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}
.option-label:hover { border-color: var(--red); background: rgba(192,57,43,0.04); }
.option-label.selected {
  border-color: var(--red);
  background: rgba(192,57,43,0.08);
  box-shadow: 0 0 0 3px rgba(192,57,43,0.12);
}

.option-label input[type="radio"] { display: none; }

.opt-key {
  width: 28px; height: 28px; flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid #d1d5db;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; color: var(--gray);
  transition: all var(--transition);
}
.option-label.selected .opt-key {
  background: var(--red); border-color: var(--red); color: white;
}

.opt-text { font-size: 0.92rem; color: #374151; line-height: 1.4; }

/* ── Quiz Navigation ────────────────────────────────── */
.quiz-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 16px; gap: 12px;
}

.btn-nav {
  padding: 12px 28px;
  border: 2px solid var(--red);
  border-radius: 9px;
  background: transparent;
  color: var(--red);
  font-size: 0.9rem; font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  min-width: 120px;
}
.btn-nav:hover:not(:disabled) { background: var(--red); color: white; }
.btn-nav:disabled { opacity: 0.35; cursor: not-allowed; }

.nav-center { font-size: 0.82rem; color: var(--gray); font-weight: 600; text-align: center; }

/* ── Submit Section ─────────────────────────────────── */
.submit-wrap { margin-top: 20px; }
.submit-notice {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 9px;
  padding: 14px 18px;
  margin-bottom: 16px;
}
.submit-notice p { font-size: 0.87rem; color: #7d6000; line-height: 1.6; }

.btn-submit { margin-top: 0; }

/* ── Success Card ───────────────────────────────────── */
.success-card { text-align: center; padding: 56px 28px; }
.success-icon  { font-size: 4rem; margin-bottom: 20px; }
.success-title { font-size: 1.6rem; font-weight: 800; color: var(--charcoal); margin-bottom: 14px; }
.success-msg   { font-size: 1.1rem; color: #374151; line-height: 1.6; margin-bottom: 8px; }
.success-sub   { font-size: 0.88rem; color: var(--gray); }

/* ── Duration Countdown Bar ─────────────────────────── */
.duration-wrap {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(39,174,96,0.07);
  border: 1px solid rgba(39,174,96,0.2);
  border-radius: 9px;
  transition: background 0.4s ease, border-color 0.4s ease;
}
.duration-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}
.duration-icon { font-size: 0.9rem; }
.duration-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #374151;
  font-variant-numeric: tabular-nums;
}
.duration-track {
  height: 6px;
  background: rgba(0,0,0,0.08);
  border-radius: 99px;
  overflow: hidden;
}
.duration-fill {
  height: 100%;
  background: #27ae60;
  border-radius: 99px;
  transition: width 1s linear, background 0.4s ease;
}

/* ── Countdown Timer (scheduling) ───────────────────── */
.countdown-grid {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.cd-box {
  background: linear-gradient(135deg, var(--dark-red), var(--red));
  color: #fff;
  border-radius: 12px;
  padding: 14px 18px;
  min-width: 72px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(192,57,43,0.3);
}
.cd-num {
  display: block;
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.cd-label {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  opacity: 0.85;
  margin-top: 4px;
}

/* Compact countdown for quiz lock screen */
.cd-box.cd-compact {
  min-width: 60px;
  padding: 10px 12px;
}
.cd-box.cd-compact .cd-num { font-size: 1.3rem; }

/* ── Footer ─────────────────────────────────────────── */
.site-footer { text-align: center; padding: 20px 0 8px; }
.site-footer p { font-size: 0.78rem; color: var(--gray); }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-card { padding: 24px 16px; }
  .quiz-nav  { gap: 8px; }
  .btn-nav   { padding: 11px 16px; min-width: 100px; font-size: 0.84rem; }
  .q-text    { font-size: 0.96rem; }
}

@media (max-width: 380px) {
  .logo-ez, .logo-way { font-size: 1.8rem; }
  .btn-nav { padding: 10px 12px; min-width: 88px; }
}

/* ── Stay Focused Notice (inside progress card, below dots) ── */
.stay-focused-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 8px;
  padding: 9px 14px;
  margin-top: 14px;   /* gap below page dots */
}
.stay-focused-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #27ae60;
  flex-shrink: 0;
  transition: background 0.3s ease;
  animation: pulseDot 1.8s ease infinite;
}
.stay-focused-text {
  font-size: 0.82rem;
  color: #7d6000;
  line-height: 1.4;
}
.stay-focused-text strong { color: #5d4400; }

@keyframes pulseDot {
  0%, 100% { transform: scale(1);   opacity: 1;   }
  50%       { transform: scale(1.5); opacity: 0.55; }
}

/* ── Marks Card (Thank You page) ────────────────────── */
.marks-card {
  background: linear-gradient(135deg, var(--dark-red), var(--red));
  border-radius: 14px;
  padding: 24px 32px;
  margin: 20px auto 16px;
  max-width: 260px;
  text-align: center;
  box-shadow: 0 6px 24px rgba(192,57,43,0.35);
}
.marks-obtained {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  margin-bottom: 6px;
}
.marks-num   { font-size: 2.8rem; font-weight: 900; color: #fff; line-height: 1; }
.marks-denom { font-size: 1.2rem; font-weight: 600; color: rgba(255,255,255,0.7); }
.marks-label { font-size: 0.78rem; color: rgba(255,255,255,0.85); text-transform: uppercase; letter-spacing: 1px; }

/* ── Result Stats Row (Thank You page) ──────────────── */
.result-stats-row {
  display: flex;
  justify-content: center;
  gap: 0;
  margin: 16px auto 20px;
  max-width: 380px;
  border: 1px solid var(--gray-light);
  border-radius: 12px;
  overflow: hidden;
}
.rs-item {
  flex: 1;
  text-align: center;
  padding: 14px 8px;
  border-right: 1px solid var(--gray-light);
}
.rs-item:last-child { border-right: none; }
.rs-num   { display: block; font-size: 1.4rem; font-weight: 800; color: var(--charcoal); }
.rs-label { display: block; font-size: 0.68rem; color: var(--gray); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 3px; }
.rs-correct .rs-num { color: var(--success); }
.rs-wrong   .rs-num { color: var(--red); }
.rs-skip    .rs-num { color: var(--warning); }

/* ── Attempted Box (legacy — keep for backward compat) ── */
.attempted-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(192,57,43,0.07);
  border: 1.5px solid rgba(192,57,43,0.2);
  border-radius: 12px;
  padding: 18px 28px;
  margin: 20px auto 18px;
  max-width: 280px;
}
.attempted-num {
  font-size: 2.8rem;
  font-weight: 900;
  color: var(--red);
  line-height: 1;
}
.attempted-label {
  font-size: 0.92rem;
  color: #374151;
  line-height: 1.5;
  text-align: left;
}
.attempted-label strong {
  color: var(--charcoal);
}

/* ── PWA Install Banner ─────────────────────────────── */
.pwa-install-banner {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(160px); /* hidden below screen */
  transition: transform 0.4s cubic-bezier(.4,0,.2,1);
  z-index: 9990;
  width: calc(100% - 32px);
  max-width: 520px;
  background: #0f3460;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.pwa-install-banner.show {
  transform: translateX(-50%) translateY(0); /* slide up */
}
.pwa-icon { font-size: 1.8rem; flex-shrink: 0; }
.pwa-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pwa-text strong { color: #ffffff; font-size: 0.88rem; }
.pwa-text span   { color: #a0b4cc; font-size: 0.78rem; }
.pwa-btn-install {
  flex-shrink: 0;
  padding: 8px 18px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.pwa-btn-install:hover { background: var(--dark-red); }
.pwa-btn-dismiss {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #a0b4cc;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 6px;
  line-height: 1;
}
.pwa-btn-dismiss:hover { color: #fff; }

/* ── Animations ─────────────────────────────────────── */
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-6px); }
  40%,80% { transform: translateX(6px); }
}
.shake { animation: shake 0.4s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.question-page.active { animation: fadeIn 0.25s ease; }


/* ── Add this CSS to quiz/assets/css/main.css ── */
/* (paste anywhere in the file, e.g. after the upload-zone styles) */

/* Badge shown next to selfie label on desktop */
.selfie-optional-badge {
  display: inline-block;
  background: rgba(108,117,125,0.12);
  color: var(--gray);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  margin-left: 6px;
  vertical-align: middle;
}

