/* ============================================
   FarmBrawl — Referrals (premium farm/pixel overhaul)
   Panels de madera oscura, bordes oro pixel,
   sombras 3D, animaciones sutiles.
   ============================================ */

/* ─── Keyframes ─── */
@keyframes ref-fade-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes ref-glow-pulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(240, 208, 96, 0.35), 0 4px 0 rgba(0,0,0,0.4); }
  50% { box-shadow: 0 0 0 2px rgba(240, 208, 96, 0.6), 0 4px 0 rgba(0,0,0,0.4), 0 0 24px rgba(240, 208, 96, 0.12); }
}
@keyframes ref-coin-spin {
  0% { transform: rotateY(0deg); }
  100% { transform: rotateY(360deg); }
}
@keyframes ref-count-up {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Hub container ─── */
.ref-hub {
  max-width: 860px;
  margin: 10px auto 0;
  animation: ref-fade-in 0.4s ease-out;
}

/* ─── Hero ─── */
.ref-hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% -20%, rgba(240, 208, 96, 0.1), transparent 60%),
    linear-gradient(165deg, rgba(34, 26, 16, 0.97), rgba(12, 10, 8, 0.98)) !important;
  border: 2px solid #0a0806;
  box-shadow:
    0 0 0 1px rgba(196, 154, 32, 0.4),
    0 6px 0 rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 220, 140, 0.08);
  padding: 18px 16px;
  text-align: center;
  margin-bottom: 14px;
}

.ref-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 40px,
      rgba(255, 220, 140, 0.02) 40px,
      rgba(255, 220, 140, 0.02) 41px
    );
  pointer-events: none;
}

.ref-hero-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(232, 184, 48, 0.1);
  border: 2px solid #c49a20;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
  position: relative;
}

.ref-hero-icon svg {
  width: 32px;
  height: 32px;
  stroke: #f0d060;
  fill: none;
  stroke-width: 1.5;
}

.ref-hero h2 {
  font-family: var(--font-game, 'Press Start 2P', monospace);
  font-size: 14px;
  color: #f0d060;
  text-shadow: 2px 2px 0 #000;
  margin: 0 0 8px;
  letter-spacing: 0.04em;
}

.ref-hero p {
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #c8b8a0;
  margin: 0 auto;
  max-width: 480px;
  line-height: 1.5;
}

.ref-hero p strong {
  color: #facc15;
  font-weight: 800;
}

/* ─── Stats row ─── */
.ref-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.ref-stat-card {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 15%, rgba(240, 208, 96, 0.06), transparent 50%),
    linear-gradient(160deg, rgba(28, 22, 16, 0.95), rgba(14, 12, 10, 0.98));
  border: 2px solid #0a0806;
  box-shadow:
    0 0 0 1px rgba(196, 154, 32, 0.3),
    0 3px 0 rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 220, 140, 0.06);
  padding: 14px 12px;
  text-align: center;
  transition: filter 0.15s, transform 0.12s;
}

.ref-stat-card:hover {
  filter: brightness(1.06);
  transform: translateY(-2px);
  box-shadow:
    0 0 0 1px rgba(196, 154, 32, 0.5),
    0 5px 0 rgba(0, 0, 0, 0.4);
}

.ref-stat-icon {
  font-size: 10px;
  color: #a89a88;
  margin-bottom: 6px;
  opacity: 0.7;
}

.ref-stat-val {
  font-family: var(--font-game, 'Press Start 2P', monospace);
  font-size: 20px;
  color: #f0d060;
  text-shadow: 2px 2px 0 #000;
  line-height: 1.1;
  animation: ref-count-up 0.35s ease-out;
}

.ref-stat-label {
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: #a89a88;
  margin-top: 5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ─── Columns ─── */
.ref-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.ref-col {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 10%, rgba(240, 208, 96, 0.04), transparent 50%),
    linear-gradient(165deg, rgba(28, 22, 16, 0.95), rgba(14, 12, 10, 0.98));
  border: 2px solid #0a0806;
  box-shadow:
    0 0 0 1px rgba(196, 154, 32, 0.3),
    0 3px 0 rgba(0, 0, 0, 0.35);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: filter 0.15s, box-shadow 0.15s;
}

.ref-col:hover {
  filter: brightness(1.03);
  box-shadow:
    0 0 0 1px rgba(196, 154, 32, 0.45),
    0 4px 0 rgba(0, 0, 0, 0.4);
}

.ref-col-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  background: rgba(232, 184, 48, 0.1);
  border: 2px solid #c49a20;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}

.ref-col-icon svg {
  width: 22px;
  height: 22px;
  stroke: #f0d060;
  fill: none;
  stroke-width: 1.5;
}

.ref-col h3 {
  font-family: var(--font-game, 'Press Start 2P', monospace);
  font-size: 11px;
  color: #f8f0e0;
  text-shadow: 1px 1px 0 #000;
  margin: 0 0 6px;
  letter-spacing: 0.03em;
}

.ref-col p {
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: #a89a88;
  margin: 0 0 12px;
  line-height: 1.5;
  max-width: 300px;
}

/* ─── Referral code display ─── */
.ref-code-label {
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 10px;
  font-weight: 700;
  color: #a89a88;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.ref-code {
  font-family: var(--font-game, 'Press Start 2P', monospace);
  font-size: 15px;
  color: #86d46a;
  text-shadow: 2px 2px 0 #000, 0 0 12px rgba(134, 212, 106, 0.35);
  padding: 10px 20px;
  background: rgba(0, 0, 0, 0.45);
  border: 2px solid rgba(134, 212, 106, 0.3);
  cursor: pointer;
  margin-bottom: 10px;
  transition: border-color 0.2s, box-shadow 0.2s;
  user-select: all;
  letter-spacing: 0.06em;
}

.ref-code:hover {
  border-color: #86d46a;
  box-shadow: 0 0 0 1px rgba(134, 212, 106, 0.4), 0 0 20px rgba(134, 212, 106, 0.15);
}

.ref-code:active {
  transform: scale(0.98);
}

/* ─── Copy button ─── */
.ref-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 20px;
  min-height: 36px;
  font-family: var(--font-game, 'Press Start 2P', monospace);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fff;
  background: linear-gradient(180deg, #7c3aed, #5b21b6);
  border: 2px solid #0a0806;
  cursor: pointer;
  box-shadow:
    0 3px 0 #0a0806,
    inset 0 1px 0 rgba(255,255,255,0.12);
  transition: filter 0.12s, transform 0.08s, box-shadow 0.08s;
}

.ref-btn:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
  box-shadow: 0 4px 0 #0a0806;
}

.ref-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 #0a0806;
}

.ref-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Gold variant for redeem action */
.ref-btn--gold {
  background: linear-gradient(180deg, #f0d060, #c49a20);
  color: #1a1208;
  font-weight: 700;
}

.ref-btn--gold:hover {
  filter: brightness(1.06);
}

/* ─── Share buttons row ─── */
.ref-share-row {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-top: 10px;
  justify-content: center;
}

.ref-share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  min-height: 32px;
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
  border: 2px solid #0a0806;
  cursor: pointer;
  box-shadow: 0 2px 0 #0a0806;
  transition: filter 0.12s, transform 0.08s;
  flex: 1;
}

.ref-share-btn:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
  box-shadow: 0 3px 0 #0a0806;
}

.ref-share-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 #0a0806;
}

.ref-share-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.ref-share-btn--whatsapp {
  background: linear-gradient(180deg, #25D366, #1DA851);
}

.ref-share-btn--telegram {
  background: linear-gradient(180deg, #0088cc, #0077b5);
}

.ref-share-btn--twitter {
  background: linear-gradient(180deg, #1DA1F2, #1a94da);
}

/* ─── Link box ─── */
.ref-link-box {
  width: 100%;
  margin-top: 10px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 2px solid #0a0806;
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: #a89a88;
  word-break: break-all;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.ref-link-box span {
  color: #86d46a;
}

/* ─── Promo input ─── */
.ref-promo-input {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-bottom: 10px;
}

.ref-promo-input input {
  flex: 1;
  padding: 9px 12px;
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #f8f0e0;
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid #0a0806;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
  outline: none;
  min-width: 0;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.ref-promo-input input:focus {
  border-color: rgba(240, 208, 96, 0.6);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    0 0 0 1px rgba(196, 154, 32, 0.3);
}

.ref-promo-input input::placeholder {
  color: #7a6a58;
  opacity: 0.7;
  font-weight: 600;
}

/* Feedback de canje promo (éxito / error en pantalla) */
.ref-promo-msg {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  border: 1px solid transparent;
  display: none;
}
.ref-promo-msg:not([hidden]):not(:empty),
.ref-promo-msg--success,
.ref-promo-msg--error,
.ref-promo-msg--pending {
  display: block;
}
.ref-promo-msg--success {
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(74, 222, 128, 0.45);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.12), inset 0 1px 0 rgba(255,255,255,0.06);
}
.ref-promo-msg--error {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(248, 113, 113, 0.45);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.12), inset 0 1px 0 rgba(255,255,255,0.05);
}
.ref-promo-msg--pending {
  color: #fde68a;
  background: rgba(234, 179, 8, 0.12);
  border-color: rgba(250, 204, 21, 0.35);
}

/* ─── Promo benefits ─── */
.ref-promo-benefits {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.ref-promo-benefit {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: #c8b8a0;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid #0a0806;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
  transition: background 0.15s;
}

.ref-promo-benefit:hover {
  background: rgba(0, 0, 0, 0.3);
}

.ref-promo-benefit svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ─── Commission hint ─── */
.ref-commission-hint {
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: #7a6a58;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(232, 184, 48, 0.15);
  line-height: 1.5;
  width: 100%;
  text-align: center;
}

/* ─── Recent referrals list ─── */
.ref-list {
  width: 100%;
  margin-top: 14px;
}

.ref-list-title {
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: #a89a88;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(232, 184, 48, 0.2);
  display: flex;
  align-items: center;
  gap: 6px;
}

.ref-list-title svg {
  width: 14px;
  height: 14px;
  stroke: #a89a88;
}

.ref-list-empty {
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: #7a6a58;
  text-align: center;
  padding: 20px 12px;
  border: 1px dashed rgba(196, 154, 32, 0.2);
}

.ref-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.12s;
}

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

.ref-list-item:hover {
  background: rgba(255,255,255,0.02);
}

.ref-list-avatar {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-game, 'Press Start 2P', monospace);
  font-size: 11px;
  color: #fff;
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  border: 2px solid rgba(255,255,255,0.12);
  flex-shrink: 0;
}

.ref-list-name {
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: #f8f0e0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ref-list-earned {
  font-family: var(--font-game, 'Press Start 2P', monospace);
  font-size: 9px;
  color: #4ade80;
  text-shadow: 1px 1px 0 #000;
  white-space: nowrap;
  flex-shrink: 0;
}

.ref-list-date {
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 10px;
  font-weight: 600;
  color: #7a6a58;
  flex-shrink: 0;
  margin-right: 6px;
}

/* ─── Decorations ─── */
.ref-divider {
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #c49a20, transparent);
  margin: 0 auto 12px;
  opacity: 0.5;
}

/* ─── Responsive ─── */
@media (max-width: 640px) {
  .ref-cols {
    grid-template-columns: 1fr;
  }
  .ref-stats {
    grid-template-columns: 1fr;
  }
  .ref-hero {
    padding: 14px 12px;
  }
  .ref-hero h2 {
    font-size: 12px;
  }
  .ref-hero p {
    font-size: 12px;
  }
  .ref-stat-val {
    font-size: 17px;
  }
  .ref-share-row {
    flex-direction: column;
  }
  .ref-share-btn {
    flex: none;
  }
}

/* ─── Override from style.css for consistency ─── */
#content-referrals.tab-glass-panel {
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-color: transparent !important;
  box-shadow: none !important;
}
