/**
 * Theta — Login
 * Grocery & Supermarket. Fresh at your doorstep.
 * Green palette. Inspired by reference layout, reimagined for fresh/organic feel.
 */

@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&family=Outfit:wght@500;600;700&display=swap");

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

:root {
  /* Fresh green palette — grocery / supermarket */
  --th-bg: #f0fdf4;
  --th-bg-warm: #ecfdf5;
  --th-card: #ffffff;
  --th-brand: #16a34a;
  --th-brand-light: #22c55e;
  --th-brand-dark: #15803d;
  --th-accent: #166534;
  --th-accent-light: #4ade80;
  --th-mint: #dcfce7;
  --th-cream: #f7fef9;
  --th-text: #14532d;
  --th-text-soft: #166534;
  --th-muted: #4b7c59;
  --th-border: rgba(22, 163, 74, 0.18);
  --th-glow: rgba(22, 163, 74, 0.25);
  --th-shadow: rgba(22, 163, 74, 0.12);
  --th-error: #b91c1c;
  /* Light brand side — for black logo visibility */
  --th-brand-side-bg: #e8f5e9;
  --th-brand-side-accent: #c8e6c9;
}

@keyframes th-fade-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes th-card-in {
  from { opacity: 0; transform: scale(0.97) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes th-shine {
  0% { left: -100%; }
  100% { left: 100%; }
}

@keyframes th-float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(0, -10px); }
}

@keyframes th-float-slow {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(4px, -6px) rotate(2deg); }
  66% { transform: translate(-3px, 4px) rotate(-1deg); }
}

@keyframes th-glow-pulse {
  0%, 100% { box-shadow: 0 32px 80px rgba(0,0,0,0.06), 0 0 0 1px var(--th-border); }
  50% { box-shadow: 0 40px 100px rgba(22, 163, 74, 0.18), 0 0 0 1px var(--th-border); }
}

@keyframes th-orb-float {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.5; }
  25% { transform: translate(3%, -4%) scale(1.05); opacity: 0.65; }
  50% { transform: translate(-2%, 2%) scale(0.95); opacity: 0.55; }
  75% { transform: translate(2%, 3%) scale(1.02); opacity: 0.6; }
}

@keyframes th-bg-drift {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.94; }
}

@keyframes th-leaf-float {
  0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.7; }
  50% { transform: translateY(-12px) rotate(3deg); opacity: 0.9; }
}

@keyframes th-leaf-sway {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(2deg); }
}

/* Base */
body.th-auth {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background:
    linear-gradient(145deg, #ecfdf5 0%, #d1fae5 20%, #f0fdf4 50%, #d1fae5 80%, #f7fef9 100%);
}

body.th-auth::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 100% 80% at 0% 0%, rgba(34, 197, 94, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 80% 100% at 100% 0%, rgba(74, 222, 128, 0.06) 0%, transparent 48%),
    radial-gradient(ellipse 90% 70% at 100% 100%, rgba(22, 163, 74, 0.06) 0%, transparent 45%),
    radial-gradient(ellipse 70% 90% at 0% 100%, rgba(34, 197, 94, 0.07) 0%, transparent 45%),
    radial-gradient(ellipse 60% 60% at 50% 50%, rgba(255, 255, 255, 0.85) 0%, transparent 70%);
  pointer-events: none;
  animation: th-bg-drift 14s ease-in-out infinite;
}

/* Subtle leaf-dot grain */
.th-grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at center, rgba(22, 163, 74, 0.04) 1.5px, transparent 1.5px);
  background-size: 24px 24px;
  opacity: 0.95;
}

.th-grain::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
  pointer-events: none;
}

/* Soft green orbs */
.th-bg-orbs {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.th-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(65px);
  animation: th-orb-float 20s ease-in-out infinite;
}

.th-orb:nth-child(1) {
  width: 340px; height: 340px;
  top: -8%; left: -5%;
  background: radial-gradient(circle, rgba(22, 163, 74, 0.14) 0%, rgba(22, 163, 74, 0.03) 50%, transparent 70%);
  animation-duration: 22s; animation-delay: 0s;
}

.th-orb:nth-child(2) {
  width: 280px; height: 280px;
  top: 42%; right: -6%;
  background: radial-gradient(circle, rgba(74, 222, 128, 0.12) 0%, rgba(74, 222, 128, 0.02) 50%, transparent 70%);
  animation-duration: 18s; animation-delay: 3s;
}

.th-orb:nth-child(3) {
  width: 260px; height: 260px;
  bottom: -5%; left: 28%;
  background: radial-gradient(circle, rgba(22, 163, 74, 0.1) 0%, transparent 60%);
  animation-duration: 25s; animation-delay: 6s;
}

.th-orb:nth-child(4) {
  width: 220px; height: 220px;
  top: 58%; left: -4%;
  background: radial-gradient(circle, rgba(34, 197, 94, 0.09) 0%, transparent 60%);
  animation-duration: 20s; animation-delay: 2s;
}

.th-orb:nth-child(5) {
  width: 300px; height: 300px;
  top: 12%; right: 18%;
  background: radial-gradient(circle, rgba(22, 163, 74, 0.08) 0%, transparent 55%);
  animation-duration: 24s; animation-delay: 4s;
}

/* Leaf-like floating shapes — organic lines & curves */
.th-shapes {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.th-shape {
  position: absolute;
  border: 1px solid rgba(22, 163, 74, 0.2);
  border-radius: 50%;
  opacity: 0.4;
  animation: th-float 14s ease-in-out infinite;
}

.th-shape:nth-child(1) { width: 100px; height: 100px; top: 14%; left: 8%; border-radius: 50% 0 50% 50%; animation-delay: 0s; animation-duration: 12s; }
.th-shape:nth-child(2) { width: 60px; height: 60px; top: 76%; right: 12%; border-radius: 0 50% 50% 50%; animation-delay: 2.5s; animation-duration: 16s; }
.th-shape:nth-child(3) { width: 80px; height: 80px; bottom: 20%; left: 10%; animation-delay: 5s; animation: th-float-slow 18s ease-in-out infinite; }
.th-shape:nth-child(4) { width: 70px; height: 70px; top: 36%; right: 16%; border-radius: 50% 50% 0 50%; animation-delay: 1s; animation-duration: 13s; }
.th-shape:nth-child(5) { width: 90px; height: 90px; top: 55%; left: 5%; border-radius: 50% 50% 50% 0; animation-delay: 3s; animation-duration: 15s; }
.th-shape:nth-child(6) { width: 50px; height: 50px; top: 20%; right: 8%; animation-delay: 4s; animation: th-float-slow 14s ease-in-out infinite; }

/* Main card */
.th-login-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1000px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--th-card);
  border-radius: 28px;
  overflow: hidden;
  min-height: 580px;
  box-shadow:
    0 32px 80px rgba(0, 0, 0, 0.06),
    0 0 0 1px var(--th-border);
  animation: th-card-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards, th-glow-pulse 8s ease-in-out 1s infinite;
}

/* Left: Brand — bright light green for black logo */
.th-brand-side {
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(165deg, #f1f8f4 0%, var(--th-brand-side-bg) 40%, #d4edda 60%, var(--th-brand-side-accent) 100%);
}

.th-brand-side::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 20%, rgba(34, 197, 94, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse 60% 80% at 80% 80%, rgba(74, 222, 128, 0.08) 0%, transparent 50%),
    linear-gradient(105deg, transparent 0%, rgba(255, 255, 255, 0.5) 50%, transparent 100%);
  background-size: 100% 100%, 100% 100%, 200% 100%;
  z-index: 0;
}

.th-brand-side::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: repeating-linear-gradient(
    105deg,
    transparent,
    transparent 2px,
    rgba(22, 163, 74, 0.04) 2px,
    rgba(22, 163, 74, 0.04) 3px
  );
  z-index: 0;
  pointer-events: none;
}

.th-brand-content {
  position: relative;
  z-index: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.th-brand-content .logo-link {
  display: inline-block;
  margin-bottom: 0;
  animation: th-fade-up 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.th-brand-content .logo-link:hover {
  transform: scale(1.04);
  filter: drop-shadow(0 6px 20px rgba(22, 163, 74, 0.25));
}

.th-brand-content .logo-link img {
  max-width: 200px;
  width: 100%;
  height: auto;
  filter: none;
}

/* Fresh produce visual — leaf/circle motif */
.th-brand-visual {
  width: 100%;
  max-width: 220px;
  margin-top: 32px;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  animation: th-leaf-float 8s ease-in-out infinite;
  box-shadow: 0 12px 32px rgba(22, 163, 74, 0.2);
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 50%, #dcfce7 100%);
  border: 2px solid rgba(22, 163, 74, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}

.th-brand-visual img {
  width: 70%;
  height: 70%;
  object-fit: contain;
  opacity: 1;
}

.th-brand-tagline {
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  color: var(--th-text-soft);
  margin-top: 28px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  animation: th-fade-up 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both;
}

.th-brand-subtitle {
  font-size: 14px;
  color: var(--th-muted);
  margin-top: 8px;
  font-weight: 500;
  animation: th-fade-up 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.2s both;
}

.th-brand-side .th-corner {
  position: absolute;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-right: 2px solid var(--th-brand);
  border-bottom: 2px solid var(--th-brand);
  border-radius: 0 0 12px 0;
  opacity: 0.6;
}

/* Right: Form */
.th-form-side {
  padding: 48px 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background:
    linear-gradient(180deg, #ffffff 0%, #f7fef9 40%, #f0fdf4 100%);
  border-left: 1px solid var(--th-border);
  position: relative;
}

.th-form-side::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(ellipse 80% 60% at 100% 0%, rgba(236, 253, 245, 0.95) 0%, transparent 55%),
    radial-gradient(ellipse 50% 80% at 0% 100%, rgba(22, 163, 74, 0.06) 0%, transparent 50%);
  pointer-events: none;
}

.th-form-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
}

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

.th-form-title {
  font-family: 'Outfit', sans-serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--th-text);
  margin-bottom: 10px;
  letter-spacing: -0.03em;
  line-height: 1.2;
  animation: th-fade-up 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.th-form-subtitle {
  font-size: 15px;
  color: var(--th-muted);
  font-weight: 500;
  letter-spacing: 0.01em;
  animation: th-fade-up 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.06s both;
}

/* Input groups */
.th-input-group {
  margin-bottom: 22px;
  animation: th-fade-up 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.th-form-inner form .th-input-group:nth-of-type(2) { animation-delay: 0.1s; }
.th-form-inner form .th-input-group:nth-of-type(3) { animation-delay: 0.16s; }

.th-input-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--th-text-soft);
  margin-bottom: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: 'DM Sans', sans-serif;
}

.th-input-wrap {
  position: relative;
  border-radius: 16px;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease, border-color 0.25s ease;
}

.th-input-wrap:focus-within {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px var(--th-shadow), 0 0 0 1px var(--th-border);
}

.th-input-wrap .icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--th-muted);
  font-size: 20px;
  pointer-events: none;
  transition: color 0.25s ease, transform 0.25s ease;
}

.th-input-wrap:focus-within .icon {
  color: var(--th-brand);
  transform: translateY(-50%) scale(1.05);
}

.th-input-wrap input {
  width: 100%;
  padding: 16px 18px 16px 50px;
  background: var(--th-cream);
  border: 2px solid var(--th-border);
  border-radius: 16px;
  color: var(--th-text);
  font-size: 15px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
  outline: none;
}

.th-input-wrap input::placeholder {
  color: var(--th-muted);
  font-weight: 400;
}

.th-input-wrap input:focus {
  border-color: var(--th-brand);
  background: #fff;
  box-shadow: 0 0 0 4px var(--th-glow);
}

.th-input-wrap input.is-invalid {
  border-color: var(--th-error);
}

.th-toggle-password {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--th-muted);
  cursor: pointer;
  font-size: 18px;
  transition: color 0.2s ease;
}

.th-toggle-password:hover {
  color: var(--th-brand);
}

.th-input-wrap.has-toggle input {
  padding-right: 48px;
}

.th-invalid-feedback {
  color: var(--th-error);
  font-size: 12px;
  margin-top: 8px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
}

/* Remember me */
.th-remember {
  margin-bottom: 26px;
  animation: th-fade-up 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.28s both;
}

.th-remember label {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--th-text-soft);
  cursor: pointer;
  user-select: none;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  transition: color 0.2s ease;
}

.th-remember label:hover {
  color: var(--th-text);
}

.th-remember input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--th-brand);
  cursor: pointer;
  border-radius: 5px;
}

/* Submit button */
.th-submit {
  width: 100%;
  padding: 18px 24px;
  background: var(--th-brand);
  color: #fff;
  border: none;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease, background 0.3s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(22, 163, 74, 0.4);
  animation: th-fade-up 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.32s both;
}

.th-submit::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  animation: th-shine 4s ease-in-out infinite;
  pointer-events: none;
}

.th-submit:hover {
  background: var(--th-brand-light);
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 16px 40px rgba(22, 163, 74, 0.5);
}

.th-submit:hover::before {
  animation: th-shine 1.2s ease-in-out;
}

.th-submit:active {
  transform: translateY(-1px) scale(1);
}

/* Forgot password & Register */
.th-form-footer {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: th-fade-up 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.35s both;
}

.th-forgot-link {
  font-size: 14px;
  color: var(--th-brand);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease;
}

.th-forgot-link:hover {
  color: var(--th-brand-dark);
  text-decoration: underline;
}

.th-register-link {
  font-size: 14px;
  color: var(--th-muted);
}

.th-register-link a {
  color: var(--th-brand);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease;
}

.th-register-link a:hover {
  color: var(--th-brand-dark);
  text-decoration: underline;
}

/* Alert */
.th-alert {
  padding: 14px 18px;
  border-radius: 14px;
  margin-bottom: 22px;
  font-size: 14px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  background: rgba(185, 28, 28, 0.08);
  border: 1px solid rgba(185, 28, 28, 0.2);
  color: var(--th-error);
  animation: th-fade-up 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Back to home */
.th-back-home {
  position: absolute;
  top: 24px;
  left: 24px;
  z-index: 2;
  color: var(--th-muted);
  font-size: 14px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color 0.2s ease;
}

.th-back-home:hover {
  color: var(--th-brand);
}

/* Responsive */
@media (max-width: 900px) {
  .th-login-wrap {
    grid-template-columns: 1fr;
    max-width: 440px;
    min-height: auto;
    border-radius: 20px;
  }

  .th-brand-side {
    padding: 36px 28px;
    min-height: 200px;
  }

  .th-brand-content .logo-link img {
    max-width: 140px;
  }

  .th-brand-visual {
    max-width: 160px;
    margin-top: 20px;
  }

  .th-brand-tagline {
    font-size: 11px;
    margin-top: 16px;
  }

  .th-form-side {
    padding: 36px 28px;
    border-left: none;
    border-top: 1px solid var(--th-border);
  }

  .th-form-title {
    font-size: 24px;
  }

  .th-brand-side .th-corner {
    display: none;
  }
}

@media (max-width: 480px) {
  body.th-auth {
    padding: 16px;
  }

  .th-brand-visual {
    max-width: 120px;
  }

  .th-form-title {
    font-size: 22px;
  }

  .th-brand-side,
  .th-form-side {
    padding: 28px 20px;
  }

  .th-shape {
    opacity: 0.3;
  }

  .th-form-footer {
    flex-direction: column;
    align-items: stretch;
  }
}
