/* Newvisa CRS Calculator
 * Mọi selector nằm trong .nvcrs để không ảnh hưởng theme; font kế thừa từ theme của website.
 * Đổi màu chủ đạo trong Cài đặt (biến --nvcrs-accent).
 */

.nvcrs {
  --nvcrs-accent: #B3261E;
  --nvcrs-ink: #1F2A37;
  --nvcrs-muted: #5F6B7A;
  --nvcrs-line: #DCE1E7;
  --nvcrs-wash: #F4F6F8;
  --nvcrs-surface: #FFFFFF;
  --nvcrs-warn: #8A5300;
  --nvcrs-warn-bg: #FFF6E5;
  --nvcrs-ok: #1E7B55;
  --nvcrs-ok-bg: #EAF6F0;
  --nvcrs-radius: 10px;

  position: relative;
  max-width: 1040px;
  margin: 0 auto;
  color: var(--nvcrs-ink);
  font-size: 16px;
  line-height: 1.55;
  text-align: left;
}

.nvcrs *, .nvcrs *::before, .nvcrs *::after { box-sizing: border-box; }
.nvcrs p, .nvcrs h2, .nvcrs h3, .nvcrs ol, .nvcrs ul, .nvcrs dl, .nvcrs dd, .nvcrs fieldset, .nvcrs legend { margin: 0; padding: 0; }
.nvcrs ol, .nvcrs ul { list-style: none; }
.nvcrs fieldset { border: 0; min-width: 0; }
.nvcrs button, .nvcrs input, .nvcrs select { font: inherit; color: inherit; letter-spacing: normal; text-transform: none; }
.nvcrs strong { font-weight: 700; }
.nvcrs h2, .nvcrs h3 { font-weight: 700; letter-spacing: normal; text-transform: none; color: var(--nvcrs-ink); }
.nvcrs [hidden] { display: none !important; }

.nvcrs :focus-visible { outline: 3px solid color-mix(in srgb, var(--nvcrs-accent) 45%, transparent); outline-offset: 2px; }

.nvcrs-loading { padding: 32px; color: var(--nvcrs-muted); }

/* ---------------------------------------------------------------- Đầu trang */
.nvcrs-head { margin-bottom: 20px; }
.nvcrs-title { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); line-height: 1.2; font-weight: 700; color: var(--nvcrs-ink); }
.nvcrs-sub { margin-top: 6px; color: var(--nvcrs-muted); }

/* ---------------------------------------------------------------- Khung form */
.nvcrs-shell {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

/* Thanh bước: là một tiến trình thật, nên dùng số thứ tự */
.nvcrs-steps { position: sticky; top: 24px; }
.nvcrs-steps li { position: relative; }
.nvcrs-steps li + li::before {
  content: ""; position: absolute; left: 15px; top: -14px; height: 14px; width: 2px; background: var(--nvcrs-line);
}
.nvcrs-steps li.is-done + li::before, .nvcrs-steps li.is-done + li.is-current::before { background: var(--nvcrs-accent); }
.nvcrs-steps li + li { margin-top: 14px; }
.nvcrs-steps button {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 0; border: 0; background: none;
  cursor: pointer; text-align: left; color: var(--nvcrs-muted);
}
.nvcrs-steps button:disabled { cursor: default; }
.nvcrs-steps-n {
  flex: 0 0 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--nvcrs-line); background: var(--nvcrs-surface); font-weight: 700; font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.nvcrs-steps .is-done .nvcrs-steps-n { border-color: var(--nvcrs-accent); color: var(--nvcrs-accent); }
.nvcrs-steps .is-current .nvcrs-steps-n { border-color: var(--nvcrs-accent); background: var(--nvcrs-accent); color: #fff; }
.nvcrs-steps .is-current button, .nvcrs-steps .is-done button { color: var(--nvcrs-ink); }
.nvcrs-steps .is-current .nvcrs-steps-t { font-weight: 700; }

.nvcrs-panel {
  background: var(--nvcrs-surface);
  border: 1px solid var(--nvcrs-line);
  border-radius: var(--nvcrs-radius);
  padding: 28px;
}
.nvcrs-panel-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding-bottom: 18px; margin-bottom: 22px; border-bottom: 1px solid var(--nvcrs-line);
}
.nvcrs-step-count { font-size: 14px; color: var(--nvcrs-muted); }
.nvcrs-panel-head h3 { font-size: 1.35rem; line-height: 1.25; font-weight: 700; margin-top: 2px; }
.nvcrs-panel-head h3:focus { outline: none; }

.nvcrs-live {
  flex: 0 0 auto; text-align: right; padding: 6px 12px; border-radius: 8px; background: var(--nvcrs-wash);
}
.nvcrs-live span { display: block; font-size: 12px; color: var(--nvcrs-muted); }
.nvcrs-live strong { display: block; font-size: 1.5rem; line-height: 1.1; color: var(--nvcrs-accent); font-variant-numeric: tabular-nums; }

.nvcrs-fields { display: grid; gap: 22px; }

/* ---------------------------------------------------------------- Trường nhập */
.nvcrs-field > label, .nvcrs-field > legend, .nvcrs-score > label {
  display: block; font-weight: 600; margin-bottom: 6px;
}
.nvcrs-hint { font-size: 14px; color: var(--nvcrs-muted); margin: -2px 0 8px; }
.nvcrs-opt { font-weight: 400; color: var(--nvcrs-muted); font-size: 14px; }

.nvcrs input[type="text"], .nvcrs input[type="email"], .nvcrs input[type="tel"], .nvcrs input[type="number"], .nvcrs select {
  display: block; width: 100%; height: 46px; margin: 0; padding: 0 12px;
  background: var(--nvcrs-surface); border: 1px solid #C3CBD4; border-radius: 8px; box-shadow: none;
  font-size: 16px; line-height: 1.2;
}
.nvcrs select { padding-right: 32px; }
.nvcrs input:focus, .nvcrs select:focus { border-color: var(--nvcrs-accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--nvcrs-accent) 20%, transparent); }
.nvcrs [aria-invalid="true"] { border-color: #B42318 !important; }
.nvcrs-field--short input { max-width: 180px; }
.nvcrs-err { margin-top: 6px; font-size: 14px; color: #B42318; }

.nvcrs-options { display: flex; flex-wrap: wrap; gap: 8px; }
.nvcrs-option {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px; min-height: 44px; border: 1px solid #C3CBD4; border-radius: 8px; cursor: pointer; background: var(--nvcrs-surface);
}
.nvcrs-option input { margin: 0; accent-color: var(--nvcrs-accent); }
.nvcrs-option.is-checked { border-color: var(--nvcrs-accent); background: color-mix(in srgb, var(--nvcrs-accent) 6%, #fff); }
.nvcrs-option:focus-within { box-shadow: 0 0 0 3px color-mix(in srgb, var(--nvcrs-accent) 20%, transparent); }

.nvcrs-note { padding: 12px 14px; border-radius: 8px; background: var(--nvcrs-wash); font-size: 15px; }
.nvcrs-note--warn { background: var(--nvcrs-warn-bg); color: #4A2E00; border-left: 3px solid var(--nvcrs-warn); }

.nvcrs-alert { margin-bottom: 18px; padding: 12px 14px; border-radius: 8px; background: #FDECEA; color: #8A1C12; }

/* Điểm thi 4 kỹ năng */
.nvcrs-scores { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: -8px; }
.nvcrs-score input { font-variant-numeric: tabular-nums; }
.nvcrs-clb { display: block; min-height: 20px; margin-top: 4px; font-size: 13px; font-weight: 600; color: var(--nvcrs-accent); }

/* Nghề lương cao */
.nvcrs-jobs { display: grid; gap: 12px; }
.nvcrs-jobs .nvcrs-hint { margin-bottom: 0; }
.nvcrs-job {
  display: grid; grid-template-columns: minmax(0, 1fr) 140px; gap: 12px 16px; align-items: start;
  padding: 14px; border-radius: 8px; background: var(--nvcrs-wash);
}
.nvcrs-job .nvcrs-field--short input { max-width: none; }
.nvcrs-job-remove { grid-column: 1 / -1; justify-self: start; }

/* Ô chọn NOC */
.nvcrs-combo { position: relative; }
.nvcrs-combo-list {
  position: absolute; z-index: 30; left: 0; right: 0; margin-top: 4px; max-height: 300px; overflow-y: auto;
  background: var(--nvcrs-surface); border: 1px solid var(--nvcrs-line); border-radius: 8px;
  box-shadow: 0 12px 28px rgba(31, 42, 55, .14);
}
.nvcrs-combo-list li { display: flex; align-items: baseline; gap: 10px; padding: 10px 12px; cursor: pointer; font-size: 15px; }
.nvcrs-combo-list li + li { border-top: 1px solid #EEF1F4; }
.nvcrs-combo-list li:hover, .nvcrs-combo-list li.is-active { background: color-mix(in srgb, var(--nvcrs-accent) 7%, #fff); }
.nvcrs-combo-code { font-weight: 700; font-variant-numeric: tabular-nums; }
.nvcrs-combo-title { flex: 1; }
.nvcrs-combo-empty { color: var(--nvcrs-muted); cursor: default !important; }
.nvcrs-badge { flex: 0 0 auto; font-size: 12px; padding: 2px 8px; border-radius: 99px; }
.nvcrs-level { display: inline-block; margin-top: 8px; font-size: 13px; padding: 3px 10px; border-radius: 99px; }
.nvcrs-level--1 { background: #E7F1EC; color: #145C3E; }
.nvcrs-level--2 { background: #E6EEF4; color: #1F4E6B; }
.nvcrs-level--3 { background: #F7EEE3; color: #7A4A12; }

/* ---------------------------------------------------------------- Nút */
.nvcrs-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 28px; }
.nvcrs-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 22px;
  border: 1px solid var(--nvcrs-accent); border-radius: 8px; background: var(--nvcrs-accent); color: #fff !important;
  font-weight: 700; text-decoration: none !important; cursor: pointer; line-height: 1.2;
}
.nvcrs-btn:hover { background: color-mix(in srgb, var(--nvcrs-accent) 86%, #000); }
.nvcrs-btn:disabled { opacity: .6; cursor: progress; }
.nvcrs-btn--ghost { background: transparent; color: var(--nvcrs-accent) !important; }
.nvcrs-btn--ghost:hover { background: color-mix(in srgb, var(--nvcrs-accent) 7%, #fff); }
.nvcrs-link {
  padding: 0; border: 0; background: none; color: var(--nvcrs-accent); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 15px;
}

/* ---------------------------------------------------------------- Tooltip */
.nvcrs-term {
  display: inline; padding: 0; margin: 0; border: 0; background: none; cursor: help;
  color: inherit; font-weight: inherit; text-decoration: underline dotted; text-decoration-color: var(--nvcrs-accent);
  text-decoration-thickness: 2px; text-underline-offset: 3px;
}
.nvcrs-term[aria-expanded="true"] { color: var(--nvcrs-accent); }
.nvcrs-tip {
  position: absolute; z-index: 50; padding: 12px 14px; border-radius: 8px;
  background: var(--nvcrs-ink); color: #F3F5F7; font-size: 14px; line-height: 1.5; box-shadow: 0 10px 30px rgba(15, 23, 32, .25);
}
.nvcrs-tip strong { display: block; margin-bottom: 4px; color: #fff; }

/* ---------------------------------------------------------------- Kết quả */
.nvcrs-result {
  background: var(--nvcrs-surface); border: 1px solid var(--nvcrs-line); border-radius: var(--nvcrs-radius); padding: 32px;
}
.nvcrs-total p:first-child { font-weight: 600; color: var(--nvcrs-muted); }
.nvcrs-total-n {
  font-size: clamp(4rem, 3rem + 6vw, 6.5rem); line-height: 1; font-weight: 800; color: var(--nvcrs-accent);
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em; margin: 4px 0 8px !important;
}
.nvcrs-total-meta { color: var(--nvcrs-muted); font-size: 14px; }

.nvcrs-bar { display: flex; gap: 3px; height: 12px; margin: 24px 0 14px; }
.nvcrs-bar span { display: block; border-radius: 3px; min-width: 6px; }
@media (prefers-reduced-motion: no-preference) {
  .nvcrs-bar--anim span { animation: nvcrs-grow .7s cubic-bezier(.2, .8, .2, 1) both; transform-origin: left; }
  @keyframes nvcrs-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
}
.nvcrs-legend { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.nvcrs-legend dt { font-size: 14px; line-height: 1.35; color: var(--nvcrs-muted); display: flex; align-items: flex-start; gap: 6px; }
.nvcrs-legend dt i { margin-top: 4px; }
.nvcrs-legend i, .nvcrs-group h3 i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; flex: 0 0 auto; }
.nvcrs-legend dd { font-variant-numeric: tabular-nums; color: var(--nvcrs-muted); }
.nvcrs-legend dd strong { font-size: 1.25rem; color: var(--nvcrs-ink); }

.nvcrs-result > .nvcrs-note { margin-top: 20px; }

/* Phần bị khoá chờ email */
.nvcrs-locked { position: relative; margin-top: 28px; }
.nvcrs-ghost-rows { display: grid; gap: 10px; filter: blur(3px); opacity: .55; }
.nvcrs-ghost-rows div { height: 44px; border-radius: 6px; background: linear-gradient(90deg, var(--nvcrs-wash) 0 62%, transparent 62% 86%, #E3E7EC 86%); }
.nvcrs-gate {
  position: relative; margin-top: -170px; max-width: 560px; margin-left: auto; margin-right: auto;
  padding: 24px; border: 1px solid var(--nvcrs-line); border-radius: var(--nvcrs-radius); background: var(--nvcrs-surface);
  box-shadow: 0 16px 40px rgba(31, 42, 55, .12);
}
.nvcrs-gate h3 { font-size: 1.2rem; line-height: 1.3; }
.nvcrs-gate > p { margin-top: 6px; color: var(--nvcrs-muted); }
.nvcrs-gate .nvcrs-alert { margin: 14px 0 0; }
.nvcrs-lead { display: grid; gap: 14px; margin-top: 18px; }
.nvcrs-lead-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.nvcrs-lead .nvcrs-btn { width: 100%; }
.nvcrs-consent { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--nvcrs-muted); cursor: pointer; }
.nvcrs-consent input { margin-top: 3px; width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--nvcrs-accent); }
.nvcrs-consent a { color: var(--nvcrs-accent); }
.nvcrs-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.nvcrs-turnstile:empty { display: none; }
.nvcrs-gate-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 16px; }

/* Kết quả chi tiết */
.nvcrs-sent { margin-top: 28px; padding: 12px 14px; border-radius: 8px; background: var(--nvcrs-ok-bg); color: #10462F; }
.nvcrs-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.nvcrs-group { margin-top: 28px; }
.nvcrs-group h3 {
  display: flex; align-items: center; gap: 8px; font-size: 1.1rem; padding-bottom: 8px; border-bottom: 2px solid var(--nvcrs-ink);
}
.nvcrs-group h3 span { margin-left: auto; font-weight: 400; color: var(--nvcrs-muted); font-variant-numeric: tabular-nums; }
.nvcrs-group h3 span strong { color: var(--nvcrs-ink); }
.nvcrs-group table { width: 100%; border-collapse: collapse; margin: 0; border: 0; }
.nvcrs-group th { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.nvcrs-group td { padding: 12px 0; border: 0; border-bottom: 1px solid var(--nvcrs-line); vertical-align: top; background: none; }
.nvcrs-item { display: block; font-weight: 600; }
.nvcrs-item-detail { display: block; font-size: 14px; color: var(--nvcrs-muted); margin-top: 2px; }
.nvcrs-pts { width: 90px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; padding-left: 12px !important; }
.nvcrs-pts span { font-weight: 400; color: var(--nvcrs-muted); font-size: 14px; }

.nvcrs-actions--result { justify-content: flex-start; gap: 20px; }
.nvcrs-disclaimer { margin-top: 20px !important; font-size: 13px; color: var(--nvcrs-muted); }

/* ---------------------------------------------------------------- Điện thoại */
@media (max-width: 820px) {
  .nvcrs-shell { grid-template-columns: 1fr; gap: 16px; }
  .nvcrs-steps { position: static; display: flex; gap: 6px; }
  .nvcrs-steps li { flex: 1; }
  .nvcrs-steps li + li { margin-top: 0; }
  .nvcrs-steps li + li::before { display: none; }
  .nvcrs-steps button { display: block; height: 6px; border-radius: 3px; background: var(--nvcrs-line); overflow: hidden; }
  .nvcrs-steps .is-done button, .nvcrs-steps .is-current button { background: var(--nvcrs-accent); }
  .nvcrs-steps-n, .nvcrs-steps-t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .nvcrs-panel, .nvcrs-result { padding: 20px 16px; }
  .nvcrs-scores { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nvcrs-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nvcrs-job { grid-template-columns: 1fr; }
  .nvcrs-lead-row { grid-template-columns: 1fr; }
  .nvcrs-gate { margin-top: -120px; padding: 20px 16px; }
  .nvcrs-option { flex: 1 1 100%; }
  .nvcrs-actions { position: sticky; bottom: 0; z-index: 20; margin: 24px -16px -20px; padding: 12px 16px; background: var(--nvcrs-surface); border-top: 1px solid var(--nvcrs-line); border-radius: 0 0 var(--nvcrs-radius) var(--nvcrs-radius); }
  .nvcrs-actions--result { position: static; margin: 24px 0 0; padding: 0; border: 0; }
  .nvcrs-actions .nvcrs-btn { flex: 1; }
}
