/* Referral Esports Theme (scoped to body.referral-page) */
body.referral-page {
  --bg-1: #050505;
  --bg-2: #0B0F0C;
  --glass: rgba(255,255,255,0.03);
  --glass-2: rgba(255,255,255,0.05);
  --text: #EDEDED;
  --muted: #9CA3AF;
  --primary-neon: #39FF14;
  --accent-green: #00FF7F;
  --accent-teal: #00FFBF;
  --success: #39FF14;
  --warning: #FFD54F;
  --card-radius: 18px;
  background: var(--bg-1);
  color: var(--text);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Global Styles */
.referral-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Glass Card Base */
.glass-card {
  background: var(--glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: var(--card-radius);
  border: 1px solid rgba(57,255,20,0.06);
  box-shadow: 0 6px 18px rgba(57,255,20,0.06);
  padding: 1.5rem;
  transition: all 0.3s ease;
  transform: translateZ(0);
  will-change: transform, box-shadow;
}

.glass-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 0 24px rgba(57,255,20,0.12);
  border-color: rgba(57,255,20,0.12);
}

/* Referral Hero Card */
.ref-hero {
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(8px);
  border-radius: var(--card-radius);
  border: 1px solid rgba(57,255,20,0.06);
  box-shadow: 0 6px 18px rgba(57,255,20,0.06);
  padding: 2rem;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
  transform: translateZ(0);
  will-change: transform;
}

.ref-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(57,255,20,0.05) 0%, transparent 70%);
  animation: rotate 20s linear infinite;
  z-index: 0;
  will-change: auto;
}

.ref-hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
}

.ref-profile-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 15px rgba(57,255,20,0.6);
  border: 3px solid var(--primary-neon);
  margin: 0 auto 1.5rem;
  transition: all 0.3s ease;
  animation: breatheGlow 3s ease-in-out infinite;
  transform: translateZ(0);
  will-change: transform, box-shadow;
}

.ref-profile-avatar:hover {
  border-color: var(--accent-green);
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(57,255,20,0.8);
}

.ref-code-display {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary-neon);
  text-shadow: 0 0 10px rgba(57,255,20,0.5);
  margin: 1.5rem 0;
  letter-spacing: 2px;
  transform: translateZ(0);
  will-change: transform;
}

.copy-btn {
  background: linear-gradient(90deg, var(--accent-green), var(--primary-neon));
  padding: 0.8rem 1.5rem;
  border-radius: 12px;
  transform: translateZ(0);
  box-shadow: 0 0 12px var(--primary-neon);
  transition: transform 0.12s ease, opacity 0.12s ease;
  border: none;
  color: #000;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  min-height: 44px;
  margin: 1rem 0;
  cursor: pointer;
  will-change: transform;
}

.copy-btn:hover {
  box-shadow: 0 0 20px var(--primary-neon);
}

.copy-btn:active {
  transform: scale(0.98);
}

.copy-btn.copied {
  background: linear-gradient(90deg, var(--success), var(--success));
}

.share-buttons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.5rem;
}

.share-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass-2);
  border: 1px solid rgba(57,255,20,0.2);
  color: var(--primary-neon);
  font-size: 1.2rem;
  transition: all 0.3s ease;
  box-shadow: 0 0 8px rgba(57,255,20,0.1);
  cursor: pointer;
  transform: translateZ(0);
  will-change: transform, box-shadow;
}

.share-btn:hover {
  background: rgba(57,255,20,0.1);
  transform: translateY(-3px) scale(1.1);
  box-shadow: 0 5px 15px rgba(57,255,20,0.3);
  border-color: var(--primary-neon);
}

/* Progress Section */
.progress-section {
  margin: 2rem 0;
}

.progress-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.progress-header h3 {
  color: var(--text);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.progress-header p {
  color: var(--muted);
  margin: 0;
}

.progress-container {
  max-width: 600px;
  margin: 0 auto;
}

.progress-bar {
  height: 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.03);
  overflow: hidden;
  margin-bottom: 1rem;
  border: 1px solid rgba(57,255,20,0.1);
}

.progress-fill {
  height: 100%;
  width: 0; /* Set by JS logic */
  background: linear-gradient(90deg, var(--accent-green), var(--primary-neon));
  transition: width 0.4s cubic-bezier(0.2,0.9,0.2,1);
  box-shadow: 0 0 10px rgba(57,255,20,0.3);
}

.progress-stats {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
}

.progress-stat {
  font-size: 1.1rem;
  font-weight: 600;
}

.progress-stat .current {
  color: var(--primary-neon);
}

.progress-stat .required {
  color: var(--muted);
}

/* Steps Section */
.steps-section {
  margin: 2rem 0;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.step-card {
  background: var(--glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: var(--card-radius);
  border: 1px solid rgba(57,255,20,0.06);
  box-shadow: 0 6px 18px rgba(57,255,20,0.06);
  padding: 1.5rem;
  text-align: center;
  transition: all 0.3s ease;
  transform: translateZ(0);
  will-change: transform, box-shadow;
}

.step-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 0 24px rgba(57,255,20,0.12);
  border-color: rgba(57,255,20,0.12);
}

.step-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(57,255,20,0.1);
  border: 1px solid rgba(57,255,20,0.3);
  color: var(--primary-neon);
  font-size: 1.5rem;
  margin: 0 auto 1rem;
  box-shadow: 0 0 10px rgba(57,255,20,0.2);
  transition: all 0.3s ease;
}

.step-card:hover .step-icon {
  background: rgba(57,255,20,0.2);
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(57,255,20,0.4);
}

.step-title {
  color: var(--text);
  font-weight: 700;
  margin: 1rem 0 0.5rem;
}

.step-desc {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
}

/* Rules Accordion */
.rules-section {
  margin: 2rem 0;
}

.accordion {
  background: var(--glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: var(--card-radius);
  border: 1px solid rgba(57,255,20,0.06);
  box-shadow: 0 6px 18px rgba(57,255,20,0.06);
  overflow: hidden;
  transform: translateZ(0);
}

.accordion-header {
  padding: 1.2rem 1.5rem;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid rgba(57,255,20,0.06);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s ease;
  transform: translateZ(0);
  will-change: transform;
}

.accordion-header:hover {
  background: rgba(57,255,20,0.05);
}

.accordion-header.active {
  background: rgba(57,255,20,0.1);
  border-color: rgba(57,255,20,0.12);
  box-shadow: 0 0 15px rgba(57,255,20,0.1);
}

.accordion-header.active .accordion-toggle {
  transform: rotate(180deg);
}

.accordion-title {
  color: var(--text);
  font-weight: 600;
  margin: 0;
}

.accordion-toggle {
  color: var(--primary-neon);
  transition: transform 0.3s ease;
  transform: translateZ(0);
  will-change: transform;
}

.accordion-content {
  padding: 0 1.5rem;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.accordion-content.active {
  padding: 1.5rem;
  max-height: 500px;
}

.rules-list {
  padding-left: 1.2rem;
  margin: 0;
}

.rules-list li {
  margin-bottom: 0.8rem;
}

.rules-list li:last-child {
  margin-bottom: 0;
}

/* Referral History */
.history-section {
  margin: 2rem 0;
}

.history-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: var(--card-radius);
  border: 1px solid rgba(57,255,20,0.06);
  box-shadow: 0 6px 18px rgba(57,255,20,0.06);
  overflow: hidden;
  transform: translateZ(0);
}

.history-table thead {
  background: rgba(255,255,255,0.02);
}

.history-table th {
  padding: 1rem 1.5rem;
  text-align: left;
  color: var(--primary-neon);
  font-weight: 600;
  border-bottom: 1px solid rgba(57,255,20,0.1);
}

.history-table td {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(57,255,20,0.06);
  color: var(--text);
}

.history-table tr:last-child td {
  border-bottom: none;
}

.history-table tr.confirmed {
  background: rgba(57,255,20,0.05);
  box-shadow: inset 0 0 10px rgba(57,255,20,0.1);
}

.history-table tr.confirmed td:first-child::before {
  content: "✓";
  color: var(--success);
  margin-right: 0.5rem;
}

.history-table tr.pending {
  background: rgba(255,213,79,0.05);
}

.history-table tr.pending td:first-child::before {
  content: "⋯";
  color: var(--warning);
  margin-right: 0.5rem;
}

.history-table tr.failed {
  background: rgba(255,0,0,0.05);
}

.history-table tr.failed td:first-child::before {
  content: "✗";
  color: #ff4757;
  margin-right: 0.5rem;
}

.history-table tr:hover {
  background: rgba(57,255,20,0.08);
}

.reward-amount {
  font-weight: 700;
}

.reward-amount.confirmed {
  color: var(--success);
}

.reward-amount.pending {
  color: var(--warning);
}

.reward-amount.failed {
  color: #ff4757;
}

/* Toast Notification */
.copy-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 12px;
  border: 1px solid rgba(57,255,20,0.3);
  box-shadow: 0 0 20px rgba(57,255,20,0.3);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--primary-neon);
  font-weight: 600;
  z-index: 1000;
  transform: translateX(150%);
  transition: transform 0.3s ease;
  will-change: transform;
}

.copy-toast.show {
  transform: translateX(0);
}

.copy-toast i {
  font-size: 1.2rem;
}

/* Animations */
@keyframes rotate {
  from {
    transform: rotate(0deg);
    will-change: auto;
  }
  to {
    transform: rotate(360deg);
    will-change: auto;
  }
}

@keyframes breatheGlow {
  0% {
    box-shadow: 0 0 10px rgba(57,255,20,0.4);
  }
  50% {
    box-shadow: 0 0 20px rgba(57,255,20,0.8);
  }
  100% {
    box-shadow: 0 0 10px rgba(57,255,20,0.4);
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 12px var(--primary-neon);
  }
  50% {
    box-shadow: 0 0 24px var(--primary-neon);
  }
  100% {
    box-shadow: 0 0 12px var(--primary-neon);
  }
}

.pulse-animation {
  animation: pulse 2s infinite;
  will-change: auto;
}

/* Responsive Design */
@media (max-width: 768px) {
  .referral-container {
    padding: 10px;
  }
  
  .ref-hero {
    padding: 1.5rem 1rem;
  }
  
  .ref-code-display {
    font-size: 1.8rem;
  }
  
  .share-buttons {
    gap: 0.8rem;
  }
  
  .share-btn {
    width: 45px;
    height: 45px;
    font-size: 1rem;
  }
  
  .steps-grid {
    grid-template-columns: 1fr;
  }
  
  .history-table {
    font-size: 0.9rem;
  }
  
  .history-table th,
  .history-table td {
    padding: 0.8rem 1rem;
  }
  
  /* Reduce animations on mobile */
  .ref-hero::before,
  .step-icon,
  .ref-profile-avatar {
    animation: none !important;
    will-change: auto !important;
  }
  
  .glass-card,
  .step-card,
  .ref-hero,
  .history-table tr {
    transition: none !important;
    transform: none !important;
  }
  
  .glass-card:hover,
  .step-card:hover,
  .ref-hero:hover,
  .history-table tr:hover {
    transform: none !important;
  }
}

@media (max-width: 480px) {
  .ref-code-display {
    font-size: 1.5rem;
    letter-spacing: 1px;
  }
  
  .progress-stats {
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
  }
  
  .share-buttons {
    flex-wrap: wrap;
  }
  
  .history-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .ref-hero::before,
  .ref-profile-avatar,
  .pulse-animation {
    animation: none !important;
  }
  
  .glass-card,
  .step-card,
  .ref-hero,
  .history-table tr,
  .share-btn,
  .copy-btn {
    transition: none !important;
    transform: none !important;
  }
  
  .glass-card:hover,
  .step-card:hover,
  .ref-hero:hover,
  .history-table tr:hover,
  .share-btn:hover,
  .copy-btn:hover {
    transform: none !important;
  }
}

/* Focus Styles for Accessibility */
.copy-btn:focus,
.share-btn:focus,
.accordion-header:focus {
  outline: 2px solid var(--primary-neon);
  outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  body.referral-page {
    --glass: rgba(0,0,0,0.8);
    --glass-2: rgba(0,0,0,0.9);
  }
  
  .glass-card,
  .ref-hero,
  .step-card,
  .accordion,
  .history-table {
    border: 2px solid var(--primary-neon);
  }
}