/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Dark mode */
.dark {
  color-scheme: dark;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fadeIn 0.5s ease-out;
}

/* Boutons période stats */
.period-btn {
  background-color: #e2e8f0;
  color: #475569;
}

.dark .period-btn {
  background-color: #334155;
  color: #cbd5e1;
}

.period-btn.active {
  background-color: #56ffaa;
  color: #1a1a2e;
}

.period-btn:hover:not(.active) {
  background-color: #cbd5e1;
}

.dark .period-btn:hover:not(.active) {
  background-color: #475569;
}

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

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

.dark ::-webkit-scrollbar-track {
  background: #1e293b;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 5px;
}

.dark ::-webkit-scrollbar-thumb {
  background: #475569;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Transitions */
a, button {
  transition: all 0.3s ease;
}

/* Input focus */
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #56ffaa;
  box-shadow: 0 0 0 3px rgba(86, 255, 170, 0.1);
}

/* Tables responsive */
@media (max-width: 768px) {
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

/* Cards hover effect */
.card-hover {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Loading spinner */
.spinner {
  border: 3px solid #f3f4f6;
  border-top: 3px solid #56ffaa;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

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

/* Toast notification */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #56ffaa;
  color: #1a1a2e;
  padding: 16px 24px;
  border-radius: 12px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  z-index: 9999;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Custom checkbox */
input[type="checkbox"] {
  accent-color: #56ffaa;
  cursor: pointer;
}

/* Print styles pour PDF */
@media print {
  body {
    background: white;
  }
  
  header, .no-print {
    display: none;
  }
}

/* =========================
   RESPONSIVE — MOBILE FIRST
   ========================= */

/* 📱 Très petits écrans (≤ 480px) */
@media (max-width: 480px) {
  body {
    font-size: 14px;
  }

  h1 { font-size: 1.4rem; }
  h2 { font-size: 1.2rem; }
  h3 { font-size: 1rem; }

  .container {
    padding: 12px;
  }

  button, .period-btn {
    width: 100%;
    padding: 12px;
    font-size: 0.9rem;
  }

  .card-hover {
    margin-bottom: 16px;
  }

  .toast {
    right: 10px;
    left: 10px;
    width: auto;
  }

  table {
    font-size: 0.85rem;
  }
}

/* 📱 Mobiles standards & petites tablettes (≤ 768px) */
@media (max-width: 768px) {
  body {
    font-size: 15px;
  }

  .grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .card-hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
  }

  header {
    flex-direction: column;
    gap: 12px;
  }

  nav {
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
  }
}

/* 💻 Tablettes & petits laptops (≤ 1024px) */
@media (max-width: 1024px) {
  .container {
    padding: 20px;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

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

/* 🖥️ Grands écrans (≥ 1280px) */
@media (min-width: 1280px) {
  .container {
    max-width: 1200px;
    margin: 0 auto;
  }

  body {
    font-size: 16px;
  }
}

/* 🧠 Amélioration UX tactile */
@media (hover: none) {
  button:hover,
  .card-hover:hover {
    transform: none;
    box-shadow: none;
  }
}
