/* ============================================================
   Auth Page — DD Beat Downloader
   Split-screen design — branding left, form right
   Uses tokens from landing.css; complements style.css
   ============================================================ */

body.auth-body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--landing-bg, #07060d);
  color: var(--landing-text, #f5f3ff);
  min-height: 100vh;
  display: block;
  padding: 0;
  overflow-x: hidden;
  animation: none;
}

/* Reset old auth-body styles */
body.auth-body .auth-back-link {
  z-index: 50;
}

/* ============ Split layout ============ */
.auth-shell {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  min-height: 100vh;
}

/* === LEFT side: branding panel === */
.auth-brand {
  position: relative;
  padding: 60px 60px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  background: linear-gradient(135deg, #0d0a18 0%, #1a0f28 50%, #240f30 100%);
  isolation: isolate;
}
.auth-brand::before,
.auth-brand::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  z-index: -1;
  opacity: 0.7;
}
.auth-brand::before {
  width: 500px; height: 500px;
  background: #7C3AED;
  top: -10%; left: -20%;
  animation: orbFloat 18s ease-in-out infinite;
}
.auth-brand::after {
  width: 450px; height: 450px;
  background: #EC4899;
  bottom: -15%; right: -15%;
  animation: orbFloat 22s ease-in-out infinite reverse;
}
.auth-brand-grid {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(167, 139, 250, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(167, 139, 250, 0.04) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
}

.auth-brand-logo {
  display: flex; align-items: center; gap: 12px;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--landing-text, #f5f3ff);
}
.auth-brand-logo span {
  background: var(--gradient-text, linear-gradient(135deg, #A78BFA, #EC4899));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-brand-content {
  max-width: 460px;
}
.auth-brand-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px;
  background: rgba(167, 139, 250, 0.1);
  border: 1px solid rgba(167, 139, 250, 0.25);
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 500;
  color: #A78BFA;
  margin-bottom: 22px;
}
.auth-brand-eyebrow .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #EC4899;
  box-shadow: 0 0 8px #EC4899;
  animation: pulse 2s ease-in-out infinite;
}
.auth-brand-title {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: clamp(2rem, 3.5vw, 3rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 18px;
}
.auth-brand-title .gradient-text {
  background: var(--gradient-text, linear-gradient(135deg, #A78BFA, #EC4899, #F472B6));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.auth-brand-text {
  font-size: 1rem;
  color: var(--landing-text-muted, #9990b8);
  line-height: 1.6;
  margin-bottom: 36px;
}

.auth-brand-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  padding-top: 28px;
  border-top: 1px solid rgba(167, 139, 250, 0.12);
}
.auth-brand-stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--gradient-text, linear-gradient(135deg, #A78BFA, #EC4899));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.auth-brand-stat-label {
  font-size: 0.78rem;
  color: var(--landing-text-muted, #9990b8);
  margin-top: 4px;
}

.auth-brand-footer {
  font-size: 0.82rem;
  color: var(--landing-text-dim, #6b6585);
}

/* === RIGHT side: form panel === */
.auth-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 60px;
  background: #07060d;
  position: relative;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: transparent;
  border: none;
  padding: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.auth-header {
  text-align: left;
  margin-bottom: 32px;
}
.auth-header .logo {
  display: none; /* logo lives in left panel on desktop */
}
.auth-header h2 {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.auth-header p {
  color: var(--landing-text-muted, #9990b8);
  font-size: 0.95rem;
  margin-top: 0;
}

/* === Form polish (override style.css) === */
body.auth-body .form-group { margin-bottom: 18px; }
body.auth-body .form-group label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--landing-text-muted, #9990b8);
  margin-bottom: 8px;
  display: block;
}
body.auth-body .input,
body.auth-body input[type="text"],
body.auth-body input[type="email"],
body.auth-body input[type="password"] {
  width: 100%;
  padding: 14px 16px;
  background: rgba(20, 16, 35, 0.5);
  border: 1px solid rgba(167, 139, 250, 0.15);
  border-radius: 12px;
  color: var(--landing-text, #f5f3ff);
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.2s;
  outline: none;
}
body.auth-body .input:focus,
body.auth-body input:focus {
  border-color: #A78BFA;
  background: rgba(20, 16, 35, 0.75);
  box-shadow: 0 0 0 4px rgba(167, 139, 250, 0.15);
}
body.auth-body .input::placeholder { color: var(--landing-text-dim, #6b6585); }

/* === Submit button (override) === */
body.auth-body .btn-primary {
  background: var(--gradient-cta, linear-gradient(135deg, #7C3AED, #EC4899));
  color: white;
  padding: 14px 24px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.25s;
  box-shadow: 0 8px 24px rgba(236, 72, 153, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  width: 100%;
  margin-top: 8px;
}
body.auth-body .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 36px rgba(236, 72, 153, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}
body.auth-body .btn-primary:active { transform: scale(0.98); }
body.auth-body .btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* Switch login/register link */
body.auth-body .link-accent {
  color: #A78BFA;
  font-weight: 600;
  text-decoration: none;
}
body.auth-body .link-accent:hover { color: #C4B5FD; }

/* Divider with text */
.auth-divider {
  display: flex; align-items: center; gap: 14px;
  margin: 24px 0;
  color: var(--landing-text-dim, #6b6585);
  font-size: 0.78rem;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(167, 139, 250, 0.12);
}

/* === Avatar grid (override) === */
body.auth-body .avatar-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
  padding: 12px;
  background: rgba(20, 16, 35, 0.5);
  border: 1px solid rgba(167, 139, 250, 0.15);
  border-radius: 12px;
}
body.auth-body .avatar-grid::-webkit-scrollbar { width: 4px; }
body.auth-body .avatar-grid::-webkit-scrollbar-thumb { background: rgba(167, 139, 250, 0.3); border-radius: 4px; }
body.auth-body .avatar-option {
  width: 100%;
  aspect-ratio: 1;
  height: auto;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: rgba(7, 6, 13, 0.5);
}
body.auth-body .avatar-option:hover {
  border-color: #A78BFA;
  transform: scale(1.08);
}
body.auth-body .avatar-option.selected {
  border-color: #EC4899;
  box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.25), 0 4px 12px rgba(236, 72, 153, 0.3);
  transform: scale(1.08);
}
body.auth-body .avatar-option img { width: 100%; height: 100%; }

/* === Back link === */
.auth-back-link {
  position: fixed;
  top: 24px; right: 24px;
  left: auto !important;
  color: var(--landing-text-muted, #9990b8);
  font-size: 0.88rem;
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 10px;
  background: rgba(20, 16, 35, 0.6);
  border: 1px solid rgba(167, 139, 250, 0.15);
  backdrop-filter: blur(12px);
  transition: all 0.2s;
  display: inline-flex; align-items: center; gap: 6px;
}
.auth-back-link:hover {
  color: var(--landing-text, #f5f3ff);
  border-color: rgba(167, 139, 250, 0.4);
  transform: translateX(-2px);
}

/* === Toast positioning === */
body.auth-body #toast-container { z-index: 9999; }

/* === Loading state on button === */
body.auth-body .btn-primary.loading {
  pointer-events: none;
  color: transparent;
  position: relative;
}
body.auth-body .btn-primary.loading::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 18px; height: 18px;
  margin-top: -9px; margin-left: -9px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === Utility for hidden forms === */
body.auth-body .hidden { display: none !important; }
body.auth-body .text-muted { color: var(--landing-text-muted, #9990b8); }
body.auth-body .text-center { text-align: center; }
body.auth-body .mt-2 { margin-top: 16px; }

/* ============ Responsive ============ */
@media (max-width: 960px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand {
    padding: 40px 32px 32px;
    min-height: auto;
  }
  .auth-brand-content { max-width: 100%; }
  .auth-brand-title { font-size: 1.6rem; }
  .auth-brand-text { font-size: 0.92rem; margin-bottom: 0; }
  .auth-brand-stats { display: none; }
  .auth-brand-footer { display: none; }
  .auth-form-side { padding: 32px 24px 48px; }
  .auth-back-link { top: 16px; right: 16px; padding: 8px 12px; font-size: 0.82rem; }
}
@media (max-width: 480px) {
  .auth-brand { padding: 32px 20px 24px; }
  .auth-form-side { padding: 24px 20px 40px; }
  .auth-header h2 { font-size: 1.5rem; }
  body.auth-body .avatar-grid { grid-template-columns: repeat(5, 1fr); }
}
