/* ───────────────────────────────────────────────────────────────────
   EcoAwareness — Auth experience (sign in / create account)
   Shared by signin.html + signup.html. Redesigned brand panel +
   segmented toggle, ported from the EcoAwareness design handoff.
   ─────────────────────────────────────────────────────────────────── */

:root {
  --ink: #0a0a0a;
  --ink-3: rgba(10, 10, 10, 0.5);
  --ink-4: rgba(10, 10, 10, 0.35);
  --paper: #f5f0e8;
  --green: #1a5c38;
  --green-light: #2d7a4f;
  --green-dark: #0d3a22;
  --lime: #a8e063;
  --rust: #c4622d;
  --error: #d64545;
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-arabic: 'Noto Naskh Arabic', serif;
  --ease-out: cubic-bezier(0.25, 1, 0.5, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--green-dark);
  -webkit-font-smoothing: antialiased;
}

.auth-noscript {
  position: fixed; inset: 0; z-index: 10000; display: flex;
  align-items: center; justify-content: center; text-align: center;
  background: var(--green-dark); color: #fff; padding: 2rem;
  font-family: var(--font-body); font-size: 1rem; line-height: 1.6;
}

.auth-layout { display: flex; min-height: 100vh; min-height: 100dvh; }

/* ── LEFT: DARK BRAND PANEL ─────────────────────────────────────── */
.brand-panel {
  flex: 1; min-width: 0; position: relative; overflow: hidden; color: #fff;
  padding: clamp(2rem, 4vw, 3rem);
  display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(ellipse 80% 60% at 18% 110%, rgba(168, 224, 99, 0.16), transparent 60%),
    radial-gradient(ellipse 60% 50% at 100% 0%, rgba(196, 98, 45, 0.14), transparent 55%),
    linear-gradient(160deg, #0e3f26 0%, #0a2c1c 55%, #061a11 100%);
}
.brand-panel::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 52px 52px;
  -webkit-mask-image: radial-gradient(ellipse 100% 80% at 40% 40%, black 35%, transparent 80%);
  mask-image: radial-gradient(ellipse 100% 80% at 40% 40%, black 35%, transparent 80%);
}
.brand-panel > * { position: relative; z-index: 1; }

.brand-watermark {
  position: absolute; right: -2%; top: 14%; z-index: 0;
  font-family: var(--font-arabic); font-size: 20vw; line-height: 1;
  color: rgba(255, 255, 255, 0.035); pointer-events: none; user-select: none;
}

.brand-logo {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-family: var(--font-display); font-style: italic; font-size: 1.5rem;
  color: #fff; text-decoration: none; letter-spacing: -0.01em;
}
.brand-logo-dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--lime);
  box-shadow: 0 0 16px rgba(168, 224, 99, 0.6); flex-shrink: 0;
  animation: pulse-dot 2.8s var(--ease-out) infinite;
}
@keyframes pulse-dot { 50% { transform: scale(1.35); opacity: 0.72; } }

.brand-mid { max-width: 480px; }
.brand-eyebrow {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.72rem; font-weight: 600; color: var(--lime);
  letter-spacing: 0.16em; text-transform: uppercase; margin-bottom: 1.2rem;
}
.brand-eyebrow::before { content: ''; width: 24px; height: 1px; background: var(--lime); }
.brand-headline {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 4.4vw, 4rem);
  line-height: 1.04; letter-spacing: -0.02em; margin: 0 0 1.2rem;
}
.brand-headline em { font-style: italic; color: var(--lime); }
.brand-sub {
  font-size: 1rem; line-height: 1.65; font-weight: 300;
  color: rgba(255, 255, 255, 0.66); max-width: 420px; margin: 0;
}

.growth-motif {
  display: flex; align-items: flex-end; gap: 9px; height: 90px;
  opacity: 0.85; margin-top: 2rem;
}
.growth-bar {
  width: 14px; border-radius: 5px 5px 2px 2px; transform-origin: bottom;
  background: rgba(168, 224, 99, 0.32);
  animation: growbar 2.6s var(--ease-out) infinite alternate;
}
.growth-bar.peak { background: var(--lime); }
@keyframes growbar { from { transform: scaleY(0.78); } to { transform: scaleY(1.05); } }

.brand-bottom { position: relative; }
.live-stats { display: flex; gap: 2.4rem; margin-bottom: 1.8rem; flex-wrap: wrap; }
.live-stat-num {
  font-family: var(--font-display); font-style: italic; font-size: 2.1rem;
  color: var(--lime); line-height: 1;
}
.live-stat-label {
  font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5); margin-top: 6px;
}
.brand-quote { padding-left: 1rem; border-left: 2px solid var(--lime); max-width: 440px; }
.brand-quote.fade { animation: fadein 0.7s var(--ease-out); }
.brand-quote p {
  font-family: var(--font-display); font-style: italic; font-size: 1.05rem;
  line-height: 1.5; color: rgba(255, 255, 255, 0.82); margin: 0;
}
.brand-quote-author {
  display: block; margin-top: 0.6rem; font-size: 0.78rem; color: rgba(255, 255, 255, 0.45);
}
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } }

/* ── RIGHT: WHITE FORM PANEL ────────────────────────────────────── */
.form-panel {
  flex: 1; min-width: 0; background: #fff; border-radius: 40px 0 0 40px;
  padding: clamp(2rem, 4vw, 3.4rem);
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow-y: auto;
}
.form-inner { width: 100%; max-width: 460px; }

.back-link {
  position: absolute; top: 1.4rem; left: clamp(1.5rem, 4vw, 3rem);
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.82rem; color: var(--ink-3); text-decoration: none; transition: color 0.2s;
}
.back-link:hover { color: var(--green); }

.seg-toggle {
  display: inline-flex; padding: 4px; border-radius: 100px;
  background: var(--paper); border: 1px solid rgba(0, 0, 0, 0.07); margin-bottom: 1.8rem;
}
.seg-btn {
  padding: 0.5rem 1.3rem; border-radius: 100px; border: none; cursor: pointer;
  font-size: 0.82rem; font-weight: 600; font-family: var(--font-body);
  background: transparent; color: var(--ink-3); transition: all 0.2s;
}
.seg-btn.active { background: var(--green); color: #fff; box-shadow: 0 4px 12px rgba(26, 92, 56, 0.22); }

.form-title {
  font-family: var(--font-display); font-size: clamp(2rem, 3.6vw, 2.7rem);
  line-height: 1.1; letter-spacing: -0.02em; margin: 0 0 0.5rem;
}
.form-title em { font-style: italic; color: var(--green); }
.form-subtitle { font-size: 0.92rem; color: var(--ink-3); font-weight: 300; margin: 0 0 1.8rem; }

.field-group { margin-bottom: 1rem; }
.field-group.hidden { display: none; }
.field-label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.68rem; font-weight: 600; color: var(--ink-3);
  letter-spacing: 0.08em; text-transform: uppercase; margin: 0 0 0.45rem 0.25rem;
}
.field-label-action {
  font-family: var(--font-body); background: none; border: none; padding: 0; cursor: pointer;
  font-size: 0.7rem; font-weight: 600; color: var(--green); text-transform: none; letter-spacing: normal;
}
.field-label-action:hover { text-decoration: underline; }

.input-field {
  width: 100%; padding: 0.85rem 1.1rem; border-radius: 100px;
  border: 1px solid rgba(0, 0, 0, 0.1); background: var(--paper);
  font-size: 0.9rem; font-family: var(--font-body); color: var(--ink);
  outline: none; transition: all 0.2s;
}
.input-field::placeholder { color: rgba(0, 0, 0, 0.32); }
.input-field:focus { border-color: var(--green); background: #fff; box-shadow: 0 0 0 3px rgba(26, 92, 56, 0.1); }
.input-field.error { border-color: var(--error); box-shadow: 0 0 0 3px rgba(214, 69, 69, 0.08); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .input-field { padding-right: 2.85rem; }
.eye-toggle {
  position: absolute; right: 1rem; background: none; border: none; cursor: pointer;
  color: var(--ink-4); padding: 4px; display: grid; font-size: 1.15rem; transition: color 0.2s;
}
.eye-toggle:hover { color: var(--green); }

.field-error { font-size: 0.72rem; color: var(--error); margin: 0.4rem 0 0 1rem; display: none; }
.field-error.visible { display: block; }

.strength { display: none; margin-top: 0.7rem; padding-left: 0.25rem; }
.strength.visible { display: block; }
.strength-bars { display: flex; gap: 5px; }
.strength-bar { flex: 1; height: 4px; border-radius: 100px; background: rgba(0, 0, 0, 0.08); transition: background 0.3s; }
.strength-text { font-size: 0.7rem; font-weight: 600; margin-top: 6px; color: var(--ink-3); }

.btn-primary {
  width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  background: var(--green); color: #fff; padding: 0.95rem 1.5rem; border: none; border-radius: 100px;
  font-family: var(--font-body); font-size: 0.95rem; font-weight: 500; cursor: pointer;
  margin-top: 0.6rem; box-shadow: 0 4px 14px rgba(26, 92, 56, 0.18); transition: all 0.2s;
}
.btn-primary:hover:not(:disabled) { background: var(--green-light); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(26, 92, 56, 0.28); }
.btn-primary:disabled { opacity: 0.65; cursor: not-allowed; }

.btn-spinner {
  display: inline-block; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.terms-note { margin: 0.9rem 0 0; font-size: 0.74rem; line-height: 1.5; color: var(--ink-4); text-align: center; }
.terms-note a { color: var(--green); font-weight: 500; text-decoration: none; border-bottom: 1px solid rgba(26, 92, 56, 0.25); }
.terms-note a:hover { border-bottom-color: var(--green); }

.divider-row { display: flex; align-items: center; gap: 0.9rem; margin: 1.4rem 0; font-size: 0.72rem; color: var(--ink-4); }
.divider-row::before, .divider-row::after { content: ''; flex: 1; height: 1px; background: rgba(0, 0, 0, 0.08); }

.btn-google {
  width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 0.65rem;
  background: #fff; color: var(--ink); padding: 0.9rem 1.5rem; border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 100px; font-family: var(--font-body); font-size: 0.9rem; font-weight: 500;
  cursor: pointer; transition: all 0.2s;
}
.btn-google:hover { background: var(--paper); border-color: rgba(0, 0, 0, 0.18); transform: translateY(-1px); }

.form-foot { text-align: center; margin-top: 1.6rem; font-size: 0.86rem; color: var(--ink-3); }
.form-foot button {
  background: none; border: none; cursor: pointer; font-family: var(--font-body);
  color: var(--green); font-weight: 600; font-size: 0.86rem; padding: 0;
}
.form-foot button:hover { text-decoration: underline; }

.confirm-help {
  display: none; margin-top: 1rem; padding: 1rem;
  border: 1px solid rgba(26, 92, 56, 0.14); border-radius: 16px;
  background: rgba(26, 92, 56, 0.06); color: rgba(0, 0, 0, 0.68); font-size: 0.85rem; line-height: 1.55;
}
.confirm-help.show { display: block; }
.confirm-help strong { display: block; margin-bottom: 0.2rem; color: var(--ink); }
.confirm-actions { display: flex; gap: 0.65rem; flex-wrap: wrap; margin-top: 0.85rem; }
.confirm-btn {
  border: 1px solid rgba(26, 92, 56, 0.22); border-radius: 999px; background: #fff; color: var(--green);
  padding: 0.6rem 0.9rem; font: 500 0.8rem var(--font-body); cursor: pointer; text-decoration: none;
}
.confirm-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── TOAST ──────────────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%) translateY(20px);
  opacity: 0; transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); z-index: 9000; pointer-events: none;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast-inner {
  display: inline-flex; align-items: center; gap: 0.6rem; padding: 0.8rem 1.2rem; border-radius: 100px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18); font-size: 0.85rem; font-weight: 500;
}
#toast-inner.ok { background: #0d3a22; color: #fff; }
#toast-inner.err { background: #fee; color: #a33; border: 1px solid #fbb; }

/* ── PAGE TRANSITION (driven by ecohub-enhancements.js + auth.js) ── */
#page-transition {
  position: fixed; inset: 0; z-index: 9999; background: var(--green-dark);
  display: flex; align-items: center; justify-content: center; opacity: 1;
  transition: opacity 550ms cubic-bezier(0.4, 0, 0.2, 1); pointer-events: none; will-change: opacity;
}
#transition-logo {
  width: 4.5rem; height: 4.5rem; transform: scale(0.92);
  transition: transform 650ms var(--ease-out); will-change: transform;
}
#page-transition.leaving #transition-logo { transform: scale(1.08); }

/* ── RESPONSIVE ─────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .auth-layout { flex-direction: column; }
  .brand-panel { padding: 2rem 1.75rem 2.6rem; }
  .brand-headline { font-size: 2rem; margin-bottom: 0.9rem; }
  .brand-sub { font-size: 0.9rem; }
  .growth-motif { height: 64px; margin-top: 1.4rem; }
  .live-stats { gap: 1.6rem; margin-bottom: 1.4rem; }
  .live-stat-num { font-size: 1.7rem; }
  .form-panel { border-radius: 32px 32px 0 0; margin-top: -24px; padding: 2.5rem 1.75rem 3rem; }
  .back-link { top: 1rem; left: 1.5rem; color: rgba(255, 255, 255, 0.7); }
  .back-link:hover { color: var(--lime); }
}
@media (max-width: 500px) {
  .brand-headline { font-size: 1.75rem; }
  .form-title { font-size: 1.9rem; }
  .brand-watermark { font-size: 32vw; }
}

/* ── REDUCED MOTION ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto !important; }
}
