/* Premium password UI — floating label, strength bar, checklist realtime */

/* Ẩn decoy chống gợi ý autofill / «Use strong password» của trình duyệt */
.pwd-autofill-trap {
  position: absolute !important;
  left: -10000px !important;
  top: auto !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.pwd-premium {
  --pwd-ink: #14345d;
  --pwd-muted: #5a7484;
  --pwd-line: rgba(20, 52, 93, .18);
  --pwd-weak: #c51f2d;
  --pwd-mid: #d6930b;
  --pwd-strong: #0f9a6a;
  --pwd-ok: #1a9f63;
  --pwd-bad: #c51f2d;
  --pwd-idle: #9aabba;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

/* Một khối liền: ô MK mới → độ mạnh → checklist (không tách khung) */
.pwd-premium[data-pwd-meter] {
  gap: .45rem;
  padding-bottom: .15rem;
}

.pwd-float {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 52px;
}

.pwd-float > input.input {
  width: 100%;
  min-height: 52px;
  height: 52px;
  padding: .85rem 2.85rem .55rem 1rem !important;
  border-radius: 14px;
  border: 1.5px solid var(--pwd-line);
  background: rgba(255, 255, 255, .72);
  color: var(--pwd-ink);
  font: inherit;
  font-size: .95rem;
  letter-spacing: .04em;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.pwd-float > input.input:focus {
  outline: none;
  border-color: #0a7ec9;
  box-shadow: 0 0 0 3px rgba(10, 126, 201, .16);
  background: #fff;
}

.pwd-float > label {
  position: absolute;
  left: .95rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0 .28rem;
  margin: 0;
  font-size: .92rem;
  font-weight: 600;
  color: var(--pwd-muted);
  pointer-events: none;
  background: transparent;
  transition: top .16s ease, transform .16s ease, font-size .16s ease, color .16s ease, background .16s ease;
}

.pwd-float > input.input:focus + label,
.pwd-float > input.input:not(:placeholder-shown) + label,
.pwd-float.is-filled > label {
  top: 0;
  transform: translateY(-50%);
  font-size: .72rem;
  font-weight: 700;
  color: #0a7ec9;
  background: linear-gradient(180deg, rgba(245, 251, 255, .95), #fff 55%);
}

#dlg-doi-mk .pwd-float > input.input:focus + label,
#dlg-doi-mk .pwd-float > input.input:not(:placeholder-shown) + label,
#dlg-doi-mk .pwd-float.is-filled > label {
  background: linear-gradient(180deg, #f4f9fd, #fff 60%);
}

.pwd-float .login-pass-toggle {
  position: absolute;
  right: .35rem;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--pwd-muted);
  cursor: pointer;
  font-size: 1rem;
  z-index: 2;
}

.pwd-float .login-pass-toggle:hover {
  color: #0a7ec9;
  background: rgba(10, 126, 201, .08);
}

/* Strength meter */
.pwd-strength {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  padding: .15rem .1rem 0;
}

.pwd-strength-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  font-size: .78rem;
  font-weight: 600;
  color: var(--pwd-muted);
}

.pwd-strength-label {
  font-weight: 800;
  font-size: .8rem;
  letter-spacing: .02em;
  color: var(--pwd-idle);
}

.pwd-strength[data-level="0"] .pwd-strength-label { color: var(--pwd-idle); }
.pwd-strength[data-level="1"] .pwd-strength-label { color: var(--pwd-weak); }
.pwd-strength[data-level="2"] .pwd-strength-label { color: var(--pwd-mid); }
.pwd-strength[data-level="3"] .pwd-strength-label { color: var(--pwd-strong); }
.pwd-strength[data-level="4"] .pwd-strength-label { color: var(--pwd-strong); }

.pwd-strength-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .35rem;
  height: 7px;
}

.pwd-strength-bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: rgba(20, 52, 93, .1);
  transition: background .2s ease, box-shadow .2s ease;
}

.pwd-strength[data-level="1"] .pwd-strength-bar > i:nth-child(1) {
  background: var(--pwd-weak);
  box-shadow: 0 0 0 1px rgba(197, 31, 45, .15);
}
.pwd-strength[data-level="2"] .pwd-strength-bar > i:nth-child(-n+2) {
  background: var(--pwd-mid);
  box-shadow: 0 0 0 1px rgba(214, 147, 11, .18);
}
.pwd-strength[data-level="3"] .pwd-strength-bar > i:nth-child(-n+3) {
  background: var(--pwd-strong);
  box-shadow: 0 0 0 1px rgba(15, 154, 106, .15);
}
.pwd-strength[data-level="4"] .pwd-strength-bar > i {
  background: var(--pwd-strong);
  box-shadow: 0 0 0 1px rgba(15, 154, 106, .18);
}

/* Checklist — một hàng, không khung/pill riêng từng mục */
.pwd-checks {
  list-style: none;
  margin: .05rem 0 0;
  padding: .15rem 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .55rem .85rem;
  border: 0;
  background: none;
  box-shadow: none;
}

.pwd-checks > li {
  display: inline-flex;
  align-items: center;
  gap: .32rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  font-size: .74rem;
  font-weight: 700;
  color: var(--pwd-idle);
  background: none;
  box-shadow: none;
  transition: color .15s ease;
}

.pwd-checks > li > i {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: .58rem;
  font-style: normal;
  background: rgba(154, 171, 186, .4);
  color: #fff;
  flex-shrink: 0;
}

.pwd-checks > li > i::before {
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  content: "\f111";
  font-size: .5rem;
}

.pwd-checks > li.is-ok {
  color: var(--pwd-ok);
  background: none;
  box-shadow: none;
}
.pwd-checks > li.is-ok > i { background: var(--pwd-ok); }
.pwd-checks > li.is-ok > i::before { content: "\f00c"; font-size: .55rem; }

.pwd-checks > li.is-bad {
  color: var(--pwd-bad);
  background: none;
  box-shadow: none;
}
.pwd-checks > li.is-bad > i { background: var(--pwd-bad); }
.pwd-checks > li.is-bad > i::before { content: "\f00d"; font-size: .55rem; }

.pwd-match-hint {
  margin: .2rem 0 0;
  font-size: .78rem;
  font-weight: 600;
  min-height: 1.1em;
  color: var(--pwd-muted);
}
.pwd-match-hint.is-ok { color: var(--pwd-ok); }
.pwd-match-hint.is-bad { color: var(--pwd-bad); }

.pwd-float.is-match > input.input {
  border-color: var(--pwd-ok);
  box-shadow: 0 0 0 3px rgba(26, 159, 99, .14);
}
.pwd-float.is-mismatch > input.input {
  border-color: var(--pwd-bad);
  box-shadow: 0 0 0 3px rgba(197, 31, 45, .12);
}

/* Tip + xác nhận — chữ thuần, không khung */
.pwd-confirm-tip {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  font-size: .78rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--pwd-muted);
  background: none;
  box-shadow: none;
  display: flex;
  align-items: flex-start;
  gap: .4rem;
}
.pwd-confirm-tip > i { margin-top: .15rem; color: #0a7ec9; }

/* Phải đè .cssk-dlg-form label { display:grid } — nếu không checkbox/chữ bị xếp dọc */
.cssk-dlg-form label.pwd-confirm-easy,
label.pwd-confirm-easy,
.pwd-confirm-easy {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: .5rem !important;
  margin: .1rem 0 .25rem;
  padding: .15rem 0;
  border: 0;
  border-radius: 0;
  cursor: pointer;
  background: none;
  box-shadow: none;
  white-space: nowrap;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  width: auto;
  max-width: 100%;
}
.pwd-confirm-easy:hover { background: none; }
.pwd-confirm-easy.is-on { background: none; box-shadow: none; }
.pwd-confirm-easy.is-on strong { color: var(--pwd-ok); }

.pwd-confirm-easy > input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0 !important;
  accent-color: #1a9f63;
  flex: 0 0 auto;
  align-self: center;
}
.pwd-confirm-easy > span {
  display: inline !important;
  flex: 0 1 auto;
  min-width: 0;
  line-height: 1.25;
  white-space: nowrap;
}
.pwd-confirm-easy strong {
  font-size: .86rem;
  font-weight: 800;
  color: var(--pwd-ink);
}
.pwd-confirm-easy em {
  font-style: normal;
  font-size: .78rem;
  font-weight: 600;
  color: var(--pwd-muted);
  margin-left: .35rem;
}
.pwd-confirm-easy em::before {
  content: "— ";
  color: var(--pwd-idle);
}
.pwd-confirm-easy[hidden],
.pwd-confirm-tip[hidden] { display: none !important; }

/* Form layout — các khối liên quan sát nhau hơn */
.pwd-form .pwd-premium,
#frm-doi-mk .pwd-premium { margin-top: .1rem; }
.pwd-form .pwd-block { margin-top: .7rem; }
.pwd-form .pwd-block:first-child { margin-top: 0; }
#frm-doi-mk .pwd-block { margin-top: .5rem; }
#frm-doi-mk .pwd-block:first-of-type { margin-top: 0; }
#frm-doi-mk .pwd-block[data-pwd-confirm-wrap],
.pwd-form .pwd-block[data-pwd-confirm-wrap] {
  margin-top: .45rem;
  padding-top: .35rem;
  border-top: 1px dashed rgba(20, 52, 93, .12);
}

#dlg-doi-mk.is-form .cssk-dlg-panel {
  max-width: min(440px, 96vw);
}

/* ——— Trang đổi MK lần đầu (login-card) — cùng mẫu Premium với popup ——— */
.login-card.is-doi-mk {
  width: min(460px, 100%);
}
.login-card.is-doi-mk .pwd-premium-form {
  margin-top: .55rem;
}
.login-card.is-doi-mk .pwd-float > input.input:focus + label,
.login-card.is-doi-mk .pwd-float > input.input:not(:placeholder-shown) + label,
.login-card.is-doi-mk .pwd-float.is-filled > label {
  background: linear-gradient(180deg, rgba(255, 255, 255, .88), #fff 58%);
}
.login-card.is-doi-mk .pwd-float > input.input {
  background: rgba(255, 255, 255, .78);
}
.login-card.is-doi-mk .pwd-float > input.input:focus {
  background: #fff;
}
/* Nút submit cùng tông xanh lá bảo mật như popup */
.login-card.is-doi-mk .login-submit.btn.jade {
  min-height: 48px;
  border-radius: 14px;
  font-weight: 800;
  box-shadow: 0 10px 20px rgba(15, 154, 106, .22);
}
.login-card.is-doi-mk .login-submit.btn.jade:hover {
  filter: brightness(1.04);
}

@media (max-width: 560px) {
  .pwd-float > input.input {
    font-size: 16px; /* tránh iOS zoom khi focus */
  }
  .pwd-checklist {
    font-size: .78rem;
  }
}
