/* ─────────────────────────────────────────────────────────────────────────
   Pro My Account — OTP login (page + checkout popup)

   One compact card, nothing competing with the phone field. Soft 12–16px
   corners, a faint brand-tinted canvas, hairline borders, layered shadows
   and calm motion. Every colour derives from the shared --pma-* tokens so
   brand colour and seasonal themes carry through.

   Themes love to restyle inputs and buttons, so the few properties they tend
   to override are pinned with !important inside the card scope only.
   ───────────────────────────────────────────────────────────────────────── */

.pma-auth-page,
.pma-auth-modal {
  --a-brand:   var(--pma-brand, #7c1695);
  --a-brand-d: var(--pma-brand-dark, #5e0f72);
  --a-on:      var(--pma-on-brand, #fff);
  --a-dim:     var(--pma-brand-dim, rgba(124,22,149, .08));
  --a-ring:    var(--pma-brand-ring, rgba(124,22,149, .16));
  --a-canvas:  var(--pma-canvas, #f6f4f8);
  --a-surface: #fff;
  --a-field:   #fbfafc;
  --a-line:    #e6e1ea;
  --a-line-2:  #f0ecf3;
  --a-ink:     #18141b;
  --a-ink-2:   #5d5663;
  --a-ink-3:   #948d99;
  --a-ok:      #7c1695;
  --a-err:     #8f6d43;
  --a-r:       10px;
  --a-ease:    cubic-bezier(.2, .8, .2, 1);
  font-family: var(--pma-font, inherit);
  color: var(--a-ink);
  -webkit-font-smoothing: antialiased;
}

.pma-auth-page *,
.pma-auth-page *::before,
.pma-auth-page *::after,
.pma-auth-modal *,
.pma-auth-modal *::before,
.pma-auth-modal *::after { box-sizing: border-box; }

.pma-auth-page .pma-i,
.pma-auth-modal .pma-i { display: block; flex: none; }
.pma-auth-page .pma-i-d,
.pma-auth-modal .pma-i-d { opacity: .16; }

/* ── Page canvas ─────────────────────────────────────────────────────────── */
.pma-auth-page {
  position: relative;
  display: grid;
  place-items: center;
  min-height: min(88vh, 680px);
  padding: 48px 16px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(rgba(24,20,27, .045) 1px, transparent 1.2px) 0 0 / 22px 22px,
    var(--a-canvas);
}

/* A single slow-drifting halo behind the card – the only decoration. */
.pma-auth-glow {
  position: absolute;
  z-index: -1;
  top: 50%;
  left: 50%;
  width: min(620px, 120vw);
  aspect-ratio: 1;
  background:
    radial-gradient(closest-side, color-mix(in srgb, var(--a-brand) 16%, transparent), transparent 70%),
    radial-gradient(closest-side at 70% 30%, color-mix(in srgb, var(--a-brand) 10%, transparent), transparent 70%);
  transform: translate(-50%, -50%);
  animation: pma-a-drift 14s ease-in-out infinite alternate;
  pointer-events: none;
}

/* ── Card ────────────────────────────────────────────────────────────────── */
.pma-auth-card {
  position: relative;
  width: min(400px, 100%);
  padding: 32px 28px 22px;
  background: var(--a-surface);
  border: 1px solid rgba(24,20,27, .07);
  border-radius: 5px;
  box-shadow:
    0 1px 2px rgba(24,20,27, .04),
    0 10px 24px -12px rgba(24,20,27, .12),
    0 32px 64px -32px color-mix(in srgb, var(--a-brand) 30%, transparent);
  overflow: hidden;
  text-align: start;
  animation: pma-a-rise .6s var(--a-ease) both;
}

/* Hairline of brand light along the top edge. */
.pma-auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  inset-inline: 28px;
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--a-brand) 55%, transparent), transparent);
  opacity: .7;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.pma-auth-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 0 22px;
  text-align: center;
}

.pma-auth-logo-link {
  display: inline-flex;
  margin: 0 0 18px;
  text-decoration: none !important;
  box-shadow: none !important;
  animation: pma-a-fade .6s .08s var(--a-ease) both;
}

.pma-auth-logo-img {
  display: block;
  width: auto !important;
  max-width: 150px;
  height: auto;
  max-height: 40px;
  object-fit: contain;
}

.pma-auth-logo-mark,
.pma-auth-modal-badge {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 5px;
  font-size: 19px;
  font-weight: 800;
  line-height: 1;
}

.pma-auth-logo-mark {
  color: var(--a-on);
  background: linear-gradient(145deg, var(--a-brand), var(--a-brand-d));
  box-shadow: 0 8px 18px -8px var(--a-brand), inset 0 1px 0 rgba(255,255,255, .25);
}

.pma-auth-modal-badge {
  margin: 0 0 14px;
  color: var(--a-brand);
  background: var(--a-dim);
}

.pma-auth-modal-badge .pma-i { width: 22px; height: 22px; }
.pma-auth-modal-badge .pma-i-d { opacity: .18; }

.pma-auth-card .pma-auth-title {
  margin: 0 0 6px !important;
  padding: 0 !important;
  font-family: inherit !important;
  font-size: 19px !important;
  font-weight: 800 !important;
  line-height: 1.5 !important;
  letter-spacing: 0 !important;
  color: var(--a-ink) !important;
  text-transform: none !important;
  animation: pma-a-fade .6s .12s var(--a-ease) both;
}

.pma-auth-card .pma-auth-subtitle {
  max-width: 320px;
  margin: 0 !important;
  text-wrap: balance;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.85;
  color: var(--a-ink-2);
  animation: pma-a-fade .6s .16s var(--a-ease) both;
}

/* ── Steps ───────────────────────────────────────────────────────────────── */
.pma-auth-step { display: none; }

.pma-auth-step.is-active {
  display: block;
  animation: pma-a-step .45s var(--a-ease) both;
}

.pma-auth-field { margin: 0 0 14px; }

.pma-auth-card .pma-auth-label {
  display: block;
  margin: 0 0 7px;
  padding: 0;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--a-ink-2);
}

/* ── Phone input ─────────────────────────────────────────────────────────── */
.pma-auth-input-group {
  position: relative;
  display: flex;
  align-items: center;
  height: 50px;
  background: var(--a-field);
  border: 1px solid var(--a-line);
  border-radius: var(--a-r);
  transition: border-color .2s, box-shadow .25s var(--a-ease), background-color .2s;
}

.pma-auth-input-group:hover { border-color: #d8d2dd; }

.pma-auth-input-group:focus-within {
  background: var(--a-surface);
  border-color: var(--a-brand);
  box-shadow: 0 0 0 4px var(--a-ring);
}

.pma-auth-input-addon {
  display: grid;
  place-items: center;
  flex: none;
  width: 46px;
  height: 100%;
  color: var(--a-ink-3);
  transition: color .2s;
}

.pma-auth-input-addon .pma-i { width: 19px; height: 19px; }
.pma-auth-input-group:focus-within .pma-auth-input-addon { color: var(--a-brand); }

.pma-auth-card input.pma-auth-input {
  flex: 1;
  min-width: 0;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 4px !important;
  font-family: inherit !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  letter-spacing: .06em;
  color: var(--a-ink) !important;
  text-align: left;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  -webkit-appearance: none;
  appearance: none;
}

.pma-auth-card input.pma-auth-input::placeholder {
  font-weight: 500;
  letter-spacing: .04em;
  color: #bdb6c2;
  opacity: 1;
}

.pma-auth-country-tag {
  flex: none;
  margin-inline: 8px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--a-ink-2);
  background: var(--a-surface);
  border: 1px solid var(--a-line-2);
  border-radius: 5px;
}

/* ── Primary button ──────────────────────────────────────────────────────── */
.pma-auth-card .pma-auth-btn {
  position: relative;
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100% !important;
  height: 50px !important;
  min-height: 0 !important;
  margin: 6px 0 0 !important;
  padding: 0 20px !important;
  overflow: hidden;
  font-family: inherit !important;
  font-size: 14.5px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  color: var(--a-on) !important;
  background: linear-gradient(180deg, color-mix(in srgb, var(--a-brand) 92%, #fff), var(--a-brand)) !important;
  border: 0 !important;
  border-radius: var(--a-r) !important;
  box-shadow: 0 1px 0 rgba(255,255,255, .18) inset, 0 10px 22px -12px var(--a-brand) !important;
  cursor: pointer;
  transition: transform .25s var(--a-ease), box-shadow .25s var(--a-ease), filter .2s;
}

/* Light sweep on hover. */
.pma-auth-card .pma-auth-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255, .22) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform .7s var(--a-ease);
  pointer-events: none;
}

.pma-auth-card .pma-auth-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 1px 0 rgba(255,255,255, .18) inset, 0 14px 28px -12px var(--a-brand) !important;
}

.pma-auth-card .pma-auth-btn:hover::after { transform: translateX(120%); }
.pma-auth-card .pma-auth-btn:active { transform: translateY(0) scale(.99); }

.pma-auth-card .pma-auth-btn:focus-visible {
  outline: 2px solid var(--a-brand);
  outline-offset: 3px;
}

.pma-auth-card .pma-auth-btn:disabled { cursor: progress; filter: saturate(.85); }

.pma-auth-btn-arrow {
  width: 18px;
  height: 18px;
  transition: transform .3s var(--a-ease);
}

.pma-auth-btn:hover .pma-auth-btn-arrow { transform: translateX(-3px); }
.pma-ltr .pma-auth-btn:hover .pma-auth-btn-arrow,
[dir="ltr"] .pma-auth-btn:hover .pma-auth-btn-arrow { transform: scaleX(-1) translateX(-3px); }

.pma-btn-spinner-wrap { display: none; }
.pma-btn-spinner { display: block; width: 18px; height: 18px; animation: pma-a-spin .75s linear infinite; }
.pma-auth-btn.is-loading .pma-btn-spinner-wrap { display: block; }
.pma-auth-btn.is-loading .pma-auth-btn-arrow { display: none; }

/* ── Step 2 ──────────────────────────────────────────────────────────────── */
.pma-auth-phone-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 16px;
  padding: 9px 12px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--a-ink-2);
  background: var(--a-canvas);
  border-radius: 5px;
}

.pma-auth-phone-val {
  margin-inline: 3px;
  font-weight: 800;
  color: var(--a-ink);
  letter-spacing: .03em;
}

.pma-auth-card .pma-auth-edit-phone,
.pma-auth-card .pma-auth-resend-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 4px 6px !important;
  font-family: inherit !important;
  font-size: 12.5px !important;
  font-weight: 700 !important;
  line-height: 1.4 !important;
  color: var(--a-brand) !important;
  text-transform: none !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 5px !important;
  box-shadow: none !important;
  cursor: pointer;
  transition: background-color .2s, color .2s;
}

.pma-auth-card .pma-auth-edit-phone:hover,
.pma-auth-card .pma-auth-resend-btn:hover { background: var(--a-dim) !important; }

.pma-auth-edit-phone .pma-i,
.pma-auth-resend-btn .pma-i,
.pma-auth-countdown .pma-i { width: 15px; height: 15px; }

/* OTP: one real input laid over decorative cells (autofill friendly). */
.pma-otp-field {
  position: relative;
  height: 52px;
}

.pma-auth-card input.pma-otp-input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100% !important;
  height: 100% !important;
  padding: 0 !important;
  color: transparent !important;
  caret-color: transparent;
  letter-spacing: 0;
  background: transparent !important;
  opacity: 0.01;
  cursor: text;
}

.pma-otp-cells {
  display: grid;
  grid-template-columns: repeat(var(--pma-otp-len, 5), minmax(0, 1fr));
  gap: 8px;
  height: 100%;
}

.pma-otp-cells span {
  position: relative;
  display: grid;
  place-items: center;
  font-size: 21px;
  font-weight: 800;
  color: var(--a-ink);
  background: var(--a-field);
  border: 1px solid var(--a-line);
  border-radius: var(--a-r);
  transition: border-color .2s, box-shadow .25s var(--a-ease), background-color .2s, transform .25s var(--a-ease);
}

.pma-otp-cells span.is-filled {
  background: var(--a-surface);
  border-color: color-mix(in srgb, var(--a-brand) 45%, var(--a-line));
  animation: pma-a-pop .28s var(--a-ease);
}

.pma-otp-cells span.is-caret {
  background: var(--a-surface);
  border-color: var(--a-brand);
  box-shadow: 0 0 0 4px var(--a-ring);
}

.pma-otp-cells span.is-caret:not(.is-filled)::after {
  content: '';
  width: 2px;
  height: 20px;
  background: var(--a-brand);
  border-radius: 2px;
  animation: pma-a-blink 1s steps(1) infinite;
}

.pma-auth-timer-row {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  margin: 0 0 6px;
  font-size: 12.5px;
  color: var(--a-ink-3);
}

.pma-auth-countdown {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pma-auth-countdown strong {
  font-weight: 800;
  color: var(--a-ink);
  font-variant-numeric: tabular-nums;
}

.pma-auth-card .pma-auth-resend-btn { display: none; }
.pma-auth-card .pma-auth-resend-btn.is-active { display: inline-flex; animation: pma-a-fade .35s var(--a-ease) both; }

/* ── Notice ──────────────────────────────────────────────────────────────── */
.pma-auth-notice { display: none; }

.pma-auth-notice.is-visible {
  display: block;
  margin: 0 0 14px;
  padding: 10px 12px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.7;
  border: 1px solid transparent;
  border-radius: 5px;
  animation: pma-a-step .35s var(--a-ease) both;
}

.pma-auth-notice.is-error   { color: var(--a-err); background: #fdf2f3; border-color: #f6efe5; }
.pma-auth-notice.is-success { color: var(--a-ok);  background: #f0faf3; border-color: #efe2f3; }
.pma-auth-notice.is-info    { color: var(--a-brand-d); background: var(--a-dim); border-color: var(--a-ring); }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.pma-auth-terms {
  margin: 20px 0 0;
  padding: 14px 4px 0;
  font-size: 11.5px;
  line-height: 1.9;
  color: var(--a-ink-3);
  text-align: center;
  border-top: 1px solid var(--a-line-2);
}

.pma-auth-terms a { color: var(--a-ink-2); text-decoration: underline; text-underline-offset: 3px; }

/* ── Success overlay ─────────────────────────────────────────────────────── */
.pma-auth-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 24px;
  text-align: center;
  background: rgba(255,255,255, .96);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .35s var(--a-ease), visibility .35s;
}

.pma-auth-overlay.is-active { opacity: 1; visibility: visible; }

.pma-auth-overlay-box {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0 0 12px;
  color: var(--a-on);
  background: var(--a-brand);
  border-radius: 50%;
  box-shadow: 0 0 0 8px var(--a-dim);
  transform: scale(.6);
  transition: transform .5s cubic-bezier(.3, 1.6, .5, 1);
}

.pma-auth-overlay.is-active .pma-auth-overlay-box { transform: scale(1); }
.pma-auth-overlay-box .pma-i { width: 26px; height: 26px; }
.pma-auth-overlay-box .pma-i-d { display: none; }

.pma-auth-overlay-title { margin: 0; font-size: 16px; font-weight: 800; color: var(--a-ink); }
.pma-auth-overlay-text  { margin: 0 0 14px; font-size: 12.5px; color: var(--a-ink-2); }

.pma-auth-overlay-bar {
  width: 120px;
  height: 3px;
  overflow: hidden;
  background: var(--a-line-2);
  border-radius: 3px;
}

.pma-auth-overlay-bar i {
  display: block;
  width: 40%;
  height: 100%;
  background: var(--a-brand);
  border-radius: 3px;
  animation: pma-a-load 1.1s var(--a-ease) infinite;
}

/* ── Checkout popup ──────────────────────────────────────────────────────── */
.pma-auth-modal {
  position: fixed;
  inset: 0;
  z-index: 100050;
  display: grid;
  place-items: center;
  padding: 16px;
  visibility: hidden;
  pointer-events: none;
}

.pma-auth-modal.is-open { visibility: visible; pointer-events: auto; }

.pma-auth-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20,14,24, .42);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity .3s var(--a-ease);
}

.pma-auth-modal.is-open .pma-auth-modal-backdrop { opacity: 1; }

.pma-auth-modal-dialog {
  position: relative;
  width: min(400px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  border-radius: 5px;
  opacity: 0;
  transform: translateY(14px) scale(.98);
  transition: opacity .3s var(--a-ease), transform .4s var(--a-ease);
}

.pma-auth-modal.is-open .pma-auth-modal-dialog { opacity: 1; transform: none; }

.pma-auth-modal .pma-auth-card {
  width: 100%;
  padding-top: 28px;
  animation: none;
  box-shadow: 0 30px 70px -24px rgba(20,14,24, .45);
}

.pma-auth-modal .pma-auth-modal-close {
  position: absolute;
  top: 12px;
  inset-inline-end: 12px;
  z-index: 6;
  display: grid !important;
  place-items: center;
  width: 32px !important;
  height: 32px !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  color: var(--a-ink-3) !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 5px !important;
  box-shadow: none !important;
  cursor: pointer;
  transition: background-color .2s, color .2s;
}

.pma-auth-modal .pma-auth-modal-close:hover { color: var(--a-ink) !important; background: var(--a-canvas) !important; }
.pma-auth-modal .pma-auth-modal-close svg { width: 16px; height: 16px; }

body.pma-modal-open { overflow: hidden; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 520px) {
  .pma-auth-page {
    align-items: start;
    min-height: 0;
    padding: 28px 16px 40px;
  }

  .pma-auth-card { padding: 26px 20px 18px; border-radius: 5px; }
  .pma-auth-header { margin-bottom: 18px; }
  .pma-auth-logo-link { margin-bottom: 14px; }
  .pma-otp-cells { gap: 6px; }

  /* Popup becomes a bottom sheet – thumb reach, keyboard friendly. */
  .pma-auth-modal { place-items: end center; padding: 0; }

  .pma-auth-modal-dialog {
    width: 100%;
    max-height: 92vh;
    border-radius: 5px 5px 0 0;
    transform: translateY(100%);
  }

  .pma-auth-modal .pma-auth-card {
    padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    border-radius: 5px 5px 0 0;
    border-bottom: 0;
  }

  .pma-auth-modal .pma-auth-card::before {
    top: 8px;
    left: 50%;
    right: auto;
    width: 36px;
    height: 4px;
    background: var(--a-line);
    border-radius: 4px;
    transform: translateX(-50%);
    opacity: 1;
  }
}

@media (max-width: 360px) {
  .pma-auth-card { padding-inline: 16px; }
  .pma-otp-cells span { font-size: 18px; }
}

/* ── Motion ──────────────────────────────────────────────────────────────── */
@keyframes pma-a-rise  { from { opacity: 0; transform: translateY(16px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes pma-a-fade  { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pma-a-step  { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
@keyframes pma-a-pop   { 50% { transform: scale(1.06); } }
@keyframes pma-a-blink { 50% { opacity: 0; } }
@keyframes pma-a-spin  { to { transform: rotate(360deg); } }
@keyframes pma-a-load  { from { transform: translateX(-110%); } to { transform: translateX(260%); } }
@keyframes pma-a-drift {
  from { transform: translate(-54%, -52%) rotate(0deg); }
  to   { transform: translate(-46%, -48%) rotate(25deg); }
}

[dir="ltr"] .pma-auth-step.is-active { animation-name: pma-a-step-ltr; }
@keyframes pma-a-step-ltr { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .pma-auth-page *,
  .pma-auth-modal *,
  .pma-auth-glow {
    animation: none !important;
    transition-duration: .01ms !important;
  }
}
