/* ===== Biến màu & kích thước dùng chung =====
   Đổi màu thương hiệu: chỉ cần sửa nhóm --brand-* bên dưới. */
:root {
  --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --brand: #b77b16;          /* vàng đồng của trang đăng nhập */
  --brand-strong: #a96e11;   /* mục đang chọn ở menu bên, nút chính */
  --brand-hover: #7f5005;

  --page-bg: #ffffff;
  --drawer-bg: #f2f2f2;
  --surface: #ffffff;
  --ink: #1d2125;
  --ink-soft: #4f555b;
  --ink-faint: #858b91;
  --line: #dee2e6;
  --line-strong: #c9cfd4;

  --primary: #a87312;        /* màu liên kết */
  --primary-hover: #7f5005;
  --primary-wash: #f8f0df;

  /* Màu các khối câu hỏi kiểu Moodle */
  --info-bg: #f7f7f8;
  --info-line: #cad0d7;
  --formulation-bg: #e7f3f5;
  --formulation-line: #b8dce2;
  --formulation-ink: #0b2a30;
  --outcome-bg: #fcefdc;
  --outcome-line: #f5dcb5;
  --outcome-ink: #6b4a1f;

  --correct: #1e7a3c;
  --correct-wash: #e2f3e6;
  --incorrect: #c0341f;
  --incorrect-wash: #fbe7e4;
  --notanswered: #8f959e;
  --flag: #d0342c;

  --radius: 4px;
  --radius-sm: 4px;

  --navbar-h: 64px;
  --drawer-w: 320px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--page-bg);
}

h1, h2, h3, h4 { margin: 0; line-height: 1.3; }
p { margin: 0 0 .6em; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }
button { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.icon {
  flex: none;
  width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round;
}
.icon.is-solid { fill: currentColor; stroke: none; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: #f5f5f5; text-decoration: none; }
.btn-primary { background: var(--brand-strong); border-color: var(--brand-strong); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--primary);
  text-align: left;
  cursor: pointer;
}
.link-btn:hover { color: var(--primary-hover); text-decoration: underline; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 10px 18px;
  border-radius: 6px;
  background: #2a2730;
  color: #fff;
  box-shadow: 0 8px 24px -6px rgba(0, 0, 0, .35);
  z-index: 100;
}
.btn-secondary { background: #ced4da; border-color: #ced4da; color: var(--ink); }
.btn-secondary:hover { background: #bcc3ca; border-color: #bcc3ca; }
.btn-danger { background: var(--incorrect); border-color: var(--incorrect); color: #fff; }
.btn-danger:hover { background: #a02a18; border-color: #a02a18; color: #fff; }

/* Nhãn kết quả "Đạt" / "Chưa đạt" */
.pill {
  display: inline-block;
  padding: 1px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}
.pill.is-pass { background: var(--correct-wash); color: var(--correct); }
.pill.is-fail { background: var(--incorrect-wash); color: var(--incorrect); }

/* --- Ô nhập liệu --- */
.form-select,
.form-input {
  min-height: 40px;
  padding: 7px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
.form-select { max-width: 100%; padding-right: 32px; }
.form-input { width: 100%; }
textarea.form-input { resize: vertical; }
.form-select:focus,
.form-input:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }

/* --- Hộp thoại (dùng thẻ <dialog class="modal">) --- */
.modal {
  width: min(560px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  padding: 0;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, .4);
}
.modal::backdrop { background: rgba(20, 18, 24, .45); }
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 { font-size: 20px; font-weight: 600; overflow-wrap: anywhere; }
.modal-close {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px; height: 32px;
  border: 0;
  border-radius: 4px;
  background: none;
  cursor: pointer;
}
.modal-close:hover { background: #f2f2f2; }
.modal-body { display: grid; gap: 14px; margin: 0; padding: 18px 20px; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}

.field label { display: block; margin-bottom: 4px; font-weight: 500; }
.field[hidden] { display: none; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.req { color: var(--incorrect); }
.form-error { margin: 0; color: var(--incorrect); }

@media (max-width: 480px) {
  .field-row { grid-template-columns: 1fr; }
}
