/* Файл: намуди саҳифаи бақайдгирӣ ва воридшавии корбарон. */

.auth-body { background: var(--bg); min-height: 100vh; min-height: 100dvh; }

.auth {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

/* Панели чапи муаррифӣ ва ороиши брендро месозад. */
.auth-aside {
  position: relative;
  background: var(--soft);
  border-right: 1px solid var(--line);
  padding: 40px 56px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.auth-aside::before {
  content: ""; position: absolute; right: -140px; bottom: -160px;
  width: 460px; height: 460px; border-radius: 50%;
  background: radial-gradient(closest-side, var(--blue-soft), transparent);
  pointer-events: none;
}
.auth-aside::after {
  content: ""; position: absolute; left: -120px; top: 40%;
  width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(closest-side, var(--teal-soft), transparent);
  pointer-events: none;
}
.auth-aside > * { position: relative; z-index: 1; }
.auth-aside-body { margin: auto 0; max-width: 440px; padding: 48px 0; }
.auth-aside h1 { font-size: clamp(1.9rem, 2.8vw, 2.5rem); line-height: 1.12; letter-spacing: -.03em; }
.auth-aside .lead { margin-top: 16px; font-size: 1.05rem; }

.benefits { list-style: none; margin: 36px 0 0; padding: 0; display: grid; gap: 20px; }
.benefits li { display: flex; gap: 14px; align-items: flex-start; }
.benefit-icon {
  flex: none; width: 40px; height: 40px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--line); color: var(--blue);
  box-shadow: 0 1px 2px rgba(11, 18, 32, .04);
}
.benefit-icon.teal { color: var(--teal); }
.benefit-icon svg { width: 20px; height: 20px; }
.benefits h3 { font-size: .98rem; }
.benefits p { margin-top: 2px; color: var(--muted); font-size: .9rem; line-height: 1.5; }

.auth-aside-foot { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; font-size: .875rem; }
.auth-aside-foot .muted { color: var(--faint); }

/* Қисми рости form-ҳои воридшавӣ ва бақайдгириро ҷойгир мекунад. */
.auth-main {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px var(--gutter);
}
.auth-top { display: none; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h2 { font-size: 1.6rem; letter-spacing: -.025em; }
.auth-card .sub { margin-top: 6px; color: var(--muted); font-size: .95rem; }

.auth-back { margin-top: 28px; display: flex; justify-content: center; gap: 20px; font-size: .875rem; }
.auth-back a { color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.auth-back a:hover { color: var(--ink); }
.auth-back svg { width: 16px; height: 16px; }

/* Огоҳии вобаста ба ҳуқуқи маъмурро оро медиҳад. */
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  margin-top: 20px; padding: 12px 14px; border-radius: 12px;
  background: var(--blue-soft); color: var(--ink-2); font-size: .875rem; line-height: 1.5;
  border: 1px solid #d6e3fb;
}
.notice svg { flex: none; width: 18px; height: 18px; color: var(--blue); margin-top: 1px; }

/* Табдилдиҳандаи байни воридшавӣ ва бақайдгириро оро медиҳад. */
.segmented {
  position: relative; display: grid; grid-template-columns: 1fr 1fr;
  margin-top: 24px; padding: 4px; border-radius: 12px;
  background: var(--soft); border: 1px solid var(--line);
}
.segmented-indicator {
  position: absolute; top: 4px; bottom: 4px; left: 4px;
  width: calc(50% - 4px); border-radius: 9px;
  background: #fff; box-shadow: 0 1px 2px rgba(11, 18, 32, .06), 0 2px 8px rgba(11, 18, 32, .06);
  transition: transform .32s cubic-bezier(.2, .8, .2, 1);
}
.segmented[data-active="register"] .segmented-indicator { transform: translateX(100%); }
.segmented button {
  position: relative; z-index: 1; height: 40px; border: 0; background: transparent;
  font: 600 .9rem/1 inherit; font-family: inherit; color: var(--muted); cursor: pointer;
  border-radius: 9px; transition: color .2s;
}
.segmented button[aria-selected="true"] { color: var(--ink); }
.segmented button:hover { color: var(--ink); }

/* Тугмаи OAuth-и Google-ро оро медиҳад. */
.btn-google {
  width: 100%; margin-top: 20px; background: #fff; color: var(--ink);
  border-color: var(--line-2); border-radius: 12px; font-weight: 600;
}
.btn-google:hover { border-color: var(--ink); color: var(--ink); background: #fff; }
.btn-google[disabled] { opacity: .7; cursor: progress; }
/* Тугмаи сиёҳи Apple-ро мувофиқи услуби Apple оро медиҳад. */
.btn-apple {
  width: 100%; margin-top: 12px; background: #000; color: #fff;
  border-color: #000; border-radius: 12px; font-weight: 600;
}
.btn-apple:hover { background: #1d1d1f; border-color: #1d1d1f; color: #fff; }
.btn-apple[disabled] { opacity: .7; cursor: progress; }
.btn-apple .apple-logo { width: 18px; height: 18px; margin-top: -2px; }
/* Тугмаи OAuth-и GitHub-ро бо услуби торики он оро медиҳад. */
.btn-github {
  width: 100%; margin-top: 12px; background: #24292f; color: #fff;
  border-color: #24292f; border-radius: 12px; font-weight: 600;
}
.btn-github:hover { background: #32383f; border-color: #32383f; color: #fff; }
.btn-github[disabled] { opacity: .7; cursor: progress; }
.btn-github .github-logo { width: 18px; height: 18px; }
.divider {
  display: flex; align-items: center; gap: 12px; margin: 20px 0 0;
  color: var(--faint); font-size: .8rem;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Паёмҳои муваффақият ва хаторо оро медиҳад. */
.alert-slot { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .28s ease; }
.alert-slot.show { grid-template-rows: 1fr; }
.alert-slot > div { overflow: hidden; }
.alert {
  display: flex; gap: 10px; align-items: flex-start;
  margin-top: 20px; padding: 12px 14px; border-radius: 12px;
  font-size: .875rem; line-height: 1.5; border: 1px solid transparent;
  opacity: 0; transform: translateY(-4px);
  transition: opacity .25s ease, transform .25s ease;
}
.alert-slot.show .alert { opacity: 1; transform: none; }
.alert svg { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.alert.error { background: var(--red-soft); color: #9f2222; border-color: #f6d3d3; }
.alert.success { background: var(--teal-soft); color: #0b6e65; border-color: #c4ece7; }

/* Form, майдонҳо ва тугмаҳои тасдиқро оро медиҳад. */
.auth-form { margin-top: 20px; }
.auth-form[hidden] { display: none; }
.auth-form.enter { animation: formIn .32s cubic-bezier(.2, .8, .2, 1); }
@keyframes formIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.field + .field { margin-top: 14px; }
.field label { display: block; font-size: .85rem; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.control { position: relative; }
.control input {
  width: 100%; height: 48px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line-2); background: #fff; color: var(--ink);
  font: 400 1rem/1.2 inherit; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none; appearance: none;
}
.control input::placeholder { color: var(--faint); }
.control input:hover { border-color: #c3c9d3; }
.control input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(31, 99, 224, .12); }
.control.has-toggle input { padding-right: 52px; }
.field.invalid input { border-color: var(--red); }
.field.invalid input:focus { box-shadow: 0 0 0 4px rgba(217, 58, 58, .12); }

.pw-toggle {
  position: absolute; top: 4px; right: 4px; width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 9px; background: transparent; color: var(--faint); cursor: pointer;
  transition: color .15s, background .15s;
}
.pw-toggle:hover { color: var(--ink); background: var(--soft); }
.pw-toggle svg { width: 20px; height: 20px; }
.pw-toggle .i-hide { display: none; }
.pw-toggle[aria-pressed="true"] .i-show { display: none; }
.pw-toggle[aria-pressed="true"] .i-hide { display: block; }

.field-msg {
  min-height: 0; font-size: .8rem; color: var(--muted); margin-top: 6px; line-height: 1.4;
}
.field.invalid .field-msg { color: var(--red); }
.field-msg:empty { display: none; }

.btn-submit {
  width: 100%; margin-top: 22px; border-radius: 12px; background: var(--blue); color: #fff; position: relative;
}
.btn-submit:hover { background: var(--blue-ink); color: #fff; }
.btn-submit[disabled] { cursor: progress; opacity: .85; }
.btn-submit .spinner { display: none; }
.btn-submit.loading .spinner { display: inline-block; }
.btn-submit.loading .arrow { display: none; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.form-foot { margin-top: 16px; text-align: center; font-size: .875rem; color: var(--muted); }
.form-foot button {
  border: 0; background: none; padding: 0; color: var(--blue); font: inherit; font-weight: 600; cursor: pointer;
}
.form-foot button:hover { color: var(--blue-ink); }

.secure-note {
  margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  color: var(--faint); font-size: .8rem; text-align: center;
}
.secure-note svg { width: 16px; height: 16px; color: var(--teal); flex: none; }

/* Пайдоиши нарми саҳифаро идора мекунад. */
.rise { animation: rise .5s cubic-bezier(.2, .8, .2, 1) both; }
.rise.d1 { animation-delay: .06s; }
.rise.d2 { animation-delay: .12s; }
.rise.d3 { animation-delay: .18s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Тарҳро ба телефон ва планшет мутобиқ мекунад. */
@media (max-width: 960px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-aside { display: none; }
  .auth-main { justify-content: flex-start; padding: 28px var(--gutter) 40px; }
  .auth-top { display: flex; justify-content: center; margin-bottom: 28px; }
  .auth-card { text-align: left; }
}
@media (max-width: 400px) {
  :root { --gutter: 16px; }
  .auth-card h2 { font-size: 1.4rem; }
  .segmented button { font-size: .85rem; }
  .auth-back { gap: 14px; flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  .rise, .auth-form.enter { animation: none; }
  .segmented-indicator, .alert-slot, .alert, .control input, .segmented button { transition: none; }
  .spinner { animation-duration: 1.6s; }
}

/* Қадами дуюми воридшавӣ (OTP) ва рамз ба почта. */
.otp-title { font-size: 18px; margin: 4px 0 2px; }
.otp-hint { color: var(--muted, #5d6676); font-size: 14px; line-height: 1.5; margin-bottom: 6px; }
.otp-input { font-size: 22px !important; letter-spacing: .25em; font-variant-numeric: tabular-nums; text-align: center; }
.email-code-link { margin-top: 10px; text-align: center; }
