/* ============================================================
   Tra cứu điểm bổ sung kiến thức - Viện IES An Giang
   Bảng màu lấy trực tiếp từ logo:
   xanh khiên #0DA1E1 - đỏ chữ IES #CC1C30 - xanh lá #147E58
   ============================================================ */

:root {
  --blue: #0da1e1;
  --blue-600: #0b86bd;
  --blue-700: #086b98;
  --blue-050: #e8f6fd;
  --red: #cc1c30;
  --red-050: #fdecee;
  --green: #147e58;
  --green-050: #e7f4ef;
  --olive: #8aa33f;
  --amber: #b8710d;
  --amber-050: #fdf3e3;

  --ink: #0e2a38;
  --ink-2: #38596b;
  --ink-3: #6b8697;
  --line: #dce7ee;
  --surface: #ffffff;
  --page: #f3f8fb;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(14, 42, 56, .06), 0 12px 28px -12px rgba(14, 42, 56, .18);
  --shadow-lg: 0 2px 4px rgba(14, 42, 56, .05), 0 24px 48px -20px rgba(14, 42, 56, .28);
  --shell: 940px;
}

* { box-sizing: border-box; }

/* Các khối dưới đây đặt display: grid/flex nên sẽ đè mất thuộc tính hidden
   của trình duyệt. Khai báo lại để hidden luôn có tác dụng. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--page);
  background-image:
    radial-gradient(900px 460px at 12% -8%, #dff1fb 0%, rgba(223, 241, 251, 0) 62%),
    radial-gradient(760px 420px at 100% 4%, #e6f5ee 0%, rgba(230, 245, 238, 0) 60%);
  background-repeat: no-repeat;
}

.shell {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 20px;
}

/* --- khiên mờ trang trí nền --- */
.backdrop {
  position: fixed;
  top: -60px;
  right: -110px;
  width: 460px;
  max-width: 62vw;
  opacity: .05;
  pointer-events: none;
  z-index: 0;
}
.backdrop svg { width: 100%; height: auto; display: block; }
.backdrop path { fill: var(--blue); }

/* ------------------------------------------------------ topbar */

.topbar {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar::after {
  content: '';
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--blue) 0%, var(--green) 52%, var(--olive) 78%, var(--red) 100%);
}
.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 12px;
  padding-bottom: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.brand__logo { width: 46px; height: 46px; object-fit: contain; flex: none; }
.brand__text { display: flex; flex-direction: column; min-width: 0; }
.brand__text strong {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .04em;
  line-height: 1.35;
  color: var(--blue-700);
}
.brand__text span {
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.35;
}
.topbar__tag {
  flex: none;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--blue-600);
  background: var(--blue-050);
  border-radius: 999px;
  padding: 5px 12px;
}

/* -------------------------------------------------------- main */

.main {
  position: relative;
  z-index: 1;
  flex: 1;
  padding-top: 40px;
  padding-bottom: 56px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.hero { max-width: 660px; }
.eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--green);
}
.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(28px, 5.4vw, 42px);
  line-height: 1.18;
  font-weight: 700;
  letter-spacing: -.02em;
}
.hero h1 span { color: var(--blue); }
.hero__lead { margin: 0; color: var(--ink-2); font-size: 15.5px; max-width: 56ch; }
.hero__lead strong { color: var(--ink); font-weight: 600; }

/* ------------------------------------------------------- panel */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
}
.panel__title {
  margin: 0 0 20px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.field { margin-bottom: 18px; }
.field label {
  display: block;
  margin-bottom: 7px;
  font-size: 14px;
  font-weight: 600;
}
.field input {
  width: 100%;
  padding: 13px 15px;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: #fbfdfe;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.field input::placeholder { color: #a9bcc8; }
.field input:hover { border-color: #c3d7e3; }
.field input:focus {
  outline: none;
  background: #fff;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(13, 161, 225, .16);
}
.field input.is-invalid {
  border-color: var(--red);
  box-shadow: 0 0 0 4px rgba(204, 28, 48, .12);
}
.field__hint { margin: 7px 0 0; font-size: 12.5px; color: var(--ink-3); }

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 13px 26px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .15s ease, background .15s ease, color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid rgba(13, 161, 225, .4); outline-offset: 2px; }

.btn--primary {
  background: linear-gradient(180deg, var(--blue) 0%, var(--blue-600) 100%);
  color: #fff;
  box-shadow: 0 10px 20px -10px rgba(11, 134, 189, .8);
  min-width: 170px;
}
.btn--primary:hover { box-shadow: 0 14px 24px -10px rgba(11, 134, 189, .9); }
.btn--primary[disabled] { opacity: .68; cursor: progress; }

.btn--ghost {
  background: #fff;
  color: var(--ink-2);
  border-color: var(--line);
}
.btn--ghost:hover { border-color: #c3d7e3; color: var(--ink); }

.spinner {
  display: none;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.is-loading .spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.alert {
  margin: 18px 0 0;
  padding: 13px 16px;
  font-size: 14px;
  border-radius: var(--radius-sm);
  background: var(--red-050);
  color: #961625;
  border: 1px solid #f5c9cf;
}
.alert[data-tone="info"] {
  background: var(--amber-050);
  color: #8a5409;
  border-color: #f0d7ae;
}

/* ------------------------------------------------------ kết quả */

.result { animation: rise .32s ease both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 22px 26px;
  background: linear-gradient(135deg, #f6fbfe 0%, #eef7f3 100%);
  border-bottom: 1px solid var(--line);
}
.card__name { margin: 0 0 4px; font-size: 21px; font-weight: 700; letter-spacing: -.01em; }
.card__sub { margin: 0; font-size: 13.5px; color: var(--ink-2); }
.card__sub b { font-weight: 600; color: var(--ink); }

.badge {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 15px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.badge--passed  { background: var(--green-050); color: var(--green); border-color: #b9ded0; }
.badge--partial { background: var(--blue-050); color: var(--blue-700); border-color: #b8e0f4; }
.badge--pending { background: var(--amber-050); color: var(--amber); border-color: #f0d7ae; }
.badge--failed  { background: var(--red-050); color: var(--red); border-color: #f5c9cf; }
.badge--exempt  { background: #eef0f3; color: var(--ink-2); border-color: #d8dfe5; }

.card__body { padding: 8px 26px 26px; }

.section-label {
  margin: 20px 0 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.scores { display: flex; flex-direction: column; gap: 10px; }
.score {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fbfdfe;
}
.score--pass { border-left-color: var(--green); }
.score--fail { border-left-color: var(--red); }
.score--none { border-left-color: #d8dfe5; background: #f8fafb; }

.score__name { font-size: 15px; font-weight: 500; min-width: 0; }
.score__meta { display: block; margin-top: 2px; font-size: 12.5px; color: var(--ink-3); font-weight: 400; }
.score__value {
  flex: none;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.score--pass .score__value { color: var(--green); }
.score--fail .score__value { color: var(--red); }
.score--none .score__value { font-size: 14px; font-weight: 500; color: var(--ink-3); }

.average {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--blue-700) 0%, var(--blue) 100%);
  color: #fff;
}
.average__label { font-size: 14px; font-weight: 500; }
.average__label small { display: block; font-size: 12px; opacity: .8; font-weight: 400; }
.average__value { font-size: 30px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* nhắc liên hệ giảng viên khi chưa có điểm học phần nào */
.callout {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  margin-top: 14px;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  background: var(--amber-050);
  border: 1px solid #f0d7ae;
}
.callout__icon {
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--amber);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}
.callout__text { font-size: 14.5px; color: #7d4c08; }
.callout__text strong { display: block; color: #6b4107; font-weight: 600; margin-bottom: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-block;
  padding: 7px 13px;
  font-size: 13px;
  border-radius: 999px;
  background: #f2f7fa;
  border: 1px solid var(--line);
  color: var(--ink-2);
}
.chip b { font-weight: 600; color: var(--ink); }

.note {
  margin-top: 16px;
  padding: 13px 16px;
  font-size: 14px;
  border-radius: var(--radius-sm);
  background: var(--amber-050);
  border: 1px solid #f0d7ae;
  color: #8a5409;
}

.card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 26px;
  border-top: 1px solid var(--line);
  background: #fafcfd;
  font-size: 12.5px;
  color: var(--ink-3);
}
.link-btn {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--blue-600);
  background: none;
  border: none;
  padding: 4px 2px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link-btn:hover { color: var(--blue-700); }

/* trạng thái rỗng */
.empty {
  background: var(--surface);
  border: 1px dashed #c6d9e4;
  border-radius: var(--radius);
  padding: 32px 26px;
  text-align: center;
}
.empty__icon {
  width: 46px; height: 46px;
  margin: 0 auto 14px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--blue-050);
  color: var(--blue-600);
  font-size: 22px;
  font-weight: 700;
}
.empty h3 { margin: 0 0 8px; font-size: 17px; }
.empty p { margin: 0 auto; max-width: 46ch; color: var(--ink-2); font-size: 14.5px; }

/* --------------------------------------------------- trang lỗi 404 */

.main--center { justify-content: center; align-items: center; text-align: center; }

.errorpage { max-width: 520px; padding: 20px 0 40px; }
.errorpage__code {
  margin: 0 0 6px;
  font-size: clamp(72px, 16vw, 118px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.04em;
  background: linear-gradient(135deg, var(--blue) 0%, var(--green) 70%, var(--olive) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.errorpage h1 { margin: 0 0 12px; font-size: clamp(22px, 4.2vw, 30px); font-weight: 700; letter-spacing: -.02em; }
.errorpage__lead { margin: 0 auto 26px; max-width: 44ch; color: var(--ink-2); font-size: 15.5px; }
.errorpage__actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.errorpage__actions .btn { text-decoration: none; }

/* ------------------------------------------------------- lưu ý */

.notice {
  border-left: 3px solid var(--blue);
  padding: 4px 0 4px 18px;
}
.notice h2 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.notice ul { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 14px; }
.notice li { margin-bottom: 5px; }

/* ------------------------------------------------------ footer */

.footer {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 20px 0;
}
.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--ink-3);
}
.footer p { margin: 0; }

/* ---------------------------------------------------- responsive */

@media (max-width: 640px) {
  .panel { padding: 20px; }
  .card__head, .card__body, .card__foot { padding-left: 18px; padding-right: 18px; }
  .brand__text strong { font-size: 11px; }
  .brand__text span { display: none; }
  .topbar__tag { display: none; }
  .actions .btn { flex: 1 1 100%; }
  .score { flex-direction: row; align-items: center; }
  .score__value { font-size: 23px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* -------------------------------------------------------- in ấn */

@media print {
  body { background: #fff; }
  .backdrop, .topbar__tag, .panel, .notice, .footer, .card__foot { display: none !important; }
  .main { padding-top: 12px; }
  .hero { display: none; }
  .card { box-shadow: none; border-color: #999; }
  .average { background: #fff !important; color: #000 !important; border: 1px solid #999; }
}
