/**
 * PrimeX Markets - Custom Components
 * Advanced UI Components for Trading Platform
 */

/* ===== STAT CARDS ===== */
.stat-card {
  background: var(--primex-bg-card);
  border: 1px solid var(--primex-border);
  border-radius: var(--primex-radius-lg);
  padding: var(--primex-space-lg);
  transition: var(--primex-transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primex-gradient-primary);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--primex-shadow-lg);
  border-color: var(--primex-primary);
}

.stat-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--primex-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: var(--primex-space-md);
}

.stat-card-icon.primary {
  background: rgba(59, 130, 246, 0.1);
  color: var(--primex-primary);
}

.stat-card-icon.success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--primex-success);
}

.stat-card-icon.warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--primex-warning);
}

.stat-card-icon.danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--primex-danger);
}

.stat-card-label {
  color: var(--primex-text-muted);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

.stat-card-value {
  color: var(--primex-text-primary);
  font-size: var(--primex-text-3xl);
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.stat-card-change {
  font-size: 0.875rem;
  font-weight: 600;
}

.stat-card-change.positive {
  color: var(--primex-success);
}

.stat-card-change.negative {
  color: var(--primex-danger);
}

/* ===== GRADIENT CARDS ===== */
.gradient-card {
  background: var(--primex-gradient-primary);
  border-radius: var(--primex-radius-lg);
  padding: var(--primex-space-xl);
  color: white;
  box-shadow: var(--primex-shadow-lg);
  position: relative;
  overflow: hidden;
}

.gradient-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  pointer-events: none;
}

.gradient-card-success {
  background: var(--primex-gradient-success);
}

.gradient-card-danger {
  background: var(--primex-gradient-danger);
}

/* ===== PRICE DISPLAY ===== */
.price-display {
  background: var(--primex-bg-card);
  border: 1px solid var(--primex-border);
  border-radius: var(--primex-radius-lg);
  padding: var(--primex-space-lg);
  text-align: center;
}

.price-label {
  color: var(--primex-text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
}

.price-value {
  color: var(--primex-text-primary);
  font-size: var(--primex-text-4xl);
  font-weight: 700;
  font-family: 'Courier New', monospace;
}

.price-change {
  margin-top: var(--primex-space-sm);
  font-size: 1rem;
  font-weight: 600;
}

/* ===== TRANSACTION CARD ===== */
.transaction-card {
  background: var(--primex-bg-card);
  border: 1px solid var(--primex-border);
  border-radius: var(--primex-radius-md);
  padding: var(--primex-space-md);
  margin-bottom: var(--primex-space-sm);
  display: flex;
  align-items: center;
  gap: var(--primex-space-md);
  transition: var(--primex-transition);
}

.transaction-card:hover {
  background: var(--primex-bg-hover);
  border-color: var(--primex-border-light);
}

.transaction-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--primex-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.transaction-icon.deposit {
  background: rgba(16, 185, 129, 0.1);
  color: var(--primex-success);
}

.transaction-icon.withdrawal {
  background: rgba(239, 68, 68, 0.1);
  color: var(--primex-danger);
}

.transaction-details {
  flex: 1;
  min-width: 0;
}

.transaction-title {
  color: var(--primex-text-primary);
  font-weight: 600;
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
}

.transaction-date {
  color: var(--primex-text-muted);
  font-size: 0.75rem;
}

.transaction-amount {
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

/* ===== STATUS BADGES ===== */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.875rem;
  border-radius: var(--primex-radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.status-badge.pending {
  background: rgba(245, 158, 11, 0.1);
  color: var(--primex-warning);
}

.status-badge.pending::before {
  background: var(--primex-warning);
}

.status-badge.success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--primex-success);
}

.status-badge.success::before {
  background: var(--primex-success);
}

/* active or approved */
.status-badge.active {
  background: rgba(59, 130, 246, 0.1);
  color: var(--primex-primary);
}

.status-badge.active::before {
  background: var(--primex-primary);
}

.status-badge.approved {
  background: rgba(59, 130, 246, 0.1);
  color: var(--primex-primary);
}

.status-badge.approved::before {
  background: var(--primex-primary);
}

.status-badge.failed {
  background: rgba(239, 68, 68, 0.1);
  color: var(--primex-danger);
}

.status-badge.failed::before {
  background: var(--primex-danger);
}

.status-badge.rejected {
  background: rgba(239, 68, 68, 0.1);
  color: var(--primex-danger);
}

.status-badge.rejected::before {
  background: var(--primex-danger);
}

.status-badge.processing {
  background: rgba(59, 130, 246, 0.1);
  color: var(--primex-primary);
}

.status-badge.processing::before {
  background: var(--primex-primary);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ===== INVESTMENT TIER CARD ===== */
.tier-card {
  background: var(--primex-bg-card);
  border: 2px solid var(--primex-border);
  border-radius: var(--primex-radius-lg);
  padding: var(--primex-space-xl);
  text-align: center;
  transition: var(--primex-transition);
  position: relative;
}

.tier-card:hover {
  border-color: var(--primex-primary);
  transform: translateY(-8px);
  box-shadow: var(--primex-shadow-lg);
}

.tier-card.featured {
  border-color: var(--primex-primary);
  background: linear-gradient(180deg, var(--primex-bg-card) 0%, rgba(59, 130, 246, 0.05) 100%);
}

.tier-card.featured::before {
  content: 'POPULAR';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primex-gradient-primary);
  color: white;
  padding: 0.25rem 1rem;
  border-radius: var(--primex-radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.tier-name {
  color: var(--primex-primary);
  font-size: 1.25rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: var(--primex-space-md);
}

.tier-roi {
  color: var(--primex-text-primary);
  font-size: var(--primex-text-3xl);
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.tier-roi-label {
  color: var(--primex-text-muted);
  font-size: 0.875rem;
  margin-bottom: var(--primex-space-lg);
}

.tier-features {
  list-style: none;
  padding: 0;
  margin: var(--primex-space-lg) 0;
}

.tier-features li {
  color: var(--primex-text-secondary);
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--primex-border);
  font-size: 0.875rem;
}

.tier-features li:last-child {
  border-bottom: none;
}

.tier-features li::before {
  content: '✓';
  color: var(--primex-success);
  margin-right: 0.5rem;
  font-weight: 700;
}

/* ===== SIDEBAR ===== */
.sidebar {
  background: var(--primex-bg-card);
  border-right: 1px solid var(--primex-border);
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  width: 280px;
  transition: var(--primex-transition);
}

.sidebar-brand {
  padding: var(--primex-space-md) var(--primex-space-lg);
  border-bottom: 1px solid var(--primex-border);
}

.sidebar-brand h3 {
  color: var(--primex-text-primary);
  margin: 0;
  font-size: 1.5rem;
  background: var(--primex-gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-nav {
  padding: var(--primex-space-md);
}

.nav-item {
  margin-bottom: 0.25rem;
}

.nav-link-custom {
  display: flex;
  align-items: center;
  gap: var(--primex-space-md);
  padding: var(--primex-space-md);
  color: var(--primex-text-secondary);
  border-radius: var(--primex-radius-md);
  transition: var(--primex-transition-fast);
  font-weight: 500;
}

.nav-link-custom:hover {
  background: var(--primex-bg-hover);
  color: var(--primex-text-primary);
  text-decoration: none;
}

.nav-link-custom.active {
  background: var(--primex-primary);
  color: white;
}

.nav-link-custom i {
  width: 20px;
  text-align: center;
}

/* Mobile Sidebar Toggle */
@media (max-width: 767px) {
  .sidebar {
    position: fixed;
    left: -280px;
    z-index: var(--primex-z-fixed);
    box-shadow: var(--primex-shadow-lg);
  }
  
  .sidebar.active {
    left: 0;
  }
  
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: calc(var(--primex-z-fixed) - 1);
  }
  
  .sidebar-overlay.active {
    display: block;
  }
}

/* ===== WALLET BALANCE ===== */
.wallet-balance {
  background: var(--primex-gradient-primary);
  border-radius: var(--primex-radius-lg);
  padding: var(--primex-space-xl);
  color: white;
  box-shadow: var(--primex-shadow-md);
  margin-bottom: var(--primex-space-lg);
}

.wallet-balance-label {
  font-size: 0.875rem;
  opacity: 0.9;
  margin-bottom: 0.5rem;
}

.wallet-balance-amount {
  font-size: var(--primex-text-4xl);
  font-weight: 700;
  font-family: 'Courier New', monospace;
  margin-bottom: var(--primex-space-md);
}

.wallet-balance-actions {
  display: flex;
  gap: var(--primex-space-sm);
  flex-wrap: wrap;
}

.wallet-balance-actions .btn {
  flex: 1;
  min-width: 120px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
}

.wallet-balance-actions .btn:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
}

/* ===== DATA TABLE ===== */
.data-table-wrapper {
  background: var(--primex-bg-card);
  border: 1px solid var(--primex-border);
  border-radius: var(--primex-radius-lg);
  overflow: hidden;
}

.data-table-header {
  padding: var(--primex-space-lg);
  border-bottom: 1px solid var(--primex-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--primex-space-md);
}

.data-table-title {
  color: var(--primex-text-primary);
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
}

.data-table-responsive {
  overflow-x: auto;
}

/* ===== LOADING STATES ===== */
.skeleton {
  background: linear-gradient(90deg, var(--primex-bg-secondary) 25%, var(--primex-bg-hover) 50%, var(--primex-bg-secondary) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--primex-radius);
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 1rem;
  margin-bottom: 0.5rem;
}

.skeleton-card {
  height: 200px;
}

/* ===== EMPTY STATES ===== */
.empty-state {
  text-align: center;
  padding: var(--primex-space-2xl);
  color: var(--primex-text-muted);
}

.empty-state-icon {
  font-size: 4rem;
  opacity: 0.3;
  margin-bottom: var(--primex-space-lg);
}

.empty-state-title {
  color: var(--primex-text-secondary);
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--primex-space-sm);
}

.empty-state-message {
  color: var(--primex-text-muted);
  margin-bottom: var(--primex-space-lg);
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 767px) {
  .stat-card {
    padding: var(--primex-space-md);
  }
  
  .stat-card-value {
    font-size: var(--primex-text-2xl);
  }
  
  .gradient-card {
    padding: var(--primex-space-lg);
  }
  
  .tier-card {
    padding: var(--primex-space-lg);
  }
  
  .wallet-balance {
    padding: var(--primex-space-lg);
  }
  
  .wallet-balance-amount {
    font-size: var(--primex-text-3xl);
  }
  
  .wallet-balance-actions {
    flex-direction: column;
  }
  
  .wallet-balance-actions .btn {
    width: 100%;
  }
  
  .data-table-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
