/* TROD auth — shared login / password chrome
   Brand: navy #022144 + R accent gradient (orange → magenta → violet)
   Type: Sora (display) + Manrope (UI) */

:root {
  --auth-navy: #022144;
  --auth-navy-deep: #01162e;
  --auth-navy-mid: #0a3a6b;
  --auth-surface: #ffffff;
  --auth-panel: #f7f5f2;
  --auth-text: #0f172a;
  --auth-text-secondary: #475569;
  --auth-text-muted: #94a3b8;
  --auth-border: #e2e8f0;
  --auth-input-bg: #f8fafc;
  --auth-danger: #ef4444;
  --auth-danger-soft: rgba(239, 68, 68, 0.08);
  --auth-danger-border: rgba(239, 68, 68, 0.25);
  --auth-success: #059669;
  --auth-success-soft: rgba(5, 150, 105, 0.08);
  --auth-success-border: rgba(5, 150, 105, 0.25);
  --auth-accent: linear-gradient(135deg, #f59e5b 0%, #e11d8a 48%, #7c3aed 100%);
  --auth-radius-sm: 10px;
  --auth-radius-md: 14px;
  --auth-radius-lg: 20px;
  --auth-shadow: 0 18px 50px -24px rgba(2, 33, 68, 0.35);
  --auth-transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --auth-font-display: "Sora", system-ui, sans-serif;
  --auth-font-ui: "Manrope", system-ui, sans-serif;
}

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

html { height: 100%; }

body.auth-body {
  min-height: 100%;
  font-family: var(--auth-font-ui);
  color: var(--auth-text);
  background: var(--auth-panel);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a { color: var(--auth-navy); text-decoration: none; }
a:hover { color: var(--auth-navy-mid); }

/* ── Layout ── */
.auth-page {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  min-height: 100dvh;
}

.auth-page--solo {
  grid-template-columns: 1fr;
  place-items: center;
  padding: 2rem 1.25rem;
  background:
    radial-gradient(900px 420px at 12% -10%, rgba(2, 33, 68, 0.06), transparent 60%),
    radial-gradient(700px 380px at 100% 100%, rgba(225, 29, 138, 0.05), transparent 55%),
    var(--auth-panel);
}

/* ── Brand stage ── */
.auth-brand-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(2.5rem, 6vw, 5rem);
  background: var(--auth-navy);
  overflow: hidden;
  isolation: isolate;
}

.auth-brand-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 20%, rgba(255, 255, 255, 0.08), transparent 55%),
    radial-gradient(ellipse 70% 50% at 85% 75%, rgba(225, 29, 138, 0.18), transparent 50%),
    radial-gradient(ellipse 50% 40% at 60% 10%, rgba(245, 158, 91, 0.12), transparent 45%);
  pointer-events: none;
}

.auth-brand-accent {
  position: absolute;
  top: 10%;
  bottom: 10%;
  right: 0;
  width: 3px;
  border-radius: 999px 0 0 999px;
  background: var(--auth-accent);
  background-size: 200% 200%;
  animation: auth-accent-shimmer 10s ease-in-out infinite;
  opacity: 0.95;
}

.auth-brand-inner {
  position: relative;
  z-index: 1;
  max-width: 34rem;
  color: #fff;
}

.auth-brand-inner:not(.auth-brand-inner--staged) {
  animation: auth-rise 0.7s var(--auth-transition) both;
}

.auth-brand-logo {
  display: block;
  width: min(100%, 280px);
  height: auto;
  margin-bottom: 2rem;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.25));
}

.auth-brand-kicker {
  display: inline-block;
  margin-bottom: 1rem;
  font-family: var(--auth-font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}

.auth-brand-title {
  font-family: var(--auth-font-display);
  font-size: clamp(1.85rem, 3.2vw, 2.65rem);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
  color: #fff;
}

.auth-brand-subtitle {
  font-size: 1.05rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.78);
  margin-bottom: 2rem;
  max-width: 32rem;
}

.auth-capabilities {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.auth-capabilities li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
}

.auth-capabilities li::before {
  content: "";
  flex: 0 0 10px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--auth-accent);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
  animation: auth-dot-breathe 3.2s ease-in-out infinite;
  animation-delay: inherit;
}

/* Staggered brand entrance — visible, one-shot, then settles */
.auth-reveal {
  --auth-delay: 0ms;
  opacity: 0;
  transform: translateY(14px);
  animation: auth-rise 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: var(--auth-delay);
}

.auth-reveal--headline {
  clip-path: inset(0 100% 0 0);
  animation:
    auth-rise 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards,
    auth-headline-reveal 0.95s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: var(--auth-delay), calc(var(--auth-delay) + 40ms);
}

/* Mobile brand band (shown only when brand stage is collapsed) */
.auth-mobile-band {
  display: none;
  background: var(--auth-navy);
  padding: 1.25rem 1.5rem 1.35rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.auth-mobile-band::after {
  content: "";
  position: absolute;
  left: 20%;
  right: 20%;
  bottom: 0;
  height: 2px;
  background: var(--auth-accent);
  opacity: 0.9;
}

.auth-mobile-band img {
  height: 36px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
  margin: 0 auto 0.55rem;
  display: block;
}

.auth-mobile-band p {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.78);
}

/* ── Sign-in stage ── */
.auth-sign-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.5rem, 4vw, 3rem);
  overflow: hidden;
  isolation: isolate;
  background: var(--auth-panel);
}

.auth-page--solo .auth-sign-stage {
  width: 100%;
  max-width: 440px;
  padding: 0;
  overflow: visible;
  background: transparent;
}

.auth-page--solo .auth-ambient {
  display: none;
}

/* Quiet ambient workspace light behind the card */
.auth-ambient {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.auth-ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  will-change: transform;
}

.auth-ambient-orb--navy {
  width: min(58vw, 480px);
  height: min(58vw, 480px);
  top: -14%;
  right: -10%;
  background: rgba(2, 33, 68, 0.18);
  animation: auth-orb-drift-a 12s ease-in-out infinite;
}

.auth-ambient-orb--coral {
  width: min(54vw, 440px);
  height: min(54vw, 440px);
  bottom: -16%;
  left: -12%;
  background: rgba(245, 158, 91, 0.22);
  animation: auth-orb-drift-b 14s ease-in-out infinite;
}

.auth-ambient-orb--rose {
  width: min(42vw, 320px);
  height: min(42vw, 320px);
  top: 38%;
  left: 36%;
  background: rgba(225, 29, 138, 0.12);
  animation: auth-orb-drift-c 11s ease-in-out infinite;
}

.auth-ambient-grain {
  position: absolute;
  inset: 0;
  opacity: 0.055;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--auth-surface);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--auth-radius-lg);
  box-shadow: var(--auth-shadow);
  padding: clamp(1.75rem, 3vw, 2.25rem);
  position: relative;
  z-index: 1;
  animation: auth-rise 0.65s 0.08s var(--auth-transition) both;
}

.auth-card::before {
  content: "";
  position: absolute;
  left: 1.25rem;
  right: 1.25rem;
  top: 0;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: var(--auth-accent);
}

.auth-card-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-card-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1.1rem;
}

.auth-card-logo img {
  height: 48px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
}

.auth-card-title {
  font-family: var(--auth-font-display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--auth-text);
  margin-bottom: 0.35rem;
}

.auth-card-subtitle {
  font-size: 0.95rem;
  color: var(--auth-text-secondary);
  line-height: 1.45;
}

/* ── Form ── */
.auth-form { display: flex; flex-direction: column; gap: 1rem; }

.form-group { display: flex; flex-direction: column; gap: 0.45rem; }

.form-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--auth-text-secondary);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 0.9rem;
  display: flex;
  color: var(--auth-text-muted);
  pointer-events: none;
}

.input-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.form-input {
  width: 100%;
  min-height: 48px;
  padding: 0.75rem 2.75rem 0.75rem 2.65rem;
  border: 1px solid var(--auth-border);
  border-radius: var(--auth-radius-sm);
  background: var(--auth-input-bg);
  font-family: var(--auth-font-ui);
  font-size: 1rem;
  color: var(--auth-text);
  outline: none;
  transition: border-color var(--auth-transition), box-shadow var(--auth-transition), background var(--auth-transition);
}

.form-input:focus {
  background: #fff;
  border-color: var(--auth-navy);
  box-shadow: 0 0 0 3px rgba(2, 33, 68, 0.12);
}

.form-input::placeholder { color: var(--auth-text-muted); }

.toggle-password {
  position: absolute;
  right: 0.55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--auth-text-muted);
  cursor: pointer;
  border-radius: 8px;
}

.toggle-password:hover { color: var(--auth-navy); background: rgba(2, 33, 68, 0.05); }

.toggle-password svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.remember-check {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--auth-text-secondary);
  cursor: pointer;
  user-select: none;
}

.remember-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--auth-navy);
}

.forgot-link {
  font-size: 0.875rem;
  font-weight: 600;
}

.auth-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 48px;
  margin-top: 0.35rem;
  padding: 0.85rem 1.25rem;
  border: none;
  border-radius: var(--auth-radius-sm);
  background: var(--auth-navy);
  color: #fff;
  font-family: var(--auth-font-ui);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--auth-transition), transform var(--auth-transition), box-shadow var(--auth-transition);
  box-shadow: 0 10px 24px -12px rgba(2, 33, 68, 0.55);
}

.auth-btn:hover { background: var(--auth-navy-mid); }
.auth-btn:active { transform: translateY(1px); }
.auth-btn:disabled { opacity: 0.75; cursor: wait; }

.auth-btn .btn-loading { display: none; align-items: center; gap: 0.5rem; }
.auth-btn.is-loading .btn-text,
.auth-btn.is-loading .btn-arrow { display: none; }
.auth-btn.is-loading .btn-loading { display: inline-flex; }

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
}

.auth-footer {
  margin-top: 1.35rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--auth-text-muted);
  line-height: 1.4;
}

.auth-actions {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}

.auth-link {
  font-size: 0.875rem;
  font-weight: 600;
}

/* ── Alerts ── */
.auth-alert {
  display: flex;
  gap: 0.75rem;
  padding: 0.85rem 0.95rem;
  border-radius: var(--auth-radius-sm);
  margin-bottom: 1rem;
  font-size: 0.875rem;
  line-height: 1.4;
}

.auth-alert .alert-icon {
  flex: 0 0 auto;
  margin-top: 1px;
}

.auth-alert .alert-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-alert.success {
  background: var(--auth-success-soft);
  border: 1px solid var(--auth-success-border);
  color: #065f46;
}

.auth-alert.error {
  background: var(--auth-danger-soft);
  border: 1px solid var(--auth-danger-border);
  color: #991b1b;
}

.auth-alert .alert-title {
  font-weight: 700;
  margin-bottom: 0.15rem;
}

.auth-alert .alert-list {
  margin: 0.25rem 0 0 1rem;
}

/* ── Motion ── */
@keyframes auth-rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes auth-headline-reveal {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}

@keyframes auth-dot-breathe {
  0%, 100% { transform: scale(1); opacity: 0.85; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08); }
  50% { transform: scale(1.15); opacity: 1; box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.12); }
}

@keyframes auth-accent-shimmer {
  0%, 100% { filter: hue-rotate(0deg); opacity: 0.9; }
  50% { filter: hue-rotate(18deg); opacity: 1; }
}

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

@keyframes auth-orb-drift-a {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-5%, 6%) scale(1.08); }
}

@keyframes auth-orb-drift-b {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(6%, -5%) scale(1.07); }
}

@keyframes auth-orb-drift-c {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-4%, -6%) scale(1.1); }
}

@media (prefers-reduced-motion: reduce) {
  .auth-brand-inner,
  .auth-card,
  .auth-brand-accent,
  .auth-ambient-orb,
  .auth-reveal,
  .auth-capabilities li::before {
    animation: none !important;
  }

  .auth-reveal {
    opacity: 1;
    transform: none;
    clip-path: none;
  }
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .auth-page {
    grid-template-columns: 1fr;
  }

  .auth-brand-stage {
    display: none;
  }

  .auth-mobile-band {
    display: block;
  }

  .auth-sign-stage {
    min-height: calc(100dvh - 88px);
    align-items: flex-start;
    padding-top: 1.75rem;
  }

  .auth-ambient-orb {
    filter: blur(64px);
    animation: none; /* static wash on mobile for clarity + battery */
  }

  .auth-card {
    box-shadow: 0 10px 30px -18px rgba(2, 33, 68, 0.28);
  }
}

@media (max-width: 480px) {
  .auth-sign-stage { padding: 1.25rem 1rem 2rem; }
  .auth-card { padding: 1.5rem 1.2rem; }
}
