/* ===================================================
   Auth Pages — Login, Register, Dashboard Shared Styles
   =================================================== */

/* ---- Auth Body ---- */
.auth-body {
  background: var(--bg);
}

/* ---- Auth Hero ---- */
.auth-hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 120px 0 60px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, #ecfdf5 0%, #d1fae5 30%, #f0fdf4 100%);
}

.auth-hero-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.auth-hero-orb--1 {
  width: 500px; height: 500px;
  top: -200px; right: -100px;
  background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
  animation: float 8s ease-in-out infinite;
}
.auth-hero-orb--2 {
  width: 350px; height: 350px;
  bottom: -100px; left: -80px;
  background: radial-gradient(circle, rgba(245,158,11,.12) 0%, transparent 70%);
  animation: float 11s ease-in-out infinite reverse;
}
.auth-hero-orb--3 {
  width: 200px; height: 200px;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(99,102,241,.08) 0%, transparent 70%);
  animation: float 7s ease-in-out infinite;
}

/* ---- Auth Layout ---- */
.auth-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: center;
  position: relative;
  z-index: 2;
}

/* ---- Left: Info Panel ---- */
.auth-info-panel h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 16px;
  color: var(--text);
}

.auth-info-panel h1 em {
  font-style: normal;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-info-panel > p {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 36px;
}

.auth-features {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 36px;
}

.auth-feature {
  display: flex;
  align-items: center;
  gap: 16px;
}

.auth-feature-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: rgba(13,148,136,.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.auth-feature strong {
  display: block;
  font-size: .92rem;
  color: var(--text);
}

.auth-feature span {
  font-size: .78rem;
  color: var(--text-muted);
}

/* Rank Preview */
.rank-preview {
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 20px 24px;
}

.rank-preview h4 {
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 14px;
  color: var(--text-muted);
}

.rank-preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rank-chip {
  padding: 6px 16px;
  border-radius: 50px;
  font-size: .78rem;
  font-weight: 700;
  color: #fff;
}

/* ---- Right: Auth Card ---- */
.auth-card {
  background: var(--bg-alt);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--surface-border);
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 32px;
  border-radius: 50px;
  background: var(--bg);
  padding: 4px;
  border: 1px solid var(--surface-border);
}

.auth-tab {
  flex: 1;
  padding: 12px 24px;
  border: none;
  border-radius: 50px;
  background: transparent;
  font-size: .92rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .3s ease;
}

.auth-tab.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  box-shadow: 0 4px 16px var(--primary-glow);
}

.auth-form {
  display: none;
  animation: stepFadeIn .4s ease;
}
.auth-form.active { display: block; }

@keyframes stepFadeIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-form-header h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.auth-form-header p {
  font-size: .88rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* Input with icon */
.input-icon-wrap {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: .95rem;
  pointer-events: none;
}

.input-icon-wrap input {
  width: 100%;
  padding: 14px 18px 14px 46px;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  font-size: .92rem;
  background: var(--bg);
  outline: none;
  transition: var(--transition);
}

.input-icon-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.auth-error {
  font-size: .85rem;
  color: var(--expense);
  font-weight: 600;
  min-height: 20px;
  margin-bottom: 8px;
}

.auth-submit {
  width: 100%;
  justify-content: center;
}

.auth-switch {
  text-align: center;
  font-size: .85rem;
  color: var(--text-muted);
  margin-top: 20px;
}

.auth-switch a {
  font-weight: 700;
  color: var(--primary);
}

/* ================================================================
   NAV AUTH ELEMENTS (injected by auth.js)
   ================================================================ */
.nav-auth {
  display: flex;
  align-items: center;
}

.nav-login-link {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-muted) !important;
  transition: var(--transition);
}

.nav-login-link:hover {
  color: var(--primary) !important;
}

.nav-user-pill {
  display: flex;
  align-items: center;
}

.nav-avatar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  border-radius: 50px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  transition: all .3s ease;
  text-decoration: none;
}

.nav-avatar-link:hover {
  box-shadow: 0 4px 16px var(--primary-glow);
  transform: translateY(-1px);
}

.nav-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .85rem;
  color: #fff;
}

.nav-user-name {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
}

.nav-rank-badge {
  padding: 3px 10px;
  border-radius: 50px;
  font-size: .68rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: .5px;
}

/* ================================================================
   DASHBOARD PAGE
   ================================================================ */
.dash-body {
  background: var(--bg);
}

.dash-hero {
  padding: 120px 0 40px;
  background: linear-gradient(160deg, #ecfdf5 0%, #d1fae5 30%, #f0fdf4 100%);
  position: relative;
  overflow: hidden;
}

.dash-hero-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.dash-hero-orb--1 {
  width: 400px; height: 400px;
  top: -150px; right: -100px;
  background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
  animation: float 8s ease-in-out infinite;
}
.dash-hero-orb--2 {
  width: 300px; height: 300px;
  bottom: -80px; left: -60px;
  background: radial-gradient(circle, rgba(245,158,11,.12) 0%, transparent 70%);
  animation: float 10s ease-in-out infinite reverse;
}

/* Profile Card */
.profile-card {
  display: flex;
  align-items: center;
  gap: 32px;
  position: relative;
  z-index: 2;
}

.profile-avatar {
  width: 100px; height: 100px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
  border: 4px solid rgba(255,255,255,.5);
}

.profile-info h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.profile-id {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  border-radius: 50px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-family: monospace;
}

.profile-rank-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  border-radius: 50px;
  font-size: .88rem;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
}

.profile-meta {
  display: flex;
  gap: 24px;
  margin-top: 12px;
  font-size: .82rem;
  color: var(--text-muted);
}

.profile-actions {
  margin-left: auto;
  display: flex;
  gap: 12px;
}

/* Dashboard Content */
.dash-content {
  padding: 40px 0 100px;
}

/* Stat Cards */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 40px;
}

.stat-card {
  background: var(--bg-alt);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 24px;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.stat-card-icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 16px;
}

.stat-card h4 {
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
}

/* Rank Progress */
.rank-progress-card {
  background: var(--bg-alt);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 40px;
}

.rank-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.rank-progress-header h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
}

.rank-progress-bar {
  height: 12px;
  background: #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
}

.rank-progress-fill {
  height: 100%;
  border-radius: 12px;
  transition: width 1.5s cubic-bezier(.4,0,.2,1);
}

.rank-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: .78rem;
  color: var(--text-muted);
}

.rank-tiers {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--surface-border);
}

.rank-tier {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  opacity: .5;
  transition: opacity .3s ease;
}

.rank-tier.current { opacity: 1; }
.rank-tier.achieved { opacity: .8; }

.rank-tier-icon {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  border: 2px solid var(--surface-border);
}

.rank-tier.current .rank-tier-icon {
  border-color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
}

.rank-tier-name {
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* Dashboard Grid */
.dash-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 32px;
}

/* Donation History */
.history-card {
  background: var(--bg-alt);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 32px;
}

.history-card h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin-bottom: 20px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--surface-border);
}

.history-item:last-child {
  border-bottom: none;
}

.history-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.history-details {
  flex: 1;
}

.history-details strong {
  display: block;
  font-size: .88rem;
}

.history-details span {
  font-size: .78rem;
  color: var(--text-muted);
}

.history-amount {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.history-empty {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

.history-empty span {
  display: block;
  font-size: 2.5rem;
  margin-bottom: 12px;
}

/* Leaderboard */
.leaderboard-card {
  background: var(--bg-alt);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 32px;
}

.leaderboard-card h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin-bottom: 20px;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--surface-border);
}

.leaderboard-item:last-child { border-bottom: none; }

.leaderboard-item.highlight {
  background: linear-gradient(135deg, rgba(13,148,136,.05), rgba(13,148,136,.02));
  margin: 0 -16px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
}

.lb-position {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  font-weight: 700;
  background: var(--bg);
  border: 1px solid var(--surface-border);
  flex-shrink: 0;
}

.lb-position.top-1 { background: linear-gradient(135deg, #f59e0b, #fbbf24); color: #fff; border: none; }
.lb-position.top-2 { background: linear-gradient(135deg, #a8a9ad, #c0c0c0); color: #fff; border: none; }
.lb-position.top-3 { background: linear-gradient(135deg, #cd7f32, #daa06d); color: #fff; border: none; }

.lb-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .82rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.lb-info {
  flex: 1;
  min-width: 0;
}

.lb-info strong {
  display: block;
  font-size: .85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-info span {
  font-size: .72rem;
  color: var(--text-muted);
}

.lb-amount {
  font-weight: 700;
  font-size: .88rem;
  color: var(--primary-dark);
  white-space: nowrap;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 1024px) {
  .auth-layout {
    grid-template-columns: 1fr;
  }
  .auth-info-panel {
    text-align: center;
  }
  .auth-features {
    max-width: 400px;
    margin: 0 auto 36px;
  }
  .rank-preview {
    max-width: 400px;
    margin: 0 auto;
  }
  .stat-cards {
    grid-template-columns: repeat(2, 1fr);
  }
  .dash-grid {
    grid-template-columns: 1fr;
  }
  .profile-card {
    flex-direction: column;
    text-align: center;
  }
  .profile-actions {
    margin-left: 0;
  }
  .profile-meta {
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .auth-card {
    padding: 24px;
  }
  .stat-cards {
    grid-template-columns: 1fr;
  }
  .rank-tiers {
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
  }
  .profile-avatar {
    width: 80px; height: 80px;
    font-size: 2rem;
  }
}

@media (max-width: 480px) {
  .rank-preview-grid {
    justify-content: center;
  }
}
