/* ── Auth page design system ─────────────────────────────────────────────── */
:root {
  --a-primary:     #2563EB;
  --a-primary-dk:  #1d4ed8;
  --a-primary-lt:  #eff6ff;
  --a-secondary:   #10B981;
  --a-amber:       #F59E0B;
  --a-danger:      #EF4444;
  --a-text:        #0f172a;
  --a-text-muted:  #64748b;
  --a-border:      #e2e8f0;
  --a-surface:     #ffffff;
  --a-bg:          #F8FAFC;
  --a-shadow:      0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
  --a-shadow-lg:   0 20px 60px -12px rgba(37,99,235,.18);
  --a-r:           14px;
  --a-t:           0.18s;
  --a-ease:        cubic-bezier(.4,0,.2,1);
}

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--a-bg);
  color: var(--a-text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Layout ─────────────────────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 480px;
}

/* Left panel — brand/illustration */
.auth-panel {
  background: linear-gradient(145deg, #1e40af 0%, #2563EB 45%, #0891b2 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 60px 48px;
  position: relative;
  overflow: hidden;
}
.auth-panel::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: rgba(255,255,255,.05);
  top: -200px; right: -150px;
  pointer-events: none;
}
.auth-panel::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
  bottom: -100px; left: -80px;
  pointer-events: none;
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 48px;
  z-index: 1;
}
.auth-brand-icon {
  width: 52px; height: 52px;
  background: rgba(255,255,255,.15);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  color: #fff;
  backdrop-filter: blur(8px);
}
.auth-brand-name {
  font-family: 'Poppins', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
}
.auth-panel-hero {
  z-index: 1;
  text-align: center;
}
.auth-panel-icon {
  font-size: 5rem;
  margin-bottom: 28px;
  color: rgba(255,255,255,.9);
  filter: drop-shadow(0 8px 24px rgba(0,0,0,.2));
}
.auth-panel-title {
  font-family: 'Poppins', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 16px;
  line-height: 1.25;
}
.auth-panel-sub {
  font-size: .95rem;
  color: rgba(255,255,255,.75);
  line-height: 1.7;
  max-width: 340px;
}
.auth-panel-features {
  margin-top: 40px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 1;
  width: 100%;
  max-width: 340px;
}
.auth-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255,255,255,.85);
  font-size: .875rem;
}
.auth-feature i {
  width: 32px; height: 32px;
  background: rgba(255,255,255,.12);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem;
  flex-shrink: 0;
}

/* Right panel — form */
.auth-form-panel {
  background: var(--a-surface);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 40px;
  overflow-y: auto;
}
.auth-form-inner {
  max-width: 380px;
  margin: 0 auto;
  width: 100%;
}

/* ── Card (kept for compatibility) ─────────────────────────────────────── */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #1e40af 0%, #2563EB 45%, #0891b2 100%);
  padding: 20px;
}
.auth-card {
  background: var(--a-surface);
  border-radius: var(--a-r);
  box-shadow: var(--a-shadow-lg);
  padding: 44px 40px;
  width: 100%;
  max-width: 440px;
  border: 1px solid rgba(255,255,255,.1);
}
.auth-header {
  text-align: center;
  margin-bottom: 32px;
}
.auth-logo {
  width: 64px; height: 64px;
  background: var(--a-primary-lt);
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.75rem;
  color: var(--a-primary);
  margin: 0 auto 18px;
}
.auth-title {
  font-family: 'Poppins', sans-serif;
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--a-text);
  margin-bottom: 8px;
}
.auth-subtitle {
  font-size: .9rem;
  color: var(--a-text-muted);
  line-height: 1.55;
}
.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: .875rem;
  color: var(--a-text-muted);
}
.auth-link {
  color: var(--a-primary);
  text-decoration: none;
  font-weight: 600;
}
.auth-link:hover { text-decoration: underline; }

/* ── Form controls ──────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: .875rem;
  font-weight: 600;
  color: var(--a-text);
}
.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--a-border);
  border-radius: 9px;
  font-size: .95rem;
  font-family: 'Inter', sans-serif;
  color: var(--a-text);
  background: var(--a-bg);
  transition: border-color var(--a-t) var(--a-ease), box-shadow var(--a-t) var(--a-ease);
  outline: none;
}
.form-control:focus {
  border-color: var(--a-primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-control::placeholder { color: #94a3b8; }
.form-text {
  font-size: .8rem;
  color: var(--a-text-muted);
  margin-top: 5px;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 9px;
  border: none;
  font-size: .9rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--a-t) var(--a-ease);
}
.btn-primary {
  background: var(--a-primary);
  color: #fff;
  box-shadow: 0 1px 3px rgba(37,99,235,.3);
}
.btn-primary:hover {
  background: var(--a-primary-dk);
  box-shadow: 0 4px 12px rgba(37,99,235,.35);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

/* ── Back link ──────────────────────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .85rem;
  color: var(--a-text-muted);
  text-decoration: none;
  margin-bottom: 20px;
  transition: color var(--a-t) var(--a-ease);
}
.back-link:hover { color: var(--a-primary); }

/* ── PIN pad ────────────────────────────────────────────────────────────── */
.pin-header { text-align: center; margin-bottom: 20px; }
.pin-church { font-size: .82rem; color: var(--a-text-muted); margin-bottom: 2px; }
.pin-pastor { font-size: 1rem; font-weight: 600; color: var(--a-text); }

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 28px;
}
.pin-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid var(--a-border);
  background: transparent;
  transition: background var(--a-t), border-color var(--a-t), transform .1s;
}
.pin-dot.filled {
  background: var(--a-primary);
  border-color: var(--a-primary);
  transform: scale(1.2);
}
.pin-dot.confirm-filled {
  background: var(--a-secondary);
  border-color: var(--a-secondary);
  transform: scale(1.2);
}
@keyframes dotShake {
  0%,100% { transform: translateX(0) scale(1); }
  20%,60% { transform: translateX(-5px) scale(1); }
  40%,80% { transform: translateX(5px) scale(1); }
}
.pin-dot.shake { animation: dotShake .4s ease; }

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 280px;
  margin: 0 auto 18px;
}
.pin-key {
  aspect-ratio: 1;
  border: 1.5px solid var(--a-border);
  border-radius: 12px;
  background: var(--a-surface);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--a-text);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  user-select: none;
  transition: background var(--a-t), transform .08s, box-shadow var(--a-t);
}
.pin-key:hover {
  background: var(--a-primary-lt);
  border-color: var(--a-primary);
  box-shadow: var(--a-shadow);
}
.pin-key:active { transform: scale(.91); background: #dbeafe; }
.pin-key.empty  { border-color: transparent; cursor: default; pointer-events: none; }
.pin-key.back   { color: var(--a-danger); font-size: 1.2rem; }
.pin-key.submit {
  background: var(--a-primary);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(37,99,235,.3);
}
.pin-key.submit:hover { background: var(--a-primary-dk); }

.pin-actions { text-align: center; margin-top: 4px; }
.pin-actions a { color: var(--a-text-muted); font-size: .85rem; text-decoration: none; }
.pin-actions a:hover { color: var(--a-primary); text-decoration: underline; }

.pin-step-label {
  text-align: center;
  font-size: .875rem;
  font-weight: 600;
  color: var(--a-text-muted);
  margin-bottom: 8px;
}

/* ── OTP boxes ──────────────────────────────────────────────────────────── */
.otp-boxes {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 24px 0;
}
.otp-box {
  width: 48px; height: 56px;
  border: 2px solid var(--a-border);
  border-radius: 10px;
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  color: var(--a-primary);
  background: var(--a-bg);
  caret-color: var(--a-primary);
  transition: border-color var(--a-t), box-shadow var(--a-t);
  outline: none;
}
.otp-box:focus {
  border-color: var(--a-primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.otp-box.filled { border-color: var(--a-secondary); background: #fff; }

/* ── Timer / resend ─────────────────────────────────────────────────────── */
.timer-row {
  text-align: center;
  font-size: .875rem;
  color: var(--a-text-muted);
  margin-bottom: 10px;
}
.timer-count { font-weight: 600; color: var(--a-primary); }
.timer-expired { color: var(--a-danger); }
.resend-row { text-align: center; margin-bottom: 18px; }
#btnResend {
  background: none; border: none; cursor: pointer;
  color: var(--a-primary); font-weight: 600; font-size: .875rem;
  font-family: 'Inter', sans-serif;
  text-decoration: underline; padding: 0;
}
#btnResend:disabled { color: var(--a-text-muted); text-decoration: none; cursor: default; }

/* ── Step animation ─────────────────────────────────────────────────────── */
.step { display: none; }
.step.active { display: block; }
@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
.step.active { animation: slideIn .25s var(--a-ease); }

/* ── Alerts ─────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 9px;
  margin-bottom: 18px;
  font-size: .875rem;
  display: flex; align-items: flex-start; gap: 10px;
  border: 1px solid transparent;
}
.alert-success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.alert-danger  { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.alert-info    { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }

/* ── DPA consent box ────────────────────────────────────────────────────── */
.dpa-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.dpa-box label {
  display: flex; align-items: flex-start; gap: 10px;
  cursor: pointer; margin: 0;
}
.dpa-box input[type="checkbox"] {
  width: 18px; height: 18px;
  margin-top: 2px; flex-shrink: 0;
  accent-color: var(--a-primary);
}
.dpa-box-text {
  font-size: .82rem;
  color: #1e40af;
  line-height: 1.55;
}
.dpa-expand {
  display: none;
  margin-top: 12px;
  font-size: .78rem;
  color: #374151;
  line-height: 1.6;
  max-height: 180px;
  overflow-y: auto;
  border-top: 1px solid #bfdbfe;
  padding-top: 10px;
}
.dpa-toggle-link {
  color: #1d4ed8;
  font-weight: 600;
  text-decoration: underline;
}

/* ── Tip text ───────────────────────────────────────────────────────────── */
.tip {
  font-size: .8rem;
  color: var(--a-text-muted);
  text-align: center;
  margin-top: 8px;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-panel { display: none; }
  .auth-form-panel { padding: 32px 24px; }
  .auth-card { padding: 32px 24px; }
  .pin-keypad { max-width: 260px; gap: 8px; }
  .otp-box { width: 42px; height: 50px; font-size: 1.3rem; }
}
@media (max-width: 400px) {
  .auth-card { padding: 24px 20px; }
  .pin-keypad { max-width: 230px; }
}

/* Google Stitch auth override. Keeps existing auth markup and JS intact. */
:root {
  --a-primary: #064ec9;
  --a-primary-dk: #073f9d;
  --a-primary-lt: #eef5ff;
  --a-secondary: #14b87a;
  --a-text: #0b1220;
  --a-text-muted: #667085;
  --a-border: #e4e9f2;
  --a-bg: #f5f7fb;
  --a-shadow-lg: 0 28px 80px rgba(17, 36, 74, .16);
  --a-r: 28px;
}

body {
  background:
    radial-gradient(circle at 10% 12%, rgba(101, 233, 169, .28), transparent 28rem),
    radial-gradient(circle at 82% 8%, rgba(6, 78, 201, .18), transparent 24rem),
    linear-gradient(180deg, #f9fbff 0%, #eef3fb 100%);
}

.auth-container {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(360px, 520px);
  align-items: stretch;
  justify-content: stretch;
  min-height: 100vh;
  padding: clamp(18px, 3vw, 38px);
  background: transparent;
  gap: clamp(18px, 3vw, 34px);
}

.auth-container::before {
  content: "";
  display: block;
  min-height: calc(100vh - clamp(36px, 6vw, 76px));
  border-radius: 36px;
  background:
    linear-gradient(180deg, rgba(7, 63, 157, .22), rgba(7, 63, 157, .82)),
    url("../img/pass.jpg"),
    linear-gradient(135deg, #064ec9 0%, #0c72f2 54%, #65e9a9 100%);
  background-size: cover;
  background-position: center;
  box-shadow: 0 30px 90px rgba(17, 36, 74, .18);
  position: relative;
}

.auth-container::after {
  content: "Manage people, messages, finance and events from one secure church workspace.";
  position: fixed;
  left: clamp(42px, 6vw, 96px);
  bottom: clamp(54px, 7vw, 98px);
  max-width: 420px;
  color: #fff;
  font-family: "Poppins", sans-serif;
  font-size: clamp(1.8rem, 3vw, 3rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -.05em;
  text-shadow: 0 14px 28px rgba(0, 0, 0, .22);
  pointer-events: none;
}

.auth-card {
  align-self: center;
  justify-self: center;
  width: 100%;
  max-width: 480px;
  padding: clamp(30px, 4vw, 52px);
  border: 1px solid rgba(228, 233, 242, .95);
  border-radius: 32px;
  box-shadow: var(--a-shadow-lg);
}

.auth-logo {
  border-radius: 22px;
  background: linear-gradient(135deg, #eef5ff 0%, #dffbea 100%);
  color: var(--a-primary);
}

.auth-title {
  font-size: clamp(1.8rem, 2.5vw, 2.35rem);
  letter-spacing: -.04em;
}

.auth-subtitle {
  color: #5b667a;
}

.form-label {
  color: #344054;
}

.form-control {
  min-height: 48px;
  border-radius: 16px;
  background: #fbfdff;
}

.btn,
.pin-key {
  border-radius: 999px;
}

.btn-primary,
.pin-key.submit {
  background: var(--a-primary);
  box-shadow: 0 14px 28px rgba(6, 78, 201, .2);
}

.btn-primary:hover,
.pin-key.submit:hover {
  background: var(--a-primary-dk);
}

.pin-keypad {
  gap: 12px;
}

.pin-key {
  background: #fff;
  border-color: var(--a-border);
  box-shadow: 0 8px 20px rgba(17, 36, 74, .05);
}

.otp-box {
  border-radius: 18px;
  background: #fbfdff;
}

.alert,
.dpa-box {
  border-radius: 18px;
}

@media (max-width: 900px) {
  .auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
  }

  .auth-container::before,
  .auth-container::after {
    display: none;
  }

  .auth-card {
    max-width: 520px;
    border-radius: 28px;
  }
}

/* Premium auth refinement */
:root {
  --a-ease-premium: cubic-bezier(0.22, 1, 0.36, 1);
  --a-focus: 0 0 0 4px rgba(6, 78, 201, .14);
}

html,
body {
  max-width: 100%;
  overflow-x: clip;
}

body {
  text-rendering: optimizeLegibility;
}

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: var(--a-focus);
}

.auth-container {
  background:
    radial-gradient(circle at 16% 12%, rgba(101, 233, 169, .25), transparent 28rem),
    linear-gradient(145deg, #f8fbff 0%, #eef5ff 48%, #f7fbf8 100%);
}

.auth-card {
  border: 1px solid rgba(228, 233, 242, .95);
  box-shadow: 0 28px 80px rgba(17, 36, 74, .13);
  animation: authCardIn 320ms var(--a-ease-premium) both;
}

.auth-logo {
  box-shadow: inset 0 0 0 1px rgba(6, 78, 201, .08), 0 14px 30px rgba(6, 78, 201, .12);
}

.auth-title {
  letter-spacing: -.035em;
  text-wrap: balance;
}

.auth-subtitle {
  text-wrap: pretty;
}

.form-control,
.btn,
.pin-key,
.otp-box {
  min-height: 44px;
}

.form-control {
  border-radius: 16px;
  background: #fbfdff;
}

.form-control:focus {
  box-shadow: var(--a-focus);
}

.btn {
  border-radius: 999px;
  font-weight: 800;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active,
.pin-key:active {
  transform: translateY(0) scale(.98);
}

.pin-key {
  min-width: 58px;
  min-height: 58px;
  transition:
    transform 150ms var(--a-ease-premium),
    box-shadow 150ms var(--a-ease-premium),
    border-color 150ms var(--a-ease-premium),
    background-color 150ms var(--a-ease-premium);
}

.pin-key:hover {
  transform: translateY(-1px);
}

.back-link,
.auth-link,
.pin-actions a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

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

@media (max-width: 520px) {
  .auth-container {
    align-items: stretch;
    padding: 12px;
  }

  .auth-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: calc(100dvh - 24px);
    padding: 28px 20px;
    border-radius: 24px;
  }

  .auth-title {
    font-size: 1.45rem;
  }

  .pin-keypad {
    width: min(100%, 280px);
    max-width: none;
  }
}

@media (max-width: 360px) {
  .auth-card {
    padding-inline: 16px;
  }

  .pin-key {
    min-width: 52px;
    min-height: 52px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
