﻿/* ==========================================================================
   ورود / OTP / ثبت‌نام — الهام از کارت دو ستونه (SMS.ir-style) + سازگاری payment
   ========================================================================== */
:root {
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-soft: rgba(2, 132, 199, 0.1);
  --secondary: #0d9488;
  --accent-gold: #fbbf24;
  --danger: #ef4444;
  --bg-body: #e8edf4;
  --bg-card: #ffffff;
  --text-main: #111827;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --border-color: #d1d5db;
  --radius-pill: 999px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --shadow-card: 0 24px 60px rgba(15, 23, 42, 0.08);
  --font-family: "Vazirmatn", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  font-feature-settings: "ss01" 1;
  -webkit-tap-highlight-color: transparent;
}

body.auth-page {
  background: var(--bg-body);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
}

/* پس‌زمینه (auth + payment) */
.bg-decor {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
}

.decor-1 {
  top: -100px;
  right: -60px;
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(2, 132, 199, 0.2) 0%, transparent 70%);
}

.decor-2 {
  bottom: -120px;
  left: -80px;
  width: 460px;
  height: 460px;
  background: radial-gradient(circle, rgba(13, 148, 136, 0.16) 0%, transparent 70%);
}

/* هدر legacy (صفحات پرداخت) */
.header-bar {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2.5rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-link--logo {
  gap: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-pill);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  background: #fff;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.btn-ghost:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.site-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 1rem 1.5rem 1.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ========== صفحه auth ========== */
.auth-page__main {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem 1rem;
  min-height: calc(100vh - 3rem);
}

.auth-page__footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 0 1rem 1.25rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.auth-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  width: 100%;
  max-width: 1080px;
  min-height: 580px;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(255, 255, 255, 0.85);
  overflow: hidden;
}

.auth-card__panel {
  padding: 2.5rem 2.75rem 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* برند داخل فرم — لوگوی عمودی */
.auth-brand {
  display: block;
  text-decoration: none;
  margin-bottom: 1.35rem;
  margin-inline: auto;
  width: fit-content;
  line-height: 0;
}

.auth-brand .medix-brand-logo--vertical {
  height: auto;
  width: min(210px, 74vw);
  max-width: min(210px, 74vw);
}

.auth-welcome {
  margin-bottom: 1.5rem;
  text-align: center;
}

.auth-welcome__title {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.6;
  margin-bottom: 0.35rem;
}

.auth-welcome__sub {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.85;
}

.auth-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.auth-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.input-group {
  margin-bottom: 1rem;
}

.input-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.input-label--split {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.auth-link-inline {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}

.auth-link-inline:hover {
  text-decoration: underline;
}

.input-control-wrap {
  position: relative;
}

.form-input {
  width: 100%;
  height: 48px;
  padding: 0 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-main);
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  direction: ltr;
  text-align: right;
}

.form-input::placeholder {
  color: var(--text-light);
  font-weight: 400;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.form-input:user-invalid:not(:placeholder-shown),
.form-input.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.input-helper {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.auth-legal {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.9;
  margin: 0.25rem 0 1.1rem;
}

.auth-legal a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

.auth-legal a:hover {
  text-decoration: underline;
}

.auth-terms {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0.25rem 0 1rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.9;
}

.auth-terms input {
  margin-top: 0.35rem;
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.auth-terms a {
  color: var(--primary);
  font-weight: 700;
}

.auth-gender-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.auth-gender-option {
  position: relative;
}

.auth-gender-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.auth-gender-box {
  height: 46px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  background: #fff;
  transition: all 0.2s ease;
  cursor: pointer;
}

.auth-gender-option input:checked + .auth-gender-box {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.btn-submit {
  width: 100%;
  height: 48px;
  margin-top: 0.25rem;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.28);
}

.btn-submit:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.32);
}

.btn-submit:disabled {
  background: #cbd5e1;
  color: #f8fafc;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 48px;
  margin-top: 0.65rem;
  border-radius: var(--radius-pill);
  border: 1px solid #d1d5db;
  background: #f3f4f6;
  color: #4b5563;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn-secondary:hover {
  background: #e5e7eb;
  border-color: #9ca3af;
  color: #374151;
}

.form-footer {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.85;
}

.form-footer a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

.form-footer a:hover {
  text-decoration: underline;
}

.auth-otp-mobile {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.8;
}

.auth-otp-mobile strong {
  color: var(--text-main);
}

.otp-dev-code {
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  background: #fffaeb;
  border: 1px solid #fedf89;
  color: #b54708;
  font-size: 0.88rem;
  text-align: center;
}

.otp-dev-code strong {
  font-size: 1.05rem;
  letter-spacing: 0.12em;
  margin-inline-start: 0.35rem;
}

.otp-inputs {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  direction: ltr;
  margin: 0.35rem 0 0.75rem;
}

.otp-digit {
  width: 48px;
  height: 52px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
  background: #f9fafb;
  transition: all 0.2s ease;
}

.otp-digit:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.otp-resend-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.timer-badge {
  color: var(--secondary);
  font-weight: 700;
  direction: ltr;
}

.resend-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  display: none;
  font-family: inherit;
}

.resend-btn:disabled {
  display: none;
}

.resend-btn.active {
  display: inline-block;
}

/* ========== Showcase (ستون تصویر) ========== */
.auth-showcase {
  position: relative;
  background: linear-gradient(180deg, #7dd3fc 0%, #2563eb 42%, #1e3a8a 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 100%;
  overflow: hidden;
}

.auth-showcase__gallery {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.auth-showcase__figure {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  transition: opacity 0.55s ease;
}

.auth-showcase__figure.is-active {
  opacity: 1;
}

.auth-showcase__figure[hidden] {
  display: none;
}

.auth-showcase__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.auth-showcase__story {
  position: relative;
  z-index: 2;
  margin: 1.25rem;
  padding: 1.1rem 1.15rem 0.85rem;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text-main);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
}

.auth-showcase__slide {
  font-size: 0.82rem;
  line-height: 2;
  color: var(--text-muted);
  min-height: 4.5rem;
}

.auth-showcase__slide[hidden] {
  display: none;
}

.auth-showcase__nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.85rem;
  padding-top: 0.65rem;
  border-top: 1px solid #eef2f7;
}

.auth-showcase__dots {
  display: flex;
  gap: 0.35rem;
}

.auth-showcase__dot {
  width: 22px;
  height: 4px;
  border: none;
  border-radius: var(--radius-pill);
  background: #e5e7eb;
  cursor: pointer;
  padding: 0;
}

.auth-showcase__dot.is-active {
  background: #374151;
}

.auth-showcase__arrows {
  display: flex;
  gap: 0.35rem;
}

.auth-showcase__arrow {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: #f3f4f6;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.auth-showcase__arrow:hover {
  background: #e5e7eb;
  color: var(--text-main);
}

/* Legacy aliases (payment / invite OTP) */
.login-container {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.auth-wrapper {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  width: 100%;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.auth-form-panel {
  padding: 2.5rem 2rem;
  background: #fff;
}

.form-header h2 {
  font-size: 1.45rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
}

.form-header p {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.input-icon {
  display: none;
}

.status-alert.error {
  display: flex;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 0.82rem;
  margin-bottom: 1rem;
}

/* ========== ریسپانسیو ========== */
@media (max-width: 992px) {
  .auth-card {
    grid-template-columns: 1fr;
    max-width: 520px;
    min-height: auto;
  }

  .auth-showcase {
    order: -1;
    min-height: 220px;
    max-height: 38vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }

  .auth-showcase__story {
    display: none;
  }

  .auth-card__panel {
    padding: 2rem 1.75rem 1.75rem;
  }

  .auth-wrapper {
    grid-template-columns: 1fr;
    max-width: 520px;
  }

  .auth-showcase.legacy-showcase {
    display: none;
  }
}

.auth-page--compact .auth-page__main {
  padding: 1rem 0.75rem 0.5rem;
  min-height: 100vh;
  align-items: flex-start;
}

.auth-page--compact .auth-card {
  max-width: 450px;
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.07);
}

.auth-page--compact .auth-showcase {
  min-height: 200px;
  max-height: 34vh;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.auth-page--compact .auth-card__panel {
  padding: 1.5rem 1.25rem 1.25rem;
}

.auth-page--compact .auth-welcome__title {
  font-size: 1.15rem;
}

/* ورود / ثبت‌نام — در viewport کوتاه اسکرول صفحه */
.auth-page--credentials {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
}

.auth-page--credentials .auth-page__main {
  flex: 1 1 auto;
  min-height: auto;
  padding: clamp(0.5rem, 2vh, 1rem) clamp(0.75rem, 2vw, 1.25rem) 0.35rem;
  align-items: center;
}

.auth-page--credentials .auth-page__footer {
  flex-shrink: 0;
  padding-bottom: 0.65rem;
}

.auth-page--credentials .auth-card {
  min-height: 32.5rem;
  max-height: none;
  height: auto;
  align-self: center;
}

.auth-page--credentials .auth-card__panel {
  padding: clamp(1rem, 2.5vh, 1.5rem) clamp(1.25rem, 3vw, 2rem) clamp(0.85rem, 2vh, 1.15rem);
  justify-content: flex-start;
  overflow: visible;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  min-height: 32.5rem;
}

.auth-page--login .auth-form {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

.auth-page--login .form-footer {
  margin-top: auto;
  padding-top: 0.25rem;
}

.auth-page--credentials .auth-brand {
  margin-bottom: clamp(0.5rem, 1.5vh, 0.85rem);
}

.auth-page--credentials .auth-welcome {
  margin-bottom: clamp(0.65rem, 1.8vh, 1rem);
}

.auth-page--credentials .auth-welcome__title {
  font-size: clamp(1.05rem, 2.2vw, 1.2rem);
  line-height: 1.45;
  margin-bottom: 0.2rem;
}

.auth-page--credentials .auth-welcome__sub {
  font-size: clamp(0.78rem, 1.8vw, 0.84rem);
  line-height: 1.55;
}

.auth-page--credentials .input-group {
  margin-bottom: 1rem;
}

.auth-page--credentials .auth-form-row {
  gap: clamp(0.45rem, 1.2vh, 0.6rem);
}

.auth-page--credentials .auth-form-row .input-group {
  margin-bottom: 0;
}

.auth-page--credentials .auth-form-row {
  margin-bottom: 1rem;
}

.auth-page--credentials .form-input {
  height: 48px;
}

.auth-page--credentials .auth-gender-box {
  height: clamp(38px, 5.2vh, 42px);
  font-size: 0.82rem;
}

.auth-page--credentials .auth-gender-grid {
  gap: 0.5rem;
}

.auth-page--credentials .auth-terms {
  margin: 0.15rem 0 clamp(0.45rem, 1.2vh, 0.65rem);
  font-size: 0.72rem;
  line-height: 1.65;
}

.auth-page--credentials .auth-legal {
  font-size: 0.72rem;
  line-height: 1.65;
  margin: 0.1rem 0 clamp(0.45rem, 1.2vh, 0.65rem);
}

.auth-page--credentials .btn-submit {
  height: 48px;
}

.auth-page--credentials .btn-secondary {
  height: clamp(42px, 5.8vh, 46px);
  font-size: 0.88rem;
  margin-top: 1rem;
}

.auth-page--credentials .form-footer {
  margin-top: clamp(0.45rem, 1.2vh, 0.65rem);
  font-size: 0.72rem;
  line-height: 1.6;
}

.auth-page--credentials .status-alert.error {
  margin-bottom: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.78rem;
}

@media (max-width: 992px) {
  .auth-page--credentials .auth-card,
  .auth-page--credentials .auth-card__panel {
    min-height: 0;
  }

  .auth-page--credentials .auth-card__panel {
    padding: clamp(0.85rem, 2vh, 1.15rem) clamp(1rem, 3vw, 1.35rem);
  }

  .auth-page--credentials .auth-showcase {
    min-height: clamp(120px, 22vh, 180px);
    max-height: 22vh;
  }
}

@media (max-width: 520px) {
  .auth-form-row {
    grid-template-columns: 1fr;
  }

  .auth-card__panel {
    padding: 1.75rem 1.25rem;
  }

  .auth-page--credentials .auth-card__panel {
    padding: 0.75rem 1rem 0.85rem;
  }

  .auth-page--credentials.auth-page--compact .auth-showcase {
    min-height: clamp(100px, 18vh, 140px);
    max-height: 18vh;
  }

  .otp-digit {
    width: 42px;
    height: 48px;
    font-size: 1.1rem;
  }

  .header-bar {
    padding: 1rem 1.25rem;
  }
}
