/* ═══════════════════════════════════════════════════════════════════════════
   auth.css — Memecoin System · Authentication Interface
   Visual identity matches dexscreener-clone.html / styles.css exactly.
   These :root variables mirror the ones in styles.css — keep them in sync.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* ── Color Palette (mirrors styles.css) ── */
  --bg-page:             #050505;
  --bg-surface:          #0a0a0a;
  --bg-surface-elevated: #111111;
  --bg-surface-hover:    #171717;

  --text-primary:   #ffffff;
  --text-secondary: #a3a3a3;
  --text-tertiary:  #737373;

  --green:      #10b981;
  --green-dim:  rgba(16, 185, 129, 0.10);
  --green-glow: rgba(16, 185, 129, 0.18);

  --red:     #ef4444;
  --red-dim: rgba(239, 68, 68, 0.10);

  --yellow: #eab308;
  --gold:   #f59e0b;

  --border-light:  #1f1f1f;
  --border-medium: #262626;

  /* ── Geometry (mirrors styles.css) ── */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Background
   ═══════════════════════════════════════════════════════════════════════════ */
.auth-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.auth-bg-grid {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(16, 185, 129, 0.065) 1px, transparent 1px);
  background-size: 30px 30px;
}

.auth-bg-glow-1 {
  position: absolute;
  width: 680px;
  height: 680px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.055) 0%, transparent 68%);
  top: -220px;
  right: -120px;
  filter: blur(48px);
}

.auth-bg-glow-2 {
  position: absolute;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.035) 0%, transparent 70%);
  bottom: -140px;
  left: -120px;
  filter: blur(64px);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Auth wrapper + card
   ═══════════════════════════════════════════════════════════════════════════ */
.auth-wrapper {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 24px;
}

.auth-card {
  width: 100%;
  max-width: 448px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 40px 40px 36px;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(16, 185, 129, 0.04),
    0 1px 0 rgba(255, 255, 255, 0.03) inset,
    0 40px 80px rgba(0, 0, 0, 0.65),
    0 12px 32px rgba(0, 0, 0, 0.45);
}

/* Subtle green shimmer on top edge */
.auth-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(16, 185, 129, 0.4) 40%,
    rgba(16, 185, 129, 0.55) 50%,
    rgba(16, 185, 129, 0.4) 60%,
    transparent 100%
  );
}

/* ═══════════════════════════════════════════════════════════════════════════
   Logo
   ═══════════════════════════════════════════════════════════════════════════ */
.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 32px;
}

.auth-logo-icon {
  color: var(--green);
  width: 22px;
  height: 22px;
  stroke-width: 2.5;
  flex-shrink: 0;
}

.auth-logo-text {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.auth-logo-text span { color: var(--green); }

/* ═══════════════════════════════════════════════════════════════════════════
   View system
   ═══════════════════════════════════════════════════════════════════════════ */
.auth-view { display: none; }
.auth-view.active { display: block; }

/* ═══════════════════════════════════════════════════════════════════════════
   Tab switcher (Login / Register)
   ═══════════════════════════════════════════════════════════════════════════ */
.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: 100px;
  padding: 4px;
  margin-bottom: 28px;
}

.auth-tab-btn {
  flex: 1;
  padding: 9px 16px;
  border-radius: 100px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
}

.auth-tab-btn:hover { color: var(--text-primary); }

.auth-tab-btn.active {
  background: var(--border-light);
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ═══════════════════════════════════════════════════════════════════════════
   View headings
   ═══════════════════════════════════════════════════════════════════════════ */
.auth-heading {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.auth-subheading {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.55;
}

.auth-subheading strong { color: var(--green); font-weight: 600; }

/* ═══════════════════════════════════════════════════════════════════════════
   Input components
   ═══════════════════════════════════════════════════════════════════════════ */
.auth-form { display: flex; flex-direction: column; gap: 14px; }

.input-group { display: flex; flex-direction: column; gap: 5px; }

.input-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-tertiary);
}

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

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-tertiary);
  width: 15px;
  height: 15px;
  pointer-events: none;
  flex-shrink: 0;
  transition: color 0.2s;
}

.auth-input {
  width: 100%;
  padding: 13px 16px 13px 42px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.auth-input.has-toggle { padding-right: 44px; }
.auth-input::placeholder { color: var(--text-tertiary); }

.auth-input:focus {
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.09);
  background: #0c0c0c;
}

/* Icon follows input focus via has() — progressive enhancement */
.input-wrapper:has(.auth-input:focus) .input-icon { color: var(--green); }

.auth-input.input-error {
  border-color: rgba(239, 68, 68, 0.55);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
}

/* ── Password toggle ── */
.input-action {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: color 0.15s;
}

.input-action:hover { color: var(--text-secondary); }

/* ── Field-level error ── */
.field-error {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--red);
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.2s, max-height 0.2s;
}

.field-error.visible { opacity: 1; max-height: 20px; }

/* ═══════════════════════════════════════════════════════════════════════════
   Alert banners (error / success)
   ═══════════════════════════════════════════════════════════════════════════ */
.auth-error,
.auth-success {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  margin-bottom: 0;
  transition: opacity 0.25s ease, max-height 0.25s ease, margin-bottom 0.25s ease;
}

.auth-error.visible,
.auth-success.visible {
  opacity: 1;
  max-height: 100px;
  margin-bottom: 14px;
}

.auth-error {
  background: var(--red-dim);
  border: 1px solid rgba(239, 68, 68, 0.22);
  color: var(--red);
}

.auth-success {
  background: var(--green-dim);
  border: 1px solid rgba(16, 185, 129, 0.22);
  color: var(--green);
}

.auth-error-icon,
.auth-success-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Buttons
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Primary ── */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 24px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--green);
  color: #000;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: -0.2px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: background 0.2s, box-shadow 0.2s, transform 0.1s, opacity 0.2s;
}

.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.08) 0%, transparent 60%);
  pointer-events: none;
}

.btn-primary:hover:not(:disabled) {
  background: #0ea572;
  box-shadow: 0 4px 24px rgba(16, 185, 129, 0.32);
}

.btn-primary:active:not(:disabled) { transform: scale(0.99); }

.btn-primary:disabled {
  background: #182b22;
  color: #2e6648;
  cursor: not-allowed;
  box-shadow: none;
}

/* Spinner */
.btn-spinner {
  display: none;
  width: 17px;
  height: 17px;
  border: 2px solid rgba(0, 0, 0, 0.25);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  flex-shrink: 0;
}

.btn-primary.loading .btn-spinner { display: block; }
.btn-primary.loading .btn-label { opacity: 0.65; }

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

/* ── Ghost ── */
.btn-ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 11px 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-medium);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-ghost:hover {
  border-color: var(--text-tertiary);
  color: var(--text-primary);
  background: var(--bg-surface-hover);
}

/* ── Form actions ── */
.form-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }

/* ── Auth switch link ── */
.auth-switch {
  text-align: center;
  margin-top: 22px;
  font-size: 13px;
  color: var(--text-tertiary);
}

.auth-switch a {
  color: var(--green);
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
}

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

/* ═══════════════════════════════════════════════════════════════════════════
   Password strength meter
   ═══════════════════════════════════════════════════════════════════════════ */
.password-strength {
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.2s, max-height 0.2s;
}

.password-strength.visible { opacity: 1; max-height: 18px; }

.strength-bars { display: flex; gap: 4px; flex: 1; }

.strength-bar {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--border-medium);
  transition: background 0.3s;
}

.strength-bar.weak   { background: var(--red); }
.strength-bar.medium { background: var(--yellow); }
.strength-bar.strong { background: var(--green); }

.strength-label {
  font-size: 11px;
  font-weight: 600;
  min-width: 46px;
  text-align: right;
}

.strength-label.weak   { color: var(--red); }
.strength-label.medium { color: var(--yellow); }
.strength-label.strong { color: var(--green); }

/* ═══════════════════════════════════════════════════════════════════════════
   Verify Email view
   ═══════════════════════════════════════════════════════════════════════════ */

/* Back button */
.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-tertiary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  padding: 0 0 24px;
  transition: color 0.2s;
}

.auth-back:hover { color: var(--text-primary); }

/* Email icon & envelope graphic */
.verify-icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--green-dim);
  border: 1px solid rgba(16, 185, 129, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  color: var(--green);
}

.verify-icon-wrap .lucide { width: 24px; height: 24px; }

/* Email badge */
.verify-email-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: 100px;
  padding: 7px 14px;
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
  margin-bottom: 28px;
  max-width: 100%;
}

.verify-email-badge-icon { color: var(--green); width: 14px; height: 14px; flex-shrink: 0; }
.verify-email-badge-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── OTP inputs ── */
.otp-container {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 24px;
}

.otp-input {
  width: 54px;
  height: 62px;
  text-align: center;
  font-size: 26px;
  font-weight: 700;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  caret-color: var(--green);
  font-family: 'Inter', ui-monospace, monospace;
  outline: none;
  -webkit-appearance: none;
  -moz-appearance: textfield;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s, transform 0.1s;
}

.otp-input:focus {
  border-color: rgba(16, 185, 129, 0.6);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.11);
  background: #0c0c0c;
}

.otp-input.otp-filled {
  border-color: rgba(16, 185, 129, 0.3);
  transform: scale(1.03);
}

.otp-input.otp-error {
  border-color: rgba(239, 68, 68, 0.65);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.otp-input.otp-success {
  border-color: var(--green);
  background: rgba(16, 185, 129, 0.07);
  color: var(--green);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-7px); }
  40%       { transform: translateX(7px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

.otp-shake { animation: shake 0.42s ease; }

/* ── Resend section ── */
.resend-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

.resend-timer {
  display: flex;
  align-items: center;
  gap: 12px;
}

.resend-countdown-text {
  font-size: 13px;
  color: var(--text-tertiary);
}

.resend-countdown-text strong {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

/* SVG countdown ring */
.countdown-ring-wrap {
  position: relative;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.countdown-svg {
  position: absolute;
  top: 0; left: 0;
  transform: rotate(-90deg);
}

.countdown-track {
  fill: none;
  stroke: var(--border-medium);
  stroke-width: 3;
}

.countdown-arc {
  fill: none;
  stroke: var(--green);
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear;
}

.countdown-num {
  position: relative;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  z-index: 1;
}

.btn-resend {
  background: transparent;
  border: none;
  color: var(--green);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: opacity 0.2s;
}

.btn-resend:disabled {
  color: var(--text-tertiary);
  text-decoration: none;
  cursor: not-allowed;
}

.btn-resend:not(:disabled):hover { opacity: 0.75; }

/* ── Divider ── */
.auth-divider {
  height: 1px;
  background: var(--border-light);
  margin: 20px 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Scrollbar
   ═══════════════════════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-medium); border-radius: 3px; }

/* ═══════════════════════════════════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 520px) {
  .auth-card {
    padding: 28px 22px 26px;
    border-radius: var(--radius-lg);
  }

  .auth-heading { font-size: 20px; }

  .otp-input {
    width: 44px;
    height: 52px;
    font-size: 22px;
  }

  .otp-container { gap: 7px; }
}

@media (max-height: 680px) {
  .auth-wrapper { align-items: flex-start; padding-top: 40px; }
}
