/**
 * staking-animations.css — Premium staking UI: stability, growth, passive income.
 * Smooth, slow animations. Dark bg, red/crimson accents, gold/green for profit.
 */

/* -------------------------------------------------------------------------
   Variables
   ------------------------------------------------------------------------- */
.staking-cabinet-enhance,
#staking-cabinet {
  --stake-bg: #0a0a0a;
  --stake-red: #dc143c;
  --stake-crimson: #e91e63;
  --stake-gold: #d4af37;
  --stake-green: #4ade80;
  --stake-glow-soft: rgba(233, 30, 99, 0.25);
  --stake-glow-green: rgba(74, 222, 128, 0.4);
  --stake-glow-gold: rgba(212, 175, 55, 0.35);
}

/* -------------------------------------------------------------------------
   Background: subtle grid, fog, floating particles
   ------------------------------------------------------------------------- */
#staking-cabinet {
  position: relative;
  overflow: hidden;
}

#staking-cabinet::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(233, 30, 99, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(233, 30, 99, 0.02) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  animation: stake-grid-drift 40s linear infinite;
}

#staking-cabinet::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 20%, rgba(233, 30, 99, 0.04) 0%, transparent 55%);
  pointer-events: none;
}

@keyframes stake-grid-drift {
  0% { transform: translate(0, 0); }
  100% { transform: translate(28px, 28px); }
}

/* -------------------------------------------------------------------------
   Contract cards: hover, active, purchase
   ------------------------------------------------------------------------- */
#staking-cabinet .contract-card.glass {
  position: relative;
  overflow: hidden;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.4s ease,
              border-color 0.3s ease;
}

#staking-cabinet .contract-card.glass:hover {
  transform: translateY(-8px) scale(1.03);
  box-shadow: 0 12px 40px var(--stake-glow-soft), 0 0 0 1px rgba(233, 30, 99, 0.2);
  border-color: rgba(233, 30, 99, 0.35);
}

#staking-cabinet .contract-card.glass.stake-selected {
  border-color: rgba(233, 30, 99, 0.5);
  box-shadow: 0 0 28px var(--stake-glow-soft), inset 0 0 20px rgba(233, 30, 99, 0.04);
  animation: stake-card-pulse 2.5s ease-in-out infinite;
}

#staking-cabinet .contract-card.glass::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 0%,
    transparent 40%,
    rgba(255, 255, 255, 0.03) 50%,
    transparent 60%,
    transparent 100%
  );
  transform: translateX(-100%);
  pointer-events: none;
}

#staking-cabinet .contract-card.glass.stake-selected::after {
  animation: stake-shimmer 2.5s ease-in-out infinite;
}

@keyframes stake-card-pulse {
  0%, 100% { box-shadow: 0 0 28px var(--stake-glow-soft), inset 0 0 20px rgba(233, 30, 99, 0.04); }
  50%      { box-shadow: 0 0 40px rgba(233, 30, 99, 0.35), inset 0 0 24px rgba(233, 30, 99, 0.06); }
}

@keyframes stake-shimmer {
  0%   { transform: translateX(-100%); }
  60%  { transform: translateX(100%); }
  100% { transform: translateX(100%); }
}

/* Purchase: lock-in + glow expand */
#staking-cabinet .contract-card.glass.stake-just-purchased {
  animation: stake-purchase-lock 1.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes stake-purchase-lock {
  0%   { transform: scale(1); box-shadow: 0 0 0 0 rgba(233, 30, 99, 0.5); }
  30%  { transform: scale(1.02); box-shadow: 0 0 0 12px rgba(233, 30, 99, 0.2); }
  70%  { transform: scale(1.01); box-shadow: 0 0 40px var(--stake-glow-soft), 0 0 0 4px rgba(233, 30, 99, 0.15); }
  100% { transform: scale(1); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3); }
}

/* -------------------------------------------------------------------------
   Progress bar: gradient, shimmer, completion burst
   ------------------------------------------------------------------------- */
.staking-progress-wrap {
  flex-basis: 100%;
  width: 100%;
  margin-top: 0.6rem;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.4);
  height: 8px;
  position: relative;
  order: 10;
}

.staking-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--stake-red), var(--stake-crimson) 40%, #ff7aa2 70%, var(--stake-green) 100%);
  background-size: 200% 100%;
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
}

.staking-progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.25) 50%,
    transparent 100%
  );
  transform: translateX(-100%);
  animation: stake-progress-shimmer 2.5s ease-in-out infinite;
}

.staking-progress-wrap.completed .staking-progress-fill {
  width: 100% !important;
  box-shadow: 0 0 20px var(--stake-glow-green);
  animation: stake-progress-complete 0.6s ease-out;
}

.staking-progress-wrap.completed .staking-progress-fill::after {
  animation: none;
}

@keyframes stake-progress-shimmer {
  0%   { transform: translateX(-100%); }
  60%  { transform: translateX(100%); }
  100% { transform: translateX(100%); }
}

@keyframes stake-progress-complete {
  0%   { filter: brightness(1); }
  50%  { filter: brightness(1.3); box-shadow: 0 0 24px var(--stake-glow-green); }
  100% { filter: brightness(1); box-shadow: 0 0 20px var(--stake-glow-green); }
}

/* -------------------------------------------------------------------------
   Passive income: profit counter (green glow, pulse)
   ------------------------------------------------------------------------- */
.staking-profit-value {
  font-weight: 700;
  color: var(--stake-green);
  transition: text-shadow 0.4s ease, transform 0.4s ease;
}

.staking-profit-value.updated {
  animation: stake-profit-pulse 0.7s ease-out;
}

@keyframes stake-profit-pulse {
  0%   { transform: scale(1); text-shadow: 0 0 0 transparent; }
  40%  { transform: scale(1.06); text-shadow: 0 0 20px var(--stake-glow-green), 0 0 30px rgba(74, 222, 128, 0.3); }
  100% { transform: scale(1); text-shadow: 0 0 8px rgba(74, 222, 128, 0.4); }
}

/* Floating "+$X" */
.staking-floating-profit {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--stake-green);
  text-shadow: 0 0 16px var(--stake-glow-green);
  pointer-events: none;
  z-index: 50;
  opacity: 0;
  animation: stake-float-up 1.8s ease-out forwards;
}

@keyframes stake-float-up {
  0%   { opacity: 0; transform: translateX(-50%) translateY(0) scale(0.9); }
  15%  { opacity: 1; transform: translateX(-50%) translateY(-10px) scale(1.05); }
  85%  { opacity: 0.85; transform: translateX(-50%) translateY(-80px) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-120px) scale(0.95); }
}

/* -------------------------------------------------------------------------
   Active contract item: status states
   ------------------------------------------------------------------------- */
.active-contract-item {
  position: relative;
  overflow: hidden;
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.active-contract-item.status-active {
  border-color: rgba(233, 30, 99, 0.3);
  box-shadow: 0 0 20px rgba(233, 30, 99, 0.08);
  animation: stake-active-pulse 3s ease-in-out infinite;
}

.active-contract-item.status-in-progress .staking-progress-fill {
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.active-contract-item.contract-completed {
  border-color: rgba(74, 222, 128, 0.45);
  background: rgba(74, 222, 128, 0.06);
  box-shadow: 0 0 24px rgba(74, 222, 128, 0.15);
}

.active-contract-item.contract-completed .status-badge.status-approved {
  animation: stake-checkmark-in 0.5s ease-out;
}

@keyframes stake-active-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(233, 30, 99, 0.08); }
  50%      { box-shadow: 0 0 28px rgba(233, 30, 99, 0.15); }
}

@keyframes stake-checkmark-in {
  0%   { opacity: 0; transform: scale(0.8); }
  60%  { transform: scale(1.1); }
  100% { opacity: 1; transform: scale(1); }
}

/* -------------------------------------------------------------------------
   Balance animation (when profit added)
   ------------------------------------------------------------------------- */
.balance-value.updated {
  animation: stake-balance-bump 0.6s ease-out;
}

@keyframes stake-balance-bump {
  0%   { transform: scale(1); text-shadow: 0 0 0 transparent; }
  25%  { transform: scale(1.05); text-shadow: 0 0 16px var(--stake-glow-green); }
  50%  { transform: scale(0.98); }
  100% { transform: scale(1); text-shadow: 0 0 8px rgba(74, 222, 128, 0.3); }
}

/* -------------------------------------------------------------------------
   Staking Engine (central visual)
   ------------------------------------------------------------------------- */
.staking-engine-wrap {
  position: relative;
  width: 100%;
  max-width: 200px;
  margin: 0 auto 1.5rem;
  padding: 1.25rem;
}

.staking-engine-core {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto;
}

.staking-engine-core .core-circle {
  position: absolute;
  inset: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ff7aa2, var(--stake-crimson) 50%, #8b0000 100%);
  box-shadow: 0 0 30px var(--stake-crimson), 0 0 50px rgba(233, 30, 99, 0.3);
  animation: stake-engine-breathe 3s ease-in-out infinite;
}

.staking-engine-core .core-ring {
  position: absolute;
  border: 1px solid rgba(233, 30, 99, 0.3);
  border-radius: 50%;
  animation: stake-engine-rotate 12s linear infinite;
}

.staking-engine-core .core-ring:nth-child(2) { inset: 0; }
.staking-engine-core .core-ring:nth-child(3) { inset: 12px; animation-duration: 10s; animation-direction: reverse; }
.staking-engine-core .core-ring:nth-child(4) { inset: 28px; animation-duration: 14s; }

.staking-engine-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

.staking-engine-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--stake-green);
  box-shadow: 0 0 8px var(--stake-green);
  animation: stake-particle-rise 4s ease-in-out infinite;
}

.staking-engine-particle:nth-child(1) { left: 50%; bottom: 0; animation-delay: 0s; }
.staking-engine-particle:nth-child(2) { left: 30%; bottom: 10%; animation-delay: 0.8s; }
.staking-engine-particle:nth-child(3) { left: 70%; bottom: 15%; animation-delay: 1.6s; }
.staking-engine-particle:nth-child(4) { left: 45%; bottom: 5%; animation-delay: 2.4s; }
.staking-engine-particle:nth-child(5) { left: 55%; bottom: 8%; animation-delay: 3s; }

@keyframes stake-engine-breathe {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  50%      { transform: translate(-50%, -50%) scale(1.08); opacity: 0.95; }
}

@keyframes stake-engine-rotate {
  to { transform: rotate(360deg); }
}

@keyframes stake-particle-rise {
  0%   { opacity: 0; transform: translateY(0) scale(0.5); }
  20%  { opacity: 0.8; transform: translateY(-15px) scale(1); }
  100% { opacity: 0; transform: translateY(-60px) scale(0.3); }
}

.staking-engine-title {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  margin-top: 0.5rem;
  letter-spacing: 0.04em;
}

/* -------------------------------------------------------------------------
   Buttons: Stake (glow pulse, energy wave on click)
   ------------------------------------------------------------------------- */
#staking-cabinet .contract-card .stake-contract {
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.4s ease, transform 0.2s ease;
  animation: stake-btn-glow 2.5s ease-in-out infinite;
}

#staking-cabinet .contract-card .stake-contract:hover {
  animation: stake-btn-glow 1.5s ease-in-out infinite;
}

#staking-cabinet .contract-card .stake-contract:active {
  animation: stake-btn-wave 0.5s ease-out;
}

@keyframes stake-btn-glow {
  0%, 100% { box-shadow: 0 0 16px rgba(233, 30, 99, 0.35); }
  50%      { box-shadow: 0 0 28px rgba(233, 30, 99, 0.5); }
}

@keyframes stake-btn-wave {
  0%   { box-shadow: 0 0 20px rgba(233, 30, 99, 0.5); transform: scale(1); }
  40%  { box-shadow: 0 0 0 8px rgba(233, 30, 99, 0.2); transform: scale(0.98); }
  100% { box-shadow: 0 0 16px rgba(233, 30, 99, 0.35); transform: scale(1); }
}

/* Withdraw: green highlight, glow on hover */
#staking-cabinet .early-withdraw-btn {
  transition: border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

#staking-cabinet .early-withdraw-btn:hover {
  border-color: rgba(74, 222, 128, 0.4);
  box-shadow: 0 0 16px rgba(74, 222, 128, 0.2);
  background: rgba(74, 222, 128, 0.08);
}

/* -------------------------------------------------------------------------
   Money flow: vertical particles (optional container)
   ------------------------------------------------------------------------- */
.staking-flow-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.staking-flow-particle {
  position: absolute;
  width: 3px;
  height: 12px;
  background: linear-gradient(180deg, transparent, rgba(74, 222, 128, 0.6));
  border-radius: 2px;
  animation: stake-flow-up 5s linear infinite;
}

@keyframes stake-flow-up {
  0%   { transform: translateY(100vh) translateX(0); opacity: 0; }
  10%  { opacity: 0.6; }
  90%  { opacity: 0.4; }
  100% { transform: translateY(-20px) translateX(0); opacity: 0; }
}

/* -------------------------------------------------------------------------
   Golden particles (when profit increases)
   ------------------------------------------------------------------------- */
.staking-gold-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--stake-gold), transparent);
  box-shadow: 0 0 10px var(--stake-glow-gold);
  animation: stake-gold-float 2s ease-out forwards;
  pointer-events: none;
}

@keyframes stake-gold-float {
  0%   { opacity: 0; transform: scale(0) translateY(0); }
  30%  { opacity: 1; transform: scale(1) translateY(-8px); }
  100% { opacity: 0; transform: scale(0.5) translateY(-40px); }
}
