/* ════════════════════════════════════════════════════════════════════════
   MJP Auth — Heritage Modern (r15p13)
   Editorial real-estate journal × premium SaaS.
   Shared CSS for all 8 auth pages (ERP + Agen Portal).
   Vanilla CSS, no build step.
   ════════════════════════════════════════════════════════════════════════ */

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

:root {
  /* Emerald — layered for gradient mesh depth */
  --emerald-950: #04221A;
  --emerald-900: #062D22;
  --emerald-800: #0A3D2E;
  --emerald-700: #0F5743;
  --emerald-600: #0F6E56;
  --emerald-500: #1B8567;
  --emerald-400: #2EA383;
  --emerald-300: #5BC3A2;
  --emerald-200: #9BDDC2;
  --emerald-100: #C9EEDD;
  --emerald-50:  #ECF8F2;

  /* Gold — heritage accent */
  --gold-500: #C9A35B;
  --gold-400: #D4B26A;
  --gold-300: #E0C283;

  /* Ink — refined neutrals */
  --ink-950: #0A1410;
  --ink-900: #0F1F18;
  --ink-700: #2A3E33;
  --ink-500: #556864;
  --ink-300: #93A09B;
  --ink-200: #C7CFCC;
  --ink-100: #E5EAE7;
  --ink-50:  #F4F7F5;
  --paper:   #FAFBF9;

  /* Effects */
  --blur-glass: 24px;
  --shadow-card:
    0 1px 2px rgba(4, 34, 26, 0.04),
    0 8px 28px -10px rgba(15, 87, 67, 0.18),
    0 30px 60px -30px rgba(4, 34, 26, 0.25);
  --shadow-cta:
    0 1px 2px rgba(0,0,0,0.06),
    0 4px 12px -4px rgba(15, 87, 67, 0.42);
  --shadow-cta-hover:
    0 1px 2px rgba(0,0,0,0.06),
    0 18px 36px -10px rgba(15, 87, 67, 0.52);

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
html, body { height: 100%; }
img, svg { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  color: var(--ink-900);
  background: var(--emerald-950);
  font-feature-settings: 'cv11';
  overflow-x: hidden;
}

/* ════════════════════════════════════════════════════════════════════════
   LAYOUT — split shell
   ════════════════════════════════════════════════════════════════════════ */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 4fr);
  position: relative;
}

@media (max-width: 960px) {
  .auth-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }
}

/* ════════════════════════════════════════════════════════════════════════
   BRAND PANEL — gradient mesh + editorial copy
   ════════════════════════════════════════════════════════════════════════ */
.auth-brand {
  position: relative;
  padding: 64px 72px 56px;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 56px;
  isolation: isolate;
  overflow: hidden;
  background: var(--emerald-950);
  min-height: 100vh;
}

@media (max-width: 960px) {
  .auth-brand {
    min-height: 340px;
    padding: 40px 28px 44px;
    gap: 36px;
  }
}

/* Layered radial-gradient mesh with slow drift */
.auth-brand::before {
  content: '';
  position: absolute;
  inset: -25%;
  background:
    radial-gradient(42% 60% at 18% 28%, rgba(46,163,131,0.55) 0%, transparent 60%),
    radial-gradient(38% 45% at 82% 22%, rgba(212,178,106,0.16) 0%, transparent 58%),
    radial-gradient(52% 70% at 72% 78%, rgba(15,110,86,0.50) 0%, transparent 65%),
    radial-gradient(32% 40% at 28% 88%, rgba(91,195,162,0.32) 0%, transparent 60%);
  filter: blur(50px);
  z-index: -2;
  animation: brand-mesh-drift 28s ease-in-out infinite;
}
@keyframes brand-mesh-drift {
  0%, 100% { transform: rotate(0deg) scale(1) translate(0, 0); }
  33%      { transform: rotate(2deg) scale(1.04) translate(2%, -1%); }
  66%      { transform: rotate(-1.5deg) scale(0.98) translate(-1%, 2%); }
}

/* Editorial grid texture overlay */
.auth-brand::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, black 25%, black 75%, transparent 100%);
          mask-image: linear-gradient(180deg, transparent 0%, black 25%, black 75%, transparent 100%);
  z-index: -1;
  pointer-events: none;
}

.auth-brand-mark {
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  z-index: 1;
  opacity: 0;
  animation: fade-up 0.9s 0.1s var(--ease-out) forwards;
}
.auth-brand-logo {
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid rgba(255,255,255,0.28);
  border-radius: 12px;
  font-family: 'DM Serif Display', serif;
  font-size: 18px;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, rgba(255,255,255,0.06), rgba(255,255,255,0.01));
  backdrop-filter: blur(8px);
  color: var(--gold-400);
}
.auth-brand-name-block { line-height: 1.25; }
.auth-brand-name {
  font-family: 'DM Sans', sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.92);
}
.auth-brand-sub {
  font-size: 11px;
  font-weight: 400;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.06em;
  margin-top: 2px;
}

.auth-brand-content {
  position: relative;
  z-index: 1;
  opacity: 0;
  animation: fade-up 0.9s 0.3s var(--ease-out) forwards;
  max-width: 520px;
}
.auth-brand-eyebrow {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-400);
  margin-bottom: 22px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.auth-brand-eyebrow::before {
  content: '';
  width: 32px;
  height: 1px;
  background: var(--gold-400);
}
.auth-brand-title {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(40px, 4.4vw, 58px);
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: -0.028em;
  color: white;
}
.auth-brand-title em {
  font-family: 'DM Serif Display', serif;
  color: var(--gold-400);
  font-style: italic;
}
.auth-brand-quote {
  margin-top: 26px;
  max-width: 38ch;
  font-size: 15.5px;
  line-height: 1.65;
  color: rgba(255,255,255,0.75);
  letter-spacing: -0.005em;
  font-weight: 400;
}

.auth-brand-foot {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  opacity: 0;
  animation: fade-up 0.9s 0.5s var(--ease-out) forwards;
}
.auth-brand-credit {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.auth-brand-stats {
  display: flex;
  gap: 36px;
}
.auth-brand-stat { text-align: left; }
.auth-brand-stat-value {
  font-family: 'DM Serif Display', serif;
  font-size: 28px;
  font-weight: 400;
  color: white;
  letter-spacing: -0.02em;
  line-height: 1;
}
.auth-brand-stat-value em {
  font-family: 'DM Serif Display', serif;
  color: var(--gold-400);
  font-style: italic;
}
.auth-brand-stat-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 10.5px;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 6px;
  font-weight: 500;
}

/* ════════════════════════════════════════════════════════════════════════
   FORM SIDE — glassmorphic card on tinted paper
   ════════════════════════════════════════════════════════════════════════ */
.auth-form-side {
  background: var(--ink-50);
  padding: 64px 72px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  min-height: 100vh;
}
@media (max-width: 960px) {
  .auth-form-side {
    padding: 48px 24px 56px;
    min-height: auto;
  }
}

.auth-form-side::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(80% 60% at 50% -10%, rgba(46,163,131,0.07) 0%, transparent 60%),
    radial-gradient(60% 80% at 100% 110%, rgba(212,178,106,0.05) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.auth-card {
  position: relative;
  z-index: 1;
  max-width: 460px;
  width: 100%;
  margin: 0 auto;
  padding: 48px 44px;
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(var(--blur-glass)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--blur-glass)) saturate(160%);
  border: 1px solid rgba(255,255,255,0.62);
  border-radius: 22px;
  box-shadow: var(--shadow-card);
}
@media (max-width: 600px) {
  .auth-card { padding: 32px 24px; border-radius: 18px; }
}

.auth-eyebrow {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--emerald-600);
  opacity: 0;
  animation: fade-up 0.8s 0.2s var(--ease-out) forwards;
}

.auth-title {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(32px, 3.4vw, 40px);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.028em;
  color: var(--ink-950);
  margin-top: 10px;
  opacity: 0;
  animation: fade-up 0.8s 0.3s var(--ease-out) forwards;
}
.auth-title em {
  font-family: 'DM Serif Display', serif;
  font-style: italic;
  color: var(--emerald-600);
}

.auth-sub {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink-500);
  margin-top: 14px;
  max-width: 42ch;
  opacity: 0;
  animation: fade-up 0.8s 0.4s var(--ease-out) forwards;
}

.auth-form {
  margin-top: 36px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ════════════════════════════════════════════════════════════════════════
   FIELD — borderless with animated bottom underline
   ════════════════════════════════════════════════════════════════════════ */
.auth-field {
  position: relative;
  opacity: 0;
  animation: fade-up 0.75s var(--ease-out) forwards;
}
.auth-form > .auth-field:nth-of-type(1) { animation-delay: 0.50s; }
.auth-form > .auth-field:nth-of-type(2) { animation-delay: 0.60s; }
.auth-form > .auth-field:nth-of-type(3) { animation-delay: 0.70s; }
.auth-form > .auth-field:nth-of-type(4) { animation-delay: 0.80s; }
.auth-form > .auth-field:nth-of-type(5) { animation-delay: 0.90s; }
.auth-form > .auth-field:nth-of-type(6) { animation-delay: 1.00s; }
.auth-form > .auth-cta { animation-delay: 1.10s; }
.auth-form > .auth-footer-links { animation-delay: 1.20s; }

.auth-field-label {
  display: block;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-500);
  margin-bottom: 10px;
}

.auth-field-input-wrap {
  position: relative;
}

.auth-input {
  width: 100%;
  padding: 6px 0 12px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--ink-200);
  border-radius: 0;
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  font-weight: 400;
  color: var(--ink-950);
  letter-spacing: -0.005em;
  transition: border-color 300ms var(--ease);
  -webkit-appearance: none;
          appearance: none;
}
.auth-input::placeholder {
  color: var(--ink-300);
  font-weight: 400;
}
.auth-input:focus {
  outline: none;
  border-bottom-color: transparent; /* defer to animated line */
}

/* The animated underline that draws from left on focus */
.auth-field-line {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1.5px;
  background: linear-gradient(90deg, var(--emerald-500), var(--emerald-400) 55%, var(--gold-400));
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 420ms var(--ease-out);
  pointer-events: none;
}
.auth-field-input-wrap:focus-within .auth-field-line {
  transform: scaleX(1);
}

.auth-field-hint {
  font-size: 12.5px;
  color: var(--ink-500);
  margin-top: 10px;
  letter-spacing: -0.005em;
  font-weight: 400;
}

/* Editorial index marker — top right of each field */
.auth-field-index {
  position: absolute;
  top: -2px;
  right: 0;
  font-family: 'DM Serif Display', serif;
  font-size: 12px;
  color: var(--ink-300);
  letter-spacing: 0.02em;
  font-style: italic;
}

/* Password show/hide */
.auth-field-toggle {
  position: absolute;
  right: 0;
  bottom: 10px;
  background: transparent;
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-300);
  cursor: pointer;
  padding: 4px 6px;
  transition: color 220ms;
}
.auth-field-toggle:hover {
  color: var(--emerald-600);
}

/* Password strength meter */
.auth-strength {
  margin-top: 14px;
  display: flex;
  gap: 5px;
}
.auth-strength-bar {
  height: 3px;
  flex: 1;
  background: var(--ink-100);
  border-radius: 999px;
  transition: background 280ms var(--ease-out), transform 280ms var(--ease-out);
}
.auth-strength-bar.is-active  { background: var(--gold-400); }
.auth-strength-bar.is-good    { background: var(--emerald-400); }
.auth-strength-bar.is-strong  { background: var(--emerald-600); }

.auth-strength-label {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--ink-500);
  letter-spacing: 0.02em;
}

/* Password requirements list */
.auth-requirements {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-500);
}
.auth-req {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color 220ms;
}
.auth-req::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink-200);
  transition: background 220ms;
}
.auth-req.is-met { color: var(--emerald-700); }
.auth-req.is-met::before { background: var(--emerald-500); }

/* ════════════════════════════════════════════════════════════════════════
   CTA — rounded-full gradient with cursor-aware highlight
   ════════════════════════════════════════════════════════════════════════ */
.auth-cta {
  margin-top: 12px;
  width: 100%;
  padding: 17px 28px;
  border: none;
  border-radius: 999px;
  background:
    linear-gradient(135deg, var(--emerald-500) 0%, var(--emerald-600) 50%, var(--emerald-800) 100%);
  background-size: 200% 200%;
  background-position: 0% 0%;
  color: white;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.015em;
  cursor: pointer;
  transition: all 360ms var(--ease);
  box-shadow: var(--shadow-cta);
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  opacity: 0;
  animation: fade-up 0.8s var(--ease-out) forwards;
}
.auth-cta:hover {
  background-position: 100% 100%;
  box-shadow: var(--shadow-cta-hover);
  transform: translateY(-2px);
}
.auth-cta:active {
  transform: translateY(0);
}
.auth-cta:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}
.auth-cta::after {
  content: '';
  position: absolute;
  top: 0;
  left: -120%;
  width: 50%;
  height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,0.18), transparent);
  transition: left 700ms var(--ease-out);
}
.auth-cta:hover::after { left: 220%; }

.auth-cta-arrow {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  transition: transform 320ms var(--ease-out);
}
.auth-cta:hover .auth-cta-arrow { transform: translateX(3px); }

.auth-cta-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.auth-cta.is-loading .auth-cta-spinner { display: inline-block; }
.auth-cta.is-loading .auth-cta-label { opacity: 0.7; }
.auth-cta.is-loading .auth-cta-arrow { display: none; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ════════════════════════════════════════════════════════════════════════
   FOOTER / LINKS / DIVIDERS
   ════════════════════════════════════════════════════════════════════════ */
.auth-footer-links {
  margin-top: 28px;
  text-align: center;
  font-size: 13.5px;
  color: var(--ink-500);
  opacity: 0;
  animation: fade-up 0.8s var(--ease-out) forwards;
}
.auth-footer-links a {
  color: var(--emerald-600);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid rgba(15, 110, 86, 0.25);
  padding-bottom: 1px;
  transition: border-color 220ms;
}
.auth-footer-links a:hover {
  border-bottom-color: var(--emerald-500);
}

.auth-help-row {
  margin-top: 24px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-300);
  letter-spacing: 0.02em;
  opacity: 0;
  animation: fade-up 0.8s 1.3s var(--ease-out) forwards;
}
.auth-help-row a {
  color: var(--emerald-600);
  font-weight: 500;
  text-decoration: none;
}
.auth-help-row a:hover { text-decoration: underline; }

.auth-divider {
  margin: 26px 0 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--ink-300);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--ink-100), transparent);
}

/* Google button */
.auth-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 14px 20px;
  border-radius: 999px;
  border: 1px solid var(--ink-100);
  background: white;
  color: var(--ink-700);
  font-family: 'DM Sans', sans-serif;
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 280ms var(--ease);
}
.auth-google:hover {
  border-color: var(--emerald-300);
  background: var(--paper);
  box-shadow: 0 4px 16px -6px rgba(15, 87, 67, 0.15);
}
.auth-google-icon { width: 18px; height: 18px; }

/* ════════════════════════════════════════════════════════════════════════
   ALERTS
   ════════════════════════════════════════════════════════════════════════ */
.auth-alert {
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.5;
  margin-bottom: 24px;
  display: none;
  align-items: flex-start;
  gap: 10px;
  background: rgba(220, 38, 38, 0.06);
  color: #991B1B;
  border: 1px solid rgba(220, 38, 38, 0.18);
}
.auth-alert.show {
  display: flex;
  animation: fade-up 0.4s var(--ease-out) forwards;
}
.auth-alert-success {
  background: rgba(15, 110, 86, 0.06);
  color: var(--emerald-700);
  border-color: rgba(15, 110, 86, 0.22);
}
.auth-alert::before {
  content: '';
  width: 4px;
  flex-shrink: 0;
  align-self: stretch;
  background: currentColor;
  border-radius: 999px;
  opacity: 0.6;
  margin-top: 2px;
  margin-bottom: 2px;
}

/* ════════════════════════════════════════════════════════════════════════
   SUCCESS STATE — pop-in mark + helper card
   ════════════════════════════════════════════════════════════════════════ */
.auth-success-state {
  display: none;
  text-align: center;
}
.auth-success-state.show { display: block; }

.auth-success-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--emerald-400), var(--emerald-700));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 26px;
  box-shadow: 0 12px 28px -10px rgba(15, 87, 67, 0.45);
  animation: pop-in 0.55s var(--ease-out);
}
@keyframes pop-in {
  0%   { transform: scale(0.4); opacity: 0; }
  60%  { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); }
}

.auth-success-help {
  background: var(--paper);
  border: 1px solid var(--ink-100);
  padding: 16px 18px;
  border-radius: 14px;
  margin-top: 22px;
  font-size: 13px;
  color: var(--ink-500);
  line-height: 1.6;
  text-align: left;
}
.auth-success-help strong { color: var(--ink-900); }
.auth-success-help code {
  font-family: 'DM Mono', 'JetBrains Mono', monospace;
  font-size: 11.5px;
  background: white;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--ink-100);
}

/* ════════════════════════════════════════════════════════════════════════
   ANIMATIONS
   ════════════════════════════════════════════════════════════════════════ */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .auth-brand::before { animation: none; }
  .auth-brand-mark,
  .auth-brand-content,
  .auth-brand-foot,
  .auth-eyebrow,
  .auth-title,
  .auth-sub,
  .auth-field,
  .auth-cta,
  .auth-footer-links,
  .auth-help-row { opacity: 1; animation: none; }
}

/* iOS — prevent zoom on focus */
@media (max-width: 640px) {
  .auth-input, .auth-cta, .auth-google {
    font-size: 16px !important;
  }
  body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
  }
}
