/* =========================================================
   A2EP Auth UI — login / signup / forgot / verify-pending
   Design tokens + base
   ========================================================= */

:root {
  /* Brand */
  --brand-purple:       #30296E;
  --brand-purple-ink:   #221951;
  --brand-green:        #6EB944;
  --brand-green-dark:   #3d7a1a;

  /* Page background */
  --base-green:         #70B82D;
  --base-green-warm:    #7bc332;
  --base-green-cool:    #6bb328;

  /* Form card */
  --form-bg:            rgba(255, 255, 255, 0.38);
  --form-border:        var(--brand-green-dark);
  --form-ring:          rgba(61, 122, 26, 0.35);

  /* Text */
  --text-body:          #1f1f1f;
  --text-muted:         rgba(34, 25, 81, 0.75);
  --text-label:         rgba(34, 25, 81, 0.60);
  --stroke-line:        rgba(34, 25, 81, 0.25);

  /* Alerts */
  --alert-error-fg:     #a11b25;
  --alert-notice-fg:    #30296E;
  --alert-info-fg:      #155d7d;
}

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--text-body);
  -webkit-font-smoothing: antialiased;
}

body.auth-body {
  background: linear-gradient(135deg,
    var(--base-green-cool) 0%,
    var(--base-green) 50%,
    var(--base-green-warm) 100%);
  position: relative;
  overflow-x: hidden;
  min-height: 100vh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Centred stage container around the form card */
.auth-stage {
  position: relative;
  z-index: 5;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}

@media (max-width: 767px) {
  .auth-stage { padding: 32px 16px; }
}
@media (max-width: 479px) {
  .auth-stage { padding: 20px 12px; }
}

/* =========================================================
   Animated wave background
   ========================================================= */

.wave-field {
  position: fixed;
  top: 0;
  left: -20vw;
  width: 140vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
}

.wave-field path {
  fill: none;
  stroke: var(--brand-purple);
  stroke-linecap: round;
  stroke-width: 180;
  mix-blend-mode: multiply;
  transform-origin: 50% 50%;
  transform-box: fill-box;
}

.wave-field path:nth-child(1) { opacity: 0.18; animation: waveB 9s  ease-in-out infinite -2.5s; }
.wave-field path:nth-child(2) { opacity: 0.26; animation: waveA 10s ease-in-out infinite; }
.wave-field path:nth-child(3) { opacity: 0.34; animation: waveB 8s  ease-in-out infinite -1.5s; }
.wave-field path:nth-child(4) { opacity: 0.40; animation: waveA 9s  ease-in-out infinite -3s; }
.wave-field path:nth-child(5) { opacity: 0.34; animation: waveB 11s ease-in-out infinite -2s; }
.wave-field path:nth-child(6) { opacity: 0.26; animation: waveA 10s ease-in-out infinite -4s; }

@keyframes waveA {
  0%, 100% { transform: translateX(0)      scaleY(1); }
  50%      { transform: translateX(-140px) scaleY(1.10); }
}

@keyframes waveB {
  0%, 100% { transform: translateX(0)     scaleY(1); }
  50%      { transform: translateX(120px) scaleY(0.92); }
}

@media (prefers-reduced-motion: reduce) {
  .wave-field path { animation: none; }
}

/* Mobile: thinner strokes, drop outer bands */
@media (max-width: 767px) {
  .wave-field path { stroke-width: 160; }
  .wave-field path:nth-child(1) { display: none; }
}
@media (max-width: 479px) {
  .wave-field path { stroke-width: 140; }
  .wave-field path:nth-child(6) { display: none; }
  @keyframes waveA { 50% { transform: translateX(-90px)  scaleY(1.08); } }
  @keyframes waveB { 50% { transform: translateX(80px)   scaleY(0.94); } }
}

/* =========================================================
   Form card (glass)
   ========================================================= */

.form-card {
  width: 100%;
  max-width: 580px;
  background: var(--form-bg);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border: 1.5px solid var(--form-border);
  border-radius: 20px;
  padding: 28px 32px;
  color: var(--text-body);
  box-shadow:
    0 0 0 5px var(--form-ring),
    0 24px 60px rgba(48, 41, 110, 0.35),
    0 4px 12px rgba(0, 0, 0, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

@media (max-width: 767px) {
  .form-card { padding: 24px 22px; border-radius: 18px; }
}
@media (max-width: 479px) {
  .form-card { padding: 22px 18px; border-radius: 16px; }
}

/* =========================================================
   Card header — logo + titles
   ========================================================= */

.card-header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
  background: transparent;
  border: none;
  padding: 0;
}

.card-header .logo {
  flex: 0 0 auto;
  width: 150px;
}

.card-header .logo img {
  display: block;
  width: 100%;
  height: auto;
}

.card-header .titles {
  flex: 1 1 auto;
  min-width: 0;
}

.card-header .title {
  color: var(--brand-purple-ink);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.01em;
  margin: 0 0 2px;
  line-height: 1.15;
}

.card-header .subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0;
  line-height: 1.3;
}

@media (max-width: 767px) {
  .card-header { gap: 14px; }
  .card-header .logo { width: 130px; }
  .card-header .title { font-size: 20px; }
}

@media (max-width: 479px) {
  .card-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
  }
  .card-header .logo { width: 140px; }
  .card-header .title { font-size: 19px; }
  .card-header .subtitle { font-size: 12px; line-height: 1.35; }
}

/* =========================================================
   Inputs — underline with icon + micro label above
   ========================================================= */

.field {
  display: block;
}

.field-label {
  display: block;
  font-size: 10px;
  color: var(--text-label);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 700;
  margin-top: 14px;
  margin-bottom: 4px;
}

.field-label .field-label-aside {
  float: right;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--brand-purple);
}

.field-input {
  position: relative;
  padding: 0 0 0 28px;
  border-bottom: 1.5px solid var(--stroke-line);
  transition: border-color 160ms ease, box-shadow 160ms ease;
  min-height: 52px;
  cursor: text;
  display: flex;
  align-items: stretch;
}

.field-input .field-icon {
  position: absolute;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(34, 25, 81, 0.55);
  font-size: 14px;
  pointer-events: none;
  transition: color 160ms ease;
}

.field-input input {
  flex: 1 1 auto;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  font: 400 15px/1.4 Inter, system-ui, sans-serif;
  color: var(--text-body);
  padding: 14px 0;
  cursor: text;
}

.field-input input::placeholder {
  color: rgba(34, 25, 81, 0.45);
}

.field-input:focus-within {
  border-bottom-color: var(--brand-green);
  box-shadow: 0 1px 0 0 var(--brand-green);
}

.field-input:focus-within .field-icon {
  color: var(--brand-purple);
}

.field-input input:-webkit-autofill,
.field-input input:-webkit-autofill:hover,
.field-input input:-webkit-autofill:focus,
.field-input input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text-body) !important;
  caret-color: var(--text-body);
  /* Stall the autofill background paint so the glass shows through */
  transition: background-color 600000s 0s, color 600000s 0s;
}

.field-input .field-toggle {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: rgba(34, 25, 81, 0.55);
  cursor: pointer;
  font-size: 14px;
  padding: 6px 8px;
  min-width: 32px;
  min-height: 32px;
}

.field-input .field-toggle:hover,
.field-input .field-toggle:focus {
  color: var(--brand-purple);
  outline: none;
}

@media (max-width: 479px) {
  .field-input { padding-left: 24px; }
}

/* =========================================================
   Password-policy hint block (under password input on signup)
   ========================================================= */

.password-policy {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}
.password-policy strong { color: var(--brand-purple-ink); }
.password-policy ul { margin: 4px 0 0 18px; padding: 0; }
.password-policy li { margin: 0; }

/* =========================================================
   Primary button (solid purple pill)
   ========================================================= */

.btn-primary {
  display: block;
  width: 100%;
  padding: 14px 22px;
  background: var(--brand-purple);
  color: #fff;
  border: none;
  border-radius: 999px;
  font: 700 13px/1 Inter, system-ui, sans-serif;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  text-decoration: none;
  text-align: center;
  box-shadow: 0 8px 24px rgba(48, 41, 110, 0.25);
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 160ms ease, background 160ms ease;
  min-height: 48px;
  -webkit-tap-highlight-color: rgba(48, 41, 110, 0.25);
  margin-top: 22px;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(48, 41, 110, 0.35);
  background: var(--brand-purple-ink);
  color: #fff;
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 6px 16px rgba(48, 41, 110, 0.25);
}

.btn-primary:focus-visible {
  outline: 2px solid var(--brand-green);
  outline-offset: 3px;
}

.btn-primary .btn-icon {
  margin-left: 6px;
  font-size: 14px;
}

.auth-link {
  color: var(--brand-purple);
  text-decoration: underline;
  font-weight: 600;
}
.auth-link:hover { color: var(--brand-purple-ink); }
.auth-link:focus-visible {
  outline: 2px solid var(--brand-green);
  outline-offset: 2px;
  border-radius: 2px;
}

.auth-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}
.auth-footer a {
  color: var(--brand-purple);
  font-weight: 700;
  text-decoration: none;
}
.auth-footer a:hover { text-decoration: underline; }

@media (max-width: 479px) {
  .btn-primary { padding: 14px 16px; font-size: 12px; }
}

/* =========================================================
   Alerts — text-only (icon + title in same flex row)
   ========================================================= */

.alert {
  margin-bottom: 18px;
}

.alert-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
}

.alert-heading .fa { font-size: 16px; line-height: 1; }

.alert-msg {
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
  white-space: pre-line;
}

.alert a { color: inherit; text-decoration: underline; font-weight: 600; }

.alert-error  { color: var(--alert-error-fg); }
.alert-notice { color: var(--alert-notice-fg); }
.alert-info   { color: var(--alert-info-fg); }

.alert ~ .form-fields { border-top: 1px solid rgba(34, 25, 81, 0.12); padding-top: 14px; }

@media (max-width: 479px) {
  .alert-heading { font-size: 13px; }
  .alert-msg { font-size: 12px; }
}
