/* صفحة OTP الثانية — تصميم مستقل عن otp.css */

:root {
  --otp2-blue: #1f62ae;
  --otp2-blue-dark: #0d2b5d;
  --otp2-heading: #2d2d2d;
  --otp2-muted: #6b7280;
  --otp2-cell-border: #6b7280;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body.otp2-page {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: Tahoma, "Segoe UI", Arial, sans-serif;
  background: #fff;
  color: var(--otp2-heading);
}

.otp2-topbar {
  flex-shrink: 0;
  width: 100%;
  padding: 14px 16px;
  text-align: center;
  font-size: clamp(15px, 3.8vw, 18px);
  font-weight: 700;
  color: #fff;
  background: var(--otp2-blue);
  line-height: 1.4;
}

.otp2-main {
  flex: 1;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: clamp(24px, 6vw, 36px) clamp(18px, 5vw, 24px) clamp(20px, 5vw, 28px);
  text-align: right;
}

.otp2-heading {
  margin: 0 0 14px;
  font-size: clamp(1.15rem, 4.2vw, 1.45rem);
  font-weight: 800;
  color: var(--otp2-heading);
  line-height: 1.35;
}

.otp2-lead {
  margin: 0 0 clamp(22px, 5vw, 32px);
  font-size: clamp(0.88rem, 3.2vw, 1rem);
  line-height: 1.65;
  color: var(--otp2-muted);
}

.otp2-cells-wrap {
  direction: ltr;
  display: flex;
  justify-content: center;
  gap: clamp(6px, 2vw, 10px);
  margin-bottom: clamp(28px, 8vw, 40px);
  flex-wrap: nowrap;
}

.otp2-cell {
  width: clamp(42px, 12vw, 52px);
  height: clamp(48px, 13vw, 56px);
  border: 2px solid var(--otp2-cell-border);
  border-radius: 12px;
  background: #fff;
  font-size: clamp(1.25rem, 5vw, 1.5rem);
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
  padding: 0;
  color: var(--otp2-heading);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.otp2-cell:focus {
  outline: none;
  border-color: var(--otp2-blue);
  box-shadow: 0 0 0 2px rgba(31, 98, 174, 0.25);
}

.otp2-cell::placeholder {
  color: #cbd5e1;
}

/* حقل مخفي يحتفظ بالقيمة لنفس منطق الإرسال السابق */
.otp2-hidden-code {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.otp2-footer {
  flex-shrink: 0;
  padding: 12px clamp(16px, 4vw, 20px) max(16px, env(safe-area-inset-bottom));
}

.otp2-submit {
  width: 100%;
  min-height: 52px;
  padding: 14px 16px;
  border: none;
  border-radius: 12px;
  background: var(--otp2-blue);
  color: #fff;
  font-size: clamp(0.95rem, 3.5vw, 1.05rem);
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.35;
  box-shadow: 0 4px 14px rgba(31, 98, 174, 0.35);
  transition: background 0.15s, transform 0.1s;
}

.otp2-submit:hover {
  background: var(--otp2-blue-dark);
}

.otp2-submit:active {
  transform: scale(0.99);
}

/* طبقة التحميل (نفس السلوك السابق) */
.otp-full-loading {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.55);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.otp-full-loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  max-width: 90vw;
  text-align: center;
}

.otp-full-loading-spinner {
  width: 52px;
  height: 52px;
  border: 4px solid rgba(255, 255, 255, 0.35);
  border-top-color: var(--otp2-blue);
  border-radius: 50%;
  animation: otpFullLoadSpin 0.85s linear infinite;
}

@keyframes otpFullLoadSpin {
  to {
    transform: rotate(360deg);
  }
}

.otp-loading-message {
  margin: 0;
  color: #fff;
  font-size: clamp(16px, 4vw, 20px);
  line-height: 1.5;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

@media (min-width: 480px) {
  .otp2-cells-wrap {
    gap: 12px;
  }
}
