/**
 * ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 * BLOCKEXPLORER BASE STYLES - Purple/Blue "Electric Glass" Theme
 * ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 *
 * Design System: Liquid Glassmorphism with Purple/Blue gradients
 * Inspiration: SiteCom, Apple, Vercel premium design
 *
 * NOTE: This is BlockExplorer styling (Purple/Blue).
 *       For Fulgura DEX green branding, see the DEX project.
 * ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 */

/* --- RESET & FOUNDATIONAL STYLES --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html,
body {
  max-width: 100vw;
  overflow-x: hidden;
  font-family: var(--font-primary);
  line-height: var(--leading-normal);
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(138, 43, 226, 0.15), transparent),
    radial-gradient(ellipse 60% 50% at 0% 100%, rgba(65, 105, 225, 0.1), transparent),
    radial-gradient(ellipse 60% 50% at 100% 100%, rgba(147, 51, 234, 0.1), transparent),
    #000000;
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  position: relative;
}

/* Animated gradient background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 50%, rgba(138, 43, 226, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(65, 105, 225, 0.08) 0%, transparent 50%);
  animation: bgPulse 15s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes bgPulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.6; }
}

/* Content above background */
body > * {
  position: relative;
  z-index: 1;
}

/* Enhanced Scrollbar Styling */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #0a0014;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--gradient-scrollbar);
  border-radius: 10px;
  border: 2px solid #0a0014;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #9333ea, #2563eb);
  box-shadow: 0 0 10px rgba(138, 43, 226, 0.5);
}

/* Selection Styling */
::selection {
  background: var(--primary-purple);
  color: white;
}

::-moz-selection {
  background: var(--primary-purple);
  color: white;
}

/* --- TYPOGRAPHY --- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

h1 { font-size: var(--font-4xl); }
h2 { font-size: var(--font-3xl); }
h3 { font-size: var(--font-2xl); }
h4 { font-size: var(--font-xl); }
h5 { font-size: var(--font-lg); }
h6 { font-size: var(--font-base); }

p {
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
}

a {
  color: inherit;
  text-decoration: none;
  transition: all var(--transition-base);
}

a:hover {
  color: var(--primary-purple);
}

code {
  font-family: var(--font-mono);
  background: rgba(138, 43, 226, 0.1);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--font-sm);
}

/* --- LAYOUT COMPONENTS --- */
.fulgura-container {
  width: 100%;
  max-width: var(--container-2xl);
  margin: 0 auto;
  padding: 0 var(--space-8);
}

@media (max-width: 768px) {
  .fulgura-container {
    padding: 0 var(--space-4);
  }
}

/* Main content area */
.fulgura-main {
  padding-top: 120px; /* Espace pour header sticky + marge généreuse */
  padding-bottom: var(--space-8);
}

/* Pour les autres conteneurs aussi */
.container {
  max-width: var(--container-2xl);
  margin: 0 auto;
  padding: 0 var(--space-8);
}

main.container.fulgura-main {
  padding-top: 120px; /* Forcer l'espacement sur main */
}

/* --- CARD COMPONENT --- Liquid Glassmorphism */
.fulgura-card,
.glass-card {
  background: rgba(20, 20, 40, 0.5);
  border: 1px solid rgba(138, 43, 226, 0.3);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.fulgura-card::before,
.glass-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg,
    rgba(138, 43, 226, 0.4),
    rgba(65, 105, 225, 0.3)
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.fulgura-card:hover,
.glass-card:hover {
  transform: translateY(-4px);
  box-shadow:
    0 20px 60px rgba(138, 43, 226, 0.3),
    0 0 0 1px rgba(138, 43, 226, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  border-color: rgba(138, 43, 226, 0.5);
}

.fulgura-card:hover::before,
.glass-card:hover::before {
  opacity: 1;
}

.fulgura-card-header {
  background: rgba(138, 43, 226, 0.08);
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.fulgura-card-content {
  padding: var(--space-6);
}

.fulgura-card-content.no-padding {
  padding: 0;
}

/* --- STAT CARDS --- Premium Liquid Glassmorphism */
.fulgura-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-6);
  margin-bottom: var(--space-8);
}

.fulgura-stat-card {
  background: rgba(20, 20, 40, 0.5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(138, 43, 226, 0.3);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  text-align: center;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.fulgura-stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg,
    rgba(138, 43, 226, 0.6),
    rgba(65, 105, 225, 0.4),
    rgba(138, 43, 226, 0.6)
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.fulgura-stat-card:hover {
  transform: translateY(-8px);
  box-shadow:
    0 20px 60px rgba(138, 43, 226, 0.4),
    0 0 0 1px rgba(138, 43, 226, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  border-color: rgba(138, 43, 226, 0.6);
}

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

.fulgura-stat-icon {
  font-size: var(--font-2xl);
  margin-bottom: var(--space-3);
  background: linear-gradient(135deg, var(--primary-purple), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 12px rgba(138, 43, 226, 0.5));
}

.fulgura-stat-value {
  font-size: var(--font-3xl);
  font-weight: var(--font-bold);
  background: linear-gradient(135deg, #ffffff, rgba(255, 255, 255, 0.8));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-2);
  line-height: var(--leading-tight);
}

.fulgura-stat-label {
  color: rgba(255, 255, 255, 0.7);
  font-size: var(--font-sm);
  font-weight: var(--font-medium);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --- BUTTON COMPONENTS --- Premium Gradient Buttons */
.fulgura-btn,
.btn {
  padding: var(--space-4) var(--space-8);
  border-radius: calc(var(--radius-lg) * 0.75);
  font-weight: 600;
  transition: all var(--transition-base);
  cursor: pointer;
  border: none;
  font-size: var(--font-base);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  position: relative;
  overflow: hidden;
  font-family: inherit;
}

.fulgura-btn::before,
.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-button-overlay);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.fulgura-btn:hover::before,
.btn:hover::before {
  opacity: 1;
}

.fulgura-btn:active,
.btn:active {
  transform: scale(0.98);
}

.fulgura-btn-primary,
.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 24px rgba(138, 43, 226, 0.4);
}

.fulgura-btn-primary:hover,
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(138, 43, 226, 0.6);
}

.fulgura-btn-secondary,
.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: white;
  border: 1px solid var(--border-medium);
  backdrop-filter: blur(10px);
}

.fulgura-btn-secondary:hover,
.btn-secondary:hover {
  background: rgba(138, 43, 226, 0.1);
  border-color: var(--primary-purple);
  transform: translateY(-2px);
}

.fulgura-btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.fulgura-btn-ghost:hover {
  color: var(--primary-purple);
  background: rgba(138, 43, 226, 0.05);
}

/* --- SEARCH COMPONENT --- */
.fulgura-search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  position: relative;
}

.fulgura-search-input {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-4);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--font-sm);
  width: 300px;
  transition: all var(--transition-base);
}

.fulgura-search-input:focus {
  outline: 2px solid var(--primary-purple);
  outline-offset: 3px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.6);
  box-shadow: 0 0 0 3px rgba(138, 43, 226, 0.15);
}

.fulgura-search-input::placeholder {
  color: var(--text-muted);
}

/* Focus Styles for All Interactive Elements */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--primary-purple);
  outline-offset: 3px;
  border-radius: 4px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}

/* --- STATUS INDICATORS --- */
.fulgura-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--font-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.fulgura-status-success {
  background: rgba(0, 255, 136, 0.1);
  color: var(--status-success);
  border: 1px solid var(--status-success);
}

.fulgura-status-warning {
  background: rgba(234, 179, 8, 0.1);
  color: var(--status-warning);
  border: 1px solid var(--status-warning);
}

.fulgura-status-error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--status-error);
  border: 1px solid var(--status-error);
}

.fulgura-status-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.fulgura-status-indicator.online {
  background: var(--status-success);
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.fulgura-status-indicator.warning {
  background: var(--status-warning);
}

.fulgura-status-indicator.error {
  background: var(--status-error);
}

/* --- LOADING STATES --- */
.fulgura-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-10);
  color: var(--text-secondary);
}

.fulgura-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-subtle);
  border-top: 2px solid var(--primary-purple);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: var(--space-2);
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.fulgura-skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-glass) 0%,
    rgba(138, 43, 226, 0.1) 50%,
    var(--surface-glass) 100%
  );
  background-size: 200px 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* --- GRID PATTERN BACKGROUND --- */
.grid-background {
  background-image:
    linear-gradient(rgba(138, 43, 226, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(138, 43, 226, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
}

/* --- NOISE TEXTURE FOR PREMIUM FEEL --- */
.noise-texture {
  position: relative;
}

.noise-texture::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.02;
  pointer-events: none;
}

/* --- RESPONSIVE UTILITIES --- */
@media (max-width: 768px) {
  .hide-mobile {
    display: none;
  }

  html {
    scroll-padding-top: 60px;
  }

  .fulgura-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .fulgura-search-input {
    width: 250px;
  }
}

@media (min-width: 769px) {
  .hide-desktop {
    display: none;
  }
}

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

  .fulgura-search-input {
    width: 200px;
  }
}

/* --- UTILITY CLASSES --- */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.font-mono { font-family: var(--font-mono); }
.font-sans { font-family: var(--font-primary); }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Container max-width */
.container {
  max-width: var(--container-2xl);
  margin: 0 auto;
  padding: 0 var(--space-8);
}

/* --- REDUCED MOTION SUPPORT --- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* Hide number input spinners */
input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type='number'] {
  -moz-appearance: textfield;
}

/* ============================================
   LIGHT THEME OVERRIDES
   ============================================ */
[data-theme="light"] {
  /* Body background - light gradient */
  html,
  body {
    background:
      radial-gradient(ellipse 80% 50% at 50% -20%, rgba(138, 43, 226, 0.08), transparent),
      radial-gradient(ellipse 60% 50% at 0% 100%, rgba(65, 105, 225, 0.05), transparent),
      radial-gradient(ellipse 60% 50% at 100% 100%, rgba(147, 51, 234, 0.05), transparent),
      #f8f9fa;
    color: var(--text-primary);
  }

  body::before {
    background:
      radial-gradient(circle at 20% 50%, rgba(138, 43, 226, 0.04) 0%, transparent 50%),
      radial-gradient(circle at 80% 80%, rgba(65, 105, 225, 0.04) 0%, transparent 50%);
  }

  /* Scrollbar light theme */
  ::-webkit-scrollbar-track {
    background: #e5e7eb;
  }

  ::-webkit-scrollbar-thumb {
    background: var(--gradient-scrollbar);
    border-color: #e5e7eb;
  }

  /* Cards - light glassmorphism */
  .fulgura-card,
  .glass-card,
  .card {
    background: rgba(255, 255, 255, 0.7);
    border-color: rgba(138, 43, 226, 0.2);
    box-shadow:
      0 8px 32px rgba(138, 43, 226, 0.1),
      inset 0 1px 0 rgba(255, 255, 255, 0.8);
  }

  .fulgura-card:hover,
  .glass-card:hover,
  .card:hover {
    box-shadow:
      0 20px 60px rgba(138, 43, 226, 0.2),
      0 0 0 1px rgba(138, 43, 226, 0.3),
      inset 0 1px 0 rgba(255, 255, 255, 0.9);
  }

  /* Stat cards */
  .fulgura-stat-card,
  .stat-card {
    background: rgba(255, 255, 255, 0.7);
    border-color: rgba(138, 43, 226, 0.2);
    box-shadow:
      0 8px 32px rgba(138, 43, 226, 0.1),
      inset 0 1px 0 rgba(255, 255, 255, 0.8);
  }

  .fulgura-stat-card:hover,
  .stat-card:hover {
    box-shadow:
      0 20px 60px rgba(138, 43, 226, 0.25),
      0 0 0 1px rgba(138, 43, 226, 0.4),
      inset 0 1px 0 rgba(255, 255, 255, 0.9);
  }

  .fulgura-stat-value,
  .stat-value {
    background: linear-gradient(135deg, #1a1a1a, rgba(0, 0, 0, 0.8));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  .fulgura-stat-label,
  .stat-label {
    color: rgba(0, 0, 0, 0.6);
  }

  /* Search input */
  .fulgura-search-input {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(138, 43, 226, 0.2);
    color: var(--text-primary);
  }

  .fulgura-search-input:focus {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 3px rgba(138, 43, 226, 0.1);
  }

  .fulgura-search-input::placeholder {
    color: var(--text-muted);
  }

  /* Status indicators */
  .fulgura-status-item {
    color: rgba(0, 0, 0, 0.7);
  }

  /* Code blocks */
  code {
    background: rgba(138, 43, 226, 0.08);
  }
}
