
/* ============================================
   REFERRAL SYSTEM — Premium UI
   ============================================ */

.ref-page {
  padding-bottom: 30px;
}

/* ===== HERO ===== */
.ref-hero {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
  background-size: 200% 200%;
  animation: refGrad 8s ease infinite;
  border-radius: 24px;
  padding: 28px 22px;
  margin-bottom: 20px;
  color: white;
  position: relative;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(99,102,241,0.35);
  text-align: center;
}
.ref-hero::before {
  content: '';
  position: absolute;
  top: -50%; right: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.15), transparent 60%);
  animation: rotate 20s linear infinite;
  pointer-events: none;
}
@keyframes refGrad {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.ref-hero-content {
  position: relative;
  z-index: 1;
}
.ref-hero-emoji {
  font-size: 64px;
  margin-bottom: 12px;
  display: block;
  animation: refFloat 3s ease-in-out infinite;
}
@keyframes refFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.ref-hero-title {
  font-size: 26px;
  font-weight: 900;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}
.ref-hero-subtitle {
  font-size: 14px;
  font-weight: 600;
  opacity: 0.95;
  line-height: 1.5;
  margin-bottom: 20px;
}
.ref-hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.ref-stat {
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 16px;
  padding: 14px 8px;
  text-align: center;
}
.ref-stat-value {
  font-size: 22px;
  font-weight: 900;
  margin-bottom: 4px;
  line-height: 1;
}
.ref-stat-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.9;
}

/* ===== KODE CARD ===== */
.ref-code-card {
  background: white;
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  position: relative;
  overflow: hidden;
}
.ref-code-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, #6366f1, #a855f7);
}
.ref-code-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #999;
  margin-bottom: 10px;
}
.ref-code-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #f0f4ff, #ede9fe);
  padding: 16px;
  border-radius: 14px;
  margin-bottom: 12px;
  border: 2px dashed rgba(99,102,241,0.3);
}
.ref-code-value {
  flex: 1;
  font-family: 'Courier New', monospace;
  font-size: 22px;
  font-weight: 900;
  color: #6366f1;
  letter-spacing: 3px;
  text-align: center;
  text-shadow: 0 2px 4px rgba(99,102,241,0.15);
}
.ref-code-copy {
  padding: 12px 16px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 0 #4338ca;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.ref-code-copy:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #4338ca;
}

.ref-link-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8f9fa;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid rgba(0,0,0,0.06);
}
.ref-link-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 12px;
  font-family: 'Courier New', monospace;
  color: #666;
  outline: none;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ref-link-copy {
  padding: 8px 14px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 3px 0 #047857;
  flex-shrink: 0;
}
.ref-link-copy:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #047857;
}

/* ===== QR CODE ===== */
.ref-qr-card {
  background: white;
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  text-align: center;
}
.ref-qr-wrap {
  display: inline-block;
  padding: 16px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  margin-bottom: 14px;
  position: relative;
}
.ref-qr-wrap::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: linear-gradient(135deg, #6366f1, #a855f7, #6366f1);
  border-radius: 18px;
  z-index: -1;
  animation: refGrad 3s ease infinite;
  background-size: 200% 200%;
}
.ref-qr-img {
  width: 220px;
  height: 220px;
  display: block;
  border-radius: 10px;
}
.ref-qr-hint {
  font-size: 12px;
  color: #999;
  margin-bottom: 12px;
  font-weight: 600;
}
.ref-qr-download {
  padding: 10px 20px;
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: white;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 0 #c2410c;
  transition: all 0.2s;
}
.ref-qr-download:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #c2410c;
}

/* ===== SHARE BUTTONS ===== */
.ref-share-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.ref-share-btn {
  padding: 16px 8px;
  border: none;
  border-radius: 16px;
  color: white;
  font-family: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 0 rgba(0,0,0,0.2);
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.ref-share-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(0,0,0,0.2);
}
.ref-share-btn .icon {
  font-size: 24px;
}
.ref-share-wa {
  background: linear-gradient(135deg, #25d366, #128c7e);
}
.ref-share-tg {
  background: linear-gradient(135deg, #0088cc, #006699);
}
.ref-share-fb {
  background: linear-gradient(135deg, #1877f2, #0d5bbd);
}

/* ===== BONUS INFO ===== */
.ref-bonus-info {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 2px solid #f59e0b;
  border-radius: 20px;
  padding: 18px;
  margin-bottom: 16px;
}
.ref-bonus-title {
  font-size: 14px;
  font-weight: 900;
  color: #78350f;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ref-bonus-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ref-bonus-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.7);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  color: #78350f;
  font-weight: 700;
}
.ref-bonus-item strong {
  color: #b45309;
  font-weight: 900;
}
.ref-bonus-item .icon {
  font-size: 20px;
  flex-shrink: 0;
}

/* ===== HISTORY LIST ===== */
.ref-history-card {
  background: white;
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}
.ref-history-title {
  font-size: 15px;
  font-weight: 900;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ref-history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ref-history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #f8f9fa;
  border-radius: 14px;
  transition: all 0.2s;
}
.ref-history-item:hover {
  background: #f0f4ff;
  transform: translateX(4px);
}
.ref-history-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: white;
  flex-shrink: 0;
  font-weight: 900;
}
.ref-history-info {
  flex: 1;
  min-width: 0;
}
.ref-history-name {
  font-size: 14px;
  font-weight: 800;
  color: #1a1a1a;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ref-history-date {
  font-size: 11px;
  color: #999;
  font-weight: 600;
}
.ref-history-coin {
  font-size: 15px;
  font-weight: 900;
  color: #10b981;
  flex-shrink: 0;
}

.ref-empty {
  text-align: center;
  padding: 40px 20px;
  color: #999;
}
.ref-empty-icon {
  font-size: 60px;
  margin-bottom: 12px;
  display: block;
  animation: float 3s ease-in-out infinite;
}
.ref-empty-text {
  font-size: 13px;
  font-weight: 600;
}

/* ===== REFERRAL INPUT (untuk user baru apply) ===== */
.ref-apply-card {
  background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
  border: 2px solid #6366f1;
  border-radius: 20px;
  padding: 18px;
  margin-bottom: 16px;
}
.ref-apply-title {
  font-size: 15px;
  font-weight: 900;
  color: #3730a3;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ref-apply-desc {
  font-size: 12px;
  color: #4f46e5;
  margin-bottom: 12px;
  line-height: 1.5;
  font-weight: 600;
}
.ref-apply-input-group {
  display: flex;
  gap: 8px;
}
.ref-apply-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid rgba(99,102,241,0.2);
  border-radius: 12px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  font-weight: 900;
  color: #3730a3;
  letter-spacing: 2px;
  text-transform: uppercase;
  outline: none;
  background: white;
  transition: all 0.2s;
}
.ref-apply-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 4px rgba(99,102,241,0.15);
}
.ref-apply-btn {
  padding: 12px 20px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 0 #4338ca;
  transition: all 0.2s;
  white-space: nowrap;
}
.ref-apply-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #4338ca;
}
.ref-apply-applied {
  background: rgba(16,185,129,0.15);
  border: 2px solid #10b981;
  border-radius: 12px;
  padding: 12px 14px;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  color: #047857;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* ===== MODAL QR PREVIEW ===== */
.ref-qr-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(12px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.3s;
}
.ref-qr-modal-content {
  background: white;
  border-radius: 24px;
  padding: 30px 20px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  animation: popIn 0.4s cubic-bezier(0.68,-0.55,0.265,1.55);
}
.ref-qr-modal-title {
  font-size: 18px;
  font-weight: 900;
  color: #6366f1;
  margin-bottom: 16px;
}
.ref-qr-modal-img {
  width: 280px;
  height: 280px;
  margin: 0 auto 16px;
  display: block;
  border-radius: 14px;
}
.ref-qr-modal-code {
  font-family: 'Courier New', monospace;
  font-size: 20px;
  font-weight: 900;
  color: #6366f1;
  letter-spacing: 3px;
  margin-bottom: 16px;
}
.ref-qr-modal-close {
  padding: 12px 32px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 0 #4338ca;
}

/* ===== DARK MODE ===== */
[data-theme="dark"] .ref-code-card,
[data-theme="dark"] .ref-qr-card,
[data-theme="dark"] .ref-history-card {
  background: #1f1f1f;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
[data-theme="dark"] .ref-code-box {
  background: linear-gradient(135deg, #2a2140, #1f1a35);
  border-color: rgba(139,92,246,0.4);
}
[data-theme="dark"] .ref-code-value {
  color: #a78bfa;
}
[data-theme="dark"] .ref-link-box {
  background: #2a2a2a;
  border-color: rgba(255,255,255,0.08);
}
[data-theme="dark"] .ref-link-input {
  color: #e5e7eb;
}
[data-theme="dark"] .ref-history-item {
  background: #2a2a2a;
}
[data-theme="dark"] .ref-history-item:hover {
  background: #342a5a;
}
[data-theme="dark"] .ref-history-name {
  color: #f3f4f6;
}
[data-theme="dark"] .ref-apply-card {
  background: linear-gradient(135deg, #2a2140, #1f1a35);
}
[data-theme="dark"] .ref-apply-input {
  background: #1a1a1a;
  color: #a78bfa;
  border-color: rgba(139,92,246,0.3);
}
[data-theme="dark"] .ref-qr-modal-content {
  background: #1f1f1f;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
  .ref-hero {
    padding: 22px 16px;
  }
  .ref-hero-title {
    font-size: 22px;
  }
  .ref-hero-emoji {
    font-size: 52px;
  }
  .ref-code-value {
    font-size: 18px;
    letter-spacing: 2px;
  }
  .ref-qr-img {
    width: 180px;
    height: 180px;
  }
  .ref-qr-modal-img {
    width: 240px;
    height: 240px;
  }
  .ref-share-btn {
    padding: 14px 6px;
    font-size: 10px;
  }
  .ref-share-btn .icon {
    font-size: 20px;
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes popIn {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
