/* ===== Referral Dashboard — Buda Rewards ===== */

/* ─────────────────────────────
   Skeleton
   ───────────────────────────── */
.rd-skeleton {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  max-width: 800px;
  margin: 0 auto;
}
.rd-skel-header { height: 56px; background: var(--color-surface-2); border-radius: var(--radius-md); }
.rd-skel-hero { height: 160px; background: var(--color-surface-2); border-radius: var(--radius-xl); }
.rd-skel-card { height: 120px; background: var(--color-surface-2); border-radius: var(--radius-xl); }
.rd-skel-row { display: grid; grid-template-columns: repeat(3,1fr); gap: var(--space-3); }
.rd-skel-metric { height: 100px; background: var(--color-surface-2); border-radius: var(--radius-lg); }
.rd-skel-header,
.rd-skel-hero,
.rd-skel-card,
.rd-skel-metric {
  animation: rdPulse 1.5s ease-in-out infinite;
  background: linear-gradient(-90deg, var(--color-surface-2) 0%, var(--color-surface-1) 50%, var(--color-surface-2) 100%);
  background-size: 400% 400%;
}
@keyframes rdPulse {
  0% { background-position: 0% 0%; }
  100% { background-position: -135% 0%; }
}

/* ─────────────────────────────
   Utilities
   ───────────────────────────── */
.rd-hidden { display: none !important; }
.rd-content { background: var(--color-bg, #f8fafc); min-height: 100vh; }

/* ─────────────────────────────
   Container
   ───────────────────────────── */
.rd-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 var(--space-3) var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* ─────────────────────────────
   Header
   ───────────────────────────── */
.rd-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border, #e2e8f0);
}
.rd-header-inner {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
}
.rd-header-start,
.rd-header-end {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.rd-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--color-text, #0f172a);
  font-weight: 800;
  font-size: 18px;
}

/* ─────────────────────────────
   Profile Hero
   ───────────────────────────── */
.rd-profile-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--pad-xl) var(--pad-lg) var(--pad-lg);
  margin-top: var(--space-3);
  overflow: hidden;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, #6D28D9 0%, #8B5CF6 100%);
}
.rd-hero-banner {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  overflow: hidden;
}
.rd-hero-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.12;
}
.rd-hero-banner-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #6D28D9 0%, #8B5CF6 100%);
  opacity: 0.05;
}
.rd-profile-avatar-wrap {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  margin-bottom: var(--space-2);
}
.rd-profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6D28D9;
  font-size: 32px;
  font-weight: 800;
  border: 4px solid rgba(255,255,255,0.5);
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.rd-profile-info {
  position: relative;
  z-index: 1;
  text-align: center;
  min-width: 0;
}
.rd-profile-greeting {
  font-size: 14px;
  color: rgba(255,255,255,0.75);
  font-weight: 700;
  margin: 0 0 4px;
}
.rd-profile-name {
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  margin: 0 0 var(--space-1);
  line-height: 1.2;
}
.rd-profile-email-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  justify-content: center;
}
.rd-profile-email {
  font-size: 14px;
  color: rgba(255,255,255,0.8);
}

/* ─────────────────────────────
   Referral Card
   ───────────────────────────── */
.rd-referral-card {
  background: linear-gradient(135deg, #6D28D9 0%, #8B5CF6 100%);
  border-radius: var(--radius-xl);
  padding: var(--pad-lg);
  display: flex;
  gap: var(--space-4);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.rd-referral-main { flex: 1; min-width: 0; }
.rd-referral-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.rd-referral-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.rd-referral-icon .buda-icon { width: 28px; height: 28px; }
.rd-referral-title {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 800;
  text-align: center;
}
.rd-referral-sub {
  margin: 0 0 var(--space-3);
  font-size: 14px;
  opacity: 0.85;
  text-align: center;
}
.rd-referral-code-box {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  background: rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-2);
  margin-bottom: var(--space-2);
  direction: ltr;
}
.rd-referral-code {
  font-size: 18px;
  font-weight: 800;
  font-family: 'Courier New', monospace;
  letter-spacing: 2px;
  flex: 1;
  text-align: center;
  color: #fff;
}
.rd-referral-url-box {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-2);
  margin-bottom: var(--space-3);
  direction: ltr;
}
.rd-referral-url {
  font-size: 12px;
  opacity: 0.85;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #fff;
}
.rd-referral-actions {
  display: flex;
  gap: var(--space-2);
}
.rd-referral-actions .buda-btn {
  border-color: rgba(255,255,255,0.3);
  color: #fff;
}
.rd-referral-actions .buda-btn-outline:hover {
  background: rgba(255,255,255,0.1);
}
.rd-copy-feedback {
  margin-top: var(--space-2);
  padding: var(--space-1) var(--space-2);
  background: rgba(255,255,255,0.15);
  border-radius: var(--radius-xs);
  font-size: 12px;
  text-align: center;
  animation: rdFadeIn 0.3s ease;
  color: #fff;
}
.rd-referral-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  flex-shrink: 0;
  padding: var(--space-2);
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius-lg);
  min-width: 140px;
}
.rd-qr-label {
  font-size: 12px;
  font-weight: 700;
  opacity: 0.9;
  margin: 0;
  color: #fff;
}
.rd-qr-container {
  width: 120px;
  height: 120px;
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rd-qr-container canvas,
.rd-qr-container img {
  width: 100% !important;
  height: 100% !important;
}
.rd-qr-hint {
  font-size: 10px;
  opacity: 0.7;
  margin: 0;
  text-align: center;
  color: #fff;
}

/* ─────────────────────────────
   Section Titles
   ───────────────────────────── */
.rd-section { display: flex; flex-direction: column; gap: var(--space-3); }
.rd-section-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--color-text, #0f172a);
  margin: 0;
  text-align: center;
}

/* ─────────────────────────────
   Statistics
   ───────────────────────────── */
.rd-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}
.rd-stat-card {
  padding: var(--pad-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  text-align: center;
  background: #fff;
  border: 1px solid #e2e8f0;
}
.rd-stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.rd-stat-icon .buda-icon { width: 24px; height: 24px; }
.rd-stat-icon--blue { background: #EDE5FF; color: #6D28D9; }
.rd-stat-icon--green { background: #d1fae5; color: #065f46; }
.rd-stat-icon--purple { background: #f5f3ff; color: #6D28D9; }
.rd-stat-body { display: flex; flex-direction: column; gap: 2px; }
.rd-stat-num {
  font-size: 32px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
}
.rd-stat-label {
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
}

/* ─────────────────────────────
   Progress Card
   ───────────────────────────── */
.rd-progress-card {
  background: linear-gradient(135deg, #6D28D9 0%, #8B5CF6 100%);
  border-radius: var(--radius-xl);
  padding: var(--pad-lg);
  text-align: center;
  color: #fff;
}
.rd-progress-content { max-width: 480px; margin: 0 auto; }
.rd-progress-title {
  font-size: 20px;
  font-weight: 800;
  margin: 0 0 var(--space-1);
}
.rd-progress-desc {
  font-size: 14px;
  opacity: 0.85;
  margin: 0 0 var(--space-4);
}
.rd-progress-bar-wrap { margin-bottom: var(--space-3); }
.rd-progress-bar {
  width: 100%;
  height: 14px;
  background: rgba(255,255,255,0.2);
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: var(--space-2);
}
.rd-progress-fill {
  height: 100%;
  background: #fff;
  border-radius: 9999px;
  transition: width 0.6s ease;
}
.rd-progress-text {
  font-size: 24px;
  font-weight: 800;
  direction: ltr;
}
.rd-progress-current { opacity: 1; }
.rd-progress-slash { opacity: 0.5; margin: 0 4px; }
.rd-progress-goal { opacity: 0.7; }
.rd-progress-target {
  font-size: 14px;
  opacity: 0.8;
  margin: 0;
}
.rd-progress-celebration {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-4);
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-radius: 9999px;
  font-size: 16px;
  font-weight: 800;
  color: #92400e;
  animation: rdFadeIn 0.5s ease;
  box-shadow: 0 2px 10px rgba(251,191,36,0.3);
}
.rd-progress-milestone {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-2);
  padding: var(--space-1) var(--space-3);
  background: rgba(255,255,255,0.15);
  border-radius: 9999px;
  font-size: 14px;
  font-weight: 700;
  animation: rdFadeIn 0.5s ease;
}

/* ─────────────────────────────
   How It Works
   ───────────────────────────── */
.rd-how-card .rd-section-title { margin-bottom: var(--space-4); }
.rd-how-card { background: #fff; border: 1px solid #e2e8f0; }
.rd-how-grid {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: var(--space-2);
}
.rd-how-step {
  flex: 1;
  max-width: 200px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
}
.rd-how-img-wrap {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  margin-bottom: var(--space-1);
  border: 3px solid #EDE5FF;
}
.rd-how-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.rd-how-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #EDE5FF;
  color: #6D28D9;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rd-how-icon .buda-icon { width: 22px; height: 22px; }
.rd-how-step-title {
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
}
.rd-how-step-desc {
  font-size: 12px;
  color: #64748b;
  margin: 0;
  line-height: 1.5;
}
.rd-how-arrow {
  display: flex;
  align-items: center;
  padding-top: 20px;
  color: #C4B5FD;
}
.rd-how-arrow .buda-icon { width: 24px; height: 24px; }
.rd-how-note {
  margin: var(--space-4) 0 0;
  font-size: 12px;
  color: #64748b;
  text-align: center;
  padding: var(--space-2);
  background: #F5F0FF;
  border-radius: var(--radius-sm);
  line-height: 1.6;
}

/* ─────────────────────────────
   Message Cards
   ───────────────────────────── */
.rd-message-card {
  padding: var(--pad-md);
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  border-radius: var(--radius-lg);
  border: 1px solid #e2e8f0;
  background: #fff;
  transition: background 0.2s ease;
}
.rd-message-card:hover { background: #F5F0FF; }
.rd-message-card.unread { background: #F5F0FF; border-color: #DDD6FE; }
.rd-message-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #EDE5FF;
  color: #6D28D9;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.rd-message-icon .buda-icon { width: 20px; height: 20px; }
.rd-message-body { flex: 1; min-width: 0; }
.rd-message-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 2px;
}
.rd-message-preview {
  font-size: 12px;
  color: #64748b;
  margin: 0;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rd-message-date {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 4px;
}
.rd-message-badge {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6D28D9;
  flex-shrink: 0;
  margin-top: 6px;
}

/* ─────────────────────────────
   Empty / General
   ───────────────────────────── */
.rd-empty {
  text-align: center;
  padding: var(--space-6) 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  color: #64748b;
  font-size: 14px;
}

/* ─────────────────────────────
   Animations
   ───────────────────────────── */
@keyframes rdFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.rd-copy-feedback,
.rd-progress-celebration,
.rd-progress-milestone { animation: rdFadeIn 0.3s ease; }

/* ─────────────────────────────
   Responsive: Tablet 768px
   ───────────────────────────── */
@media (max-width: 768px) {
  .rd-container { padding: 0 12px 32px; gap: 16px; }
  .rd-profile-hero { padding: 24px 16px 16px; margin-top: 12px; }
  .rd-profile-avatar { width: 64px; height: 64px; font-size: 26px; }
  .rd-profile-name { font-size: 20px; }
  .rd-referral-card { flex-direction: column; gap: 16px; }
  .rd-referral-qr { flex-direction: row; min-width: auto; padding: 8px 16px; }
  .rd-qr-container { width: 80px; height: 80px; }
  .rd-stats-grid { gap: 8px; }
  .rd-stat-num { font-size: 24px; }
  .rd-how-grid { gap: 8px; }
}

/* ─────────────────────────────
   Responsive: Mobile 480px
   ───────────────────────────── */
@media (max-width: 480px) {
  .rd-container { padding: 0 8px 24px; gap: 12px; }
  .rd-skeleton { padding: 8px; gap: 12px; }
  .rd-skel-row { grid-template-columns: 1fr 1fr; }
  .rd-profile-hero { flex-direction: column; text-align: center; padding: 20px 12px 12px; }
  .rd-profile-avatar { width: 56px; height: 56px; font-size: 22px; }
  .rd-profile-name { font-size: 18px; }
  .rd-profile-email-wrap { justify-content: center; }
  .rd-referral-actions { flex-direction: column; }
  .rd-referral-qr { flex-direction: column; padding: 8px; }
  .rd-qr-container { width: 100px; height: 100px; }
  .rd-stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .rd-stat-card { padding: 12px 8px; }
  .rd-stat-num { font-size: 20px; }
  .rd-stat-label { font-size: 10px; }
  .rd-how-grid { flex-direction: column; align-items: center; gap: 12px; }
  .rd-how-arrow { transform: rotate(90deg); padding-top: 0; }
  .rd-how-step { max-width: 260px; width: 100%; }
  .rd-how-img-wrap { width: 60px; height: 60px; }
  .rd-referral-title { font-size: 16px; }
  .rd-referral-code { font-size: 14px; }
  .rd-progress-title { font-size: 16px; }
  .rd-progress-text { font-size: 18px; }
  .rd-progress-bar { height: 10px; }
  .rd-section-title { font-size: 16px; }
  .rd-how-note { padding: 8px; font-size: 11px; }
  .rd-message-card { padding: 10px 12px; gap: 10px; }
}

/* ─────────────────────────────
   Responsive: Small Mobile 360px
   ───────────────────────────── */
@media (max-width: 360px) {
  .rd-container { padding: 0 6px 16px; gap: 8px; }
  .rd-profile-avatar { width: 48px; height: 48px; font-size: 18px; }
  .rd-profile-name { font-size: 16px; }
  .rd-stat-num { font-size: 18px; }
  .rd-how-step { max-width: 100%; }
  .rd-how-img-wrap { width: 52px; height: 52px; }
  .rd-how-icon { width: 36px; height: 36px; }
  .rd-how-arrow .buda-icon { width: 18px; height: 18px; }
}