/* Auth pages — shared styles */

html:has(.auth-page),
html:has(.auth-page) body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

html:has(.auth-page) body {
  background: #f8fafc;
  color: #0a1628;
}

html.dark:has(.auth-page) body {
  background: #050d1a;
  color: #f1f5f9;
}

/* Full-viewport animated background (behind card) */
.auth-bg-wrapper {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.auth-bg-wrapper .hero-bg,
.auth-bg-wrapper .hero-gradient,
.auth-bg-wrapper .hero-noise,
.auth-bg-wrapper .hero-chart-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.auth-bg-wrapper .hero-chart-canvas {
  opacity: 0.4;
}

.auth-bg-wrapper .hero-orb {
  position: absolute;
}

.auth-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 3.25rem;
  padding: 0.625rem 1rem;
  pointer-events: none;
}

.auth-topbar > * {
  pointer-events: auto;
}

@media (min-width: 640px) {
  .auth-topbar {
    padding: 0.75rem 1.25rem;
  }
}

.auth-page {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3.5rem 1rem 1.5rem;
  box-sizing: border-box;
}

@media (min-width: 480px) {
  .auth-page {
    padding: 4rem 1rem 2rem;
  }
}

@media (min-width: 640px) {
  .auth-page {
    padding: 4.5rem 1rem 2rem;
  }
}

.auth-card {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 420px;
  padding: 1.5rem;
  border-radius: 1rem;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(10, 22, 40, 0.08);
  box-shadow: 0 12px 40px rgba(10, 22, 40, 0.1);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
}

html.dark .auth-card {
  background: rgba(10, 22, 40, 0.88);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

@media (min-width: 480px) {
  .auth-card {
    padding: 1.875rem;
    border-radius: 1.25rem;
  }
}

@media (min-width: 640px) {
  .auth-card {
    padding: 2.5rem;
  }
}

.auth-logo {
  display: block;
  margin-bottom: 1rem;
  text-decoration: none;
  text-align: center;
}

@media (min-width: 480px) {
  .auth-logo {
    margin-bottom: 1.25rem;
  }
}

@media (min-width: 640px) {
  .auth-logo {
    margin-bottom: 1.5rem;
  }
}

.auth-logo-img {
  width: min(60vw, 9rem);
  height: auto;
  margin: 0 auto;
  display: block;
  filter: drop-shadow(0 8px 24px rgba(212, 175, 55, 0.22));
  transition: transform 0.25s ease;
}

@media (min-width: 480px) {
  .auth-logo-img {
    width: min(65vw, 10rem);
  }
}

@media (min-width: 640px) {
  .auth-logo-img {
    width: min(72vw, 10.5rem);
  }
}

.auth-logo:hover .auth-logo-img {
  transform: scale(1.02);
}

.auth-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.25rem;
}

@media (min-width: 640px) {
  .auth-title {
    font-size: 1.5rem;
    margin-bottom: 0.35rem;
  }
}

.auth-subtitle {
  text-align: center;
  font-size: 0.8125rem;
  color: #64748b;
  margin-bottom: 1.25rem;
}

@media (min-width: 640px) {
  .auth-subtitle {
    font-size: 0.875rem;
    margin-bottom: 1.75rem;
  }
}

html.dark .auth-subtitle {
  color: #94a3b8;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.125rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
}

.form-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #334155;
}

html.dark .form-label {
  color: #cbd5e1;
}

.form-input-wrap {
  position: relative;
  display: block;
  width: 100%;
}

.form-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 2.75rem;
  padding: 0.65rem 0.875rem;
  border-radius: 0.625rem;
  font-size: 0.875rem;
  font-family: inherit;
  line-height: 1.4;
  border: 1px solid rgba(10, 22, 40, 0.14);
  background: #ffffff;
  color: #0a1628;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

.form-input-wrap .form-input {
  padding-right: 2.75rem;
}

@media (min-width: 640px) {
  .form-input {
    min-height: 2.875rem;
    padding: 0.7rem 0.875rem;
    font-size: 0.9375rem;
  }

  .form-input-wrap .form-input {
    padding-right: 2.875rem;
  }
}

html.dark .form-input {
  background: #0f1a2e;
  border-color: rgba(255, 255, 255, 0.14);
  color: #f1f5f9;
}

.form-input:focus {
  outline: none;
  border-color: #d4af37;
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

.form-input::placeholder {
  color: #94a3b8;
}

.form-input-toggle {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: 0.5rem;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.form-input-toggle:hover {
  color: #b8960c;
  background: rgba(212, 175, 55, 0.1);
}

html.dark .form-input-toggle {
  color: #94a3b8;
}

html.dark .form-input-toggle:hover {
  color: #f4c430;
}

.form-input-toggle svg {
  width: 1.125rem;
  height: 1.125rem;
}

.form-input-toggle .icon-eye-off {
  display: none;
}

.form-input-toggle.is-visible .icon-eye {
  display: none;
}

.form-input-toggle.is-visible .icon-eye-off {
  display: block;
}

.form-hint {
  font-size: 0.75rem;
  color: #64748b;
  line-height: 1.45;
}

html.dark .form-hint {
  color: #64748b;
}

.auth-submit {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.75rem 1rem;
  border: none;
  cursor: pointer;
  font-family: inherit;
  box-sizing: border-box;
}

.auth-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.auth-alert {
  padding: 0.75rem 1rem;
  border-radius: 0.625rem;
  font-size: 0.8125rem;
  font-weight: 500;
  display: none;
  margin-bottom: 0.25rem;
}

.auth-alert.show {
  display: block;
}

.auth-alert-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #dc2626;
}

html.dark .auth-alert-error {
  color: #f87171;
}

.auth-alert-success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.25);
  color: #16a34a;
}

html.dark .auth-alert-success {
  color: #4ade80;
}

.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.875rem;
  color: #64748b;
}

html.dark .auth-footer {
  color: #94a3b8;
}

.auth-footer a {
  color: #b8960c;
  font-weight: 600;
  text-decoration: none;
}

html.dark .auth-footer a {
  color: #f4c430;
}

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

.auth-back {
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  color: #334155;
  text-decoration: none;
  padding: 0;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(10, 22, 40, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(10, 22, 40, 0.08);
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.auth-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(10, 22, 40, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(10, 22, 40, 0.08);
  cursor: pointer;
  padding: 0;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.auth-theme-toggle:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(212, 175, 55, 0.35);
  transform: translateY(-1px);
}

html.dark .auth-theme-toggle {
  background: rgba(10, 22, 40, 0.75);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

html.dark .auth-theme-toggle:hover {
  border-color: rgba(212, 175, 55, 0.35);
  background: rgba(15, 25, 45, 0.9);
}

.auth-back svg,
.auth-theme-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
}

.auth-theme-toggle .theme-icon-sun {
  display: none;
  color: #f4c430;
}

.auth-theme-toggle .theme-icon-moon {
  display: block;
  color: #0a1628;
}

html.dark .auth-theme-toggle .theme-icon-sun {
  display: block;
}

html.dark .auth-theme-toggle .theme-icon-moon {
  display: none;
}

.auth-back:hover {
  color: #b8960c;
  border-color: rgba(212, 175, 55, 0.35);
  background: rgba(255, 255, 255, 0.95);
  transform: translateY(-1px);
}

html.dark .auth-back {
  color: #e2e8f0;
  background: rgba(10, 22, 40, 0.75);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

html.dark .auth-back:hover {
  color: #f4c430;
  border-color: rgba(212, 175, 55, 0.35);
  background: rgba(15, 25, 45, 0.9);
}

/* Dashboard legacy helpers */
.dashboard-page {
  min-height: 100dvh;
  padding: 6rem 1rem 3rem;
}

.dashboard-grid {
  display: grid;
  gap: 1.25rem;
  max-width: 56rem;
  margin: 0 auto;
}

@media (min-width: 640px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.dashboard-card {
  padding: 1.5rem;
  border-radius: 1rem;
}

.dashboard-card-full {
  grid-column: 1 / -1;
}

.referral-code-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: 0.75rem;
  background: rgba(212, 175, 55, 0.1);
  border: 1px dashed rgba(212, 175, 55, 0.35);
}

.referral-code-box code {
  flex: 1;
  font-size: 1.125rem;
  font-weight: 700;
  color: #d4af37;
  letter-spacing: 0.05em;
}

.btn-copy {
  padding: 0.4rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 0.5rem;
  border: 1px solid rgba(212, 175, 55, 0.4);
  background: transparent;
  color: #d4af37;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
}

.btn-copy:hover {
  background: rgba(212, 175, 55, 0.15);
}

.dashboard-logout {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: 0.5rem;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
}

.dashboard-logout:hover {
  background: rgba(239, 68, 68, 0.15);
}
