/* "Check your email" page with the 6-digit code, in the Asmeli "bold" look
 * (Bold-Login OTP design approved 27 Nov 2026): deep blue page, the customer's logo tile
 * and name above a frosted white card; inside the card a blue envelope tile, a large title,
 * the email in a pill, six rounded boxes (left to right), a glowing confirm button and a
 * short «کد نرسید؟ دوباره بفرست» line with a countdown. lite-mode.css still removes blur.
 */

body:has(.check-email-panel) {
  background:
    radial-gradient(260px 260px at 100% 0%, rgba(110, 149, 242, 0.7), rgba(110, 149, 242, 0) 70%),
    radial-gradient(300px 300px at 0% 100%, rgba(232, 194, 106, 0.4), rgba(232, 194, 106, 0) 70%),
    linear-gradient(170deg, var(--as-primary-active, #12245c) 0%, var(--as-primary, #2341a0) 38%, #6e95f2 75%, #cfddff 100%) !important;
  background-attachment: scroll !important;
  min-height: 100vh;
}

.check-email-screen {
  margin: 0 auto;
  max-width: 420px;
  padding: 28px 0 24px;
}

/* The customer's logo tile and name, white on the blue page. */
.check-email-brand {
  align-items: center;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 22px;
  text-align: center;
}

.check-email-logo {
  background: linear-gradient(145deg, #ffffff, #c8d9fe);
  border-radius: 22px;
  box-shadow: 0 18px 36px -10px rgba(0, 0, 0, 0.5);
  display: grid;
  height: 72px;
  place-items: center;
  width: 72px;
}

.check-email-logo img {
  height: 46px;
  object-fit: contain;
  width: 46px;
}

.check-email-brand strong {
  color: #ffffff;
  font-size: 22px;
  font-weight: 800;
}

body:has(.check-email-panel) .check-email-panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.86)) !important;
  border: 1px solid #ffffff !important;
  border-radius: 32px !important;
  box-shadow: 0 30px 70px -18px rgba(5, 15, 50, 0.65), inset 0 1px 0 #ffffff !important;
  margin-inline: auto;
  max-width: 420px;
  padding: 28px 22px 22px !important;
  text-align: center;
}

.check-email-icon {
  background: linear-gradient(145deg, #3b63e0, #1b337b);
  border-radius: 18px;
  box-shadow: 0 12px 24px -8px rgba(35, 65, 160, 0.7);
  color: #ffffff;
  display: grid;
  height: 56px;
  margin: 0 auto 12px;
  place-items: center;
  width: 56px;
}

body:has(.check-email-panel) .check-email-title {
  color: var(--as-text, #10192b) !important;
  font-size: 22px !important;
  font-weight: 800 !important;
  margin: 0 0 6px !important;
}

.check-email-lead {
  color: var(--as-text-muted, #4a5468);
  font-size: 15px;
  line-height: 1.8;
  margin: 0 0 18px;
}

.check-email-lead strong {
  background: var(--as-primary-subtle, #e3ecff);
  border-radius: 8px;
  color: var(--as-text, #10192b);
  display: inline-block;
  font-family: "Inter", system-ui, sans-serif;
  font-weight: 600;
  overflow-wrap: anywhere;
  padding: 1px 8px;
}

.check-email-panel .otp-form {
  display: grid;
  gap: 18px;
  margin: 0;
}

.check-email-panel .otp-form[hidden] {
  display: none;
}

.check-email-panel .otp-boxes {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.check-email-panel .otp-box {
  background: #ffffff;
  border: 1px solid #c0c8d6;
  border-radius: 14px;
  box-shadow: inset 0 1px 2px rgba(16, 40, 120, 0.08);
  color: var(--as-text, #10192b);
  font: 700 22px "Inter", system-ui, sans-serif;
  height: 56px;
  padding: 0;
  text-align: center;
  width: 44px;
}

.check-email-panel .otp-box:focus {
  border: 2px solid var(--as-primary, #2341a0);
  box-shadow: 0 0 0 5px rgba(35, 65, 160, 0.16);
  outline: none;
}

/* Confirm button: always the glowing blue; until six digits are in, a softer blue. */
body:has(.check-email-panel) .check-email-panel .primary-button {
  align-items: center;
  background: linear-gradient(180deg, #3b63e0, var(--as-primary, #2341a0)) !important;
  border: 0 !important;
  border-radius: 18px !important;
  box-shadow: 0 16px 30px -10px rgba(35, 65, 160, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
  color: #ffffff !important;
  display: flex;
  font-size: 17px;
  font-weight: 800;
  justify-content: center;
  min-height: 52px;
  width: 100%;
}

body:has(.check-email-panel) .check-email-panel .primary-button:disabled {
  box-shadow: none !important;
  cursor: default;
  opacity: 0.5;
}

.check-email-resend {
  align-items: center;
  color: var(--as-text-muted, #4a5468);
  display: flex;
  flex-wrap: wrap;
  font-size: 14px;
  gap: 4px;
  justify-content: center;
  margin: 12px 0 0;
}

.check-email-resend[hidden] {
  display: none;
}

.check-email-resend-button {
  background: none;
  border: 0;
  color: var(--as-primary, #2341a0);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  min-height: 44px;
  padding: 0 4px;
}

.check-email-resend-button:disabled {
  color: var(--as-text-subtle, #778093);
  cursor: default;
}

.check-email-timer {
  font-family: "Inter", system-ui, sans-serif;
  font-weight: 600;
}

.check-email-panel .form-message:empty {
  display: none;
}

.check-email-back {
  color: var(--as-primary, #2341a0);
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  font-weight: 700;
  min-height: 44px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* After the code is confirmed the way back becomes the main «ورود» button. */
body:has(.check-email-panel) .check-email-panel .check-email-signin {
  margin-top: 10px;
  text-decoration: none;
}

.check-email-screen > .powered-by {
  color: #12172b;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 12px;
  margin: 18px 0 0;
  opacity: 0.8;
  text-align: center;
}

/* ---- Motion -------------------------------------------------------------------------
 * Quiet and short: the card rises in, the logo and envelope follow, the six boxes appear
 * one after another, a box pulses as its digit arrives, a wrong code shakes the row once,
 * and a confirmed code turns the envelope into a green tick. Nothing loops.
 * Off for «reduce motion» and in lite mode (weak phones).
 */
@keyframes check-email-rise {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@keyframes check-email-pop {
  0% { opacity: 0; transform: scale(0.6); }
  70% { opacity: 1; transform: scale(1.06); }
  100% { opacity: 1; transform: none; }
}

@keyframes check-email-send {
  0% { transform: translate(-6px, 6px) rotate(-8deg); opacity: 0; }
  60% { transform: translate(2px, -2px) rotate(3deg); opacity: 1; }
  100% { transform: none; opacity: 1; }
}

@keyframes check-email-box-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes check-email-box-pulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.1); border-color: var(--as-primary, #2341a0); }
  100% { transform: scale(1); }
}

@keyframes check-email-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(3px); }
}

@keyframes check-email-tick {
  from { stroke-dashoffset: 24; }
  to { stroke-dashoffset: 0; }
}

@media (prefers-reduced-motion: no-preference) {
  html:not(.as-lite) .check-email-brand {
    animation: check-email-rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  }

  html:not(.as-lite) .check-email-logo {
    animation: check-email-pop 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) 0.05s both;
  }

  html:not(.as-lite) .check-email-panel {
    animation: check-email-rise 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) 0.12s both;
  }

  html:not(.as-lite) .check-email-icon > svg {
    animation: check-email-send 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) 0.4s both;
  }

  html:not(.as-lite) .check-email-panel .otp-box {
    animation: check-email-box-in 0.35s ease-out both;
  }

  html:not(.as-lite) .check-email-panel .otp-box:nth-child(1) { animation-delay: 0.45s; }
  html:not(.as-lite) .check-email-panel .otp-box:nth-child(2) { animation-delay: 0.5s; }
  html:not(.as-lite) .check-email-panel .otp-box:nth-child(3) { animation-delay: 0.55s; }
  html:not(.as-lite) .check-email-panel .otp-box:nth-child(4) { animation-delay: 0.6s; }
  html:not(.as-lite) .check-email-panel .otp-box:nth-child(5) { animation-delay: 0.65s; }
  html:not(.as-lite) .check-email-panel .otp-box:nth-child(6) { animation-delay: 0.7s; }

  html:not(.as-lite) .check-email-panel .otp-box.is-filled {
    animation: check-email-box-pulse 0.25s ease-out;
  }

  html:not(.as-lite) .check-email-panel .otp-boxes.is-wrong {
    animation: check-email-shake 0.42s ease-in-out;
  }

  html:not(.as-lite) .check-email-panel .primary-button {
    transition: opacity 0.25s ease, box-shadow 0.25s ease, transform 0.15s ease;
  }

  html:not(.as-lite) .check-email-panel .primary-button:not(:disabled):active {
    transform: scale(0.98);
  }

  html:not(.as-lite) .check-email-icon {
    transition: background 0.35s ease, box-shadow 0.35s ease, transform 0.35s ease;
  }

  html:not(.as-lite) .check-email-icon.is-done {
    animation: check-email-pop 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  }

  html:not(.as-lite) .check-email-icon.is-done .check-email-tick {
    animation: check-email-tick 0.45s ease-out 0.15s both;
    stroke-dasharray: 24;
  }
}

/* Confirmed: green tile (with or without motion). */
.check-email-icon.is-done {
  background: linear-gradient(145deg, #2fb171, #15804d);
  box-shadow: 0 12px 24px -8px rgba(21, 128, 77, 0.6);
}
