/**
 * Fulgura Explorer - Professional Dashboard Styles
 * Modern glassmorphism design with purple/blue theme
 */

/* ============================================
   DASHBOARD LAYOUT
   ============================================ */

.dashboard-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
  padding: var(--space-lg) 0;
}

/* Hero Stats Section */
.hero-stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--space-lg);
}

@media (max-width: 1400px) {
  .hero-stats {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .hero-stats {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   STAT CARDS - ENHANCED
   ============================================ */

.stat-card-enhanced {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.stat-card-enhanced::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-purple), var(--primary-blue));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.stat-card-enhanced:hover {
  transform: translateY(-2px);
  border-color: var(--primary-purple);
  box-shadow: 0 8px 32px rgba(138, 43, 226, 0.2);
}

.stat-card-enhanced:hover::before {
  opacity: 1;
}

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.stat-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.stat-card-icon.purple {
  background: rgba(138, 43, 226, 0.15);
  color: var(--primary-purple);
}

.stat-card-icon.blue {
  background: rgba(65, 105, 225, 0.15);
  color: var(--primary-blue);
}

.stat-card-icon.cyan {
  background: rgba(0, 212, 255, 0.15);
  color: var(--primary-cyan);
}

.stat-card-icon.green {
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
}

.stat-card-icon.yellow {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
}

.stat-card-icon.red {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.stat-card-trend {
  font-size: var(--font-xs);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: var(--font-semibold);
}

.stat-card-trend.up {
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
}

.stat-card-trend.down {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.stat-card-trend.neutral {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
}

.stat-card-value {
  font-size: 2rem;
  font-weight: var(--font-bold);
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: var(--space-xs);
  font-family: var(--font-mono);
}

.stat-card-label {
  font-size: var(--font-sm);
  color: var(--text-muted);
  font-weight: var(--font-medium);
}

.stat-card-sparkline {
  height: 40px;
  margin-top: var(--space-md);
}

/* ============================================
   CHARTS SECTION
   ============================================ */

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-xl);
}

@media (max-width: 1024px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

.chart-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all 0.3s ease;
}

.chart-card:hover {
  border-color: rgba(138, 43, 226, 0.3);
}

.chart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.chart-card-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--font-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.chart-card-title i {
  color: var(--primary-purple);
}

.chart-card-actions {
  display: flex;
  gap: var(--space-xs);
}

.chart-action-btn {
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--border-secondary);
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  font-size: var(--font-xs);
  cursor: pointer;
  transition: all 0.2s ease;
}

.chart-action-btn:hover,
.chart-action-btn.active {
  border-color: var(--primary-purple);
  color: var(--primary-purple);
  background: rgba(138, 43, 226, 0.1);
}

.chart-container {
  height: 280px;
  position: relative;
}

.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}

/* Small chart variant */
.chart-card.small .chart-container {
  height: 200px;
}

/* ============================================
   NETWORK HEALTH SECTION
   ============================================ */

.network-health-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
}

@media (max-width: 1200px) {
  .network-health-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .network-health-grid {
    grid-template-columns: 1fr;
  }
}

.health-indicator {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.health-status {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.health-status.healthy {
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
  animation: pulse-green 2s infinite;
}

.health-status.degraded {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  animation: pulse-yellow 2s infinite;
}

.health-status.down {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  animation: pulse-red 2s infinite;
}

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0); }
}

@keyframes pulse-yellow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(251, 191, 36, 0); }
}

@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

.health-info {
  flex: 1;
}

.health-label {
  font-size: var(--font-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.health-value {
  font-size: var(--font-xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
}

/* ============================================
   TOP ACCOUNTS & LIVE FEED SECTION
   ============================================ */

.data-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
}

@media (max-width: 1024px) {
  .data-grid {
    grid-template-columns: 1fr;
  }
}

.data-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.data-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border-secondary);
}

.data-card-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--font-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.data-card-title i {
  color: var(--primary-purple);
}

.data-card-badge {
  padding: var(--space-xs) var(--space-sm);
  background: rgba(138, 43, 226, 0.15);
  color: var(--primary-purple);
  border-radius: var(--radius-full);
  font-size: var(--font-xs);
  font-weight: var(--font-semibold);
}

.data-card-content {
  padding: 0;
  max-height: 400px;
  overflow-y: auto;
}

/* Custom scrollbar for data cards */
.data-card-content::-webkit-scrollbar {
  width: 6px;
}

.data-card-content::-webkit-scrollbar-track {
  background: transparent;
}

.data-card-content::-webkit-scrollbar-thumb {
  background: var(--border-secondary);
  border-radius: 3px;
}

.data-card-content::-webkit-scrollbar-thumb:hover {
  background: var(--primary-purple);
}

/* ============================================
   TOP ACCOUNTS TABLE
   ============================================ */

.accounts-table {
  width: 100%;
}

.account-row {
  display: flex;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-secondary);
  transition: background 0.2s ease;
}

.account-row:hover {
  background: rgba(138, 43, 226, 0.05);
}

.account-row:last-child {
  border-bottom: none;
}

.account-rank {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-sm);
  font-weight: var(--font-bold);
  margin-right: var(--space-md);
}

.account-rank.gold {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #000;
}

.account-rank.silver {
  background: linear-gradient(135deg, #94a3b8, #64748b);
  color: #000;
}

.account-rank.bronze {
  background: linear-gradient(135deg, #cd7c2f, #a56223);
  color: #fff;
}

.account-rank.default {
  background: var(--glass-bg);
  border: 1px solid var(--border-secondary);
  color: var(--text-muted);
}

.account-info {
  flex: 1;
  min-width: 0;
}

.account-address {
  font-family: var(--font-mono);
  font-size: var(--font-sm);
  color: var(--text-accent);
  text-decoration: none;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-address:hover {
  color: var(--primary-purple);
}

.account-meta {
  font-size: var(--font-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

.account-balance {
  text-align: right;
}

.account-balance-value {
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.account-balance-label {
  font-size: var(--font-xs);
  color: var(--text-muted);
}

/* ============================================
   LIVE TRANSACTION FEED
   ============================================ */

.tx-feed {
  display: flex;
  flex-direction: column;
}

.tx-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-secondary);
  transition: background 0.2s ease;
}

.tx-item:hover {
  background: rgba(138, 43, 226, 0.05);
}

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

.tx-item.new {
  animation: tx-highlight 2s ease;
}

@keyframes tx-highlight {
  0% { background: rgba(138, 43, 226, 0.2); }
  100% { background: transparent; }
}

.tx-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.tx-icon.transfer {
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
}

.tx-icon.contract {
  background: rgba(244, 114, 182, 0.15);
  color: #f472b6;
}

.tx-icon.token {
  background: rgba(96, 165, 250, 0.15);
  color: #60a5fa;
}

.tx-icon.swap {
  background: rgba(167, 139, 250, 0.15);
  color: #a78bfa;
}

.tx-info {
  flex: 1;
  min-width: 0;
}

.tx-type {
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  font-size: var(--font-sm);
  margin-bottom: 2px;
}

.tx-details {
  font-size: var(--font-xs);
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.tx-hash {
  font-family: var(--font-mono);
  color: var(--text-accent);
  text-decoration: none;
}

.tx-hash:hover {
  color: var(--primary-purple);
}

.tx-time {
  font-size: var(--font-xs);
  color: var(--text-muted);
  white-space: nowrap;
}

.tx-value {
  font-weight: var(--font-semibold);
  color: var(--primary-cyan);
  font-family: var(--font-mono);
  font-size: var(--font-sm);
}

/* ============================================
   LOADING STATES
   ============================================ */

.skeleton {
  background: linear-gradient(90deg,
    var(--glass-bg) 25%,
    rgba(138, 43, 226, 0.1) 50%,
    var(--glass-bg) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-sm);
}

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

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

.skeleton-text.large {
  height: 2em;
  width: 60%;
}

.skeleton-chart {
  height: 200px;
}

/* ============================================
   EMPTY STATES
   ============================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  text-align: center;
}

.empty-state-icon {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
  opacity: 0.5;
}

.empty-state-title {
  font-size: var(--font-lg);
  font-weight: var(--font-semibold);
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.empty-state-description {
  font-size: var(--font-sm);
  color: var(--text-muted);
  max-width: 300px;
}

/* ============================================
   REAL-TIME INDICATOR
   ============================================ */

.realtime-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--font-xs);
  color: var(--text-muted);
}

.realtime-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: #4ade80;
  animation: realtime-pulse 2s infinite;
}

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

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
  .stat-card-value {
    font-size: 1.5rem;
  }

  .chart-container {
    height: 220px;
  }

  .data-card-header {
    padding: var(--space-md);
  }

  .account-row,
  .tx-item {
    padding: var(--space-sm) var(--space-md);
  }

  .account-address {
    max-width: 120px;
  }
}

/* ============================================
   RECENT BLOCKS PREVIEW - PREMIUM DESIGN
   ============================================ */

.blocks-preview-card {
  background: linear-gradient(145deg,
    rgba(15, 15, 35, 0.95),
    rgba(25, 20, 50, 0.9)
  );
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(138, 43, 226, 0.2);
  border-radius: 20px;
  overflow: hidden;
  margin-top: var(--space-xl);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.4),
    0 0 40px rgba(138, 43, 226, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  position: relative;
}

.blocks-preview-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg,
    var(--primary-purple),
    var(--primary-blue),
    var(--primary-cyan),
    var(--primary-blue),
    var(--primary-purple)
  );
  background-size: 200% 100%;
  animation: gradient-flow 3s linear infinite;
}

@keyframes gradient-flow {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

.blocks-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid rgba(138, 43, 226, 0.15);
  background: rgba(138, 43, 226, 0.03);
}

.blocks-preview-title {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.blocks-preview-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg,
    rgba(138, 43, 226, 0.25),
    rgba(65, 105, 225, 0.25)
  );
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: var(--primary-purple);
  box-shadow:
    0 4px 15px rgba(138, 43, 226, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.blocks-preview-title h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.blocks-preview-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

.live-pulse-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  background: linear-gradient(135deg,
    rgba(74, 222, 128, 0.15),
    rgba(52, 211, 153, 0.1)
  );
  border: 1px solid rgba(74, 222, 128, 0.3);
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #4ade80;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: 1rem;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 12px #4ade80;
  animation: pulse-live 2s ease-in-out infinite;
}

@keyframes pulse-live {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 12px #4ade80;
  }
  50% {
    opacity: 0.6;
    transform: scale(1.2);
    box-shadow: 0 0 20px #4ade80;
  }
}

.view-all-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1.4rem;
  background: linear-gradient(135deg,
    rgba(138, 43, 226, 0.2),
    rgba(65, 105, 225, 0.2)
  );
  border: 1px solid rgba(138, 43, 226, 0.3);
  border-radius: 12px;
  color: var(--primary-purple);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px rgba(138, 43, 226, 0.1);
}

.view-all-btn:hover {
  background: linear-gradient(135deg,
    rgba(138, 43, 226, 0.35),
    rgba(65, 105, 225, 0.35)
  );
  border-color: rgba(138, 43, 226, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(138, 43, 226, 0.25);
}

.view-all-btn i {
  transition: transform 0.3s ease;
}

.view-all-btn:hover i {
  transform: translateX(4px);
}

.blocks-preview-content {
  padding: 0;
}

.blocks-table-wrapper {
  overflow-x: auto;
}

.blocks-table-modern {
  width: 100%;
  border-collapse: collapse;
}

.blocks-table-modern thead {
  background: rgba(138, 43, 226, 0.08);
}

.blocks-table-modern thead tr {
  border-bottom: 1px solid rgba(138, 43, 226, 0.15);
}

.blocks-table-modern th {
  padding: 1rem 1.5rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.blocks-table-modern th i {
  margin-right: 0.5rem;
  color: var(--primary-purple);
  opacity: 0.7;
}

.blocks-table-modern tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: all 0.25s ease;
}

.blocks-table-modern tbody tr:hover {
  background: linear-gradient(90deg,
    rgba(138, 43, 226, 0.08),
    rgba(65, 105, 225, 0.05),
    transparent
  );
}

.blocks-table-modern tbody tr:last-child {
  border-bottom: none;
}

.blocks-table-modern td {
  padding: 1rem 1.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  vertical-align: middle;
}

/* Block number styling */
.blocks-table-modern td:first-child a,
.blocks-table-modern .text-accent {
  color: var(--primary-purple) !important;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.blocks-table-modern td:first-child a:hover {
  color: var(--primary-cyan) !important;
  text-shadow: 0 0 12px rgba(138, 43, 226, 0.5);
}

/* Hash styling */
.blocks-table-modern .hash {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
  background: rgba(138, 43, 226, 0.08);
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  border: 1px solid rgba(138, 43, 226, 0.1);
}

/* New block animation */
.blocks-table-modern tbody tr.new-block {
  animation: new-block-glow 2.5s ease-out;
}

@keyframes new-block-glow {
  0% {
    background: linear-gradient(90deg,
      rgba(138, 43, 226, 0.3),
      rgba(65, 105, 225, 0.2),
      rgba(138, 43, 226, 0.1)
    );
    box-shadow: inset 0 0 30px rgba(138, 43, 226, 0.2);
  }
  100% {
    background: transparent;
    box-shadow: none;
  }
}

/* Loading state */
.blocks-table-modern .loading-state {
  padding: 3rem 2rem;
  text-align: center;
  color: var(--text-muted);
}

.loading-spinner {
  font-size: 2rem;
  color: var(--primary-purple);
  margin-bottom: 1rem;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
  .blocks-preview-header {
    flex-direction: column;
    gap: 1rem;
    padding: 1.25rem 1rem;
  }

  .blocks-preview-title {
    flex-wrap: wrap;
  }

  .live-pulse-badge {
    margin-left: 0;
  }

  .blocks-table-modern th,
  .blocks-table-modern td {
    padding: 0.8rem 1rem;
  }

  .blocks-table-modern th:nth-child(4),
  .blocks-table-modern td:nth-child(4) {
    display: none; /* Hide Amps on mobile */
  }
}
