/* =========================================================
   ArmanSaaS - Authentication Pages Stylesheet
   Author: ArmanSaaS Frontend Team
   Notes: RTL-first design system for Persian SaaS product
   ========================================================= */

/* ---------- Font (Vazirmatn via CDN, loaded from <head>) ---------- */

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

/* ---------- Design Tokens ---------- */
:root {
  --color-primary: #0d9488;
  --color-primary-dark: #0f766e;
  --color-primary-light: #5eead4;
  --color-accent: #d4a017;
  --color-navy: #14213d;
  --color-navy-2: #0f3d3e;

  --color-error: #dc2626;
  --color-error-bg: #fef2f2;
  --color-error-border: #fca5a5;

  --color-success: #16a34a;
  --color-success-bg: #f0fdf4;
  --color-success-border: #86efac;

  --color-text: #1f2937;
  --color-text-muted: #6b7280;
  --color-text-faint: #9ca3af;
  --color-border: #e5e7eb;
  --color-bg: #ffffff;
  --color-bg-soft: #f9fafb;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 999px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 6px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 24px 48px rgba(15, 23, 42, 0.16);

  --transition-fast: all 0.15s ease;
  --transition: all 0.25s ease;

  --font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
}

body {
  font-family: var(--font-family);
  color: var(--color-text);
  background: var(--color-bg-soft);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input {
  font-family: inherit;
}

ul {
  list-style: none;
}

svg {
  display: block;
}

/* ---------- Layout: Split Screen ----------
   NOTE: The page direction is RTL (Persian). However the spec requires a
   FIXED physical layout: branding always on the LEFT, form always on the
   RIGHT, regardless of text direction. CSS Grid/Flex column order follows
   the `direction` property, so we force `direction: ltr` on the grid
   container to lock physical placement, then re-apply `direction: rtl`
   on each panel so all Persian content inside still flows correctly. */
.auth-wrapper {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  direction: ltr;
}

.auth-branding,
.auth-form-panel {
  direction: rtl;
}

/* ===================== LEFT: BRANDING PANEL ===================== */
.auth-branding {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3rem 3.25rem;
  color: #ffffff;
  background: linear-gradient(150deg, var(--color-navy) 0%, var(--color-navy-2) 45%, var(--color-primary) 100%);
  isolation: isolate;
}

/* Decorative Persian girih-inspired pattern overlay */
.auth-branding::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.12;
  background-image:
    radial-gradient(circle at 20% 20%, transparent 0 6px, rgba(255,255,255,0.9) 6.5px 7px, transparent 7.5px),
    radial-gradient(circle at 60% 50%, transparent 0 6px, rgba(255,255,255,0.9) 6.5px 7px, transparent 7.5px),
    radial-gradient(circle at 90% 10%, transparent 0 5px, rgba(255,255,255,0.9) 5.5px 6px, transparent 6.5px);
  background-size: 140px 140px, 200px 200px, 160px 160px;
}

/* Soft glowing blobs for modern SaaS depth */
.auth-branding::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 160, 23, 0.35), transparent 70%);
  top: -120px;
  left: -100px;
  z-index: 0;
  filter: blur(10px);
}

.branding-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 2.75rem;
  max-width: 480px;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
}

.brand-logo .logo-mark {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.brand-logo .logo-text {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand-headline h1 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.55;
  margin-bottom: 0.9rem;
}

.brand-headline p {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.9;
}

.brand-highlight {
  color: var(--color-primary-light);
}

/* Testimonial card */
.testimonial-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(6px);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.testimonial-quote {
  font-size: 0.98rem;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1.9;
  position: relative;
  margin-bottom: 1.25rem;
}

.testimonial-quote::before {
  content: "\201C";
  font-size: 2.2rem;
  color: var(--color-accent);
  line-height: 0;
  display: inline-block;
  position: relative;
  top: 12px;
  margin-left: 4px;
}

.testimonial-author {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.author-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-accent), #f4d160);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--color-navy);
  flex-shrink: 0;
  font-size: 0.9rem;
}

.author-name {
  font-weight: 600;
  font-size: 0.92rem;
}

.author-role {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.65);
}

/* Trust badges row */
.trust-strip {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.trust-strip p {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.6);
}

.city-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.city-chips span {
  font-size: 0.78rem;
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.85);
}

/* ===================== MOBILE BRAND HEADER ===================== */
.mobile-brand-header {
  display: none;
  align-items: center;
  gap: 0.6rem;
  padding: 1.25rem 1.25rem 0.5rem;
}

.mobile-brand-header .logo-mark {
  width: 32px;
  height: 32px;
}

.mobile-brand-header .logo-text {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-navy);
}

.mobile-brand-header .logo-tagline {
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

/* ===================== RIGHT: FORM PANEL ===================== */
.auth-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
  background: var(--color-bg);
}

.form-card {
  width: 100%;
  max-width: 420px;
  animation: fadeInUp 0.45s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.form-header {
  margin-bottom: 1.75rem;
}

.form-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: var(--color-text);
}

.form-header p {
  color: var(--color-text-muted);
  font-size: 0.92rem;
}

/* ---------- Form Elements ---------- */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--color-text);
}

.inline-link {
  font-size: 0.8rem;
  color: var(--color-primary);
  font-weight: 600;
  transition: var(--transition-fast);
}

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

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper .input-icon {
  position: absolute;
  right: 14px;
  width: 18px;
  height: 18px;
  color: var(--color-text-faint);
  pointer-events: none;
  transition: var(--transition-fast);
}

.input-wrapper input {
  width: 100%;
  padding: 0.8rem 2.6rem 0.8rem 2.6rem;
  font-size: 0.92rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-soft);
  color: var(--color-text);
  transition: var(--transition-fast);
}

.input-wrapper input::placeholder {
  color: var(--color-text-faint);
}

.input-wrapper input:focus {
  outline: none;
  border-color: var(--color-primary);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.12);
}

.input-wrapper input:focus ~ .input-icon {
  color: var(--color-primary);
}

.form-group.has-error input {
  border-color: var(--color-error);
  background: var(--color-error-bg);
  animation: shake 0.35s ease;
}

.form-group.has-error input:focus {
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.12);
}

.form-group.has-success input {
  border-color: var(--color-success);
}

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

.field-error {
  display: none;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--color-error);
}

.form-group.has-error .field-error {
  display: flex;
}

.field-hint {
  font-size: 0.76rem;
  color: var(--color-text-faint);
}

/* Password toggle button */
.toggle-password {
  position: absolute;
  left: 12px;
  width: 20px;
  height: 20px;
  color: var(--color-text-faint);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.toggle-password:hover {
  color: var(--color-primary);
}

.toggle-password svg {
  width: 100%;
  height: 100%;
}

.toggle-password .icon-hidden {
  display: none;
}

/* ---------- Password strength meter ---------- */
.password-strength {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.2rem;
}

.strength-bars {
  display: flex;
  gap: 5px;
}

.strength-bars span {
  height: 5px;
  flex: 1;
  border-radius: var(--radius-full);
  background: var(--color-border);
  transition: var(--transition);
}

.strength-label {
  font-size: 0.76rem;
  color: var(--color-text-faint);
  font-weight: 600;
}

/* strength levels applied via JS data attribute */
.password-strength[data-level="1"] .strength-bars span:nth-child(1) { background: var(--color-error); }
.password-strength[data-level="2"] .strength-bars span:nth-child(-n+2) { background: #f59e0b; }
.password-strength[data-level="3"] .strength-bars span:nth-child(-n+3) { background: #eab308; }
.password-strength[data-level="4"] .strength-bars span:nth-child(-n+4) { background: var(--color-success); }

/* Password requirements tooltip */
.password-requirements {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 0.85rem 1rem;
  z-index: 10;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: var(--transition);
}

.password-requirements.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.password-requirements ul {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.password-requirements li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.password-requirements li .req-dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1.5px solid var(--color-border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.password-requirements li.met .req-dot {
  background: var(--color-success);
  border-color: var(--color-success);
}

.password-requirements li.met .req-dot svg {
  width: 9px;
  height: 9px;
  color: #fff;
}

.password-requirements li.met {
  color: var(--color-success);
}

.field-with-tooltip {
  position: relative;
}

/* ---------- Checkbox ---------- */
.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
}

.checkbox-row input[type="checkbox"] {
  appearance: none;
  width: 19px;
  height: 19px;
  border-radius: 6px;
  border: 1.5px solid var(--color-border);
  flex-shrink: 0;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
  position: relative;
}

.checkbox-row input[type="checkbox"]:checked {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.checkbox-row input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  top: 2px;
  right: 5px;
}

.checkbox-row label {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  cursor: pointer;
  user-select: none;
}

.checkbox-row label a {
  color: var(--color-primary);
  font-weight: 600;
}

.checkbox-row label a:hover {
  text-decoration: underline;
}

.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 0.94rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(13, 148, 136, 0.25);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(13, 148, 136, 0.32);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.75;
  cursor: not-allowed;
}

.btn .spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn.is-loading .btn-text {
  opacity: 0.85;
}

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

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

.btn-subtext {
  text-align: center;
  font-size: 0.78rem;
  color: var(--color-text-faint);
  margin-top: -0.4rem;
}

/* ---------- Divider ---------- */
.divider {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: var(--color-text-faint);
  font-size: 0.8rem;
  margin: 0.3rem 0;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* ---------- Social buttons ---------- */
.social-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.btn-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.72rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--color-border);
  color: var(--color-text);
  background: #ffffff;
  transition: var(--transition-fast);
}

.btn-social:hover {
  background: var(--color-bg-soft);
  border-color: #d1d5db;
  transform: translateY(-1px);
}

.btn-social svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
}

/* ---------- Footer ---------- */
.form-footer {
  text-align: center;
  font-size: 0.88rem;
  color: var(--color-text-muted);
  margin-top: 0.6rem;
}

.form-footer a {
  color: var(--color-primary);
  font-weight: 700;
}

.form-footer a:hover {
  text-decoration: underline;
}

/* ---------- Security notes ---------- */
.security-notes {
  margin-top: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.security-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--color-text-faint);
}

.security-item svg {
  width: 15px;
  height: 15px;
  color: var(--color-primary);
  flex-shrink: 0;
}

.security-badges {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.9rem;
  flex-wrap: wrap;
}

.security-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-text-muted);
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-full);
}

.security-badge svg {
  width: 13px;
  height: 13px;
  color: var(--color-primary);
}

/* ---------- Success box (forgot password) ---------- */
.success-box {
  display: none;
  align-items: flex-start;
  gap: 0.65rem;
  background: var(--color-success-bg);
  border: 1.5px solid var(--color-success-border);
  color: #166534;
  border-radius: var(--radius-md);
  padding: 1rem;
  font-size: 0.86rem;
  animation: fadeInUp 0.35s ease;
}

.success-box.is-visible {
  display: flex;
}

.success-box svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  color: var(--color-success);
  margin-top: 2px;
}

/* ---------- Back link ---------- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.86rem;
  color: var(--color-text-muted);
  font-weight: 600;
  margin-bottom: 1.5rem;
  transition: var(--transition-fast);
}

.back-link:hover {
  color: var(--color-primary);
}

.back-link svg {
  width: 16px;
  height: 16px;
}

/* ---------- Toast notifications ---------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 92%;
  max-width: 380px;
}

.toast {
  background: var(--color-navy);
  color: #fff;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.55rem;
  animation: toastIn 0.3s ease;
}

.toast svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  color: var(--color-primary-light);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 960px) {
  .auth-wrapper {
    grid-template-columns: 1fr;
  }

  .auth-branding {
    display: none;
  }

  .mobile-brand-header {
    display: flex;
  }

  .auth-form-panel {
    padding: 0.5rem 1.25rem 2.5rem;
  }
}

@media (max-width: 420px) {
  .form-header h1 {
    font-size: 1.4rem;
  }

  .social-buttons {
    gap: 0.6rem;
  }
}
