/* ============================================================
   auth.css  —  Login & Registration Pages
   AK-SoilSuite | Akwa Ibom State Colors: #1A6B1A & #F47920
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&family=Playfair+Display:wght@700;800&display=swap');

:root {
  --green:   #1A6B1A;
  --green-d: #134f13;
  --green-l: #2d8a2d;
  --orange:  #F47920;
  --orange-d:#d4641a;
  --orange-l:#f89040;
  --white:   #ffffff;
  --gray-50: #f9fafb;
  --gray-100:#f3f4f6;
  --gray-300:#d1d5db;
  --gray-500:#6b7280;
  --gray-700:#374151;
  --gray-900:#111827;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.10);
  --shadow-md: 0 4px 16px rgba(0,0,0,.12);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.18);
  --radius:  14px;
  --transition: .3s cubic-bezier(.4,0,.2,1);
}

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

html, body {
  height: 100%;
  font-family: 'Poppins', sans-serif;
  background: var(--green-d);
  overflow-x: hidden;
}

/* ── PAGE SHELL ─────────────────────────────────────────────── */
.auth-page {
  display: flex;
  min-height: 100vh;
}

/* ── LEFT BRANDING PANEL ────────────────────────────────────── */
.auth-brand {
  position: relative;
  width: 45%;
  min-height: 100vh;
  background: linear-gradient(160deg, var(--green-d) 0%, var(--green) 60%, #2a7a1a 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 3rem;
  overflow: hidden;
  flex-shrink: 0;
}

/* Background Uyo image subtle overlay */
.auth-brand::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('/static/images/akwabg.jpeg') center/cover no-repeat;
  opacity: .13;
  z-index: 0;
}

/* Floating decorative circles */
.brand-circle {
  position: absolute;
  border-radius: 50%;
  opacity: .10;
  animation: floatCircle 8s ease-in-out infinite;
}
.bc1 { width: 320px; height: 320px; background: var(--orange); top: -80px; right: -80px; animation-delay: 0s; }
.bc2 { width: 200px; height: 200px; background: var(--white);  bottom: 80px; left: -60px; animation-delay: 3s; }
.bc3 { width: 130px; height: 130px; background: var(--orange-l); top: 55%; right: 10%;    animation-delay: 5s; }

@keyframes floatCircle {
  0%, 100% { transform: translateY(0) scale(1); }
  50%       { transform: translateY(-20px) scale(1.05); }
}

/* Floating leaf particles */
.leaf-particle {
  position: absolute;
  font-size: 1.6rem;
  animation: leafFloat linear infinite;
  opacity: .18;
  z-index: 0;
}
@keyframes leafFloat {
  0%   { transform: translateY(110vh) rotate(0deg);   opacity: 0; }
  10%  { opacity: .18; }
  90%  { opacity: .18; }
  100% { transform: translateY(-10vh) rotate(720deg); opacity: 0; }
}

.brand-content {
  position: relative;
  z-index: 2;
  text-align: center;
  color: var(--white);
}

/* State Logo */
.state-logo-wrap {
  margin-bottom: 1.6rem;
  animation: logoIn .8s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes logoIn {
  from { transform: scale(.5) rotate(-15deg); opacity: 0; }
  to   { transform: scale(1) rotate(0deg);    opacity: 1; }
}
.state-logo {
  width: 110px;
  height: 110px;
  object-fit: contain;
  filter: drop-shadow(0 4px 20px rgba(0,0,0,.4)) brightness(1.08);
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  padding: 10px;
}

.brand-tagline {
  font-size: .72rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--orange-l);
  margin-bottom: .8rem;
  font-weight: 600;
  animation: fadeUp .6s .2s both;
}

.brand-title {
  font-family: 'Playfair Display', serif;
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: .7rem;
  animation: fadeUp .6s .35s both;
}
.brand-title .hi { color: var(--orange-l); }

.brand-desc {
  font-size: .875rem;
  color: rgba(255,255,255,.78);
  line-height: 1.7;
  max-width: 300px;
  margin: 0 auto 2rem;
  animation: fadeUp .6s .5s both;
}

/* Feature pills */
.brand-features {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  animation: fadeUp .6s .65s both;
}
.bf-pill {
  display: flex;
  align-items: center;
  gap: .7rem;
  background: rgba(255,255,255,.10);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 50px;
  padding: .55rem 1.2rem;
  font-size: .8rem;
  color: rgba(255,255,255,.9);
  text-align: left;
  transition: background var(--transition);
}
.bf-pill:hover { background: rgba(255,255,255,.16); }
.bf-icon { font-size: 1rem; flex-shrink: 0; }

/* Footer credit */
.brand-footer {
  position: absolute;
  bottom: 1.4rem;
  font-size: .72rem;
  color: rgba(255,255,255,.38);
  letter-spacing: .04em;
  z-index: 2;
}

/* ── RIGHT FORM PANEL ───────────────────────────────────────── */
.auth-form-panel {
  flex: 1;
  min-height: 100vh;
  background: var(--gray-50);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 2rem;
  position: relative;
  overflow: hidden;
}

/* Subtle pattern background */
.auth-form-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 80%, rgba(26,107,26,.06) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(244,121,32,.06) 0%, transparent 50%);
  pointer-events: none;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  background: var(--white);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  padding: 2.6rem 2.6rem 2.2rem;
  animation: cardIn .7s cubic-bezier(.34,1.1,.64,1) both;
}
@keyframes cardIn {
  from { transform: translateY(40px) scale(.97); opacity: 0; }
  to   { transform: translateY(0)    scale(1);   opacity: 1; }
}

/* Top brand strip */
.auth-card-logo {
  display: flex;
  align-items: center;
  gap: .8rem;
  margin-bottom: 1.8rem;
}
.card-logo-img {
  width: 44px; height: 44px;
  object-fit: contain;
  border-radius: 10px;
  background: var(--green);
  padding: 5px;
  filter: brightness(1.1);
}
.card-logo-text {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--gray-900);
  line-height: 1.1;
}
.card-logo-text span { color: var(--orange); }
.card-logo-sub {
  font-size: .68rem;
  color: var(--gray-500);
  font-weight: 400;
}

/* Headings */
.auth-heading {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: .3rem;
}
.auth-subheading {
  font-size: .85rem;
  color: var(--gray-500);
  margin-bottom: 1.8rem;
}

/* ── FORM ELEMENTS ──────────────────────────────────────────── */
.auth-form { display: flex; flex-direction: column; gap: 1.15rem; }

/* Floating label group */
.field-float {
  position: relative;
}
.field-float input {
  width: 100%;
  padding: 1rem 1rem .6rem 1rem;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: .92rem;
  font-family: 'Poppins', sans-serif;
  color: var(--gray-900);
  background: var(--white);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  /* leave room for floating label */
  padding-top: 1.4rem;
}
.field-float input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(26,107,26,.10);
}
.field-float input.error {
  border-color: #e53e3e;
  box-shadow: 0 0 0 3px rgba(229,62,62,.10);
}
.field-float label {
  position: absolute;
  left: 1rem;
  top: 1rem;
  font-size: .875rem;
  color: var(--gray-500);
  pointer-events: none;
  transition: all var(--transition);
  transform-origin: left top;
}
/* Label floats up when input focused or has value */
.field-float input:focus ~ label,
.field-float input:not(:placeholder-shown) ~ label {
  transform: translateY(-.55rem) scale(.78);
  color: var(--green);
  font-weight: 600;
}
.field-float input.error:focus ~ label,
.field-float input.error:not(:placeholder-shown) ~ label {
  color: #e53e3e;
}

/* Password toggle */
.field-float .pw-toggle {
  position: absolute;
  right: .9rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--gray-500);
  padding: .2rem;
  transition: color var(--transition);
  line-height: 1;
}
.field-float .pw-toggle:hover { color: var(--green); }

/* Row of two fields */
.field-row-auth {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .9rem;
}

/* Field error message */
.field-error {
  font-size: .74rem;
  color: #e53e3e;
  margin-top: .25rem;
  margin-left: .2rem;
  display: none;
}
.field-error.show { display: block; animation: shake .3s; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25%      { transform: translateX(-4px); }
  75%      { transform: translateX(4px); }
}

/* Flash / alert messages from Flask */
.flash-msg {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  font-size: .83rem;
  margin-bottom .5rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.flash-error   { background: #fef2f2; border: 1px solid #fca5a5; color: #b91c1c; }
.flash-success { background: #f0fdf4; border: 1px solid #86efac; color: #15803d; }
.flash-info    { background: #eff6ff; border: 1px solid #93c5fd; color: #1d4ed8; }

/* Checkbox row */
.check-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .82rem;
  color: var(--gray-700);
}
.check-row input[type=checkbox] {
  width: 16px; height: 16px;
  accent-color: var(--green);
  cursor: pointer;
  flex-shrink: 0;
}
.check-row a { color: var(--green); text-decoration: none; font-weight: 500; }
.check-row a:hover { color: var(--orange); }

/* Forgot password */
.forgot-row {
  display: flex;
  justify-content: flex-end;
  margin-top: -.5rem;
}
.forgot-row a {
  font-size: .78rem;
  color: var(--gray-500);
  text-decoration: none;
  transition: color var(--transition);
}
.forgot-row a:hover { color: var(--orange); }

/* Submit button */
.btn-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  width: 100%;
  padding: .9rem 1.5rem;
  background: linear-gradient(135deg, var(--green) 0%, var(--green-l) 100%);
  color: var(--white);
  font-family: 'Poppins', sans-serif;
  font-size: .92rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(26,107,26,.30);
  position: relative;
  overflow: hidden;
  margin-top: .3rem;
}
.btn-auth::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(255,255,255,.10) 100%);
  opacity: 0;
  transition: opacity var(--transition);
}
.btn-auth:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(26,107,26,.40);
}
.btn-auth:hover::after { opacity: 1; }
.btn-auth:active { transform: translateY(0); }

/* Loading state */
.btn-auth.loading { pointer-events: none; opacity: .75; }
.btn-auth .spin {
  display: none;
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,.35);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn-auth.loading .spin { display: block; }
.btn-auth.loading .btn-label { opacity: .7; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Divider */
.auth-divider {
  display: flex;
  align-items: center;
  gap: .8rem;
  color: var(--gray-300);
  font-size: .75rem;
  margin: .2rem 0;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}

/* Switch page link */
.auth-switch {
  text-align: center;
  font-size: .83rem;
  color: var(--gray-500);
  margin-top: 1.1rem;
}
.auth-switch a {
  color: var(--green);
  font-weight: 600;
  text-decoration: none;
  transition: color var(--transition);
}
.auth-switch a:hover { color: var(--orange); }

/* Password strength meter (register only) */
.pw-strength {
  margin-top: .4rem;
}
.pw-strength-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--gray-200);
  overflow: hidden;
  margin-bottom: .25rem;
}
.pw-strength-fill {
  height: 100%;
  border-radius: 2px;
  width: 0;
  transition: width .4s, background .4s;
}
.pw-strength-label {
  font-size: .7rem;
  color: var(--gray-500);
}

/* ── TERMS SECTION ─────────────────────────────────────────── */
.terms-note {
  font-size: .72rem;
  color: var(--gray-500);
  text-align: center;
  line-height: 1.6;
}
.terms-note a { color: var(--green); text-decoration: none; }
.terms-note a:hover { color: var(--orange); }

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 840px) {
  .auth-brand { display: none; }
  .auth-form-panel { background: linear-gradient(160deg, var(--green-d) 0%, var(--green) 40%, var(--gray-50) 60%); }
  .auth-card { max-width: 96vw; margin-top: 1rem; }
}

@media (max-width: 480px) {
  .auth-card { padding: 2rem 1.4rem 1.8rem; border-radius: 18px; }
  .auth-heading { font-size: 1.3rem; }
  .field-row-auth { grid-template-columns: 1fr; }
}

/* ── ENTRANCE ANIMATIONS ────────────────────────────────────── */
@keyframes fadeUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* Stagger children of auth-form */
.auth-form > *:nth-child(1) { animation: fadeUp .45s .15s both; }
.auth-form > *:nth-child(2) { animation: fadeUp .45s .22s both; }
.auth-form > *:nth-child(3) { animation: fadeUp .45s .29s both; }
.auth-form > *:nth-child(4) { animation: fadeUp .45s .36s both; }
.auth-form > *:nth-child(5) { animation: fadeUp .45s .43s both; }
.auth-form > *:nth-child(6) { animation: fadeUp .45s .50s both; }
.auth-form > *:nth-child(7) { animation: fadeUp .45s .57s both; }
