/* ===== Amir SMS OTP Auth - Modern Animated Form ===== */

.amir-otp-wrapper {
  --amir-primary: #6c5ce7;
  --amir-primary-2: #a29bfe;
  --amir-accent: #00cec9;
  --amir-text: #2d3436;
  --amir-muted: #636e72;
  --amir-danger: #d63031;
  --amir-bg: #f5f6fa;
  --amir-card-bg: rgba(255, 255, 255, 0.85);

  width: 100%;
  min-height: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, "IRANSans", "Vazirmatn", sans-serif;
  box-sizing: border-box;
}

.amir-otp-wrapper * {
  box-sizing: border-box;
}

.amir-otp-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--amir-card-bg);
  backdrop-filter: blur(12px);
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(108, 92, 231, 0.18), 0 2px 8px rgba(0,0,0,0.04);
  padding: 40px 32px;
  overflow: hidden;
  animation: amirCardIn 0.6s cubic-bezier(.2,.8,.2,1);
}

@keyframes amirCardIn {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* شکل‌های پس‌زمینه متحرک */
.amir-otp-bg-shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.35;
  z-index: 0;
  animation: amirFloat 8s ease-in-out infinite;
}
.shape-1 {
  width: 140px; height: 140px;
  background: linear-gradient(135deg, var(--amir-primary), var(--amir-primary-2));
  top: -50px; right: -40px;
  animation-delay: 0s;
}
.shape-2 {
  width: 100px; height: 100px;
  background: linear-gradient(135deg, var(--amir-accent), var(--amir-primary-2));
  bottom: -30px; left: -30px;
  animation-delay: 2s;
}
.shape-3 {
  width: 60px; height: 60px;
  background: var(--amir-primary-2);
  bottom: 40%; right: -20px;
  animation-delay: 4s;
}

@keyframes amirFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-16px) rotate(12deg); }
}

@media (prefers-reduced-motion: reduce) {
  .amir-otp-bg-shape, .amir-otp-card { animation: none; }
}

.amir-otp-steps {
  position: relative;
  z-index: 1;
}

.amir-otp-step {
  display: none;
  text-align: center;
  animation: amirStepIn 0.45s cubic-bezier(.2,.8,.2,1);
}

.amir-otp-step-active {
  display: block;
}

@keyframes amirStepIn {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

.amir-otp-icon {
  color: var(--amir-primary);
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
  animation: amirPulse 2.4s ease-in-out infinite;
}

@keyframes amirPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.amir-otp-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--amir-text);
  margin: 4px 0 6px;
}

.amir-otp-subtitle {
  font-size: 14px;
  color: var(--amir-muted);
  margin: 0 0 24px;
  min-height: 18px;
}

/* فیلد ورودی با لیبل شناور */
.amir-otp-field {
  position: relative;
  margin-bottom: 8px;
}

.amir-otp-field input {
  width: 100%;
  padding: 16px 18px;
  font-size: 18px;
  letter-spacing: 1px;
  border: 2px solid #e0e0f0;
  border-radius: 14px;
  outline: none;
  text-align: center;
  direction: ltr;
  background: #fff;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.amir-otp-field input:focus {
  border-color: var(--amir-primary);
  box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.12);
}

.amir-otp-field label {
  position: absolute;
  top: 50%;
  right: 18px;
  transform: translateY(-50%);
  color: #b2b2c4;
  font-size: 15px;
  pointer-events: none;
  transition: all 0.2s ease;
  background: transparent;
}

.amir-otp-field input:focus + label,
.amir-otp-field input:not(:placeholder-shown) + label {
  top: -9px;
  right: 14px;
  font-size: 12px;
  padding: 0 6px;
  background: #fff;
  color: var(--amir-primary);
  transform: translateY(0);
}

/* باکس‌های کد تایید */
.amir-otp-code-inputs {
  display: flex;
  justify-content: center;
  gap: 10px;
  direction: ltr;
  margin-bottom: 8px;
}

.amir-code-box {
  width: 52px;
  height: 60px;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  border: 2px solid #e0e0f0;
  border-radius: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  background: #fff;
}

.amir-code-box:focus {
  border-color: var(--amir-primary);
  box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.12);
  transform: translateY(-2px);
}

.amir-code-box.amir-shake {
  animation: amirShake 0.4s;
  border-color: var(--amir-danger);
}

@keyframes amirShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.amir-otp-error {
  color: var(--amir-danger);
  font-size: 13px;
  min-height: 18px;
  margin-bottom: 12px;
  transition: opacity 0.2s;
}

/* دکمه اصلی */
.amir-otp-btn {
  position: relative;
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--amir-primary), var(--amir-primary-2));
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
  box-shadow: 0 10px 24px rgba(108, 92, 231, 0.3);
}

.amir-otp-btn:hover { transform: translateY(-2px); }
.amir-otp-btn:active { transform: translateY(0); }

.amir-otp-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.amir-otp-btn.amir-loading .amir-otp-btn-text { opacity: 0; }
.amir-otp-btn.amir-loading .amir-otp-spinner { opacity: 1; }

.amir-otp-spinner {
  position: absolute;
  top: 50%; left: 50%;
  width: 20px; height: 20px;
  margin: -10px 0 0 -10px;
  border: 2.5px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  opacity: 0;
  animation: amirSpin 0.7s linear infinite;
}

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

.amir-otp-resend-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
  flex-wrap: wrap;
  gap: 10px;
}

.amir-otp-link {
  background: none;
  border: none;
  color: var(--amir-primary);
  font-size: 13px;
  cursor: pointer;
  padding: 4px;
}

.amir-otp-link:disabled {
  color: #b2b2c4;
  cursor: default;
}

.amir-otp-back { color: var(--amir-muted); }

/* مرحله موفقیت */
.amir-otp-success-check {
  color: #00b894;
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.amir-check-path {
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: amirDraw 0.5s ease forwards 0.15s;
}

@keyframes amirDraw {
  to { stroke-dashoffset: 0; }
}

/* ===== ریسپانسیو ===== */

/* تبلت */
@media (max-width: 768px) {
  .amir-otp-card {
    max-width: 92%;
    padding: 32px 24px;
  }
  .amir-otp-title { font-size: 20px; }
}

/* موبایل */
@media (max-width: 480px) {
  .amir-otp-card {
    max-width: 100%;
    padding: 28px 18px;
    border-radius: 18px;
  }
  .amir-code-box {
    width: 42px;
    height: 52px;
    font-size: 20px;
  }
  .amir-otp-code-inputs { gap: 7px; }
  .shape-1, .shape-2, .shape-3 { display: none; } /* حذف انیمیشن‌های سنگین در موبایل برای کارایی بهتر */
}
