/* ============================================================
   Hermes Training — style.css
   Ai tiếp quản: biến màu ở :root; dark mode = class .dark trên <html>
   Quy ước class: .btn (nút), .card (khóa học), .container (khung 1100px)
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #0B5FFF;
  --primary-dark: #0846C6;
  --accent: #00C48C;
  --bg: #F9FAFB;
  --surface: #FFFFFF;
  --text: #111827;
  --muted: #6B7280;
  --border: #E5E7EB;
  --success: #10B981;
  --danger: #EF4444;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.05);
  --radius: 14px;
}

.dark {
  --bg: #111827;
  --surface: #1F2937;
  --text: #F3F4F6;
  --muted: #9CA3AF;
  --border: #374151;
  --shadow: 0 1px 3px rgba(0,0,0,.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background .2s, color .2s;
}
a { color: inherit; text-decoration: none; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* ===== Header ===== */
header.site {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; }
.logo-badge {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #0B5FFF, #00C48C);
  display: grid; place-items: center; color: #fff; font-size: 18px;
}
nav.main a { margin-left: 22px; font-weight: 500; color: var(--muted); }
nav.main a:hover { color: var(--primary); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: 999px; border: none; cursor: pointer;
  font-weight: 600; font-size: 14px; font-family: inherit;
  transition: transform .1s, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: linear-gradient(135deg, #0846C6, #0B5FFF); color: #fff; }
.btn-primary:hover { opacity: .92; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ===== Hero ===== */
.hero { text-align: center; padding: 56px 0 40px; }
.hero h1 { font-size: clamp(26px, 4vw, 40px); font-weight: 800; letter-spacing: -.02em; }
.hero h1 span {
  background: linear-gradient(135deg, #0B5FFF, #00C48C);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--muted); margin-top: 10px; font-size: 17px; }

/* ===== Course cards grid ===== */
.grid-courses {
  display: grid; gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  padding: 30px 0 60px;
}
.card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.card-cover {
  height: 120px; display: grid; place-items: center; font-size: 44px; color: #fff;
}
.grad-a { background: linear-gradient(135deg, #0B5FFF, #8B5CF6); }
.grad-b { background: linear-gradient(135deg, #0EA5E9, #6366F1); }
.grad-c { background: linear-gradient(135deg, #F59E0B, #EF4444); }
.grad-d { background: linear-gradient(135deg, #10B981, #0EA5E9); }
.card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-body h3 { font-size: 17px; font-weight: 700; }
.card-body p { color: var(--muted); font-size: 14px; flex: 1; }
.card-meta { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.badge {
  padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--bg); border: 1px solid var(--border);
}
.progress-track { height: 6px; border-radius: 999px; background: var(--border); overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #00C48C); transition: width .3s; }

/* ===== Forms ===== */
.form-card {
  max-width: 400px; margin: 60px auto; background: var(--surface);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 34px;
}
.form-card h2 { margin-bottom: 20px; text-align: center; }
label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 6px; }
input[type="text"], input[type="password"], textarea, select {
  width: 100%; padding: 11px 14px; border-radius: 10px;
  border: 1.5px solid var(--border); background: var(--bg); color: var(--text);
  font-family: inherit; font-size: 14px;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--primary); border-color: transparent; }
.form-error { color: var(--danger); font-size: 14px; margin-top: 12px; min-height: 20px; }

/* ===== Course page ===== */
.course-layout { display: grid; grid-template-columns: 320px 1fr; gap: 24px; padding: 28px 0 60px; }
@media (max-width: 800px) { .course-layout { grid-template-columns: 1fr; } }
.lesson-list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.lesson-list header { padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 700; }
.lesson-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 20px; cursor: pointer; border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.lesson-item:last-child { border-bottom: none; }
.lesson-item:hover { background: var(--bg); }
.lesson-item.active { background: var(--bg); font-weight: 600; color: var(--primary); }
.lesson-check {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--border); display: grid; place-items: center; font-size: 12px; color: #fff;
}
.lesson-check.done { background: var(--success); border-color: var(--success); }
.lesson-view { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 30px 34px; }
.lesson-view h2 { margin-bottom: 18px; }
.lesson-content { white-space: pre-wrap; color: var(--text); }
.lesson-content img { max-width: 100%; border-radius: 10px; margin: 12px 0; }
.lesson-actions { margin-top: 28px; display: flex; gap: 12px; align-items: center; }
.cert-banner {
  margin-top: 24px; padding: 20px; border-radius: var(--radius); text-align: center;
  background: linear-gradient(135deg, rgba(11,95,255,.1), rgba(245,158,11,.12));
  border: 1px dashed var(--primary);
}

/* ===== Certificate page ===== */
.cert-wrap { max-width: 640px; margin: 40px auto; text-align: center; }
.cert-preview {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 46px 34px; border: 3px solid var(--primary); position: relative;
}
.cert-preview::before {
  content: ''; position: absolute; inset: 8px; border: 1px solid var(--accent);
  border-radius: 10px; pointer-events: none;
}
.cert-preview .brand { color: var(--primary); font-weight: 800; letter-spacing: 2px; font-size: 13px; }
.cert-preview h1 { font-size: 30px; margin: 12px 0 4px; }
.cert-preview .name { font-size: 26px; font-weight: 800; margin: 18px 0 6px; color: var(--primary); }
.cert-preview .course { font-size: 17px; font-weight: 600; }
.cert-preview .meta { color: var(--muted); font-size: 13px; margin-top: 20px; }

/* ===== Admin ===== */
.admin-section { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin: 20px 0; }
.admin-section h3 { margin-bottom: 14px; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); }
table.data th { color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; }
.row-inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row-inline > div { flex: 1; min-width: 150px; }

/* ===== Toast + misc ===== */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--text); color: var(--bg); padding: 12px 22px; border-radius: 999px;
  font-size: 14px; font-weight: 500; opacity: 0; transition: all .25s; z-index: 99; pointer-events: none;
}
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
footer.site { border-top: 1px solid var(--border); margin-top: 40px; padding: 26px 0; color: var(--muted); font-size: 13px; }

/* ===== Quiz builder (admin) ===== */
.qe-option-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
}
.qe-option-row input[type="radio"] { width: 18px; height: 18px; accent-color: var(--success); flex-shrink: 0; }
.qe-option-row input[type="text"] { flex: 1; }
.qe-option-row .btn { padding: 6px 12px; }

/* ===== Quiz view (student) ===== */
.quiz-q { margin-bottom: 26px; }
.quiz-q h4 { margin-bottom: 12px; font-size: 16px; }
.quiz-opt {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 16px; border: 1.5px solid var(--border); border-radius: 12px;
  cursor: pointer; margin-bottom: 9px; transition: all .13s;
  background: var(--bg); font-size: 14.5px;
}
.quiz-opt:hover { border-color: var(--primary); }
.quiz-opt.selected { border-color: var(--primary); background: rgba(11,95,255,.07); font-weight: 600; }
.quiz-opt.correct { border-color: var(--success); background: rgba(16,185,129,.09); }
.quiz-opt.wrong { border-color: var(--danger); background: rgba(239,68,68,.08); }
.quiz-result {
  text-align: center; padding: 28px; border-radius: var(--radius);
  margin-top: 20px;
}
.quiz-result.pass { background: rgba(16,185,129,.1); border: 1.5px solid var(--success); }
.quiz-result.fail { background: rgba(239,68,68,.07); border: 1.5px solid var(--danger); }
.quiz-result .score { font-size: 34px; font-weight: 800; }
.video-frame {
  position: relative; padding-top: 56.25%; border-radius: 14px; overflow: hidden;
  box-shadow: var(--shadow); margin-bottom: 8px;
}
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: none; }
