/* ═══════════════════════════════════════════
   Auth Modal Styles — Tesmino Academy
   Based on Figma design
═══════════════════════════════════════════ */

.auth-body {
  background: var(--color-bg);
  min-height: 100vh;
}

/* ─── Modal Overlay ───────────────────────── */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 0;
}

.auth-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* Desktop: center modal */
@media (min-width: 768px) {
  .auth-overlay {
    align-items: center;
  }
}

/* ─── Modal Sheet ─────────────────────────── */
.auth-modal {
  width: 100%;
  max-width: 100%;
  background: white;
  border-radius: 24px 24px 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0px -8px 32px rgba(0,0,0,0.12);
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
  position: relative;
  max-height: 92vh;
  overflow-y: auto;
}

/* drag handle */
.auth-modal::before {
  content: '';
  display: block;
  width: 36px;
  height: 4px;
  background: #e4e4e7;
  border-radius: 2px;
  margin: 12px auto 0;
  flex-shrink: 0;
}

.auth-overlay.open .auth-modal {
  transform: translateY(0);
}

/* Desktop: centered modal */
@media (min-width: 600px) {
  .auth-overlay {
    align-items: center;
    padding: 20px;
  }
  .auth-modal {
    border-radius: 24px;
    max-width: 420px;
    max-height: 90vh;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    transform: translateY(20px) scale(0.97);
  }
  .auth-modal::before { display: none; }
  .auth-overlay.open .auth-modal {
    transform: translateY(0) scale(1);
  }
}

/* ─── Modal Head ──────────────────────────── */
.auth-head {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 24px;
  background: linear-gradient(to bottom, white 77.75%, rgba(255,255,255,0));
  flex-shrink: 0;
}

/* Pattern background */
.auth-pattern {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 177px;
  overflow: hidden;
  pointer-events: none;
}

.auth-pattern-fade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(255,255,255,0) 49.718%, white);
}

/* Decorative squares */
.auth-deco {
  position: absolute;
  width: 43px; height: 43px;
  background: linear-gradient(to top, rgba(244,244,245,0.8) 80%, white);
}

.auth-deco-1 { top: 43px; left: 261px; }
.auth-deco-2 { top: 0;    left: 87px; }
.auth-deco-3 { top: 130px; left: 44px; opacity: 0.5; }

/* Close button */
.auth-close {
  position: absolute;
  top: 15px; left: 16px;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: none;
  cursor: pointer; border-radius: 12px;
  color: #91A0C3;
  transition: background 0.15s;
  z-index: 2;
}
.auth-close:hover { background: var(--color-bg); }

/* Logo icon box */
.auth-logo-box {
  position: relative; z-index: 1;
  width: 64px; height: 64px;
  display: flex; align-items: center; justify-content: center;
}

/* Phone icon box (step 2) */
.auth-phone-box {
  position: relative; z-index: 1;
  border: 1px solid #d3d9e7;
  border-radius: 12px;
  padding: 12px;
  background: white;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05), inset 0 -4px 0 #f2f4fb;
  display: flex; align-items: center; justify-content: center;
}

/* Title */
.auth-title {
  font-size: 20px;
  font-weight: 700;
  color: #283249;
  text-align: center;
  line-height: 1.5;
  position: relative; z-index: 1;
}
.auth-title span { color: #E71838; }

.auth-subtitle {
  font-size: 16px;
  color: #485A83;
  text-align: center;
  line-height: 1.5;
  max-width: 300px;
  position: relative; z-index: 1;
}

/* ─── Modal Body ──────────────────────────── */
.auth-body-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: flex-end;
  padding: 24px 24px 0;
  flex-shrink: 0;
}

/* Input field */
.auth-field-label {
  font-size: 14px;
  font-weight: 600;
  color: #283249;
  text-align: right;
  width: 100%;
  margin-bottom: 8px;
  display: block;
}

.auth-input-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px;
  border: 1px solid #e4e4e7;
  border-radius: 12px;
  background: white;
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-input-wrap:focus-within {
  border-color: #283249;
  box-shadow: 0 0 0 3px rgba(40,50,73,0.08);
}

.auth-input-wrap.error {
  border-color: #E71838;
  box-shadow: 0 0 0 3px rgba(231,24,56,0.08);
}

.auth-input {
  flex: 1;
  font-size: 14px;
  font-family: var(--font-num);
  color: #283249;
  text-align: right;
  direction: rtl;
  border: none;
  outline: none;
  background: transparent;
  min-width: 0;
}

.auth-input::placeholder { color: #91A0C3; }

.auth-input-icon {
  color: #91A0C3;
  flex-shrink: 0;
  width: 20px; height: 20px;
}

/* Error text */
.auth-error {
  display: none;
  font-size: 13px;
  color: #E71838;
  text-align: right;
  width: 100%;
  margin-top: -12px;
}
.auth-error.show { display: block; }

/* ─── OTP Inputs ──────────────────────────── */
.auth-otp-wrap {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  padding: 24px 24px 0;
}

.otp-boxes {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  direction: ltr;
}

.otp-box {
  width: 48px;
  height: 48px;
  border: 1.5px solid #e4e4e7;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-num);
  color: #283249;
  text-align: center;
  background: white;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  caret-color: #E71838;
}

.otp-box:focus {
  border-color: #283249;
  box-shadow: 0 0 0 3px rgba(40,50,73,0.08);
}

.otp-box.filled {
  border-color: #283249;
  background: white;
}

.otp-box.error {
  border-color: #E71838;
  animation: shake 0.4s ease;
}

.auth-change-phone {
  font-size: 14px;
  color: #657AAA;
  text-align: right;
  width: 100%;
  line-height: 1.5;
}

.auth-change-phone a {
  color: #283249;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

/* ─── Modal Footer ────────────────────────── */
.auth-footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 24px 32px;
  flex-shrink: 0;
}

/* Primary button */
.auth-btn-primary {
  width: 100%;
  padding: 13px 24px;
  background: #E71838;
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-base);
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  text-align: center;
}

.auth-btn-primary:hover { background: #C8152F; }
.auth-btn-primary:active { transform: scale(0.99); }
.auth-btn-primary:disabled {
  background: #A7B3CF;
  cursor: not-allowed;
  transform: none;
}

/* Secondary button */
.auth-btn-secondary {
  width: 100%;
  padding: 13px 24px;
  background: white;
  color: #283249;
  border: 1px solid #e4e4e7;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-base);
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}

.auth-btn-secondary:hover { background: #f8f9fc; }

.auth-btn-secondary:disabled {
  color: #A7B3CF;
  cursor: not-allowed;
}

/* Resend timer */
.auth-resend-timer {
  color: #A7B3CF;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-num);
}

/* Divider with "یا" */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.auth-divider-line {
  flex: 1;
  height: 1px;
  background: #e4e4e7;
}

.auth-divider-text {
  font-size: 14px;
  font-weight: 600;
  color: #283249;
  flex-shrink: 0;
}

/* Terms */
.auth-terms {
  font-size: 14px;
  color: #485A83;
  text-align: center;
  line-height: 1.6;
}

.auth-terms a {
  color: #4176f5;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ─── Animations ──────────────────────────── */
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(6px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}

@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.auth-step { animation: slideUp 0.25s ease both; }