/* ============================================================
 *  STYLESHEET UTAMA — Website Profil & Ujian Online
 *  Rosmati, S.Pd — Guru Matematika, SMK Nusatama Padang
 *  Tema: biru / ungu profesional ala sekolah, responsif.
 * ============================================================ */

:root {
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --purple: #7c3aed;
  --purple-dark: #6d28d9;
  --grad: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  --grad-soft: linear-gradient(135deg, #eff6ff 0%, #f5f3ff 100%);
  --ink: #1e293b;
  --muted: #64748b;
  --bg: #f8fafc;
  --card: #ffffff;
  --line: #e2e8f0;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(37, 99, 235, 0.12);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* ---------- Navbar ---------- */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--grad);
  box-shadow: 0 4px 18px rgba(37, 99, 235, 0.35);
}
.navbar .container { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { color: #fff; font-weight: 700; font-size: 1.15rem; text-decoration: none; letter-spacing: 0.3px; }
.brand small { display: block; font-size: 0.68rem; font-weight: 400; opacity: 0.85; letter-spacing: 0.6px; }
.nav-links { display: flex; gap: 6px; align-items: center; }
.nav-links a {
  color: #fff; text-decoration: none; font-weight: 500; font-size: 0.95rem;
  padding: 8px 16px; border-radius: 999px; transition: background 0.2s;
}
.nav-links a:hover, .nav-links a.active { background: rgba(255, 255, 255, 0.22); }
.nav-toggle {
  display: none; background: transparent; border: none; color: #fff;
  font-size: 1.6rem; cursor: pointer; padding: 6px 10px;
}

/* ---------- Hero ---------- */
.hero {
  background: var(--grad);
  color: #fff;
  padding: 70px 0 80px;
  text-align: center;
  position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 60px;
  background: var(--bg); clip-path: ellipse(60% 100% at 50% 100%);
}
.avatar {
  width: 130px; height: 130px; border-radius: 50%;
  margin: 0 auto 20px;
  background: rgba(255, 255, 255, 0.18);
  border: 4px solid rgba(255, 255, 255, 0.85);
  display: flex; align-items: center; justify-content: center;
  font-size: 3.4rem; font-weight: 800;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(4px);
}
.hero h1 { font-size: 2.4rem; margin-bottom: 6px; }
.hero .jabatan { font-size: 1.15rem; font-weight: 600; opacity: 0.95; }
.hero .sekolah { font-size: 1rem; opacity: 0.85; margin-bottom: 28px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; position: relative; z-index: 1; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; padding: 12px 28px; border-radius: 999px;
  font-weight: 600; font-size: 1rem; text-decoration: none; cursor: pointer;
  border: none; transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
}
.btn-primary { background: #fff; color: var(--blue-dark); box-shadow: 0 8px 20px rgba(0,0,0,0.18); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(0,0,0,0.22); }
.btn-outline { background: transparent; color: #fff; border: 2px solid #fff; }
.btn-outline:hover { background: rgba(255,255,255,0.15); }
.btn-grad { background: var(--grad); color: #fff; box-shadow: var(--shadow); }
.btn-grad:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(124,58,237,0.35); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost { background: #f1f5f9; color: var(--ink); }
.btn-ghost:hover { background: #e2e8f0; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* ---------- Sections ---------- */
.section { padding: 56px 0; }
.section-title {
  text-align: center; font-size: 1.7rem; margin-bottom: 8px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  font-weight: 800;
}
.section-sub { text-align: center; color: var(--muted); margin-bottom: 36px; }

.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 32px;
  border: 1px solid var(--line);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.about-text { font-size: 1.05rem; color: var(--ink); max-width: 800px; margin: 0 auto; text-align: center; }
.about-text strong { color: var(--purple-dark); }

.contact-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.contact-card {
  display: flex; align-items: center; gap: 16px; padding: 22px;
  background: var(--card); border-radius: var(--radius); border: 1px solid var(--line);
  box-shadow: var(--shadow); text-decoration: none; color: var(--ink);
  transition: transform 0.15s;
}
.contact-card:hover { transform: translateY(-3px); }
.contact-icon {
  width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0;
  background: var(--grad); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
}
.contact-card b { display: block; font-size: 0.85rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.contact-card span { font-size: 1.05rem; font-weight: 600; color: var(--blue-dark); word-break: break-all; }

/* ---------- Footer ---------- */
footer {
  background: #0f172a; color: #cbd5e1; padding: 34px 0; text-align: center; margin-top: 40px;
}
footer a { color: #93c5fd; text-decoration: none; }
footer a:hover { text-decoration: underline; }
footer .foot-links { margin-top: 10px; font-size: 0.9rem; }

/* ---------- Forms ---------- */
.form-wrap { max-width: 520px; margin: 0 auto; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.95rem; }
.form-group input {
  width: 100%; padding: 12px 14px; border: 2px solid var(--line);
  border-radius: 10px; font-size: 1rem; font-family: inherit;
  transition: border-color 0.2s;
}
.form-group input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,0.12); }
.form-hint { font-size: 0.85rem; color: var(--muted); margin-top: 4px; }
.alert { padding: 14px 16px; border-radius: 10px; margin-bottom: 20px; font-size: 0.95rem; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.alert-warn { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.alert-info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }

/* ---------- Exam ---------- */
.exam-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 20px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 20px; box-shadow: var(--shadow);
  position: sticky; top: 76px; z-index: 50;
}
.timer {
  font-size: 1.35rem; font-weight: 800; color: var(--blue-dark);
  background: var(--grad-soft); padding: 6px 18px; border-radius: 999px;
  border: 2px solid var(--blue);
}
.timer.danger { color: var(--red); border-color: var(--red); background: #fef2f2; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.6; } }
.progress { font-weight: 600; color: var(--muted); }

.exam-layout { display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: start; }
.exam-nav {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
  position: sticky; top: 168px;
}
.exam-nav h3 { font-size: 0.95rem; margin-bottom: 12px; color: var(--muted); }
.nav-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.nav-btn {
  aspect-ratio: 1; border-radius: 10px; border: 2px solid var(--line);
  background: #f8fafc; font-weight: 700; cursor: pointer; font-size: 0.95rem;
  transition: all 0.15s;
}
.nav-btn:hover { border-color: var(--blue); }
.nav-btn.answered { background: var(--blue); border-color: var(--blue); color: #fff; }
.nav-btn.current { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(124,58,237,0.2); }

.question {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; margin-bottom: 18px; box-shadow: var(--shadow);
  scroll-margin-top: 180px;
}
.question h3 { font-size: 1.08rem; margin-bottom: 14px; }
.question h3 .qnum {
  display: inline-block; background: var(--grad); color: #fff;
  width: 32px; height: 32px; line-height: 32px; text-align: center;
  border-radius: 10px; margin-right: 10px; font-size: 0.95rem;
}
.option { display: block; margin-bottom: 10px; }
.option input { display: none; }
.option span {
  display: block; padding: 12px 16px 12px 52px; border: 2px solid var(--line);
  border-radius: 10px; cursor: pointer; position: relative; transition: all 0.15s;
  font-size: 1rem;
}
.option span::before {
  content: attr(data-huruf);
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; line-height: 30px; text-align: center;
  border-radius: 50%; background: #f1f5f9; font-weight: 700; font-size: 0.9rem;
  color: var(--muted); transition: all 0.15s;
}
.option input:checked + span { border-color: var(--blue); background: #eff6ff; }
.option input:checked + span::before { background: var(--grad); color: #fff; }
.option span:hover { border-color: var(--blue); }

.exam-finish { text-align: center; margin: 30px 0 50px; }

/* ---------- Result ---------- */
.result-card { max-width: 640px; margin: 0 auto; text-align: center; }
.score-circle {
  width: 170px; height: 170px; border-radius: 50%; margin: 10px auto 20px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--grad); color: #fff; box-shadow: var(--shadow);
}
.score-circle .skor { font-size: 3rem; font-weight: 800; line-height: 1; }
.score-circle .lbl { font-size: 0.85rem; opacity: 0.9; }
.status-badge {
  display: inline-block; padding: 10px 30px; border-radius: 999px;
  font-weight: 800; font-size: 1.15rem; margin: 8px 0 20px;
}
.status-lulus { background: #dcfce7; color: #166534; border: 2px solid var(--green); }
.status-gagal { background: #fee2e2; color: #991b1b; border: 2px solid var(--red); }
.result-table { width: 100%; border-collapse: collapse; margin: 10px 0 24px; text-align: left; }
.result-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.result-table td:first-child { font-weight: 600; color: var(--muted); width: 42%; }
.result-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---------- Guru dashboard ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); }
table.data { width: 100%; border-collapse: collapse; background: #fff; font-size: 0.92rem; min-width: 760px; }
table.data th { background: var(--grad); color: #fff; padding: 12px 14px; text-align: left; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.4px; }
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--line); }
table.data tr:hover td { background: #f8fafc; }
.badge { display: inline-block; padding: 3px 12px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; }
.badge-ok { background: #dcfce7; color: #166534; }
.badge-bad { background: #fee2e2; color: #991b1b; }
.guru-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 22px 0; }
.empty-state { text-align: center; color: var(--muted); padding: 40px 20px; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .exam-layout { grid-template-columns: 1fr; }
  .exam-nav { position: static; }
  .nav-grid { grid-template-columns: repeat(10, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none; position: absolute; top: 64px; left: 0; right: 0;
    background: var(--purple-dark); flex-direction: column; align-items: stretch;
    padding: 10px 16px 16px; gap: 4px;
  }
  .nav-links.open { display: flex; }
  .hero h1 { font-size: 1.9rem; }
  .card { padding: 22px; }
  .section { padding: 40px 0; }
  .exam-top { top: 70px; }
  .nav-grid { grid-template-columns: repeat(5, 1fr); }
}

/* ---------- Print (hasil) ---------- */
@media print {
  .navbar, footer, .result-actions, .no-print { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}

/* ================= Dashboard Admin ================= */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 6px; }
.tab-btn {
  padding: 10px 18px; border: 1px solid var(--line); background: #fff;
  border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 0.95rem;
}
.tab-btn.active { background: var(--grad); color: #fff; border-color: transparent; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.form-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.search-input {
  padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px;
  min-width: 220px; font: inherit;
}
.opsi-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.opsi-huruf { font-weight: 700; min-width: 24px; text-align: center; }
.opsi-row input { flex: 1; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.soal-card {
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px;
}
.soal-head { display: flex; gap: 12px; align-items: flex-start; }
.soal-head p { margin: 4px 0; }
.soal-nomor {
  background: var(--grad); color: #fff; font-weight: 700; border-radius: 50%;
  min-width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.soal-opsi { margin: 10px 0 4px 44px; padding: 0; list-style: none; }
.soal-opsi li { padding: 4px 0; }
.soal-opsi li.benar { font-weight: 700; color: #15803d; }
.soal-aksi { margin-top: 10px; }
.soal-kunci { margin: 8px 0 0 44px; font-size: 0.9rem; color: var(--muted); }
.count-badge { font-weight: 700; align-self: center; }
.stat-row { display: flex; gap: 16px; margin: 14px 0; flex-wrap: wrap; }
.stat {
  background: #f8fafc; border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 22px; text-align: center;
}
.stat b { display: block; font-size: 1.6rem; }
.stat span { font-size: 0.85rem; color: var(--muted); }
.danger-zone { border-color: #fca5a5; }
.form-hint-inline { font-weight: 400; font-size: 0.85rem; color: var(--muted); }
td.aksi { white-space: nowrap; }

/* ================= Soal essai di halaman ujian ================= */
.essai-title { margin: 30px 0 4px; }
.essai-info { color: var(--muted); margin: 0 0 14px; }
.essai-jawab {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; font: inherit; resize: vertical; box-sizing: border-box;
}

/* ================= Akun admin & lupa password ================= */
.alert-ok { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.center-hint { text-align: center; margin-top: 12px; font-size: 0.95rem; }
.lupa-box {
  margin-top: 16px; padding: 14px; border: 1px dashed var(--line);
  border-radius: 10px; background: #f8fafc;
}
.lupa-box h4 { margin: 0 0 8px; }
.lupa-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
