/* ============================================================
   TX 7th Grade Pre-Algebra Portal — Main Stylesheet
   ============================================================ */

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

:root {
  --brand:       #185FA5;
  --brand-dark:  #104880;
  --brand-light: #E6F1FB;
  --text:        #1a202c;
  --muted:       #64748b;
  --border:      #e2e8f0;
  --bg:          #f0f4f8;
  --white:       #ffffff;
  --radius:      10px;
}

body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }

/* ── Topbar ──────────────────────────────────────────────── */
.topbar { background: var(--brand); color: #fff; padding: 0 16px; height: 52px; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.topbar-inner { max-width: 900px; margin: 0 auto; height: 100%; display: flex; align-items: center; gap: 12px; }
.topbar-brand { font-weight: 700; font-size: .95rem; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 12px; font-size: .85rem; }

/* Progress bar in quiz topbar */
.progress-bar-wrap { flex: 1; height: 6px; background: rgba(255,255,255,.3); border-radius: 3px; }
.progress-bar { height: 100%; background: #22c55e; border-radius: 3px; transition: width .4s ease; }
.q-counter { font-size: .8rem; font-weight: 600; white-space: nowrap; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 24px; border-radius: 8px; font-size: .9rem; font-weight: 600; cursor: pointer; border: none; text-decoration: none; transition: all .2s; }
.btn-primary   { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #cbd5e1; }
.btn-lg { padding: 13px 32px; font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 5px 12px; font-size: .78rem; font-weight: 600; border-radius: 6px; background: rgba(255,255,255,.2); color: #fff; text-decoration: none; border: none; cursor: pointer; }
.btn-sm:hover { background: rgba(255,255,255,.35); }

/* ── Alerts ──────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: .88rem; }
.alert-error   { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; }
.alert-success { background: #f0fdf4; border: 1px solid #86efac; color: #166534; }

/* ── Login page ──────────────────────────────────────────── */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-wrap { width: 100%; max-width: 420px; padding: 16px; }
.login-card { background: var(--white); border-radius: 16px; padding: 40px 32px; box-shadow: 0 4px 24px rgba(0,0,0,.1); }
.login-header { text-align: center; margin-bottom: 28px; }
.login-icon { font-size: 3rem; }
.login-header h1 { font-size: 1.3rem; margin-top: 8px; color: var(--brand); }
.login-header .school { color: var(--muted); font-size: .88rem; margin-top: 4px; }
.login-footer { text-align: center; margin-top: 20px; font-size: .82rem; }
.login-footer a { color: var(--muted); }

/* ── Form elements ───────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: .85rem; font-weight: 600; color: #374151; margin-bottom: 6px; }
.form-group .hint { font-size: .78rem; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: .95rem; transition: border-color .2s; background: var(--white); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(24,95,165,.12); }

/* ── Page layout ─────────────────────────────────────────── */
.page-wrap { max-width: 860px; margin: 0 auto; padding: 32px 16px 80px; }
.page-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 6px; }
.page-sub { color: var(--muted); margin-bottom: 28px; }
.section-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 24px 0 10px; }
.section-heading { font-size: 1.1rem; font-weight: 700; margin: 32px 0 16px; color: var(--text); }

/* ── Quiz selection cards ────────────────────────────────── */
.quiz-option-card { display: flex; align-items: center; gap: 16px; background: var(--white); border: 2px solid var(--border); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 10px; cursor: pointer; transition: all .2s; }
.quiz-option-card:hover { border-color: var(--brand); }
.quiz-option-card.selected { border-color: var(--brand); background: var(--brand-light); }
.qoc-radio { font-size: 1.2rem; color: var(--muted); transition: color .2s; }
.quiz-option-card.selected .qoc-radio { color: var(--brand); }
.qoc-title { font-weight: 700; font-size: .95rem; }
.qoc-desc  { font-size: .82rem; color: var(--muted); margin-top: 2px; }

/* SE chips */
.se-group { margin-bottom: 20px; }
.se-group-header { font-size: .82rem; font-weight: 700; margin-bottom: 8px; }
.se-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.se-chip { background: var(--white); border: 2px solid var(--border); border-radius: 8px; padding: 10px 14px; cursor: pointer; transition: all .15s; }
.se-chip:hover { border-color: var(--se-dark, var(--brand)); }
.se-chip.selected { border-color: var(--se-dark, var(--brand)); background: var(--se-light, var(--brand-light)); }
.se-chip strong { font-size: .78rem; display: block; color: var(--se-dark, var(--brand)); }
.se-chip span { font-size: .78rem; color: var(--muted); line-height: 1.3; }

/* ── Quiz main ───────────────────────────────────────────── */
.quiz-main { max-width: 720px; margin: 0 auto; padding: 24px 16px 80px; }
.teks-badge { display: inline-flex; gap: 10px; align-items: center; padding: 6px 14px; border-radius: 20px; font-size: .78rem; margin-bottom: 20px; }
.teks-code  { font-weight: 700; }
.teks-title { }

.question-card { background: var(--white); border-radius: 14px; padding: 28px; box-shadow: 0 2px 12px rgba(0,0,0,.08); }
.question-number { font-size: .78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 10px; }
.question-text { font-size: 1.1rem; font-weight: 600; line-height: 1.55; margin-bottom: 24px; }

/* Choices */
.choices { display: flex; flex-direction: column; gap: 10px; }
.choice-label { cursor: pointer; }
.choice-label input[type=radio] { display: none; }
.choice-btn { display: flex; align-items: center; gap: 14px; border: 2px solid var(--border); border-radius: 10px; padding: 13px 18px; transition: all .15s; cursor: pointer; }
.choice-btn:hover { border-color: var(--brand); background: var(--brand-light); }
.choice-btn.selected { border-color: var(--brand); background: var(--brand-light); }
.choice-key { font-weight: 700; min-width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; border-radius: 50%; border: 2px solid currentColor; font-size: .8rem; color: var(--brand); flex-shrink: 0; }
.choice-text { font-size: .95rem; line-height: 1.4; }

/* Feedback states */
.feedback-choice { pointer-events: none; }
.choice-btn.correct { border-color: #22c55e; background: #f0fdf4; }
.choice-btn.wrong   { border-color: #ef4444; background: #fef2f2; }
.check-icon { margin-left: auto; color: #22c55e; font-size: 1.1rem; font-weight: 700; }
.x-icon     { margin-left: auto; color: #ef4444; font-size: 1.1rem; font-weight: 700; }

.feedback-box { margin-top: 20px; padding: 14px 18px; border-radius: 10px; font-size: .92rem; font-weight: 600; }
.correct-box { background: #f0fdf4; color: #166534; border: 1px solid #86efac; }
.wrong-box   { background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5; }
.explanation-box { margin-top: 14px; padding: 14px 18px; border-radius: 10px; background: #fffbeb; border: 1px solid #fde68a; font-size: .88rem; line-height: 1.55; color: #78350f; }

/* ── Results page ────────────────────────────────────────── */
.score-card { background: var(--white); border-radius: 16px; padding: 32px; box-shadow: 0 4px 20px rgba(0,0,0,.1); display: flex; align-items: center; gap: 28px; margin-bottom: 36px; }
.grade-circle { width: 90px; height: 90px; border-radius: 50%; border: 5px solid var(--grade-color, #185FA5); display: flex; align-items: center; justify-content: center; font-size: 2.5rem; font-weight: 900; flex-shrink: 0; }
.score-pct  { font-size: 2rem; font-weight: 800; }
.score-sub  { color: var(--muted); font-size: .9rem; }
.score-name { margin-top: 6px; font-weight: 600; }

.strand-section { background: var(--white); border-radius: var(--radius); margin-bottom: 20px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.07); }
.strand-header { padding: 12px 20px; font-weight: 700; font-size: .9rem; }
.strand-summary { padding: 10px 20px; font-size: .85rem; color: var(--muted); border-bottom: 1px solid var(--border); }
.mini-bar-wrap { height: 5px; background: var(--border); border-radius: 3px; margin-top: 6px; }
.mini-bar { height: 100%; border-radius: 3px; transition: width .5s ease; }

.se-result-row { display: grid; grid-template-columns: 80px 1fr 50px 100px; align-items: center; gap: 12px; padding: 10px 20px; border-bottom: 1px solid #f8fafc; }
.se-result-row:last-child { border: none; }
.se-result-teks { font-size: .78rem; font-weight: 700; }
.se-result-title { font-size: .82rem; color: var(--text); }
.se-result-score { font-size: .88rem; font-weight: 700; text-align: right; }
.se-mini-bar-wrap { height: 5px; background: var(--border); border-radius: 3px; }
.se-mini-bar { height: 100%; border-radius: 3px; }

.results-actions { display: flex; gap: 12px; justify-content: center; margin-top: 32px; flex-wrap: wrap; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 540px) {
  .score-card { flex-direction: column; text-align: center; }
  .se-result-row { grid-template-columns: 60px 1fr 40px; }
  .se-mini-bar-wrap { display: none; }
}
