/* =========================================================================
   Manwa Wap — luồng tài khoản
   Figma "Ui App Manwa 6/8/2026" › "Đăng ký / Đăng nhập 1a → 20"
   (2304:20884 …). Tiền tố .mwa-. Khung thiết kế 360px, lề form 32px.
   ========================================================================= */
body.mwa-page { background: #fff; color: #111827; min-height: 100vh; }

/* ---------- Banner "Chào mừng đến với Manwa" (instance "Bg login") ------ */
.mwa-hero {
  position: relative;
  height: 216px;
  overflow: hidden;
  background: linear-gradient(180deg, #EE0033 0%, #F56685 68%, #FCCCD6 88%);
}

/* Toàn bộ chi tiết được đặt theo khung 360px rồi căn giữa */
.mwa-hero__stage {
  position: absolute;
  left: 50%; top: 0;
  width: 360px; height: 100%;
  transform: translateX(-50%);
}

.mwa-hero__cloud { position: absolute; display: block; pointer-events: none; }
.mwa-hero__cloud--1 { left: -24px; top: 62px; width: 48px; height: 28px; }
.mwa-hero__cloud--2 { left: 220px; top: 6px; width: 30px; height: 18px; opacity: .7; transform: scaleX(-1); }
.mwa-hero__cloud--3 { left: 330px; top: 144px; width: 48px; height: 28px; }

/* Đường cong trắng dưới đáy banner */
.mwa-hero__curve {
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 58px;
  transform: scaleY(-1);
}

.mwa-hero__art {
  position: absolute;
  left: 10px; bottom: 0;
  width: 340px; height: 205px;
  object-fit: cover;
  pointer-events: none;
}

/* Chữ đặt lên tấm bảng gỗ trong ảnh */
.mwa-hero__board {
  position: absolute;
  left: 0; right: 0; top: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.mwa-hero__board--solo { top: 62px; }

.mwa-hero__title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .001em;
  background: linear-gradient(90deg, #EE0033 0%, #BA1236 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.mwa-hero__tagline {
  margin: 0;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 500;
  line-height: 15px;
  color: #660016;
}

.mw .mwa-hero__close {
  position: absolute;
  top: 10px; right: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, .5);
  color: #fff;
}

/* ---------- Thân form -------------------------------------------------- */
.mwa-body {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 0 calc(24px + env(safe-area-inset-bottom, 0px));
}

.mwa-form { display: flex; flex-direction: column; gap: 16px; }
.mwa-form[hidden] { display: none; }

.mwa-head { padding: 0 32px; text-align: center; }
.mwa-head__title { margin: 0; font-size: 20px; font-weight: 700; color: #111827; }
.mwa-head__sub { margin: 4px 0 0; font-size: 12px; font-weight: 500; color: var(--color-text-muted); }

.mwa-fields { display: flex; flex-direction: column; gap: 16px; }

.mwa-field { display: flex; flex-direction: column; gap: 8px; padding: 0 32px; }
.mwa-field__label { font-size: 14px; font-weight: 600; color: #111827; }

.mwa-field__box {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--color-field);
  transition: border-color .15s ease, background-color .15s ease;
}

.mwa-field__box:focus-within { border-color: var(--color-primary); }

/* Khung đỏ khi focus đã do .mwa-field__box lo. manwa-core.css có quy tắc chung
   `.mw :focus-visible { outline: 2px solid var(--color-primary) }` (độ ưu tiên
   0,2,0) ăn đè `outline: 0` của .mwa-field__input (0,1,0) nên ô nhập vẽ thêm
   một viền đỏ thứ hai bên trong hộp. Tắt riêng cho ô nhập của luồng tài khoản. */
.mw .mwa-field__input:focus-visible,
.mw .mwa-field__input:focus { outline: none; box-shadow: none; }
.mwa-field.is-invalid .mwa-field__box { border-color: var(--color-primary); background: var(--color-primary-soft); }

.mwa-field__input {
  flex: 1;
  min-width: 0;
  height: 46px;
  border: 0;
  outline: 0;
  background: none;
  font: inherit;
  /* Phải >= 16px: Safari iOS tự phóng to trang khi focus vào ô nhập có cỡ chữ
     nhỏ hơn, làm vỡ bố cục màn đăng nhập/đăng ký (bị cắt mất mép phải). */
  font-size: 16px;
  font-weight: 500;
  color: #111827;
}

.mwa-field__input::placeholder { color: var(--color-text-muted); }
.mwa-field__input[type="password"] { letter-spacing: .12em; }
.mwa-field__input[type="password"]::placeholder { letter-spacing: 0; }

.mw .mwa-field__eye {
  flex: none;
  display: inline-flex;
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-primary);
  cursor: pointer;
}

.mwa-field__eye .mwa-eye-off,
.mwa-field__eye[aria-pressed="true"] .mwa-eye-on { display: none; }
.mwa-field__eye[aria-pressed="true"] .mwa-eye-off { display: block; color: var(--color-text-muted); }

.mwa-field__error,
.mwa-alert {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--color-primary);
}

.mwa-field__error { text-align: center; }
.mwa-field__error[hidden], .mwa-alert[hidden] { display: none; }

/* Lỗi chung của form đăng nhập: có icon cảnh báo, căn trái (Figma 5a) */
.mwa-alert {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 0 32px;
  margin-top: -8px;
}

.mwa-alert::before {
  content: '';
  flex: none;
  width: 14px; height: 14px;
  margin-top: 1px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3'/%3E%3Cpath d='M12 9v4'/%3E%3Cpath d='M12 17h.01'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3'/%3E%3Cpath d='M12 9v4'/%3E%3Cpath d='M12 17h.01'/%3E%3C/svg%3E") center / contain no-repeat;
}

.mwa-alert--center { justify-content: center; text-align: center; }
.mwa-alert--center::before { display: none; }

/* ---------- Nút --------------------------------------------------------- */
.mwa-actions { padding: 0 32px; }

.mw .mwa-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 0;
  border-radius: 12px;
  background: var(--color-primary);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .15s ease;
}

.mw .mwa-btn:active { background: var(--color-primary-dark); }
.mw .mwa-btn[disabled] { background: #FCCCD6; color: #fff; cursor: default; }
.mwa-btn.is-loading { pointer-events: none; opacity: .85; }

/* ---------- Liên kết dưới nút ------------------------------------------ */
.mwa-links {
  display: flex;
  justify-content: space-between;
  padding: 0 32px;
  font-size: 14px;
  font-weight: 500;
}

.mwa-links a, .mwa-switch a, .mwa-terms a { color: var(--color-primary); }

.mwa-switch {
  margin: 0;
  padding: 0 32px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-muted);
}

.mwa-switch a { margin-left: 4px; font-weight: 600; }

.mwa-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.mwa-divider::before,
.mwa-divider::after {
  content: '';
  width: 48px; height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(128, 130, 133, 0) 0%, rgba(128, 130, 133, .35) 100%);
}

.mwa-divider::after { transform: scaleX(-1); }

.mwa-social { display: flex; justify-content: center; gap: 24px; }

.mwa-social__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px; height: 48px;
  border-radius: var(--radius-full);
  border: 1px solid;
  background: #fff;
}

.mwa-social__btn--fb { border-color: #1877F2; }
.mwa-social__btn--gg { border-color: #EA4335; }

.mwa-terms {
  margin: 8px 0 0;
  padding: 0 24px;
  text-align: center;
  font-size: 10px;
  line-height: 15px;
  color: var(--color-text-muted);
}

/* ---------- OTP --------------------------------------------------------- */
.mwa-otp {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  padding: 0 32px;
}

.mwa-otp__cell {
  width: 100%;
  height: 48px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--color-field);
  font: inherit;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  color: #111827;
  outline: 0;
  caret-color: var(--color-primary);
}

.mwa-otp__cell:focus { border-color: var(--color-primary); background: #fff; }
/* Cùng lý do như .mwa-field__input: ô OTP đã tự đổi viền khi focus. */
.mw .mwa-otp__cell:focus-visible { outline: none; box-shadow: none; }
.mwa-otp__cell.is-filled { border-color: var(--color-primary); background: #fff; }
.mwa-otp.is-invalid .mwa-otp__cell { border-color: var(--color-primary); background: var(--color-primary-soft); }

.mwa-field__error--center { padding: 0 32px; margin-top: -4px; }

.mwa-resend {
  margin: 0;
  text-align: center;
  font-size: 14px;
  color: var(--color-text-muted);
}

.mwa-resend__timer { margin-left: 4px; font-weight: 600; color: var(--color-primary); }
.mwa-resend__timer:empty { display: none; }

.mw .mwa-resend__btn {
  margin-left: 4px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  color: var(--color-primary);
  cursor: pointer;
}

.mwa-resend__btn[hidden] { display: none; }

/* ---------- Hộp thoại -------------------------------------------------- */
.mwa-dialog {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, .5);
}

.mwa-dialog[hidden] { display: none; }

.mwa-dialog__panel {
  width: 100%;
  max-width: 320px;
  padding: 24px 20px 16px;
  border-radius: 20px;
  background: #fff;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mwa-dialog__title { margin: 0; font-size: 17px; font-weight: 700; }
.mwa-dialog__text { margin: 0 0 4px; font-size: 14px; line-height: 1.5; color: #4B4B4F; }

.mw .mwa-dialog__close {
  padding: 8px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
}
