@tailwind base;
@tailwind components;
@tailwind utilities;

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* Variables CSS personnalisées */
:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a24;
  --bg-card: #16161f;
  --bg-card-hover: #1e1e2a;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-green: #22c55e;
  --accent-green-glow: rgba(34, 197, 94, 0.3);
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-hover: rgba(255, 255, 255, 0.15);
  
  --gradient-start: #0f172a;
  --gradient-end: #020617;
}

/* Reset et base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: linear-gradient(180deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar personnalisée */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Classes utilitaires personnalisées */
@layer components {
  /* Cards */
  .card {
    @apply bg-dark-900/50 backdrop-blur-sm border border-white/5 rounded-2xl;
    transition: all 0.3s ease;
  }
  
  .card:hover {
    @apply border-white/10 bg-dark-900/70;
  }
  
  .card-highlight {
    @apply bg-gradient-to-br from-safe-900/30 to-dark-900/50 border-safe-500/20;
  }
  
  /* Glow effects */
  .glow-green {
    box-shadow: 0 0 20px var(--accent-green-glow),
                0 0 40px var(--accent-green-glow);
  }
  
  .glow-green-subtle {
    box-shadow: 0 0 10px var(--accent-green-glow);
  }
  
  /* Text styles */
  .text-gradient {
    @apply bg-clip-text text-transparent bg-gradient-to-r from-safe-400 to-safe-300;
  }
  
  /* Badge styles */
  .badge {
    @apply inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium;
  }
  
  .badge-excellent {
    @apply bg-safe-500/20 text-safe-400 border border-safe-500/30;
  }
  
  .badge-good {
    @apply bg-lime-500/20 text-lime-400 border border-lime-500/30;
  }
  
  .badge-moderate {
    @apply bg-yellow-500/20 text-yellow-400 border border-yellow-500/30;
  }
  
  .badge-risky {
    @apply bg-orange-500/20 text-orange-400 border border-orange-500/30;
  }
  
  .badge-danger {
    @apply bg-red-500/20 text-red-400 border border-red-500/30;
  }
  
  /* Button styles */
  .btn-primary {
    @apply inline-flex items-center justify-center px-6 py-3 rounded-xl
           bg-safe-500 hover:bg-safe-400 text-dark-950 font-semibold
           transition-all duration-200 hover:shadow-lg hover:shadow-safe-500/25;
  }
  
  .btn-secondary {
    @apply inline-flex items-center justify-center px-6 py-3 rounded-xl
           bg-white/5 hover:bg-white/10 text-white border border-white/10
           transition-all duration-200;
  }
  
  /* Filter chip */
  .filter-chip {
    @apply px-3 py-1.5 rounded-lg text-sm font-medium cursor-pointer
           bg-white/5 text-white/70 border border-white/10
           hover:bg-white/10 hover:text-white transition-all duration-200;
  }
  
  .filter-chip-active {
    @apply bg-safe-500/20 text-safe-400 border-safe-500/30;
  }
  
  /* Table styles */
  .table-row {
    @apply border-b border-white/5 hover:bg-white/[0.02] transition-colors;
  }
  
  /* Animations */
  .animate-fade-in {
    animation: fadeIn 0.5s ease-out;
  }
  
  .animate-slide-up {
    animation: slideUp 0.5s ease-out;
  }
  
  .animate-pulse-glow {
    animation: pulseGlow 2s ease-in-out infinite;
  }
}

/* Keyframes */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.3);
  }
  50% {
    box-shadow: 0 0 30px rgba(34, 197, 94, 0.5);
  }
}

/* Score ring animation */
@keyframes scoreRing {
  from {
    stroke-dashoffset: 100;
  }
  to {
    stroke-dashoffset: var(--score-offset);
  }
}

.score-ring {
  animation: scoreRing 1s ease-out forwards;
}

/* Grain overlay for texture */
.grain-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' 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");
  z-index: 9999;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .card {
    @apply rounded-xl;
  }
  
  .btn-primary, .btn-secondary {
    @apply px-4 py-2.5 text-sm;
  }
}

/* Dark mode optimizations */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
  }
}

/* Print styles */
@media print {
  body {
    background: white;
    color: black;
  }
  
  .card {
    border: 1px solid #ccc;
    background: white;
  }
}
