/* ==========================================================================
   Reachi App — authentication pages (login, register, password reset)
   Shares its design tokens with the reachi.ai website.
   ========================================================================== */

:root {
  --brand: #1572E8;
  --brand-600: #0F5FCC;
  --brand-400: #4C94F5;
  --brand-300: #8DBBFF;
  --brand-50: #EDF4FF;
  --grad: linear-gradient(120deg, #2F84FF 0%, #7C5CFF 55%, #22C7EE 100%);
  --grad-text-dark: linear-gradient(100deg, #8EC1FF 0%, #B9A6FF 50%, #6CE6F7 100%);

  --ink-950: #050913;
  --ink-900: #080E1E;
  --on-dark: #F3F6FF;
  --on-dark-2: #B6C0D8;
  --on-dark-muted: #828DAA;

  --bg: #F5F7FB;
  --surface: #FFFFFF;
  --surface-2: #F0F3F9;
  --line: #E4E9F2;
  --line-strong: #CFD7E5;
  --text: #0B1324;
  --text-2: #3A4459;
  --muted: #667085;

  --success: #12B76A;
  --danger: #F04438;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  font-family: var(--font); font-size: 1rem; line-height: 1.6;
  color: var(--text); background: var(--surface);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-600); }
h1, h2, h3, p { margin: 0; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand-400); outline-offset: 3px; border-radius: 6px; }

/* ---------- Split layout ---------- */

.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); min-height: 100vh; }
.auth-main { display: flex; flex-direction: column; padding: 32px clamp(24px, 5vw, 64px); }
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.auth-top img { height: 30px; width: auto; }
.auth-top .back { display: inline-flex; align-items: center; gap: .45rem; color: var(--muted); font-size: .875rem; font-weight: 600; }
.auth-top .back:hover { color: var(--text); }

.auth-body { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 0; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font-size: clamp(1.75rem, 1.4rem + 1.2vw, 2.25rem); font-weight: 800; letter-spacing: -.035em; line-height: 1.15; }
.auth-card .subtitle { margin-top: .6rem; color: var(--muted); }

.auth-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem; color: var(--muted); font-size: .8125rem; }
.auth-foot nav { display: flex; gap: 1.1rem; }
.auth-foot a { color: var(--muted); }
.auth-foot a:hover { color: var(--text); }

/* ---------- Messages ---------- */

.auth-alerts { display: grid; gap: .6rem; margin-top: 1.5rem; }
.auth-alert {
  display: flex; gap: .65rem; align-items: flex-start;
  padding: .8rem 1rem; border-radius: 12px; border: 1px solid;
  font-size: .9rem; font-weight: 500; line-height: 1.45;
}
.auth-alert i { margin-top: .2rem; }
.auth-alert a { color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.auth-alert.is-error, .auth-alert.is-danger { background: #FEF3F2; border-color: #FECDCA; color: #B42318; }
.auth-alert.is-success { background: #ECFDF3; border-color: #ABEFC6; color: #067647; }
.auth-alert.is-info, .auth-alert.is-warning { background: var(--brand-50); border-color: #CFE0FB; color: var(--brand-600); }

/* ---------- Social + divider ---------- */

.btn-google {
  display: flex; align-items: center; justify-content: center; gap: .7rem;
  width: 100%; height: 50px; margin-top: 1.75rem;
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface);
  color: var(--text); font-weight: 600; font-size: .95rem;
  transition: border-color .2s, background-color .2s, box-shadow .2s;
}
.btn-google:hover { color: var(--text); border-color: var(--text); box-shadow: 0 6px 18px -10px rgba(16, 24, 40, .35); }
.btn-google img { width: 20px; height: 20px; }

.divider {
  display: flex; align-items: center; gap: 1rem; margin: 1.5rem 0;
  color: var(--muted); font-size: .8rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- Form ---------- */

.auth-form { display: grid; gap: 1.1rem; }
.field { display: grid; gap: .45rem; }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.label { font-size: .875rem; font-weight: 600; color: var(--text); }
.field-row .link { font-size: .85rem; font-weight: 600; }

.control { position: relative; }
.control > i {
  position: absolute; left: 1rem; top: 50%; transform: translateY(-50%);
  color: #98A2B3; font-size: .95rem; pointer-events: none;
}
.input {
  width: 100%; height: 50px; padding: 0 1rem 0 2.8rem;
  border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--surface); color: var(--text); font-size: 1rem;
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: #98A2B3; }
.input:hover { border-color: #B4BFD1; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(21, 114, 232, .15); }
.input.is-valid { border-color: var(--success); }
.input.is-valid:focus { box-shadow: 0 0 0 4px rgba(18, 183, 106, .15); }
.input.is-invalid { border-color: var(--danger); }
.input.is-invalid:focus { box-shadow: 0 0 0 4px rgba(240, 68, 56, .12); }
.control.has-toggle .input { padding-right: 3rem; }

.toggle-pass {
  position: absolute; right: .5rem; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center; width: 36px; height: 36px;
  border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer;
}
.toggle-pass:hover { background: var(--surface-2); color: var(--text); }

.hint { color: var(--muted); font-size: .8125rem; line-height: 1.5; }

.rules { display: flex; flex-wrap: wrap; gap: .4rem; margin: .2rem 0 0; padding: 0; list-style: none; }
.rules li {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .25rem .6rem; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); font-size: .75rem; font-weight: 600;
  transition: background-color .2s, color .2s;
}
.rules li i { font-size: .65rem; }
.rules li.ok { background: #ECFDF3; color: #067647; }

.check { display: inline-flex; align-items: center; gap: .6rem; color: var(--text-2); font-size: .9rem; cursor: pointer; }
.check input {
  appearance: none; -webkit-appearance: none; flex-shrink: 0;
  width: 18px; height: 18px; margin: 0; border: 1.5px solid var(--line-strong); border-radius: 5px;
  background: var(--surface); display: grid; place-items: center; cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.check input::after {
  content: ""; width: 9px; height: 5px; margin-top: -2px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) scale(0);
  transition: transform .15s var(--ease);
}
.check input:checked { background: var(--brand); border-color: var(--brand); }
.check input:checked::after { transform: rotate(-45deg) scale(1); }
.check a { font-weight: 600; }

.btn-submit {
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  width: 100%; height: 52px; margin-top: .4rem;
  border: 0; border-radius: 999px; cursor: pointer;
  background: linear-gradient(180deg, #2A84F4 0%, #1366D6 100%); color: #fff;
  font-size: 1rem; font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 12px 28px -12px rgba(21, 114, 232, .8);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.btn-submit:hover { color: #fff; transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 16px 34px -12px rgba(21, 114, 232, .9); }
.btn-submit:active { transform: none; }

.switch-auth { margin-top: 1.75rem; text-align: center; color: var(--muted); font-size: .925rem; }
.switch-auth a { font-weight: 700; }

.success-box { margin-top: 1.75rem; padding: 28px; border: 1px solid #ABEFC6; border-radius: 18px; background: #F6FEF9; text-align: center; }
.success-box .ic { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 1rem; border-radius: 16px; background: #DCFAE6; color: var(--success); font-size: 1.35rem; }
.success-box p { color: var(--text-2); }
.success-box .btn-submit { margin-top: 1.25rem; }

/* ---------- Brand panel ---------- */

.auth-aside {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; justify-content: center;
  margin: 12px; padding: clamp(40px, 5vw, 72px);
  border-radius: 28px; background: var(--ink-950); color: var(--on-dark);
}
.auth-aside::before {
  content: ""; position: absolute; inset: 0; z-index: -2;
  background:
    radial-gradient(60% 50% at 15% 0%, rgba(21, 114, 232, .45), transparent 65%),
    radial-gradient(45% 45% at 95% 15%, rgba(124, 92, 255, .32), transparent 65%),
    radial-gradient(50% 40% at 60% 105%, rgba(34, 211, 238, .16), transparent 65%);
}
.auth-aside::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 52px 52px;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 30% 0%, #000 25%, transparent 75%);
  mask-image: radial-gradient(ellipse 80% 70% at 30% 0%, #000 25%, transparent 75%);
}
.auth-aside .eyebrow { font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand-300); }
.auth-aside h2 { margin-top: .9rem; font-size: clamp(1.9rem, 1.2rem + 1.9vw, 2.9rem); font-weight: 800; letter-spacing: -.04em; line-height: 1.08; }
.auth-aside h2 span { background: var(--grad-text-dark); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-aside .lead { max-width: 480px; margin-top: 1rem; color: var(--on-dark-2); font-size: 1.05rem; }

.aside-visual { position: relative; max-width: 520px; margin-top: clamp(32px, 4vw, 48px); }
.aside-frame {
  padding: 7px; border-radius: 26px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .03));
  border: 1px solid rgba(255, 255, 255, .1);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .75), 0 0 120px -40px rgba(21, 114, 232, .55);
}
.aside-frame img { width: 100%; aspect-ratio: 16 / 9.5; object-fit: cover; object-position: 25% 50%; border-radius: 20px; }

.chip-float {
  position: absolute; display: flex; align-items: center; gap: .7rem;
  padding: .7rem .95rem; border-radius: 15px;
  background: rgba(10, 17, 36, .8); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, .12); box-shadow: 0 24px 48px -16px rgba(0, 0, 0, .6);
  color: var(--on-dark); font-size: .85rem; line-height: 1.3;
  animation: float 7s ease-in-out infinite;
}
.chip-float strong { display: block; }
.chip-float small { color: var(--on-dark-muted); font-size: .75rem; }
.chip-float.is-call { left: -18px; bottom: -22px; }
.chip-float.is-summary { right: -14px; top: -20px; animation-delay: -3.5s; }
.chip-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: rgba(18, 183, 106, .16); color: #4ADE80; }
.chip-ic.is-blue { background: rgba(21, 114, 232, .2); color: var(--brand-300); }
.wave { display: flex; align-items: center; gap: 3px; height: 20px; }
.wave span { width: 3px; height: 100%; border-radius: 3px; background: linear-gradient(180deg, #8DBBFF, #6CE6F7); animation: wave 1.1s ease-in-out infinite; }
.wave span:nth-child(2) { animation-delay: -.9s; }
.wave span:nth-child(3) { animation-delay: -.6s; }
.wave span:nth-child(4) { animation-delay: -.3s; }
.wave span:nth-child(5) { animation-delay: -.75s; }

.aside-points { display: flex; flex-wrap: wrap; gap: .6rem 1.4rem; margin: clamp(40px, 5vw, 56px) 0 0; padding: 0; list-style: none; color: var(--on-dark-2); font-size: .9rem; font-weight: 500; }
.aside-points li { display: inline-flex; align-items: center; gap: .5rem; }
.aside-points i { color: var(--brand-300); }

@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes wave { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }

@media (max-width: 991px) {
  .auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-main { padding: 24px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .chip-float, .wave span { animation: none; }
}
