/* ── Shared auth styles ─────────────────────────────────────────────────── */

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

:root {
  --black: #0a0a0a;
  --white: #ffffff;
  --gray-50: #fafafa;
  --gray-100: #f4f4f4;
  --gray-200: #e8e8e8;
  --gray-300: #d0d0d0;
  --gray-400: #aaaaaa;
  --gray-500: #888888;
  --gray-700: #444444;
  --red: #dc2626;
  --amber: #d97706;
  --green: #16a34a;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

html,
body {
  height: 100%;
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  background: var(--white);
  color: var(--black);
}

/* ── Layout ──────────────────────────────────────────────────────────────── */

.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

/* ── Dark panel ──────────────────────────────────────────────────────────── */

.panel-dark {
  background: var(--black);
  display: flex;
  flex-direction: column;
  padding: 40px 48px;
  position: relative;
  overflow: hidden;
}

.panel-dark::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .04) 1px, transparent 1px);
  background-size: 36px 36px;
  pointer-events: none;
}

.panel-top {
  position: relative;
  z-index: 1;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .78rem;
  font-weight: 500;
  color: rgba(255, 255, 255, .4);
  text-decoration: none;
  transition: color .15s;
  margin-bottom: 48px;
}

.back-link:hover {
  color: rgba(255, 255, 255, .85);
}

.back-link svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.panel-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--white);
  text-decoration: none;
  margin-bottom: 48px;
}

.panel-logo-mark {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(37,99,235,.4);
}

.panel-logo-mark svg {
  width: 20px;
  height: 20px;
}

.panel-mid {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.panel-headline {
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  color: var(--white);
  margin-bottom: 1.25rem;
}

.panel-headline em {
  font-style: italic;
  font-weight: 300;
  color: rgba(255, 255, 255, .45);
}

.panel-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
}

.panel-features li {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  font-size: .88rem;
  color: rgba(255, 255, 255, .5);
  line-height: 1.5;
}

.feat-icon {
  width: 20px;
  height: 20px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.feat-icon svg {
  width: 11px;
  height: 11px;
  stroke: rgba(255, 255, 255, .6);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.panel-bottom {
  position: relative;
  z-index: 1;
  font-size: .8rem;
  color: rgba(255, 255, 255, .3);
}

.panel-bottom a {
  color: rgba(255, 255, 255, .6);
  text-decoration: none;
  font-weight: 600;
  transition: color .15s;
}

.panel-bottom a:hover {
  color: var(--white);
}

/* ── Form panel ──────────────────────────────────────────────────────────── */

.panel-form {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 64px;
  background: var(--white);
}

.form-header {
  margin-bottom: 36px;
}

.form-header h1 {
  font-size: clamp(1.6rem, 2.5vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 8px;
}

.form-header h1 em {
  font-style: italic;
  font-weight: 300;
}

.form-subtitle {
  font-size: .9rem;
  color: var(--gray-500);
}

/* ── Form elements ───────────────────────────────────────────────────────── */

.form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--gray-500);
  transition: color .15s;
}

.field:focus-within .field-label {
  color: var(--black);
}

.field-input-wrap {
  position: relative;
}

.field input {
  width: 100%;
  padding: 11px 14px;
  padding-right: 42px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: .95rem;
  font-family: var(--font);
  color: var(--black);
  background: var(--white);
  outline: none;
  transition: border-color .18s, background .18s;
  -webkit-appearance: none;
  appearance: none;
}

.field input::placeholder {
  color: var(--gray-300);
}

.field input:focus {
  border-color: var(--black);
  background: var(--gray-50);
}

.field input.is-error {
  border-color: var(--red) !important;
}

.field input.is-ok {
  border-color: var(--green);
}

.field input.no-icon {
  padding-right: 14px;
}

.field-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  display: flex;
  align-items: center;
  color: var(--gray-300);
  transition: color .15s;
  padding: 2px;
  background: none;
  border: none;
  outline: none;
}

.field-icon:hover {
  color: var(--gray-700);
}

.field-icon svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.field-error {
  font-size: .72rem;
  color: var(--red);
  display: none;
}

.field-error.visible {
  display: block;
}

/* password strength */
.strength-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 2px;
}

.strength-bars {
  display: flex;
  gap: 4px;
  height: 3px;
}

.strength-bar {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--gray-200);
  transition: background .25s;
}

.strength-label {
  font-size: .68rem;
  color: var(--gray-400);
  transition: color .25s;
}

/* checkbox */
.field-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

/* Fully custom checkbox: native rendering is disabled with appearance:none and
 * the checkmark is drawn via ::after. This is the only way to combine a custom
 * border / border-radius with a guaranteed-visible check across browsers — a
 * mixed approach (custom border + accent-color) leaves the box empty in Chrome. */
.field-check input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 17px;
  height: 17px;
  min-width: 17px;
  padding: 0;
  margin: 1px 0 0;
  border: 1.5px solid var(--gray-300);
  border-radius: 4px;
  background: var(--white);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: background .15s ease, border-color .15s ease;
}

.field-check input[type="checkbox"]:hover {
  border-color: var(--gray-500);
}

.field-check input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--black);
  outline-offset: 2px;
}

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

/* Checkmark drawn as a rotated rectangle with two borders forming an "L". */
.field-check input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 0px;
  width: 5px;
  height: 10px;
  border: solid var(--white);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.check-label {
  font-size: .82rem;
  color: var(--gray-500);
  line-height: 1.5;
}

.check-label a {
  color: var(--black);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* aux row */
.field-aux {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.field-aux .check-label {
  color: var(--gray-500);
}

.aux-link {
  font-size: .8rem;
  font-weight: 600;
  color: var(--gray-500);
  text-decoration: none;
  transition: color .15s;
}

.aux-link:hover {
  color: var(--black);
}

/* submit button */
.btn-submit {
  width: 100%;
  padding: 13px;
  background: var(--black);
  color: var(--white);
  border: 2px solid var(--black);
  border-radius: 8px;
  font-size: .95rem;
  font-weight: 700;
  font-family: var(--font);
  letter-spacing: -0.01em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .18s, color .18s;
  margin-top: 4px;
}

.btn-submit:hover:not(:disabled) {
  background: var(--white);
  color: var(--black);
}

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

.btn-submit .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, .3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: none;
}

.btn-submit.loading .spinner {
  display: block;
}

.btn-submit.loading .btn-text {
  opacity: .5;
}

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

/* divider */
.form-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .75rem;
  color: var(--gray-300);
  margin: 2px 0;
}

.form-divider::before,
.form-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}

/* switch link */
.form-switch {
  font-size: .85rem;
  color: var(--gray-500);
  text-align: center;
}

.form-switch a {
  color: var(--black);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1.5px solid currentColor;
  padding-bottom: 1px;
  transition: opacity .15s;
}

.form-switch a:hover {
  opacity: .65;
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .auth-wrap {
    grid-template-columns: 1fr;
  }

  .panel-dark {
    padding: 20px 24px;
    min-height: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .panel-mid {
    display: none;
  }

  .back-link {
    margin-bottom: 0;
  }

  .panel-logo {
    margin-bottom: 0;
  }

  .panel-bottom {
    display: none;
  }

  .panel-form {
    padding: 40px 24px 48px;
    justify-content: flex-start;
  }
}

/* ── Animations & polish ────────────────────────────────────────────────── */

@keyframes authFadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes authFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes authOrbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: .9; }
  50%      { transform: translate(-20px, 24px) scale(1.08); opacity: 1; }
}
@keyframes authOrbFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: .7; }
  50%      { transform: translate(22px, -18px) scale(1.05); opacity: .95; }
}
@keyframes authLogoGlow {
  0%, 100% { box-shadow: 0 2px 10px rgba(37,99,235,.4); }
  50%      { box-shadow: 0 4px 22px rgba(79,70,229,.65); }
}
@keyframes authShake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-5px); }
  40%      { transform: translateX(5px); }
  60%      { transform: translateX(-3px); }
  80%      { transform: translateX(3px); }
}
@keyframes authShimmer {
  0%   { transform: translateX(-120%) skewX(-20deg); }
  100% { transform: translateX(220%)  skewX(-20deg); }
}

/* Dark panel gets two floating orbs behind its grid */
.panel-dark::after {
  content: '';
  position: absolute;
  top: -160px;
  right: -160px;
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, rgba(37,99,235,.28) 0%, rgba(79,70,229,.12) 40%, transparent 72%);
  border-radius: 50%;
  pointer-events: none;
  animation: authOrbFloat 16s ease-in-out infinite;
  z-index: 0;
}
.panel-dark .panel-top,
.panel-dark .panel-mid,
.panel-dark .panel-bottom { position: relative; z-index: 1; }

/* second orb via an inner layer on panel-mid */
.panel-mid::before {
  content: '';
  position: absolute;
  bottom: -180px;
  left: -140px;
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(255,255,255,.08) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  animation: authOrbFloat2 20s ease-in-out infinite;
  z-index: 0;
}
.panel-mid > * { position: relative; z-index: 1; }

/* Entrance stagger — dark panel */
.panel-dark .back-link     { animation: authFadeUp .6s ease .05s both; }
.panel-dark .panel-logo    { animation: authFadeUp .6s ease .15s both; }
.panel-headline            { animation: authFadeUp .7s ease .25s both; }
.panel-features li         { animation: authFadeUp .6s ease both; opacity: 0; }
.panel-features li:nth-child(1) { animation-delay: .38s; }
.panel-features li:nth-child(2) { animation-delay: .48s; }
.panel-features li:nth-child(3) { animation-delay: .58s; }
.panel-features li:nth-child(4) { animation-delay: .68s; }
.panel-bottom              { animation: authFadeIn .6s ease .75s both; }

/* Logo mark gets a subtle animated glow + hover lift */
.panel-logo-mark {
  animation: authLogoGlow 3.5s ease-in-out infinite;
  transition: transform .35s ease;
}
.panel-logo:hover .panel-logo-mark {
  transform: rotate(-6deg) scale(1.08);
}

/* Back-link arrow slide */
.back-link svg {
  transition: transform .25s ease;
}
.back-link:hover svg {
  transform: translateX(-3px);
}

/* Feature icons gently light up */
.panel-features li {
  transition: color .25s ease, transform .25s ease;
}
.panel-features li:hover {
  color: rgba(255,255,255,.85);
  transform: translateX(3px);
}
.panel-features li:hover .feat-icon {
  border-color: rgba(255,255,255,.5);
}
.feat-icon { transition: border-color .25s ease; }

/* Entrance stagger — form panel */
.form-header   { animation: authFadeUp .6s ease .2s both; }
.form .field   { animation: authFadeUp .55s ease both; opacity: 0; }
.form .field:nth-of-type(1) { animation-delay: .32s; }
.form .field:nth-of-type(2) { animation-delay: .40s; }
.form .field:nth-of-type(3) { animation-delay: .48s; }
.form .field:nth-of-type(4) { animation-delay: .56s; }
.form .field:nth-of-type(5) { animation-delay: .64s; }
.form .field-aux  { animation: authFadeUp .55s ease .6s both; }
.form .btn-submit { animation: authFadeUp .55s ease .7s both; }
.form-switch      { animation: authFadeIn .6s ease .85s both; }

/* Input hover/focus lift */
.field input {
  transition: border-color .18s, background .18s, transform .18s, box-shadow .18s;
}
.field input:hover:not(:focus):not(.is-error) {
  border-color: var(--gray-300);
}
.field input:focus {
  box-shadow: 0 4px 14px rgba(10,10,10,.06);
  transform: translateY(-1px);
}

/* Error shake */
.field input.is-error {
  animation: authShake .45s ease;
}

/* Submit button: arrow slide + shimmer sweep on hover */
.btn-submit {
  position: relative;
  overflow: hidden;
  transition: background .18s, color .18s, transform .18s, box-shadow .25s;
}
.btn-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(10,10,10,.18);
}
.btn-submit:active:not(:disabled) {
  transform: translateY(0);
}
.btn-submit .btn-arrow {
  display: inline-block;
  transition: transform .25s ease;
}
.btn-submit:hover:not(:disabled) .btn-arrow {
  transform: translateX(4px);
}
.btn-submit::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.25), transparent);
  transform: translateX(-120%) skewX(-20deg);
  pointer-events: none;
}
.btn-submit:hover:not(:disabled)::before {
  animation: authShimmer .9s ease;
}

/* Aux link underline-grow */
.aux-link, .panel-bottom a, .form-switch a {
  position: relative;
}
.aux-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .3s ease;
}
.aux-link:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Strength bars grow smoothly */
.strength-bar {
  transform-origin: left;
  transition: background .25s, transform .35s ease;
}

/* Checkbox polish — subtle hover lift on the wrapper instead of scaling the
 * input itself (which would also stretch the absolutely-positioned ::after
 * checkmark and warp the proportions). */
.field-check:hover input[type="checkbox"]:not(:checked) {
  border-color: var(--black);
}

@media (prefers-reduced-motion: reduce) {
  .panel-dark::after,
  .panel-mid::before,
  .panel-logo-mark,
  .btn-submit::before,
  .back-link,
  .panel-logo,
  .panel-headline,
  .panel-features li,
  .panel-bottom,
  .form-header,
  .form .field,
  .form .field-aux,
  .form .btn-submit,
  .form-switch {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}