/* =====================================================================
   CryptoEarn Auth — Premium White Design
   Fully responsive · Mobile-first · Innovative split-screen
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@500;600&family=Outfit:wght@400;600;700;800;900&display=swap');

/* =====================================================
   CSS Variables — Light Theme
   ===================================================== */
.auth-page,
body.auth-page-body {
  --auth-bg: #ffffff;
  --auth-bg-soft: #f8fafc;
  --auth-mesh-1: #eef2ff;
  --auth-mesh-2: #f5f3ff;
  --auth-mesh-3: #ecfeff;
  --auth-mesh-4: #fdf4ff;

  --auth-surface: #ffffff;
  --auth-border: #e5e7eb;
  --auth-border-strong: #d1d5db;
  --auth-divider: #f1f5f9;

  --auth-text: #0f172a;
  --auth-text-bright: #020617;
  --auth-text-soft: #334155;
  --auth-muted: #64748b;
  --auth-dim: #94a3b8;

  --auth-primary: #6366f1;
  --auth-primary-h: #4f46e5;
  --auth-primary-light: #e0e7ff;
  --auth-accent: #8b5cf6;
  --auth-accent-light: #ede9fe;
  --auth-pink: #ec4899;
  --auth-cyan: #06b6d4;

  --auth-success: #10b981;
  --auth-success-light: #ecfdf5;
  --auth-warn: #f59e0b;
  --auth-warn-light: #fffbeb;
  --auth-error: #ef4444;
  --auth-error-light: #fef2f2;

  --auth-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --auth-shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 4px -1px rgba(15, 23, 42, 0.04);
  --auth-shadow-lg: 0 24px 48px -12px rgba(15, 23, 42, 0.12), 0 8px 16px -8px rgba(15, 23, 42, 0.06);
  --auth-shadow-xl: 0 36px 72px -16px rgba(99, 102, 241, 0.18), 0 16px 32px -8px rgba(15, 23, 42, 0.08);

  --auth-r-sm: 8px;
  --auth-r: 12px;
  --auth-r-lg: 16px;
  --auth-r-xl: 20px;
  --auth-r-2xl: 24px;

  --auth-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --auth-font-display: 'Outfit', var(--auth-font-sans);
  --auth-font-mono: 'JetBrains Mono', 'Menlo', monospace;
}

/* =====================================================
   Reset (scoped to auth pages so we don't touch the rest)
   ===================================================== */
.auth-page *,
.auth-page *::before,
.auth-page *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.auth-page {
  font-family: var(--auth-font-sans);
  background: var(--auth-bg);
  color: var(--auth-text);
  line-height: 1.6;
  font-size: 15px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* If the page <body> uses .auth-page directly, kill the dark theme */
body.auth-page,
body.auth-page-body {
  background: var(--auth-bg) !important;
  color: var(--auth-text) !important;
}

/* =====================================================
   Layout — Split screen
   ===================================================== */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  position: relative;
}

.auth-form-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4.5rem 4rem 3rem;
  position: relative;
  background: var(--auth-bg);
  min-height: 100vh;
}

.auth-brand {
  position: absolute;
  top: 1.75rem;
  left: 4rem;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--auth-font-display);
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  color: var(--auth-text-bright);
  text-decoration: none;
  z-index: 5;
}

.auth-brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--auth-primary), var(--auth-accent));
  display: grid;
  place-items: center;
  color: white;
  font-size: 1rem;
  box-shadow: 0 8px 20px -4px rgba(99, 102, 241, 0.45);
}

.auth-form-inner {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
}

/* Visual side */
.auth-visual-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse at top right, var(--auth-mesh-1) 0%, transparent 55%),
    radial-gradient(ellipse at bottom left, var(--auth-mesh-2) 0%, transparent 55%),
    radial-gradient(ellipse at center, var(--auth-mesh-3) 0%, transparent 70%);
}

/* Floating glow orbs */
.auth-visual-side::before,
.auth-visual-side::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
}

.auth-visual-side::before {
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.4), transparent 70%);
  top: -100px;
  right: -100px;
  animation: float-glow 8s ease-in-out infinite;
}

.auth-visual-side::after {
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.3), transparent 70%);
  bottom: -120px;
  left: -120px;
  animation: float-glow 10s ease-in-out infinite reverse;
}

@keyframes float-glow {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(15px, -15px) scale(1.05); }
}

.auth-visual-card {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: var(--auth-r-2xl);
  padding: 2.5rem;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--auth-shadow-xl);
  position: relative;
  z-index: 1;
}

.auth-visual-card h2 {
  font-family: var(--auth-font-display);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--auth-text-bright);
  margin-bottom: 0.5rem;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.auth-visual-card p {
  color: var(--auth-muted);
  font-size: 0.92rem;
  line-height: 1.65;
  margin-bottom: 1.75rem;
}

/* Decorative chip on top of visual card */
.auth-visual-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.9rem;
  background: linear-gradient(135deg, var(--auth-primary-light), var(--auth-accent-light));
  color: var(--auth-primary-h);
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
}

.auth-visual-chip::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--auth-primary);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.5); }
}

/* Feature list inside visual card */
.feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.85rem 0;
  border-bottom: 1px dashed rgba(15, 23, 42, 0.08);
}

.feature-list li:last-child { border-bottom: 0; }

.feature-icon {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--auth-primary-light), var(--auth-accent-light));
  color: var(--auth-primary);
  display: grid;
  place-items: center;
  margin-top: 1px;
}

.feature-text { flex: 1; }

.feature-text strong {
  display: block;
  font-size: 0.92rem;
  color: var(--auth-text-bright);
  font-weight: 700;
  margin-bottom: 3px;
}

.feature-text span {
  color: var(--auth-muted);
  font-size: 0.83rem;
  line-height: 1.5;
}

/* =====================================================
   Form heading
   ===================================================== */
.auth-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--auth-primary);
  background: var(--auth-primary-light);
  padding: 0.45rem 0.95rem;
  border-radius: 100px;
  margin-bottom: 1.25rem;
}

.auth-eyebrow::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--auth-primary);
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
}

.auth-title {
  font-family: var(--auth-font-display);
  font-size: 2.15rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.035em;
  color: var(--auth-text-bright);
  margin-bottom: 0.7rem;
}

.auth-title em {
  font-style: normal;
  background: linear-gradient(135deg, var(--auth-primary), var(--auth-accent), var(--auth-pink));
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 4s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.auth-subtitle {
  color: var(--auth-muted);
  font-size: 0.96rem;
  margin-bottom: 2rem;
  line-height: 1.6;
}

/* =====================================================
   OAuth buttons (Google / Facebook)
   ===================================================== */
.oauth-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.oauth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  background: white;
  color: var(--auth-text);
  border: 1px solid var(--auth-border);
  border-radius: var(--auth-r);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  box-shadow: var(--auth-shadow-sm);
}

.oauth-btn:hover {
  border-color: var(--auth-primary);
  background: var(--auth-bg-soft);
  transform: translateY(-1px);
  box-shadow: var(--auth-shadow-md);
}

.oauth-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  color: var(--auth-dim);
  font-size: 0.78rem;
  font-weight: 500;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--auth-divider);
}

/* =====================================================
   Form fields
   ===================================================== */
.field { margin-bottom: 1.1rem; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.field label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--auth-text);
  margin-bottom: 0.45rem;
}

.field label .hint {
  color: var(--auth-dim);
  font-weight: 400;
  font-size: 0.74rem;
}

.field label .hint a {
  color: var(--auth-primary);
  font-weight: 600;
  text-decoration: none;
}

.input-wrap {
  position: relative;
}

.input-wrap .input-icon {
  position: absolute;
  left: 0.95rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--auth-dim);
  pointer-events: none;
  display: grid;
  place-items: center;
}

.input-wrap .input-icon svg { display: block; }

.input-wrap .input-toggle {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  padding: 0.4rem;
  color: var(--auth-dim);
  cursor: pointer;
  border-radius: 8px;
  display: grid;
  place-items: center;
}

.input-wrap .input-toggle:hover {
  color: var(--auth-primary);
  background: var(--auth-primary-light);
}

.auth-page input[type="text"],
.auth-page input[type="email"],
.auth-page input[type="password"],
.auth-page input[type="number"],
.auth-page input[type="search"],
.auth-page input[type="tel"],
.auth-page select,
.auth-page textarea {
  width: 100%;
  padding: 0.8rem 0.95rem;
  background: white;
  border: 1px solid var(--auth-border);
  border-radius: var(--auth-r);
  color: var(--auth-text-bright);
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.15s;
  box-shadow: var(--auth-shadow-sm);
}

.auth-page input.has-icon {
  padding-left: 2.65rem;
}

.auth-page input.has-toggle {
  padding-right: 2.6rem;
}

.auth-page input:hover,
.auth-page select:hover,
.auth-page textarea:hover {
  border-color: var(--auth-border-strong);
}

.auth-page input:focus,
.auth-page select:focus,
.auth-page textarea:focus {
  outline: none;
  border-color: var(--auth-primary);
  box-shadow: 0 0 0 4px var(--auth-primary-light);
}

.auth-page input::placeholder {
  color: var(--auth-dim);
}

.auth-page small {
  display: block;
  color: var(--auth-muted);
  font-size: 0.78rem;
  margin-top: 0.4rem;
  line-height: 1.5;
}

/* Remember me checkbox */
.field-check {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.field-check label {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.86rem;
  color: var(--auth-text-soft);
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

.field-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--auth-primary);
  cursor: pointer;
  border-radius: 5px;
}

.field-check a {
  font-size: 0.86rem;
  color: var(--auth-primary);
  font-weight: 600;
  text-decoration: none;
}

.field-check a:hover {
  text-decoration: underline;
}

/* =====================================================
   Password strength meter
   ===================================================== */
.pw-strength {
  margin-top: 0.65rem;
}

.pw-bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-bottom: 0.4rem;
}

.pw-bar {
  height: 5px;
  border-radius: 100px;
  background: var(--auth-divider);
  transition: background 0.25s;
}

.pw-bar.active-1 { background: var(--auth-error); }
.pw-bar.active-2 { background: var(--auth-warn); }
.pw-bar.active-3 { background: var(--auth-primary); }
.pw-bar.active-4 { background: var(--auth-success); }

.pw-label {
  font-size: 0.75rem;
  color: var(--auth-muted);
  font-weight: 500;
}

/* =====================================================
   OTP input
   ===================================================== */
.otp-input {
  letter-spacing: 0.65rem !important;
  font-size: 1.5rem !important;
  text-align: center !important;
  font-weight: 700 !important;
  font-family: var(--auth-font-mono) !important;
  padding: 1rem !important;
}

/* =====================================================
   Buttons
   ===================================================== */
.auth-page .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.9rem 1.6rem;
  background: linear-gradient(135deg, var(--auth-primary), var(--auth-primary-h));
  color: white;
  border: 0;
  border-radius: var(--auth-r);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.18s;
  box-shadow: 0 8px 20px -6px rgba(99, 102, 241, 0.45);
  position: relative;
  overflow: hidden;
}

.auth-page .btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 50%, rgba(255, 255, 255, 0.18) 100%);
  pointer-events: none;
}

.auth-page .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px -8px rgba(99, 102, 241, 0.55);
}

.auth-page .btn:active { transform: translateY(0); }

.auth-page .btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none !important;
}

.auth-page .btn-block { width: 100%; }

.auth-page .btn-ghost {
  background: white;
  color: var(--auth-text);
  border: 1px solid var(--auth-border);
  box-shadow: var(--auth-shadow-sm);
}

.auth-page .btn-ghost::before { display: none; }

.auth-page .btn-ghost:hover {
  background: var(--auth-bg-soft);
  border-color: var(--auth-border-strong);
  transform: none;
  box-shadow: var(--auth-shadow-md);
}

.auth-page .btn-sm {
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
  border-radius: var(--auth-r-sm);
}

/* =====================================================
   Footer link area
   ===================================================== */
.auth-foot {
  margin-top: 1.75rem;
  text-align: center;
  color: var(--auth-muted);
  font-size: 0.92rem;
}

.auth-foot a {
  color: var(--auth-primary);
  font-weight: 600;
  text-decoration: none;
}

.auth-foot a:hover { text-decoration: underline; }

.auth-secure-note {
  margin-top: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--auth-dim);
  font-weight: 500;
}

.auth-secure-note svg {
  color: var(--auth-success);
  flex-shrink: 0;
}

/* =====================================================
   Alerts
   ===================================================== */
.auth-page .alert {
  padding: 0.95rem 1.1rem;
  border-radius: var(--auth-r);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  line-height: 1.5;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-page .alert-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  margin-top: 1px;
  color: white;
}

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

.auth-page .alert-danger .alert-icon,
.auth-page .alert-error .alert-icon {
  background: var(--auth-error);
}

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

.auth-page .alert-success .alert-icon {
  background: var(--auth-success);
}

.auth-page .alert-info {
  background: #eff6ff;
  color: #1e3a8a;
  border: 1px solid #bfdbfe;
}

.auth-page .alert-info .alert-icon {
  background: var(--auth-primary);
}

.auth-page .alert-warn,
.auth-page .alert-warning {
  background: var(--auth-warn-light);
  color: #92400e;
  border: 1px solid #fde68a;
}

.auth-page .alert-warn .alert-icon,
.auth-page .alert-warning .alert-icon {
  background: var(--auth-warn);
}

/* =====================================================
   Loading spinner
   ===================================================== */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

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

/* =====================================================
   Responsive — Tablet & Mobile
   ===================================================== */

/* Tablet — hide visual side, expand form */
@media (max-width: 1024px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-visual-side {
    display: none;
  }

  .auth-form-side {
    padding: 5rem 2.5rem 3rem;
    max-width: 540px;
    margin: 0 auto;
  }

  .auth-brand {
    left: 2.5rem;
  }
}

/* Small tablet / large phone */
@media (max-width: 640px) {
  .auth-form-side {
    padding: 5rem 1.5rem 2rem;
  }

  .auth-brand {
    top: 1.25rem;
    left: 1.5rem;
  }

  .auth-title {
    font-size: 1.75rem;
  }

  .auth-subtitle {
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
  }

  .auth-form-inner {
    max-width: 100%;
  }
}

/* Phone */
@media (max-width: 480px) {
  .auth-form-side {
    padding: 4.5rem 1.25rem 1.5rem;
    min-height: 100vh;
  }

  .auth-brand {
    top: 1rem;
    left: 1.25rem;
    font-size: 1.05rem;
  }

  .auth-brand-mark {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
  }

  .auth-title {
    font-size: 1.55rem;
  }

  .auth-eyebrow {
    font-size: 0.68rem;
    padding: 0.35rem 0.75rem;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .oauth-row {
    grid-template-columns: 1fr;
  }

  .otp-input {
    letter-spacing: 0.45rem !important;
    font-size: 1.25rem !important;
  }

  .auth-page .btn {
    padding: 0.85rem 1.25rem;
  }
}

/* Tiny phones */
@media (max-width: 360px) {
  .auth-form-side {
    padding: 4rem 1rem 1.5rem;
  }

  .auth-title {
    font-size: 1.4rem;
  }

  .field {
    margin-bottom: 0.95rem;
  }
}

/* =====================================================
   RTL support (Arabic)
   ===================================================== */
.auth-page[dir="rtl"] .input-wrap .input-icon {
  left: auto;
  right: 0.95rem;
}

.auth-page[dir="rtl"] input.has-icon {
  padding-left: 0.95rem;
  padding-right: 2.65rem;
}

.auth-page[dir="rtl"] .input-wrap .input-toggle {
  right: auto;
  left: 0.6rem;
}

.auth-page[dir="rtl"] input.has-toggle {
  padding-right: 0.95rem;
  padding-left: 2.6rem;
}

.auth-page[dir="rtl"] .auth-brand {
  left: auto;
  right: 4rem;
}

@media (max-width: 1024px) {
  .auth-page[dir="rtl"] .auth-brand {
    left: auto;
    right: 2.5rem;
  }
}

@media (max-width: 640px) {
  .auth-page[dir="rtl"] .auth-brand {
    left: auto;
    right: 1.5rem;
  }
}
