/* ============================================
   ADVANCED-UI.CSS - Buttons (glow, ripple), cards (glass, reflection), tables, status badges
   ============================================ */

/* ----- Button ripple (click wave) ----- */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

.btn-ripple::after {
  content: '';
  position: absolute;
  width: 120%;
  height: 120%;
  top: 50%;
  left: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.25) 0%, transparent 70%);
  transform: translate(-50%, -50%) scale(0);
  border-radius: 50%;
  pointer-events: none;
}

.btn-ripple:active::after {
  animation: btn-ripple 0.5s ease-out;
}

@keyframes btn-ripple {
  to {
    transform: translate(-50%, -50%) scale(2.5);
    opacity: 0;
  }
}

/* ----- Button hover glow pulse ----- */
.btn-glow:hover {
  box-shadow: 0 0 20px var(--glow-crimson), 0 0 40px rgba(233, 30, 99, 0.2);
  animation: btn-glow-pulse 1.2s ease-in-out infinite;
}

@keyframes btn-glow-pulse {
  0%, 100% { box-shadow: 0 0 20px var(--glow-crimson), 0 0 40px rgba(233, 30, 99, 0.2); }
  50% { box-shadow: 0 0 28px var(--glow-pink), 0 0 50px rgba(233, 30, 99, 0.35); }
}

/* ----- Card reflection on hover ----- */
.balance-card.glass:hover,
.bot-card.glass:hover,
.contract-card.glass:hover {
  position: relative;
}

.balance-card.glass::after,
.bot-card.glass::after,
.contract-card.glass::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40%;
  background: linear-gradient(180deg, rgba(255,255,255,0.04) 0%, transparent 100%);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.balance-card.glass:hover::after,
.bot-card.glass:hover::after,
.contract-card.glass:hover::after {
  opacity: 1;
}

/* ----- Animated number (counter) ----- */
.animated-number {
  transition: transform 0.2s ease, color 0.2s ease;
}

.balance-value.updated {
  animation: balance-flash 0.6s ease;
}

@keyframes balance-flash {
  0% { opacity: 1; }
  50% { opacity: 0.6; color: #4ade80; }
  100% { opacity: 1; }
}

/* ----- History / data tables ----- */
.table-wrap {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--glass-border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table th {
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-secondary);
  font-weight: 600;
}

.data-table tbody tr:hover td {
  background: rgba(220, 20, 60, 0.05);
}

.amount-cell {
  font-weight: 600;
  color: var(--accent-pink);
}

.wallet-cell {
  font-family: monospace;
  font-size: 0.85rem;
}

/* ----- Status badges ----- */
.status-badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.status-pending {
  background: rgba(234, 179, 8, 0.2);
  color: #eab308;
}

.status-approved {
  background: rgba(74, 222, 128, 0.2);
  color: #4ade80;
}

.status-rejected {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

/* ----- Admin action buttons ----- */
.btn-success {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  border: none;
}

.btn-success:hover {
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.4);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  border: none;
}

.btn-danger:hover {
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.4);
}

/* ----- Loading state ----- */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
}

.loading-spinner-sm {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--accent-pink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ----- Trading dashboard: live data & arbitrage cards ----- */
.trading-dashboard {
  animation: fade-in 0.4s ease;
  padding: 1.5rem;
}

.trading-selectors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 520px) {
  .trading-selectors {
    grid-template-columns: 1fr;
  }
}

.start-trade-heading {
  font-size: 1.1rem;
  margin: 1.5rem 0 1rem;
  color: var(--text-secondary);
}

.trading-live-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.trading-live-cell {
  padding: 1rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
}

.trading-live-cell .label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.trading-live-cell .value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-pink);
}

.trading-live-cell .value.animated-value {
  transition: color 0.2s;
}

.arbitrage-section h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.arbitrage-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.arbitrage-card {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.arbitrage-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(220, 20, 60, 0.15);
}

.arbitrage-card.profitable {
  border-color: rgba(74, 222, 128, 0.3);
  box-shadow: 0 0 20px rgba(74, 222, 128, 0.1);
}

.arbitrage-card .route {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.arbitrage-card .route strong {
  color: var(--text-primary);
}

.arbitrage-card .profit-pct {
  font-size: 1.25rem;
  font-weight: 700;
  color: #4ade80;
}

.arbitrage-card .price-diff {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.history-section {
  margin-top: 2.5rem;
}

.history-row-new {
  animation: history-row-in 0.5s ease;
}

@keyframes history-row-in {
  from {
    opacity: 0;
    background: rgba(233, 30, 99, 0.15);
  }
  to {
    opacity: 1;
    background: transparent;
  }
}

.history-section .step-label {
  margin-bottom: 1rem;
}

/* ----- Admin stats & row highlight ----- */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.admin-stat {
  text-align: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius);
  border: 1px solid var(--glass-border);
}

.admin-stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-pink);
}

.admin-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.admin-row-updated {
  animation: admin-row-highlight 0.6s ease;
}

/* ----- Blockchain / Web3 loading ----- */
.blockchain-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  margin-top: 1rem;
}

.blockchain-loading.hidden {
  display: none;
}

.blockchain-loading .loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--glass-border);
  border-top-color: var(--accent-pink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.btn-loading {
  position: relative;
  pointer-events: none;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  right: 12px;
  top: 50%;
  margin-top: -9px;
}

.bsc-deposit-section {
  margin-bottom: 2rem;
  padding: 1.5rem;
}

.bsc-deposit-section .bsc-wallet-status {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.bsc-deposit-section .bsc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

@keyframes admin-row-highlight {
  from {
    background: rgba(20, 241, 149, 0.25);
  }
  to {
    background: transparent;
  }
}
