.login-body {
  height: 100%;
  background: #ffffff;
  overflow: hidden;
}

.login-body {
  position: fixed;
  inset: 0;
  width: 100%;
  min-height: 100dvh;
  padding-bottom: 0;
  background: #ffffff;
  overscroll-behavior: none;
  touch-action: manipulation;
}

.login-body::after {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: max(24px, var(--safe-bottom));
  background: #ffffff;
  pointer-events: none;
  z-index: 1;
}

/* ========================================== */
/* LOGIN PAGE LAYOUT: App shell, page và panel chính */
/* ========================================== */
.login-body .app-shell,
.login-body .app-frame {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  min-height: 100dvh;
  background: #ffffff;
  background-image: none;
  box-shadow: none;
  overflow: hidden;
}

.login-page {
  position: relative;
  display: flex;
  align-items: flex-start;
  height: 100dvh;
  min-height: 100dvh;
  padding: 0 !important;
  background: #ffffff;
  overflow: hidden;
}

.login-panel {
  position: relative;
  width: 100%;
  max-width: none;
  height: 100dvh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 0;
  overflow: hidden;
}

/* ========================================== */
/* LOGIN HERO BACKGROUND: Khung hai lớp ảnh Logo và Beauty */
/* ========================================== */
.login-phone-entry-hero {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 0;
  height: 64dvh;
  min-height: 520px;
  margin: 0;
  background: transparent;
  pointer-events: none;
}

.login-phone-entry-shell {
  padding: 0 20px;
}

/* ========================================== */
/* LOGIN ENTRY SHEET: Khối form nổi phía dưới và hiệu ứng bàn phím */
/* ========================================== */
.login-entry-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  margin-top: 0;
  padding: 0 16px;
  padding-bottom: 56px !important;
  border-radius: 0;
  background: #ffffff;
  box-shadow: 0px -4px 100px 92px #FFFFFF;
  transform: translate3d(0, calc(var(--login-keyboard-shift, 0px) * -1), 0);
  transform-origin: center bottom;
  backface-visibility: hidden;
  transition: transform 80ms linear, padding-bottom 180ms cubic-bezier(0.22, 0.9, 0.24, 1);
  will-change: transform;
}

.login-page.is-keyboard-open .login-entry-sheet {
  padding-bottom: 8px !important;
}

/* .login-entry-sheet::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 220px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.6) 55%, #ffffff 100%);
  pointer-events: none;
  transition: height 0.24s cubic-bezier(0.22, 0.9, 0.24, 1), opacity 0.24s ease-out;
  transform-origin: bottom center;
} */

.login-entry-sheet::after {
  content: none;
}

/* ========================================== */
/* LOGIN PHONE FORM: Form kiểm tra số điện thoại */
/* ========================================== */
.login-form {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 0;
  overflow: visible;
}

/* ========================================== */
/* LOGIN PASSWORD HEADER: Tiêu đề, số điện thoại và nút quay lại */
/* ========================================== */
.login-stage {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: center;
}

.login-stage__title {
  margin: 0;
  font-size: 31px;
  line-height: 1.2;
  color: #1d2537;
  letter-spacing: -0.02em;
}

.login-stage__description,
.login-stage__phone {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: #758195;
}

.login-stage__phone {
  margin-top: 24px;
  font-size: 18px;
  font-weight: 500;
  color: #758195;
}

.login-stage__back {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0;
  border: 0;
  background: transparent;
  color: #1b2233;
  cursor: pointer;
}

.login-stage__back i {
  width: 34px;
  height: 34px;
}

/* ========================================== */
/* LOGIN FIELD WRAPPER: Shell chứa từng nhóm input */
/* ========================================== */
.login-field-shell {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: visible;
}

.login-field-shell--phone {
  margin-top: 0;
}

.login-field-shell--password {
  margin-top: 60px;
}

.login-password-shell {
  display: grid;
  gap: 18px;
  padding-top: 18px;
}

/* ========================================== */
/* LOGIN FIELD BASE: Nền, viền và focus chung cho input */
/* ========================================== */
.login-field {
  display: flex;
  align-items: center;
  /* gap: 10px; */
  min-height: 56px;
  padding: 0 14px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #e8dfe5;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}



.login-field:focus-within {
  border-color: #d76b9f;
  box-shadow: 0 0 0 3px rgba(215, 107, 159, 0.1);
}

/* ========================================== */
/* LOGIN PHONE FIELD: Ô số điện thoại, cờ quốc gia và phân cách */
/* ========================================== */
.login-field--phone-entry {
  min-height: 56px;
  padding: 0;
  border-radius: 999px;
  border: 1.5px solid transparent;
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    linear-gradient(90deg, #ff007f, #8b00ff) border-box;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.login-field__prefix {
  position: relative;
  width: 88px;
  height: 100%;
  flex: 0 0 88px;
  min-width: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #1d2537;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.login-field__separator {
  width: 18px;
  height: 22px;
  margin: 0;
  color: #6b7280;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 300;
  line-height: 1;
}

.login-field__flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 21px;
  flex: 0 0 32px;
  overflow: hidden;
  border-radius: 2px;
}

.login-field__flag-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.login-field__code {
  color: #1d2537;
  font-size: 0;
}

.login-field__chevron {
  width: 12px;
  height: 12px;
  color: #1d2537;
}

.login-field--phone-entry .login-field__code::after {
  content: "";
}

.login-field--phone-entry .login-field__input {
  height: 100%;
  padding: 0 18px;
  font-size: 16px;
  font-weight: 400;
  color: #111827;
}

.login-phone-group {
  position: relative;
  overflow: visible;
  z-index: 6;
}


/* ========================================== */
/* LOGIN INPUT BASE: Typography và trạng thái focus của input */
/* ========================================== */
.login-field__input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 16px;
  font-weight: 600;
  color: #24161f;
}

.login-field__input::placeholder {
  color: #6b7280;
}

.login-field__input:focus {
  outline: none;
}

/* ========================================== */
/* LOGIN PASSWORD FIELD: Ô mật khẩu, action icon và lỗi inline */
/* ========================================== */
.login-field--password {
  position: relative;
  min-height: 56px;
  padding: 0 102px 0 30px;
  border: 0;
  border-radius: 999px;
  background: #f3f4f7;
  box-shadow: none;
}

.login-field--password:focus-within {
  border-color: transparent;
  box-shadow: inset 0 0 0 1px #d7dbe3;
}

.login-field-shell--password.is-invalid .login-field--password {
  box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.64);
}

.login-field-error {
  margin: 0;
  padding: 0 18px;
  color: #ef4444;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.login-field-error[hidden] {
  display: none !important;
}

.login-field__action {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #1d2537;
  cursor: pointer;
}

.login-field__action:hover {
  background: rgba(215, 107, 159, 0.08);
  color: #1d2537;
}

.login-field__action i {
  width: 24px;
  height: 24px;
}

.login-field__action--clear {
  right: 58px;

  color: #e36383;
}

.login-field__action--toggle {
  right: 18px;
}

/* ========================================== */
/* LOGIN FEEDBACK / ACTIONS: Thông báo, quên mật khẩu và nút đăng nhập */
/* ========================================== */
.login-social-error {
  margin: 0;
  background: #faf7f9;
  border: 1px solid #e8dfe5;
  color: #6d5663;
}

.login-forgot {
  display: block;
  width: 100%;
  /* margin-top: 18px; */
  color: #ff4fa1;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
}

.login-forgot[hidden] {
  display: none !important;
}

.login-submit {
  min-height: 56px;
  /* margin-top: 24px; */
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff007f 0%, #c000ff 55%, #8700ff 100%);
  /* box-shadow: 0 10px 20px rgba(150, 0, 255, 0.25); */
  font-size: 16px;
  font-weight: 800;
}

.login-field--password .login-field__input {
  font-size: 16px;
  font-weight: 500;
  color: #677389;
}

.login-form input,
.login-form textarea,
.login-form select {
  font-size: 16px;
}

.login-field--password .login-field__input::placeholder {
  color: #677389;
}

.login-submit:hover {
  transform: translateY(-1px);
}

/* ========================================== */
/* LOGIN SOCIAL DIVIDER: Đường phân cách trước nhóm social login */
/* ========================================== */
.login-social-section {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  opacity: 1;
  visibility: visible;
  transition:
    grid-template-rows 180ms cubic-bezier(0.22, 0.9, 0.24, 1),
    opacity 120ms ease-out,
    visibility 0s linear 0s;
}

.login-social-section__content {
  min-height: 0;
  overflow: hidden;
}

.login-divider {
  position: relative;
  width: 200px;
  margin: 24px auto;
  text-align: center;
}

.login-divider--phone {
  position: relative;
  z-index: 1;
  padding: 0;
}

.login-divider::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  border-top: 1px solid #b9c0ce;
}

.login-divider span {
  position: relative;
  z-index: 1;
  display: inline-block;
  padding: 0 8px;
  background: #ffffff;
  color: #7d889d;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.3;
}

/* ========================================== */
/* LOGIN SOCIAL BUTTONS: Nút Google, Apple và link phụ */
/* ========================================== */
.login-social-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 0;
}

.login-links {
  position: relative;
  z-index: 1;
}

.login-page.is-keyboard-open .login-social-section {
  grid-template-rows: minmax(0, 0fr);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    grid-template-rows 180ms cubic-bezier(0.22, 0.9, 0.24, 1),
    opacity 120ms ease-out,
    visibility 0s linear 180ms;
}

.btn-social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  border-radius: 32px;
  font-weight: 700;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.btn-social:hover {
  transform: none;
}

.btn-social__icon {
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
}

.btn-social__icon svg {
  width: 32px;
  height: 32px;
}

.btn-google {
  color: #2c1824;
  border: 0;
  background: #f1f1f1;
}

.btn-google-slot.is-disabled,
.btn-social--disabled {
  opacity: 0.62;
}

.btn-apple {
  color: #211720;
  border: 0;
  background: #f1f1f1;
}

.btn-google.is-loading {
  opacity: 0.72;
  pointer-events: none;
}

.login-links {
  display: flex;
  justify-content: center;
  margin-top: 16px;
  padding: 0 16px;
}

.login-links a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #b04e84;
  font-size: 14px;
  font-weight: 700;
}

.login-links a svg {
  width: 16px;
  height: 16px;
}

.login-form input[readonly] {
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-tap-highlight-color: transparent !important;
}

.login-form input:focus,
.login-form input:active {
  outline: none !important;
  box-shadow: none !important;
}

* {
  -webkit-tap-highlight-color: transparent !important;
}

/* ========================================== */
/* AUTH RESPONSIVE: Màn nhỏ cho Login và desktop riêng cho Register */
/* ========================================== */
@media (max-width: 360px) {
  .login-phone-entry-hero {
    min-height: 500px;
  }

  .login-phone-entry-shell {
    padding-left: 16px;
    padding-right: 16px;
  }

  .login-social-grid {
    grid-template-columns: 1fr;
  }

  .login-stage__title {
    font-size: 18px;
  }

  .login-field-shell--password {
    margin-top: 44px;
  }

  .login-field--password {
    min-height: 78px;
  }

  .login-field--password .login-field__input {
    font-size: 20px;
  }
}

/* ========================================== */
/* AUTH DESKTOP SHELL: Register va Forgot Password dung canvas Portal 430px */
/* ========================================== */
@media (min-width: 768px) {
  html.login-html:not(.login-page-html),
  .login-body:not(.login-page-body) {
    min-height: 100%;
    overflow: hidden;
    background: #f6f3f8;
  }

  .login-body:not(.login-page-body) {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    overscroll-behavior: none;
  }

  .login-body:not(.login-page-body)::after {
    content: none;
  }

  .login-body:not(.login-page-body) .app-shell {
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: none;
    height: 100dvh;
    min-height: 100dvh;
    background: #f6f3f8;
    overflow: hidden;
  }

  .login-body:not(.login-page-body) .app-frame {
    width: 430px;
    max-width: 430px;
    height: 100dvh;
    min-height: 100dvh;
    background: #ffffff;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.06);
  }
}

/* ========================================== */
/* LOGIN ROOT BACKGROUND: Beauty, Logo và Gradient được vẽ trực tiếp trên root canvas */
/* ========================================== */
html.login-page-html {
  --login-theme-gradient: linear-gradient(-36deg, #FF4B2B, #8F00FF);
  --login-canvas-height: var(--login-static-viewport-height, 100lvh);
  --login-safe-top: env(safe-area-inset-top, 0px);
  --login-safe-bottom: max(var(--safe-bottom, 0px), env(safe-area-inset-bottom, 0px));
  --login-logo-width: clamp(180px, 86vw, 339px);
  --login-beauty-offset-bottom: max(0px, calc(99px - var(--login-safe-bottom)));
  --login-beauty-height: min(calc(var(--login-canvas-height) - var(--login-safe-top) - var(--login-beauty-offset-bottom)),
      177.7778vw);
  --login-beauty-top: max(0px,
      calc(var(--login-canvas-height) - var(--login-beauty-offset-bottom) - var(--login-beauty-height)));

  width: 100% !important;
  height: 100% !important;
  min-height: var(--login-canvas-height) !important;
  overflow: hidden !important;
  overscroll-behavior: none !important;
  overflow-anchor: none !important;
  scroll-behavior: auto !important;
  background-color: #8F00FF !important;
  background-image:
    url("../../../public/imgs/beauty-login.png"),
    url("../../../public/imgs/logo-2.png"),
    var(--login-theme-gradient) !important;
  background-repeat: no-repeat, no-repeat, no-repeat !important;
  background-position:
    center top var(--login-beauty-top),
    center top var(--login-safe-top),
    center top !important;
  background-size:
    auto var(--login-beauty-height),
    var(--login-logo-width) auto,
    cover !important;
  /* Trang đã khóa scroll; attachment scroll giữ ảnh neo vào root layout thay vì visual viewport của iOS. */
  background-attachment: scroll, scroll, scroll !important;
  background-blend-mode: normal, soft-light, normal !important;
  background-origin: border-box, border-box, border-box !important;
  background-clip: border-box, border-box, border-box !important;
}

/* ========================================== */
/* LOGIN STATIC LAYOUT: Body và app trong suốt để root background luôn hiển thị */
/* ========================================== */
body.login-page-body::after {
  content: none;
}

body.login-page-body {
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  bottom: auto !important;
  left: 0 !important;
  width: 100vw !important;
  height: var(--login-static-viewport-height, 100vh) !important;
  min-height: var(--login-static-viewport-height, 100vh) !important;
  max-height: var(--login-static-viewport-height, 100vh) !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  overscroll-behavior: none !important;
  overflow-anchor: none !important;
  scroll-behavior: auto !important;
  touch-action: none !important;
  background: transparent !important;
}

body.login-page-body .app-shell,
body.login-page-body .app-frame,
body.login-page-body .login-page,
body.login-page-body .login-panel {
  height: var(--login-static-viewport-height, 100vh) !important;
  min-height: var(--login-static-viewport-height, 100vh) !important;
  max-height: var(--login-static-viewport-height, 100vh) !important;
  background: transparent !important;
  overflow: hidden !important;
  overflow-anchor: none !important;
}

body.login-page-body .app-shell {
  position: relative;
  z-index: 1;
}

body.login-page-body .login-entry-sheet {
  overflow-anchor: none !important;
}

/* ========================================== */
/* LOGIN DESKTOP SHELL: Dong bo canvas 430px voi Portal */
/* ========================================== */
@media (min-width: 768px) {
  html.login-page-html {
    --login-frame-width: 430px;
    --login-logo-width: min(86%, 339px);
    --login-beauty-height: min(
      calc(var(--login-canvas-height) - var(--login-safe-top) - var(--login-beauty-offset-bottom)),
      764px
    );

    background: #f6f3f8 !important;
    background-image: none !important;
  }

  body.login-page-body {
    background: #f6f3f8 !important;
  }

  body.login-page-body .app-shell {
    display: flex;
    justify-content: center;
    width: 100vw !important;
    max-width: none !important;
    background: #f6f3f8 !important;
  }

  body.login-page-body .app-frame {
    position: relative;
    width: var(--login-frame-width) !important;
    max-width: var(--login-frame-width) !important;
    margin: 0 auto;
    background-color: #8f00ff !important;
    background-image:
      url("../../../public/imgs/beauty-login.png"),
      url("../../../public/imgs/logo-2.png"),
      var(--login-theme-gradient) !important;
    background-repeat: no-repeat, no-repeat, no-repeat !important;
    background-position:
      center top var(--login-beauty-top),
      center top var(--login-safe-top),
      center top !important;
    background-size:
      auto var(--login-beauty-height),
      var(--login-logo-width) auto,
      cover !important;
    background-attachment: scroll, scroll, scroll !important;
    background-blend-mode: normal, soft-light, normal !important;
    background-origin: border-box, border-box, border-box !important;
    background-clip: border-box, border-box, border-box !important;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.06);
  }

  body.login-page-body .login-page,
  body.login-page-body .login-panel {
    width: 100% !important;
    max-width: none !important;
    background: transparent !important;
  }
}
