/* Trang xác thực (đăng nhập / quên / đặt lại mật khẩu) – tông Xanh Navy + Trắng ngà.
   Mọi màu khai báo một lần ở biến --auth-*, chế độ tối chỉ đổi biến. */
body.auth-body {
  --auth-navy-950: #0b1222;
  --auth-navy-900: #0f172a;
  --auth-navy-800: #1e3a8a;
  --auth-navy-850: #172554;
  --auth-page-bg: #fdfbf7;
  --auth-card-bg: #ffffff;
  --auth-card-border: rgba(15, 23, 42, 0.06);
  --auth-field-bg: #f8fafc;
  --auth-field-border: #dbe1ea;
  --auth-ink: #0f172a;
  --auth-muted: #5b6577;
  --auth-accent: var(--auth-navy-800);
  --auth-accent-hover: var(--auth-navy-850);
  --auth-link: var(--auth-navy-800);
  --auth-glow: rgba(30, 58, 138, 0.16);
  --auth-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 24px 56px -16px rgba(15, 23, 42, 0.3);

  min-height: 100vh;
  background: var(--auth-page-bg);
  color: var(--auth-ink);
}

[data-bs-theme='dark'] .auth-body {
  --auth-page-bg: #0a0f1c;
  --auth-card-bg: #111a2e;
  --auth-card-border: rgba(148, 163, 184, 0.14);
  --auth-field-bg: #0b1222;
  --auth-field-border: #27334b;
  --auth-ink: #e2e8f0;
  --auth-muted: #9aa6b8;
  --auth-accent: #2a4bb0;
  --auth-accent-hover: #3358c9;
  --auth-link: #9cc0ff;
  --auth-glow: rgba(96, 141, 255, 0.25);
  --auth-shadow: 0 24px 56px -16px rgba(0, 0, 0, 0.6);
}

/* ---------- Nền Navy phía trên: lưới bản vẽ kỹ thuật + quầng sáng ---------- */
.auth-hero {
  position: absolute;
  inset: 0 0 auto 0;
  height: clamp(17rem, 46vh, 29rem);
  background-color: var(--auth-navy-900);
  background-image:
    radial-gradient(60rem 22rem at 50% 0%, rgba(59, 91, 219, 0.35), transparent 70%),
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(
      160deg,
      var(--auth-navy-800) 0%,
      var(--auth-navy-900) 55%,
      var(--auth-navy-950) 100%
    );
  background-size:
    100% 100%,
    96px 96px,
    96px 96px,
    24px 24px,
    24px 24px,
    100% 100%;
  background-position: center top;
  border-bottom-left-radius: 50% 2.5rem;
  border-bottom-right-radius: 50% 2.5rem;
}

.auth-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: clamp(2rem, 7vh, 4rem) 1rem 1.5rem;
}

/* ---------- Thương hiệu ---------- */
.auth-brand {
  text-align: center;
  color: #fff;
  margin-bottom: 1.75rem;
  max-width: 48rem;
}

.auth-logo {
  display: inline-grid;
  place-items: center;
  width: 4rem;
  height: 4rem;
  border-radius: 1rem;
  background: #fdfbf7;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.55);
}

.auth-logo img {
  max-width: 3rem;
  max-height: 3rem;
  object-fit: contain;
}

.auth-logo-text {
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--auth-navy-800);
  letter-spacing: 0.02em;
}

.auth-brand-name {
  margin-top: 0.9rem;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.01em;
}

.auth-brand-slogan {
  margin-top: 0.25rem;
  color: rgba(255, 255, 255, 0.78);
}

/* Quy trình REV00: chuỗi bước đánh số */
.auth-flow {
  counter-reset: buoc;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
}

.auth-flow li {
  counter-increment: buoc;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.8rem 0.3rem 0.35rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.85rem;
}

.auth-flow li::before {
  content: counter(buoc);
  display: inline-grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  font-size: 0.75rem;
  font-weight: 700;
}

.auth-flow .bi {
  opacity: 0.8;
}

/* ---------- Thẻ đăng nhập ---------- */
.auth-card {
  width: 100%;
  max-width: 27.5rem;
  padding: 2.25rem 2rem;
  background: var(--auth-card-bg);
  border: 1px solid var(--auth-card-border);
  border-radius: var(--bs-border-radius-xl);
  box-shadow: var(--auth-shadow);
}

.auth-card h1 {
  color: var(--auth-ink);
}

.auth-card .text-body-secondary {
  color: var(--auth-muted) !important;
}

.auth-card .form-label {
  margin-bottom: 0.4rem;
  font-size: 0.92rem;
  color: var(--auth-ink);
}

/* Ô nhập: icon + input + nút mắt nằm chung một khung viền mềm */
.auth-field {
  flex-wrap: nowrap;
  background: var(--auth-field-bg);
  border: 1px solid var(--auth-field-border);
  border-radius: 0.75rem;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease;
}

.auth-field > .input-group-text,
.auth-field > .form-control,
.auth-field > .btn {
  border: 0;
  background: transparent;
}

.auth-field > .input-group-text {
  padding-left: 0.95rem;
  padding-right: 0.6rem;
  color: var(--auth-muted);
  transition: color 0.15s ease;
}

.auth-field > .form-control {
  padding: 0.7rem 0.75rem 0.7rem 0.15rem;
  color: var(--auth-ink);
}

.auth-field > .form-control::placeholder {
  color: var(--auth-muted);
}

.auth-field > .form-control:focus {
  box-shadow: none;
  background: transparent;
}

.auth-field > .form-control.is-invalid {
  background-image: none;
  padding-right: 0.75rem;
}

.auth-field:focus-within {
  border-color: var(--auth-accent);
  background: var(--auth-card-bg);
  box-shadow: 0 0 0 0.25rem var(--auth-glow);
}

.auth-field:focus-within > .input-group-text {
  color: var(--auth-accent);
}

[data-bs-theme='dark'] .auth-field:focus-within > .input-group-text {
  color: var(--auth-link);
}

.auth-field:has(.is-invalid) {
  border-color: var(--bs-form-invalid-border-color);
}

.auth-field:has(.is-invalid):focus-within {
  box-shadow: 0 0 0 0.25rem rgba(var(--bs-danger-rgb), 0.18);
}

.auth-field > .btn {
  --bs-btn-color: var(--auth-muted);
  --bs-btn-hover-color: var(--auth-accent);
  --bs-btn-hover-bg: transparent;
  --bs-btn-active-color: var(--auth-accent);
  --bs-btn-active-bg: transparent;
  padding-inline: 0.95rem;
  border-radius: 0 0.75rem 0.75rem 0 !important;
}

.auth-field > .btn:focus-visible {
  box-shadow: inset 0 0 0 2px var(--auth-accent);
}

/* Chrome tự điền: giữ nền ô theo theme thay vì nền xanh nhạt mặc định */
.auth-field > .form-control:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 100px var(--auth-field-bg) inset;
  -webkit-text-fill-color: var(--auth-ink);
  caret-color: var(--auth-ink);
}

/* Nút chính Navy: hover đậm hơn + nổi nhẹ */
.auth-card .btn-primary {
  --bs-btn-bg: var(--auth-accent);
  --bs-btn-border-color: var(--auth-accent);
  --bs-btn-hover-bg: var(--auth-accent-hover);
  --bs-btn-hover-border-color: var(--auth-accent-hover);
  --bs-btn-active-bg: var(--auth-navy-900);
  --bs-btn-active-border-color: var(--auth-navy-900);
  --bs-btn-disabled-bg: var(--auth-accent);
  --bs-btn-disabled-border-color: var(--auth-accent);
  --bs-btn-focus-shadow-rgb: 30, 58, 138;
  padding-block: 0.75rem;
  border-radius: 0.75rem;
  letter-spacing: 0.01em;
  box-shadow: 0 6px 16px -8px rgba(30, 58, 138, 0.6);
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.auth-card .btn-primary:hover:not(:disabled) {
  transform: translateY(-1px) scale(1.015);
  box-shadow: 0 14px 28px -10px rgba(30, 58, 138, 0.65);
}

.auth-card .btn-primary:active:not(:disabled) {
  transform: scale(0.99);
}

.auth-card .btn-outline-primary {
  --bs-btn-color: var(--auth-link);
  --bs-btn-border-color: var(--auth-accent);
  --bs-btn-hover-bg: var(--auth-accent);
  --bs-btn-hover-border-color: var(--auth-accent);
  --bs-btn-active-bg: var(--auth-accent-hover);
  --bs-btn-active-border-color: var(--auth-accent-hover);
  border-radius: 0.75rem;
}

.auth-card a:not(.btn) {
  color: var(--auth-link);
  font-weight: 600;
  text-decoration: none;
}

.auth-card a:not(.btn):hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.auth-card a:focus-visible,
.auth-card .btn:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 0.25rem var(--auth-glow);
}

.auth-card .alert {
  border-radius: 0.75rem;
  font-size: 0.93rem;
}

.auth-card .alert .bi {
  margin-top: 0.15rem;
}

/* Checklist độ mạnh mật khẩu */
.auth-rules li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.12rem 0;
  color: var(--auth-muted);
}

.auth-rules li.is-met {
  color: var(--bs-success-text-emphasis);
}

/* ---------- Footer ---------- */
.auth-footer {
  margin-top: auto;
  padding-top: 2rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--auth-muted);
}

.auth-footer > div + div {
  margin-top: 0.25rem;
}

.auth-footer a {
  color: inherit;
  text-decoration: none;
}

.auth-footer a:hover {
  color: var(--auth-link);
}

.auth-footer-sep {
  margin-inline: 0.5rem;
}

.auth-android { display: flex; gap: 1rem; align-items: center; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--bs-border-color); }
.auth-android-qr { flex-shrink: 0; background: #fff; border: 1px solid var(--bs-border-color); border-radius: .75rem; overflow: hidden; }
.auth-android-qr img { display: block; width: 112px; height: 112px; }

/* ---------- Điện thoại ---------- */
@media (max-width: 575.98px) {
  .auth-hero {
    height: 15rem;
  }

  .auth-brand {
    margin-bottom: 1.25rem;
  }

  .auth-logo {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 0.85rem;
  }

  .auth-logo img {
    max-width: 2.4rem;
    max-height: 2.4rem;
  }

  .auth-brand-name {
    font-size: 1.3rem;
    margin-top: 0.7rem;
  }

  .auth-card {
    padding: 1.75rem 1.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-body *,
  .auth-body *::before,
  .auth-body *::after {
    transition: none !important;
    animation: none !important;
  }

  .auth-card .btn-primary:hover:not(:disabled),
  .auth-card .btn-primary:active:not(:disabled) {
    transform: none;
  }
}
