/* dayhocso.vn – bộ màu: xanh mòng két (học) + hổ phách (thi) */
:root {
  --primary: #0E6E7E;
  --primary-dark: #0A4F5C;
  --primary-soft: #E3F1F3;
  --accent: #F4A23B;
  --accent-dark: #B86E10;
  --accent-soft: #FDF1E0;
  --ink: #17252B;
  --muted: #5B6B72;
  --line: #DDE6E8;
  --bg: #F5F8F8;
  --surface: #FFFFFF;
  --good: #1E8E5A;
  --good-soft: #E2F4EA;
  --bad: #C8423B;
  --bad-soft: #FBE7E5;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(23, 37, 43, .06), 0 4px 16px rgba(23, 37, 43, .06);
  font-family: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; font-size: 15px; line-height: 1.55; }
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }

/* Khởi động */
.boot { min-height: 100vh; display: grid; place-content: center; text-align: center; gap: 12px; color: var(--muted); }
.boot img { margin: 0 auto; }

/* Bố cục chính */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: var(--primary-dark); color: #fff; padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: #fff; text-decoration: none; }
.brand img { width: 36px; height: 36px; }
.brand b { font-size: 1.15rem; letter-spacing: .2px; }
.brand span { display: block; font-size: .72rem; opacity: .75; font-weight: 400; }
.nav-group { margin: 14px 8px 4px; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; opacity: .6; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: #E8F3F4; text-decoration: none; font-weight: 500; }
.nav a:hover { background: rgba(255, 255, 255, .08); }
.nav a.active { background: #fff; color: var(--primary-dark); }
.nav a.learn.active { box-shadow: inset 4px 0 0 var(--primary); }
.nav a.test.active { box-shadow: inset 4px 0 0 var(--accent); }
.sidebar .who { margin-top: auto; padding: 12px; border-top: 1px solid rgba(255, 255, 255, .15); font-size: .85rem; }
.sidebar .who b { display: block; }
.sidebar .who button { margin-top: 8px; }
.main { padding: 28px clamp(16px, 4vw, 40px) 60px; max-width: 1180px; width: 100%; }
.topbar { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; transform: translateX(-100%); transition: transform .2s; z-index: 30; }
  .shell.open .sidebar { transform: none; }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--primary-dark); color: #fff; position: sticky; top: 0; z-index: 20; }
  .topbar button { background: none; border: 0; color: #fff; font-size: 1.4rem; padding: 4px 8px; }
  .main { padding-top: 18px; }
}

/* Thành phần */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-head p { margin: 0; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 10px; padding: 10px 18px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; background: var(--primary); color: #fff; }
.btn:hover { background: var(--primary-dark); }
.btn.accent { background: var(--accent); color: #2B1A04; }
.btn.accent:hover { background: #E89222; }
.btn.ghost { background: transparent; color: var(--primary); border-color: var(--line); }
.btn.ghost:hover { background: var(--primary-soft); }
.btn.small { padding: 6px 12px; font-size: .85rem; }
.btn.light { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .25); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

label { display: block; font-weight: 500; font-size: .9rem; margin-bottom: 4px; }
input, select, textarea { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.field { margin-bottom: 14px; }
.error { color: var(--bad); font-size: .9rem; min-height: 1.2em; }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--primary-soft); color: var(--primary-dark); }
.pill.accent { background: var(--accent-soft); color: var(--accent-dark); }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.grey { background: #EEF2F3; color: var(--muted); }

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.table-wrap { overflow-x: auto; }

.progress { height: 8px; background: #E6EEEF; border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.progress.accent > i { background: var(--accent); }

/* Trang đăng nhập */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-hero { background: linear-gradient(160deg, var(--primary-dark), var(--primary)); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.login-hero h1 { font-size: 2rem; max-width: 460px; }
.login-hero .parts { display: grid; gap: 14px; max-width: 460px; }
.login-hero .part { background: rgba(255, 255, 255, .1); border-radius: 12px; padding: 14px 16px; }
.login-hero .part b { display: block; }
.login-hero .part.test { border-left: 4px solid var(--accent); }
.login-hero .part.learn { border-left: 4px solid #8FD3DC; }
.login-form { display: grid; place-content: center; padding: 32px; }
.login-form .card { width: min(400px, 90vw); }
@media (max-width: 860px) { .login { grid-template-columns: 1fr; } .login-hero { padding: 28px; } }

/* Trang chủ hai phân hệ */
.hub { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; margin-bottom: 24px; }
.hub a { text-decoration: none; color: inherit; }
.hub .tile { border-radius: 18px; padding: 24px; color: #fff; min-height: 170px; display: flex; flex-direction: column; justify-content: space-between; box-shadow: var(--shadow); }
.hub .tile.learn { background: linear-gradient(140deg, var(--primary-dark), var(--primary)); }
.hub .tile.test { background: linear-gradient(140deg, #9A5A0C, var(--accent)); }
.hub .tile h2 { font-size: 1.35rem; margin: 0 0 6px; }
.hub .tile p { opacity: .9; margin: 0; }
.hub .tile .go { font-weight: 600; margin-top: 16px; }

.subject-card { display: flex; flex-direction: column; gap: 10px; }
.subject-card .icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-content: center; font-weight: 700; background: var(--primary-soft); color: var(--primary-dark); }
.topic { border: 1px solid var(--line); border-radius: 12px; background: #fff; margin-bottom: 12px; }
.topic > header { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.lesson { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.lesson:last-child { border-bottom: 0; }
.lesson .status { width: 26px; height: 26px; border-radius: 50%; display: grid; place-content: center; font-size: .8rem; flex: none; background: #EEF2F3; color: var(--muted); }
.lesson .status.done { background: var(--good); color: #fff; }
.lesson .status.doing { background: var(--accent); color: #2B1A04; }
.lesson .grow { flex: 1; }

/* Trình phát SCORM */
.player { display: grid; grid-template-rows: auto 1fr; height: calc(100vh - 56px); gap: 12px; }
.player iframe { width: 100%; height: 100%; min-height: 520px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }

/* Làm bài */
.exam-bar { position: sticky; top: 0; z-index: 10; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; box-shadow: var(--shadow); }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.15rem; color: var(--accent-dark); }
.part-title { margin: 24px 0 10px; padding-bottom: 6px; border-bottom: 2px solid var(--accent); display: inline-block; }
.q { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; }
.q .stem { margin-bottom: 10px; }
.q .num { font-weight: 700; color: var(--accent-dark); margin-right: 6px; }
.opts { display: grid; gap: 8px; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 400; margin: 0; }
.opt:hover { background: var(--accent-soft); }
.opt input { width: auto; margin-top: 4px; }
.opt.correct { border-color: var(--good); background: var(--good-soft); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.tf { width: 100%; }
.tf td { padding: 8px; }
.tf td.c { width: 70px; text-align: center; }
.tf input { width: auto; }
.tf tr.correct td:first-child { box-shadow: inset 3px 0 0 var(--good); }
.tf tr.wrong td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.short input { max-width: 220px; }
.explain { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--primary-soft); font-size: .92rem; }
.score-big { font-size: 3rem; font-weight: 700; color: var(--accent-dark); line-height: 1; }

.bar-row { display: grid; grid-template-columns: 200px 1fr 60px; gap: 10px; align-items: center; padding: 6px 0; }
@media (max-width: 600px) { .bar-row { grid-template-columns: 1fr 60px; } .bar-row .progress { grid-column: 1 / -1; order: 3; } }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 100; max-width: 90vw; }
#toast.show { opacity: 1; }
