/* ---------- فونت (اختیاری: اگر فایل وزیرمتن را در static/fonts گذاشتید) ---------- */
@font-face {
  font-family: "Vazirmatn";
  src: url("/static/fonts/Vazirmatn-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("/static/fonts/Vazirmatn-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("/static/fonts/Vazirmatn-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

/* ---------- توکن‌ها ---------- */
:root {
  --brand-1: #1e3a8a;      /* آبی تیره */
  --brand-2: #4c1d95;      /* بنفش تیره */
  --brand-3: #06b6d4;      /* فیروزه‌ای */
  --bg: #f5f7fb;
  --card-bg: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --danger: #dc2626;
  --radius: 18px;
  --shadow: 0 20px 60px -20px rgba(15, 23, 42, .25);
  --font: "Vazirmatn", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ---------- چیدمان کلی ---------- */
.auth-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;   /* برند | فرم */
  background: var(--bg);
}

/* ---------- ستون برند ---------- */

.brand-pane {
  position: relative;
  overflow: hidden;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;

  /* گرادیان نیمه‌شفاف روی تصویر برای خوانایی متن */
  background:
    linear-gradient(135deg, rgba(30, 58, 138, .72), rgba(76, 29, 149, .82)),
    url("/static/sso2.jpg") center/cover no-repeat;
}

.brand-glow {
  position: absolute;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(6,182,212,.35), transparent 60%);
  top: -100px; left: -100px;
  filter: blur(20px);
  pointer-events: none;
}

.brand-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 30% 30%, #000 30%, transparent 75%);
  pointer-events: none;
}

.brand-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 420px;
}
.brand-logo {
  width: 72px; height: 72px;
  margin: 0 auto 20px;
  border-radius: 20px;
  display: grid; place-items: center;
  font-size: 34px; font-weight: 700;
  background: linear-gradient(135deg, #fff, #c7d2fe);
  color: var(--brand-1);
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
}
.brand-content h1 {
  font-size: 34px; margin: 0 0 10px;
  letter-spacing: -.5px;
}
.brand-content p {
  margin: 0; color: #cbd5e1; font-size: 15px;
}

/* ---------- ستون فرم ---------- */
.form-pane {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
}

.card {
  width: 100%;
  max-width: 420px;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  animation: rise .5s cubic-bezier(.2,.8,.2,1);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card-head h2 { margin: 0 0 6px; font-size: 22px; }
.card-head p  { margin: 0 0 22px; color: var(--muted); font-size: 14px; }

/* ---------- آلرت ---------- */
.alert {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--danger);
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* ---------- تب‌ها ---------- */
.tabs {
  position: relative;
  display: flex;
  background: #f1f5f9;
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 20px;
}
.tab {
  flex: 1;
  position: relative;
  z-index: 1;
  border: 0;
  background: transparent;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-radius: 9px;
  transition: color .2s;
}
.tab.active { color: var(--text); }
.tab-indicator {
  position: absolute;
  top: 4px; bottom: 4px;
  right: 4px;            /* شروع از راست */
  width: 0;
  background: #fff;
  border-radius: 9px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  transition: right .28s cubic-bezier(.2,.8,.2,1), width .28s;
  z-index: 0;
  /* مهم: از transform استفاده نکنید */
  transform: none;
}

/* ---------- پنل‌ها ---------- */
.tab-panel { display: none; animation: fade .25s ease; }
.tab-panel.active { display: block; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- فیلدها ---------- */
.field { display: block; margin-bottom: 16px; }
.field > span {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #334155;
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-family: inherit;
  font-size: 15px;
  background: #fff;
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}
.field input::placeholder { color: #94a3b8; }
.field input:focus {
  outline: none;
  border-color: var(--brand-3);
  box-shadow: 0 0 0 4px rgba(6,182,212,.15);
}

.pw-wrap { position: relative; }
.pw-wrap input { padding-left: 44px; }
.pw-toggle {
  position: absolute;
  left: 8px; top: 50%;
  transform: translateY(-50%);
  border: 0; background: transparent;
  cursor: pointer;
  font-size: 16px;
  opacity: .6;
  padding: 6px;
  border-radius: 8px;
}
.pw-toggle:hover { opacity: 1; background: #f1f5f9; }

.otp-input {
  letter-spacing: 8px;
  text-align: center;
  font-size: 20px;
  font-weight: 600;
}

/* ---------- دکمه‌ها ---------- */
.btn-primary {
  width: 100%;
  padding: 12px 16px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  box-shadow: 0 10px 24px -10px rgba(76,29,149,.6);
  transition: transform .15s, box-shadow .2s, filter .2s;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:active { transform: translateY(1px); }

.btn-ghost {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  transition: background .2s, color .2s;
}
.btn-ghost:hover:not(:disabled) { background: #f8fafc; color: var(--text); }
.btn-ghost:disabled { opacity: .6; cursor: not-allowed; }

.resend-form { margin-top: 10px; }

.hint {
  margin: 14px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.7;
}

/* ---------- فوتر کارت ---------- */
.card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--muted);
}
.card-foot a { color: var(--brand-1); text-decoration: none; }
.card-foot a:hover { text-decoration: underline; }

/* ---------- موبایل ---------- */
@media (max-width: 860px) {
  .auth-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    min-height: 100dvh;
  }
  .brand-pane {
    padding: 24px 20px;
    min-height: 180px;
    background-position: center 30%;   /* سوژه بالاتر بیفتد */
  }
  .brand-grid { display: none; }
  .brand-content { text-align: center; }
  .brand-logo { width: 52px; height: 52px; font-size: 24px; margin-bottom: 10px; border-radius: 14px; }
  .brand-content h1 { font-size: 22px; }
  .brand-content p { font-size: 12.5px; }

  .form-pane {
    padding: 20px 16px 32px;
    align-items: flex-start;
  }
  .card {
    max-width: 100%;
    padding: 24px 20px;
    box-shadow: 0 10px 30px -18px rgba(15,23,42,.25);
  }
  .card-head h2 { font-size: 19px; }
}

@media (max-width: 380px) {
  .card { padding: 20px 16px; }
  .tab { font-size: 13px; padding: 9px 8px; }
  .brand-content h1 { font-size: 20px; }
}
