/* ============================================================
   Quiz App — Stylesheet
   Design: clean corporate / neutral dark
   Fonts: Inter (Google Fonts)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0f1117;
  --surface:    #1a1d27;
  --surface-2:  #22263a;
  --border:     #2e3348;
  --accent:     #5a7ef7;
  --accent-hover: #4a6ee6;
  --text:       #e8eaf0;
  --text-muted: #7a82a0;
  --text-dim:   #4a5272;
  --success:    #3ecf8e;
  --error:      #f66b6b;
  --warning:    #f5a623;
  --radius:     10px;
  --radius-sm:  6px;
  --shadow:     0 4px 24px rgba(0,0,0,.45);
}

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Layout ───────────────────────────────────────────────── */
.page-center {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 460px;
}

.card--wide { max-width: 780px; }
.card--dashboard { max-width: 960px; }

/* ── Logo / Header ────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 2rem;
}

.logo-mark {
  width: 36px; height: 36px;
  flex-shrink: 0;
}

.app-title {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text);
}

.app-subtitle {
  font-size: .8rem;
  color: var(--text-muted);
}

/* ── Form ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }

label {
  display: block;
  font-size: .8125rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: .5rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}

input[type="text"] {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: .9375rem;
  padding: .7rem 1rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(90,126,247,.18);
}

input[type="text"]::placeholder { color: var(--text-dim); }

/* ── Button ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .75rem 1.5rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s, opacity .15s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
}

.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-size: .8125rem;
  padding: .4rem .9rem;
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }

/* ── Alert ────────────────────────────────────────────────── */
.alert {
  border-radius: var(--radius-sm);
  padding: .8rem 1rem;
  font-size: .875rem;
  margin-bottom: 1.25rem;
  border: 1px solid transparent;
  display: none;
}
.alert.show { display: block; }
.alert-error   { background: rgba(246,107,107,.12); border-color: rgba(246,107,107,.35); color: #f9a0a0; }
.alert-success { background: rgba(62,207,142,.12);  border-color: rgba(62,207,142,.35);  color: #70d9a8; }
.alert-info    { background: rgba(90,126,247,.12);  border-color: rgba(90,126,247,.35);  color: #8ea8fa; }

/* ── Section title ────────────────────────────────────────── */
.section-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: .3rem;
}

.section-sub {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

/* ── Quiz progress ────────────────────────────────────────── */
.progress-bar-track {
  background: var(--surface-2);
  border-radius: 99px;
  height: 5px;
  margin-bottom: 2rem;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width .3s ease;
}

.progress-label {
  font-size: .78rem;
  color: var(--text-dim);
  margin-bottom: .5rem;
}

/* ── Question card ────────────────────────────────────────── */
.question-block {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.question-meta {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
  margin-bottom: .6rem;
}

.question-text {
  font-size: .9375rem;
  font-weight: 500;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.options-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.option-item {
  position: relative;
}

.option-item input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
}

.option-label {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .9rem;
  transition: border-color .15s, background .15s;
  user-select: none;
}

.option-label .dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  transition: border-color .15s, background .15s;
}

.option-item input:checked + .option-label {
  border-color: var(--accent);
  background: rgba(90,126,247,.1);
}
.option-item input:checked + .option-label .dot {
  border-color: var(--accent);
  background: var(--accent);
}
.option-label:hover {
  border-color: var(--accent);
}

/* ── Result screen ────────────────────────────────────────── */
.score-display {
  text-align: center;
  padding: 1.5rem 0 2rem;
}

.score-number {
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
}

.score-label {
  font-size: .875rem;
  color: var(--text-muted);
  margin-top: .4rem;
}

/* ── Admin dashboard ──────────────────────────────────────── */
.admin-badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--warning);
  background: rgba(245,166,35,.12);
  border: 1px solid rgba(245,166,35,.3);
  border-radius: 99px;
  padding: .2rem .65rem;
  margin-bottom: 1rem;
}

.stats-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.stat-box {
  flex: 1;
  min-width: 120px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .9rem 1.1rem;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-name {
  font-size: .75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-top: .1rem;
}

/* ── Submission accordion ─────────────────────────────────── */
.sub-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: .75rem;
  overflow: hidden;
}

.sub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .9rem 1.25rem;
  cursor: pointer;
  user-select: none;
  gap: 1rem;
}

.sub-header:hover { background: rgba(255,255,255,.03); }

.sub-username {
  font-weight: 600;
  font-size: .9375rem;
}

.sub-meta {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-shrink: 0;
}

.score-pill {
  font-size: .8rem;
  font-weight: 700;
  padding: .2rem .65rem;
  border-radius: 99px;
}

.score-pill.high   { background: rgba(62,207,142,.15);  color: #3ecf8e; }
.score-pill.mid    { background: rgba(245,166,35,.15);  color: #f5a623; }
.score-pill.low    { background: rgba(246,107,107,.15); color: #f66b6b; }

.chevron {
  color: var(--text-dim);
  font-size: .8rem;
  transition: transform .2s;
}
.sub-card.open .chevron { transform: rotate(180deg); }

.sub-body {
  display: none;
  padding: 0 1.25rem 1.25rem;
  border-top: 1px solid var(--border);
}
.sub-card.open .sub-body { display: block; }

.response-row {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .85rem;
}
.response-row:last-child { border-bottom: none; }

.res-num {
  font-size: .72rem;
  color: var(--text-dim);
  min-width: 24px;
  padding-top: .15rem;
}

.res-q   { color: var(--text-muted); flex: 1; }
.res-ans { font-weight: 500; }

.tag-correct   { color: var(--success); }
.tag-incorrect { color: var(--error); }

.sub-date {
  font-size: .72rem;
  color: var(--text-dim);
}

.btn-delete {
  background: transparent;
  border: 1px solid rgba(246,107,107,.35);
  color: var(--error);
  border-radius: var(--radius-sm);
  font-size: .72rem;
  font-weight: 600;
  font-family: inherit;
  padding: .2rem .55rem;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.btn-delete:hover {
  background: rgba(246,107,107,.12);
  border-color: var(--error);
}
.btn-delete:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* ── Spinner ──────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Utility ──────────────────────────────────────────────── */
.hidden { display: none !important; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.text-muted { color: var(--text-muted); font-size: .875rem; }
.text-center { text-align: center; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 600px) {
  .card { padding: 1.75rem 1.25rem; }
  .stats-row { gap: .6rem; }
}
