/* Makronova AI — Premium authentication experience */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --auth-primary: #C33764;
  --auth-primary-d: #a02b53;
  --auth-primary-soft: rgba(195, 55, 100, 0.12);
  --auth-deep: #111318;
  --auth-bg: #F7F8FA;
  --auth-card: #FFFFFF;
  --auth-text: #17191F;
  --auth-muted: #667085;
  --auth-border: #E4E7EC;
  --auth-success: #12B76A;
  --auth-error: #D92D20;
  --auth-radius: 24px;
  --auth-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --auth-dur: 800ms;
  --auth-perspective: 1400px;
}

html { font-size: 16px; }

body.auth-page {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--auth-bg);
  color: var(--auth-text);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  overflow-x: hidden;
}

.auth-page__bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 60% at 10% 0%, rgba(195, 55, 100, 0.06), transparent 55%),
    radial-gradient(ellipse 60% 50% at 90% 100%, rgba(29, 38, 113, 0.05), transparent 50%);
}

.auth-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1140px;
}

/* ── Card ─────────────────────────────────────────────────────── */
.auth-card {
  position: relative;
  width: 100%;
  min-height: 640px;
  background: var(--auth-card);
  border-radius: var(--auth-radius);
  box-shadow:
    0 4px 6px rgba(16, 24, 40, 0.03),
    0 12px 16px rgba(16, 24, 40, 0.06),
    0 24px 48px rgba(16, 24, 40, 0.08);
  overflow: hidden;
  perspective: var(--auth-perspective);
  contain: layout style;
}

/* ── Seamless sliding track (login ↔ signup) ─────────────────── */
.auth-track {
  display: flex;
  width: 200%;
  min-height: 640px;
  transform: translate3d(0, 0, 0);
  transition: transform var(--auth-dur) var(--auth-ease);
  transform-style: preserve-3d;
  backface-visibility: hidden;
}

.auth-card.is-signup .auth-track {
  transform: translate3d(-50%, 0, 0);
}

.auth-composition {
  flex: 0 0 50%;
  width: 50%;
  display: flex;
  flex-direction: row;
  min-height: 640px;
}

/* ── Forms column ─────────────────────────────────────────────── */
.auth-forms {
  position: relative;
  flex: 0 0 50%;
  width: 50%;
  padding: 2.75rem 2.5rem 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  max-height: min(90vh, 820px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--auth-card);
}

.auth-form-view {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
}

/* ── Brand mark (form side) ───────────────────────────────────── */
.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
  animation: authFadeUp 0.6s var(--auth-ease) both;
}
.auth-brand__logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
}
.auth-brand__text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.auth-brand__name {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--auth-text);
}
.auth-brand__tag {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--auth-muted);
  letter-spacing: 0.02em;
}

.auth-heading {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 0.5rem;
  animation: authFadeUp 0.6s var(--auth-ease) 0.05s both;
}
.auth-lead {
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--auth-muted);
  margin-bottom: 1.75rem;
  animation: authFadeUp 0.6s var(--auth-ease) 0.1s both;
}

@keyframes authFadeUp {
  from { opacity: 0; transform: translate3d(0, 14px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

/* ── Fields ───────────────────────────────────────────────────── */
.auth-field {
  margin-bottom: 1.1rem;
}
.auth-field--row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.auth-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--auth-text);
  margin-bottom: 0.4rem;
}
.auth-input,
.auth-select {
  width: 100%;
  min-height: 46px;
  padding: 0.65rem 0.875rem;
  font-family: inherit;
  font-size: 0.9375rem;
  color: var(--auth-text);
  background: #fff;
  border: 1px solid var(--auth-border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}
.auth-input:hover,
.auth-select:hover {
  border-color: #C5CAD3;
}
.auth-input:focus,
.auth-select:focus {
  border-color: var(--auth-primary);
  box-shadow: 0 0 0 3px var(--auth-primary-soft);
}
.auth-input.is-error,
.auth-select.is-error {
  border-color: var(--auth-error);
  box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.1);
}
.auth-field-error {
  font-size: 0.75rem;
  color: var(--auth-error);
  margin-top: 0.35rem;
  display: flex;
  align-items: flex-start;
  gap: 0.25rem;
}
.auth-field-error::before {
  content: '•';
}

.auth-pw {
  position: relative;
}
.auth-pw .auth-input {
  padding-right: 2.75rem;
}
.auth-pw-toggle {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--auth-muted);
  cursor: pointer;
}
.auth-pw-toggle:hover,
.auth-pw-toggle:focus-visible {
  color: var(--auth-text);
  background: var(--auth-bg);
  outline: none;
}
.auth-pw-toggle svg { width: 1.15rem; height: 1.15rem; display: block; }
.auth-pw-toggle .icon-hide { display: none; }
.auth-pw-toggle.is-visible .icon-show { display: none; }
.auth-pw-toggle.is-visible .icon-hide { display: block; }

.auth-row-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.25rem 0 1.25rem;
  flex-wrap: wrap;
}
.auth-check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8125rem;
  color: var(--auth-muted);
  cursor: pointer;
  user-select: none;
}
.auth-check input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--auth-primary);
}
.auth-link {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--auth-primary);
  text-decoration: none;
  transition: color 0.15s;
}
.auth-link:hover { color: var(--auth-primary-d); text-decoration: underline; }

.auth-terms {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--auth-muted);
  margin-bottom: 1.25rem;
}
.auth-terms input { margin-top: 0.15rem; accent-color: var(--auth-primary); flex-shrink: 0; }

/* ── Buttons ──────────────────────────────────────────────────── */
.auth-btn {
  width: 100%;
  min-height: 48px;
  padding: 0.75rem 1.25rem;
  font-family: 'Outfit', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}
.auth-btn--primary {
  background: var(--auth-primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}
.auth-btn--primary:hover:not(:disabled) {
  background: var(--auth-primary-d);
  box-shadow: 0 4px 14px rgba(195, 55, 100, 0.35);
  transform: translateY(-1px);
}
.auth-btn--primary:active:not(:disabled) {
  transform: translateY(0) scale(0.99);
}
.auth-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}
.auth-btn__spinner {
  width: 1.1rem;
  height: 1.1rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: authSpin 0.7s linear infinite;
  display: none;
}
.auth-btn.is-loading .auth-btn__spinner { display: block; }
.auth-btn.is-loading .auth-btn__label { opacity: 0.85; }

@keyframes authSpin { to { transform: rotate(360deg); } }

.auth-mobile-switch {
  display: none;
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.875rem;
  color: var(--auth-muted);
}
.auth-mobile-switch button {
  background: none;
  border: none;
  font: inherit;
  font-weight: 600;
  color: var(--auth-primary);
  cursor: pointer;
  padding: 0.25rem;
}
.auth-mobile-switch button:hover { text-decoration: underline; }

/* ── Alert ────────────────────────────────────────────────────── */
.auth-alert {
  border-radius: 10px;
  padding: 0.75rem 0.875rem;
  font-size: 0.875rem;
  line-height: 1.45;
  margin-bottom: 1.25rem;
}
.auth-alert--error {
  background: rgba(217, 45, 32, 0.08);
  border: 1px solid rgba(217, 45, 32, 0.2);
  color: #B42318;
}
.auth-alert--success {
  background: rgba(18, 183, 106, 0.08);
  border: 1px solid rgba(18, 183, 106, 0.25);
  color: #027A48;
}
.auth-alert ul { margin: 0.35rem 0 0 1.1rem; }

/* ── Promo panel (inside each composition) ────────────────────── */
.auth-panel {
  flex: 0 0 50%;
  width: 50%;
  position: relative;
  background: linear-gradient(145deg, #1a1030 0%, #111318 45%, #1D2671 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2.5rem 2.25rem;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  overflow: hidden;
}

/* Subtle depth during the slide — synced to track duration */
.auth-card.is-animating .auth-panel {
  animation: authPanelDepth var(--auth-dur) var(--auth-ease) both;
}

@keyframes authPanelDepth {
  0%, 100% { transform: rotateY(0deg) scale(1); }
  25%      { transform: rotateY(-2deg) scale(0.995); }
  50%      { transform: rotateY(-4deg) scale(0.985); }
  75%      { transform: rotateY(-2deg) scale(0.995); }
}

.auth-panel__glow {
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(195, 55, 100, 0.35), transparent 70%);
  top: -80px;
  right: -60px;
  pointer-events: none;
  animation: authGlowPulse 8s ease-in-out infinite;
}
@keyframes authGlowPulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 0.9; transform: scale(1.08); }
}

.auth-panel__content {
  position: relative;
  z-index: 1;
  max-width: 340px;
}

.auth-panel__kicker {
  font-family: 'Outfit', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 0.75rem;
}
.auth-panel__title {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(1.5rem, 2.5vw, 1.85rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 0.85rem;
}
.auth-panel__body {
  font-size: 0.9rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.72);
  margin-bottom: 1.75rem;
}

/* Abstract viz */
.auth-viz {
  position: relative;
  height: 100px;
  margin-bottom: 1.75rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1rem;
}
.auth-viz svg {
  width: 100%;
  height: 100%;
  display: block;
}
.auth-viz__node {
  animation: authNodeFloat 6s ease-in-out infinite;
}
.auth-viz__node:nth-child(2) { animation-delay: -2s; }
.auth-viz__node:nth-child(3) { animation-delay: -4s; }
@keyframes authNodeFloat {
  0%, 100% { transform: translateY(0); opacity: 0.7; }
  50% { transform: translateY(-3px); opacity: 1; }
}

.auth-metrics {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  padding: 0.75rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.auth-metric {
  flex: 1;
  text-align: center;
}
.auth-metric__val {
  font-family: 'Outfit', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
}
.auth-metric__lbl {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 0.15rem;
}
.auth-metric__note {
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.35);
  margin-top: 0.75rem;
  text-align: center;
}

.auth-panel-cta {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 0.65rem;
}
.auth-btn--ghost {
  background: transparent;
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  min-height: 44px;
  width: auto;
  padding: 0.65rem 1.5rem;
}
.auth-btn--ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: #fff;
  transform: translateY(-1px);
  box-shadow: none;
}

/* ── Success overlay ──────────────────────────────────────────── */
.auth-success {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(247, 248, 250, 0.92);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: authFadeIn 0.35s ease;
}
.auth-success[hidden] { display: none !important; }
@keyframes authFadeIn { from { opacity: 0; } to { opacity: 1; } }

.auth-success__card {
  text-align: center;
  max-width: 360px;
}
.auth-success__check {
  width: 72px;
  height: 72px;
  margin: 0 auto 1.25rem;
}
.auth-success__check circle {
  fill: none;
  stroke: var(--auth-success);
  stroke-width: 2;
}
.auth-success__check path {
  fill: none;
  stroke: var(--auth-success);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: authCheckDraw 0.7s var(--auth-ease) 0.15s forwards;
}
@keyframes authCheckDraw { to { stroke-dashoffset: 0; } }
.auth-success__title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}
.auth-success__sub {
  color: var(--auth-muted);
  font-size: 0.9375rem;
}

.auth-footer {
  margin-top: 1.75rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--auth-muted);
  line-height: 1.5;
}
.auth-footer a { color: var(--auth-muted); text-decoration: none; }
.auth-footer a:hover { color: var(--auth-primary); }

/* ── Reduced motion ───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .auth-track {
    transition-duration: 0.2s !important;
  }
  .auth-panel,
  .auth-brand,
  .auth-heading,
  .auth-lead {
    animation: none !important;
  }
  .auth-viz__node { animation: none; }
}

/* ── Tablet ───────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .auth-track,
  .auth-composition { min-height: 580px; }
  .auth-forms { padding: 2rem 1.75rem; }
  .auth-panel { padding: 2rem 1.5rem; }
}

/* ── Mobile: single column, instant swap ──────────────────────── */
@media (max-width: 768px) {
  body.auth-page { padding: 0.75rem; align-items: flex-start; padding-top: 1.25rem; }
  .auth-card {
    min-height: auto;
    border-radius: 16px;
  }
  .auth-track {
    width: 100%;
    min-height: auto;
    transform: none !important;
    transition: none;
    flex-direction: column;
  }
  .auth-composition {
    width: 100%;
    flex: none;
    min-height: auto;
    flex-direction: column;
  }
  .auth-composition--signup {
    display: none;
  }
  .auth-card.is-signup .auth-composition--login {
    display: none;
  }
  .auth-card.is-signup .auth-composition--signup {
    display: flex;
  }
  .auth-panel {
    display: none;
  }
  .auth-forms {
    width: 100%;
    flex: none;
    padding: 1.75rem 1.25rem 1.5rem;
  }
  .auth-mobile-switch { display: block; }
  .auth-field--row { grid-template-columns: 1fr; }
  .auth-heading { font-size: 1.65rem; }
}

@media (max-width: 480px) {
  .auth-forms { padding: 1.5rem 1rem; }
}
