/* Auth (Login) Page - Dither Background + Fuzzy Title + GlassSurface CTA */

/* screen-reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


body.auth-body {
  min-height: 100vh;
  margin: 0;
  background: #070A12;
  overflow: hidden;
  display: block;
}

.auth-layout {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: 48px 24px 28px;
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: center;
  justify-items: center;
  gap: 28px;
}

/* Static Fallback for Fuzzy Title (prevents pop-in delay) */
.static-title-fallback {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  /* Visual alignment */
  align-items: flex-start;
  z-index: 0;
  /* Behind canvas */

  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
  font-weight: 900;
  color: #FFFFFF;
  font-size: clamp(73px, 11vh, 120px);
  /* Matching JS logic roughly */
  line-height: 1.0;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.55);
  opacity: 1;
  transition: opacity 0.8s ease;
  pointer-events: none;
}

@media (min-width: 900px) {
  .static-title-fallback {
    align-items: center;
    /* Desktop centers the text in the canvas area */
  }
}

/* Hide fallback once canvas is ready */
.canvas-ready~.static-title-fallback {
  opacity: 0;
}

@media (min-width: 900px) {
  .auth-layout {
    grid-template-rows: 1fr;
    grid-template-columns: 7fr 5fr;
    align-content: center;
    justify-content: center;
    max-width: 1120px;
    margin: 0 auto;
    gap: 40px;
    padding: 76px 40px;
  }

  /* subtle optical balance: CTA sits slightly lower than hero */
  .auth-cta {
    align-self: center;
    transform: translateY(24px);
  }

  .auth-hero {
    align-self: center;
  }
}

.auth-hero {
  width: 100%;
  display: grid;
  place-items: center;
}

@media (min-width: 900px) {
  .auth-hero {
    place-items: start;
    padding-left: 8px;
  }
}

.auth-hero-inner {
  width: 100%;
  max-width: 680px;
  text-align: left;
  display: grid;
  justify-items: start;
}

.fuzzy-title {
  width: 100%;
  height: clamp(160px, 24vh, 260px);
  display: block;
  margin-left: -6px;
}

body.auth-body .auth-hero-subtitle {
  margin: 10px 0 0;
  padding: 0;

  /* typography */
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.12em;

  /* color + "digital glow" */
  color: rgba(255, 255, 255, 0.82);
  text-shadow:
    0 0 18px rgba(255, 255, 255, 0.10),
    -0.6px 0 0 rgba(99, 102, 241, 0.25),
    0.6px 0 0 rgba(236, 72, 153, 0.18);
}

@media (min-width: 900px) {
  body.auth-body .auth-hero-subtitle {
    margin-left: 6px;
  }
}

.auth-hero-meta {
  margin: 8px 0 0;
  font-size: 13px;
  letter-spacing: -0.1px;
  color: rgba(255, 255, 255, 0.62);
}

.auth-cta {
  width: 100%;
  display: grid;
  place-items: center;
}

/* full-screen background canvas */
.auth-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
}


/* contrast + color grading */
.auth-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 650px at 50% 35%, rgba(255, 255, 255, 0.06) 0%, rgba(0, 0, 0, 0.42) 60%, rgba(0, 0, 0, 0.78) 100%),
    linear-gradient(145deg, rgba(79, 70, 229, 0.18) 0%, rgba(0, 0, 0, 0.10) 45%, rgba(0, 0, 0, 0.45) 100%);
  pointer-events: none;
}

/* soften pixel edges + lift saturation a bit */
#dither-bg {
  width: 100%;
  height: 100%;
  display: block;
  filter: contrast(1.05) saturate(1.15);
}


.auth-card {
  width: min(420px, 100%);
  padding: 18px;
}

.auth-card-header {
  text-align: left;
  margin-bottom: 14px;
}

.auth-card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: rgba(255, 255, 255, 0.92);
}

.auth-card-desc {
  margin: 6px 0 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.1px;
  color: rgba(255, 255, 255, 0.72);
}

.auth-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.auth-google-btn {
  width: 100%;
  justify-content: center;
  gap: 10px;
}

.auth-google-icon {
  width: 20px;
  height: 20px;
}

.auth-footer {
  margin-top: 14px;
  text-align: left;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.60);
  letter-spacing: -0.1px;
}

/* button loading */
.btn.is-loading {
  opacity: 0.9;
  pointer-events: none;
}

.btn .btn-spinner {
  display: inline-flex;
  margin-right: 10px;
}

@media (max-width: 420px) {
  .auth-layout {
    padding: 28px 16px 20px;
    gap: 18px;
  }

  .auth-card {
    padding: 16px;
  }
}

/* --- Dark Mode Overrides for Auth Page --- */

/* By default, the auth page is already dark. This is for consistency and future changes. */
.auth-body.theme-dark .auth-hero-subtitle {
  color: rgba(255, 255, 255, 0.9);
}

/* Style the Google button for dark mode */
.auth-body.theme-dark .auth-google-btn {
  background-color: var(--bg-secondary, rgba(28, 28, 30, 0.60));
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.10));
}

.auth-body.theme-dark .auth-google-btn:hover {
  background-color: var(--bg-tertiary, rgba(35, 35, 38, 0.65));
}

.auth-body.theme-dark .auth-google-btn .btn-text {
  color: var(--text-primary, rgba(255, 255, 255, 0.92));
}

/* Invert the Google icon to make it white in dark mode */
/* --- Liquid Morphing Login Animation --- */

.auth-btn-morph {
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

/* Phase 1: Contract to Circle (Spinner) */
.auth-btn-morph.state-circle {
  width: 44px !important;
  /* Force circle width */
  min-width: 44px !important;
  color: transparent !important;
  /* Hide text */
  padding: 0 !important;
  border-radius: 50% !important;
  pointer-events: none;
}

.auth-btn-morph.state-circle .auth-google-icon,
.auth-btn-morph.state-circle .btn-text {
  opacity: 0;
  transition: opacity 0.2s ease;
}

/* Spinner Ring inside the button */
.auth-btn-morph.state-circle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  opacity: 1;
}

/* Phase 2: Expand to Capsule (Status) */
.auth-btn-morph.state-capsule {
  width: 280px !important;
  /* Detailed status width */
  min-width: 280px !important;
  border-radius: 30px !important;
  background: rgba(255, 255, 255, 0.15) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  color: rgba(255, 255, 255, 0.9) !important;
  pointer-events: none;
  justify-content: flex-start !important;
  /* Align text left-center */
  padding-left: 56px !important;
  /* Space for icon */
}

/* Hide original content in capsule mode too */
.auth-btn-morph.state-capsule .auth-google-icon,
.auth-btn-morph.state-capsule .btn-text {
  display: none;
}

/* Status Text Container */
.status-text-container {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
}

.auth-btn-morph.state-capsule .status-text-container {
  opacity: 1;
  transform: translateY(0);
}

/* Status Icon (Mini Spinner or Check) */
.status-icon-area {
  width: 20px;
  height: 20px;
  margin-right: 12px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Status Text Slide Animation */
.status-message {
  font-family: 'SF Mono', 'Roboto Mono', monospace;
  font-size: 13px;
  letter-spacing: -0.2px;
  white-space: nowrap;
}

/* Shimmer Effect */
.auth-btn-morph.state-capsule::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg,
      transparent,
      rgba(255, 255, 255, 0.2),
      transparent);
  transform: skewX(-20deg);
  animation: shimmerFlow 2s infinite;
}

@keyframes shimmerFlow {
  0% {
    left: -100%;
  }

  100% {
    left: 200%;
  }
}

/* Phase 3: Success State */
.auth-btn-morph.status-success {
  background: rgba(52, 199, 89, 0.2) !important;
  /* iOS Green Glass */
  border-color: rgba(52, 199, 89, 0.4) !important;
  color: #fff !important;
}

.auth-btn-morph.status-success .status-icon-area {
  color: #34C759;
}

.success-check {
  display: inline-block;
  transform: scale(0);
  animation: scaleInCheck 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes scaleInCheck {
  to {
    transform: scale(1);
  }
}