/* ═══════════════════════════════════════════════════════════
   IR CARS SERVICES — AUTHENTICATION DESIGN SYSTEM (v2.0)
   Scoped specifically for Authentication & Onboarding
   Theme: Milky White × Deep Black × Performance Orange
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800;900&display=swap');

:root {
  /* Inherited Tokens from site_v2.css */
  --auth-primary: #f4730f;
  --auth-primary-hover: #d35e08;
  --auth-primary-soft: #fff4ec;
  --auth-primary-border: rgba(244, 115, 15, 0.28);
  --auth-primary-glow: 0 0 0 4px rgba(244, 115, 15, 0.15);

  --auth-bg: #f8f9fa;
  --auth-surface: #ffffff;
  --auth-surface-muted: #f4f5f7;

  --auth-text-title: #0f172a;
  --auth-text-body: #334155;
  --auth-text-muted: #64748b;
  --auth-text-light: #94a3b8;

  --auth-border-subtle: #e2e8f0;
  --auth-border-hover: #cbd5e1;
  --auth-border-focus: #f4730f;

  --auth-danger: #ef4444;
  --auth-danger-soft: #fef2f2;
  --auth-danger-border: rgba(239, 68, 68, 0.2);

  --auth-success: #10b981;
  --auth-success-soft: #ecfdf5;
  --auth-success-border: rgba(16, 185, 129, 0.2);

  --auth-radius-sm: 8px;
  --auth-radius-md: 12px;
  --auth-radius-lg: 18px;
  --auth-radius-xl: 24px;
  --auth-radius-pill: 9999px;

  --auth-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --auth-shadow-card: 0 12px 40px -10px rgba(15, 23, 42, 0.08), 0 2px 8px rgba(15, 23, 42, 0.04);
  --auth-shadow-btn: 0 4px 14px rgba(244, 115, 15, 0.3);
  --auth-shadow-btn-hover: 0 6px 20px rgba(244, 115, 15, 0.4);

  --auth-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --auth-transition: all 0.2s var(--auth-ease);
}

/* ═══════════════════════════════════════════════════════════
   GLOBAL & LAYOUT
   ═══════════════════════════════════════════════════════════ */
body.auth-body {
  font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(circle at 50% 0%, rgba(244, 115, 15, 0.05) 0%, transparent 60%),
              linear-gradient(180deg, #f8f9fa 0%, #edf1f5 100%);
  color: var(--auth-text-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin: 0;
  padding: 24px 16px;
  direction: rtl;
  text-align: right;
  -webkit-font-smoothing: antialiased;
}

.auth-container {
  width: 100%;
  max-width: 460px;
  margin: auto;
}

.auth-container.auth-container-wide {
  max-width: 520px;
}

/* ═══════════════════════════════════════════════════════════
   AUTH CARD
   ═══════════════════════════════════════════════════════════ */
.auth-card {
  background: var(--auth-surface);
  border: 1px solid var(--auth-border-subtle);
  border-radius: var(--auth-radius-xl);
  box-shadow: var(--auth-shadow-card);
  padding: 36px 32px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(16px);
  transition: var(--auth-transition);
}

@media (max-width: 576px) {
  .auth-card {
    padding: 28px 20px;
    border-radius: var(--auth-radius-lg);
  }
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #f4730f, #ff8a3d, #f4730f);
}

/* ═══════════════════════════════════════════════════════════
   HEADER & BRANDING
   ═══════════════════════════════════════════════════════════ */
.auth-header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  margin-bottom: 16px;
  transition: transform 0.2s ease;
}

.auth-logo-link:hover {
  transform: scale(1.03);
}

.auth-logo-badge {
  width: 52px;
  height: 52px;
  border-radius: var(--auth-radius-md);
  background: linear-gradient(135deg, var(--auth-primary), var(--auth-primary-hover));
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: var(--auth-shadow-btn);
}

.auth-logo-text {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--auth-text-title);
  letter-spacing: -0.5px;
}

.auth-logo-text span {
  color: var(--auth-primary);
}

.auth-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--auth-text-title);
  margin-bottom: 6px;
}

.auth-subtitle {
  font-size: 0.92rem;
  color: var(--auth-text-muted);
  margin-bottom: 0;
  line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════
   ROLE SELECTOR CARDS
   ═══════════════════════════════════════════════════════════ */
.auth-role-group {
  margin-bottom: 24px;
}

.auth-role-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--auth-text-title);
  margin-bottom: 10px;
  display: block;
}

.auth-role-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.auth-role-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 14px 8px;
  background: var(--auth-surface-muted);
  border: 2px solid transparent;
  border-radius: var(--auth-radius-md);
  cursor: pointer;
  text-decoration: none;
  color: var(--auth-text-body);
  transition: var(--auth-transition);
  user-select: none;
}

.auth-role-card:hover {
  background: var(--auth-surface);
  border-color: var(--auth-border-hover);
  transform: translateY(-2px);
  color: var(--auth-primary);
}

.auth-role-card.active {
  background: var(--auth-primary-soft);
  border-color: var(--auth-primary);
  color: var(--auth-primary-hover);
  box-shadow: 0 4px 12px rgba(244, 115, 15, 0.12);
}

.auth-role-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.auth-role-icon {
  font-size: 1.4rem;
  margin-bottom: 6px;
  display: inline-flex;
}

.auth-role-name {
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.3;
}

/* ═══════════════════════════════════════════════════════════
   SEGMENTED TABS
   ═══════════════════════════════════════════════════════════ */
.auth-tabs {
  display: flex;
  background: var(--auth-surface-muted);
  border-radius: var(--auth-radius-md);
  padding: 4px;
  margin-bottom: 24px;
  gap: 4px;
}

.auth-tab-item {
  flex: 1;
  text-align: center;
  padding: 10px 14px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--auth-text-muted);
  border-radius: var(--auth-radius-sm);
  text-decoration: none;
  transition: var(--auth-transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.auth-tab-item:hover {
  color: var(--auth-text-title);
}

.auth-tab-item.active {
  background: var(--auth-surface);
  color: var(--auth-primary);
  box-shadow: var(--auth-shadow-sm);
}

/* ═══════════════════════════════════════════════════════════
   FORM FIELDS & INPUTS
   ═══════════════════════════════════════════════════════════ */
.auth-form-group {
  margin-bottom: 20px;
  position: relative;
}

.auth-form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--auth-text-title);
  margin-bottom: 8px;
}

.auth-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--auth-surface);
  border: 1.5px solid var(--auth-border-subtle);
  border-radius: var(--auth-radius-md);
  transition: var(--auth-transition);
  overflow: hidden;
}

.auth-input-wrapper:focus-within {
  border-color: var(--auth-primary);
  box-shadow: var(--auth-primary-glow);
}

.auth-input-wrapper.is-invalid {
  border-color: var(--auth-danger) !important;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15) !important;
}

.auth-input-addon {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  color: var(--auth-text-muted);
  font-size: 1.1rem;
  background: transparent;
  user-select: none;
}

.auth-input-addon.country-code {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--auth-text-title);
  border-right: 1px solid var(--auth-border-subtle);
  direction: ltr;
  gap: 6px;
}

.auth-input-addon.country-code .flag-icon {
  font-size: 1.1rem;
}

.auth-input {
  width: 100%;
  height: 48px;
  border: none;
  background: transparent;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.98rem;
  color: var(--auth-text-title);
  outline: none;
  font-weight: 600;
}

.auth-input::placeholder {
  color: var(--auth-text-light);
  font-weight: 400;
}

.auth-input[type="password"] {
  letter-spacing: 2px;
}

.auth-input-btn {
  background: transparent;
  border: none;
  color: var(--auth-text-muted);
  padding: 0 14px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.2s ease;
}

.auth-input-btn:hover {
  color: var(--auth-text-title);
}

.auth-field-error {
  font-size: 0.82rem;
  color: var(--auth-danger);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════
   OTP INPUT DIGIT BOXES
   ═══════════════════════════════════════════════════════════ */
.otp-container {
  margin: 28px 0;
}

.otp-box-wrapper {
  display: flex;
  justify-content: center;
  gap: 12px;
  direction: ltr;
}

.otp-digit-input {
  width: 62px;
  height: 64px;
  text-align: center;
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--auth-text-title);
  background: var(--auth-surface);
  border: 2px solid var(--auth-border-subtle);
  border-radius: var(--auth-radius-md);
  outline: none;
  transition: var(--auth-transition);
  box-shadow: var(--auth-shadow-sm);
}

@media (max-width: 480px) {
  .otp-digit-input {
    width: 52px;
    height: 56px;
    font-size: 1.5rem;
    gap: 8px;
  }
}

.otp-digit-input:focus {
  border-color: var(--auth-primary);
  box-shadow: var(--auth-primary-glow);
  transform: translateY(-2px);
}

.otp-digit-input.is-invalid {
  border-color: var(--auth-danger);
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15);
  animation: authShake 0.4s ease;
}

@keyframes authShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

/* ═══════════════════════════════════════════════════════════
   COUNTDOWN & RESEND WIDGET
   ═══════════════════════════════════════════════════════════ */
.auth-otp-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 0 24px;
  font-size: 0.88rem;
}

.auth-timer-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--auth-text-muted);
  background: var(--auth-surface-muted);
  padding: 6px 14px;
  border-radius: var(--auth-radius-pill);
  font-weight: 600;
}

.auth-timer-badge .timer-val {
  font-weight: 800;
  color: var(--auth-primary);
  direction: ltr;
  display: inline-block;
}

.auth-resend-link {
  color: var(--auth-primary);
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s ease;
}

.auth-resend-link:hover {
  color: var(--auth-primary-hover);
  text-decoration: underline;
}

.auth-resend-link.disabled {
  color: var(--auth-text-light);
  pointer-events: none;
  text-decoration: none;
}

.auth-phone-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--auth-surface-muted);
  border: 1px solid var(--auth-border-subtle);
  border-radius: var(--auth-radius-pill);
  padding: 6px 16px;
  font-size: 0.9rem;
  color: var(--auth-text-title);
  font-weight: 700;
  margin-bottom: 20px;
}

.auth-phone-badge a {
  color: var(--auth-primary);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 6px;
}

.auth-phone-badge a:hover {
  text-decoration: underline;
}

/* ═══════════════════════════════════════════════════════════
   PASSWORD STRENGTH METER
   ═══════════════════════════════════════════════════════════ */
.auth-pwd-meter {
  background: var(--auth-surface-muted);
  border-radius: var(--auth-radius-md);
  padding: 14px 16px;
  margin-top: 12px;
  margin-bottom: 20px;
}

.auth-pwd-rules {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  list-style: none;
  padding: 0;
  margin: 0;
}

@media (max-width: 480px) {
  .auth-pwd-rules {
    grid-template-columns: 1fr;
  }
}

.auth-pwd-rule {
  font-size: 0.82rem;
  color: var(--auth-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  transition: color 0.2s ease;
}

.auth-pwd-rule i {
  font-size: 0.9rem;
}

.auth-pwd-rule.valid {
  color: var(--auth-success);
}

.auth-pwd-rule.invalid {
  color: var(--auth-text-light);
}

/* ═══════════════════════════════════════════════════════════
   BUTTONS & CTAs
   ═══════════════════════════════════════════════════════════ */
.auth-btn-primary {
  width: 100%;
  height: 50px;
  background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-primary-hover) 100%);
  color: #ffffff;
  border: none;
  border-radius: var(--auth-radius-md);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: var(--auth-shadow-btn);
  transition: var(--auth-transition);
  text-decoration: none;
}

.auth-btn-primary:hover {
  background: linear-gradient(135deg, var(--auth-primary-hover) 0%, #b34a04 100%);
  box-shadow: var(--auth-shadow-btn-hover);
  transform: translateY(-1px);
  color: #ffffff;
}

.auth-btn-primary:active {
  transform: translateY(1px);
  box-shadow: var(--auth-shadow-sm);
}

.auth-btn-primary:disabled,
.auth-btn-primary.loading {
  background: #cbd5e1;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.auth-btn-spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: authSpin 0.7s linear infinite;
}

.auth-btn-primary.loading .auth-btn-spinner {
  display: inline-block;
}

.auth-btn-primary.loading .auth-btn-text-content {
  display: none;
}

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

.auth-btn-secondary {
  width: 100%;
  height: 48px;
  background: transparent;
  color: var(--auth-text-body);
  border: 1.5px solid var(--auth-border-subtle);
  border-radius: var(--auth-radius-md);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--auth-transition);
  text-decoration: none;
}

.auth-btn-secondary:hover {
  background: var(--auth-surface-muted);
  border-color: var(--auth-border-hover);
  color: var(--auth-primary);
}

/* ═══════════════════════════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════════════════════════ */
.auth-alert {
  padding: 12px 16px;
  border-radius: var(--auth-radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: authFadeIn 0.3s ease;
}

.auth-alert-danger {
  background: var(--auth-danger-soft);
  color: #b91c1c;
  border: 1px solid var(--auth-danger-border);
}

.auth-alert-success {
  background: var(--auth-success-soft);
  color: #047857;
  border: 1px solid var(--auth-success-border);
}

@keyframes authFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════════
   FOOTER & COMPLIANCE
   ═══════════════════════════════════════════════════════════ */
.auth-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--auth-text-muted);
}

.auth-footer-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--auth-border-subtle);
}

.auth-footer-link {
  color: var(--auth-primary);
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s ease;
}

.auth-footer-link:hover {
  color: var(--auth-primary-hover);
  text-decoration: underline;
}

.auth-terms-text {
  font-size: 0.78rem;
  color: var(--auth-text-light);
  margin-top: 16px;
  line-height: 1.6;
}

.auth-terms-text a {
  color: var(--auth-text-muted);
  text-decoration: underline;
}

.auth-terms-text a:hover {
  color: var(--auth-primary);
}

/* ═══════════════════════════════════════════════════════════
   ACCESSIBILITY & REDUCED MOTION
   ═══════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

:focus-visible {
  outline: 3px solid rgba(244, 115, 15, 0.4);
  outline-offset: 2px;
}
