/* ==========================================================================
   BASES.CSS - Fondations, Variables, Reset & Typographie
   Sahel Group 2026 - Design System
   Version: 2.0 - Optimisée
   ========================================================================== */

/* ==========================================================================
   RESET ET NORMALISATION
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 80px;
  font-size: 16px;
}

body {
  margin: 0;
  font-family:
    "DM Sans",
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
  color: var(--sahel-dark);
  background-color: var(--sahel-white);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Éléments fluides */
img,
video,
svg {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

ul,
ol {
  list-style: none;
}

/* ==========================================================================
   VARIABLES CSS - DESIGN SYSTEM
   ========================================================================== */

:root {
  /* ========== COLORS ========== */
  --sahel-primary: #0a4275;
  --sahel-primary-light: #1a5a9a;
  --sahel-secondary: #ff7849;
  --sahel-accent: #059669;
  --sahel-dark: #0f172a;
  --sahel-gray: #64748b;
  --sahel-gray-light: #cbd5e1;
  --sahel-light: #f8fafc;
  --sahel-white: #ffffff;
  
  /* ========== RGB VALUES (pour rgba) ========== */
--sahel-primary-rgb: 10, 66, 117;
--sahel-primary-light-rgb: 26, 90, 154;
--sahel-secondary-rgb: 255, 120, 73;
--sahel-accent-rgb: 5, 150, 105;
--sahel-dark-rgb: 15, 23, 42;
--sahel-gray-rgb: 100, 116, 139;

  /* ========== GRADIENTS ========== */
  --gradient-primary: linear-gradient(135deg, #0a4275 0%, #062c50 100%);
  --gradient-accent: linear-gradient(135deg, #059669 0%, #047857 100%);
  --gradient-secondary: linear-gradient(135deg, #ff7849 0%, #ff5500 100%);
  --gradient-hero: linear-gradient(180deg, #f8fafc 0%, #eff6ff 100%);
  --gradient-dark: linear-gradient(135deg, #0f172a 0%, #0a3847 100%);

  /* ========== SPACING ========== */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-2xl: 4rem;
  --space-3xl: 5rem;
  --space-4xl: 6rem;

  /* ========== BORDER RADIUS ========== */
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.25rem;
  --radius-2xl: 1.5rem;
  --radius-3xl: 2rem;
  --radius-full: 9999px;

  /* ========== SHADOWS ========== */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.15);
  --shadow-primary: 0 8px 24px rgba(10, 66, 117, 0.25);
  --shadow-accent: 0 8px 24px rgba(5, 150, 105, 0.25);
  --shadow-secondary: 0 8px 24px rgba(255, 120, 73, 0.25);

  /* ========== COLOR VARIANTS ========== */
  --sahel-primary-dark: #062c50;
  --sahel-accent-dark: #047857;
  --sahel-secondary-dark: #ff5500;

  /* ========== TRANSITIONS ========== */
  --transition-fast: 150ms ease;
  --transition-base: 300ms ease;
  --transition-slow: 500ms ease;
  --transition-smooth: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);

  /* ========== TYPOGRAPHIE ========== */
  --font-heading: "Sora", system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, sans-serif;

  /* ========== Z-INDEX ========== */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  --z-toast: 1080;

  /* ========== CONTAINER ========== */
  --container-padding: 1.5rem;
}

/* ==========================================================================
   TYPOGRAPHIE
   ========================================================================== */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--space-md);
  color: var(--sahel-dark);
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
}

h2 {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 800;
}

h3 {
  font-size: clamp(1.5rem, 3vw, 2rem);
}

h4 {
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
}

h5 {
  font-size: 1.25rem;
}

h6 {
  font-size: 1.125rem;
}

p {
  margin-bottom: 1rem;
  line-height: 1.7;
}

/* Classes typographiques utilitaires */
.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-gradient-secondary {
  background: var(--gradient-secondary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sahel-section-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  color: var(--sahel-dark);
  margin-bottom: var(--space-lg);
  letter-spacing: -0.03em;
}

.lead {
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 400;
  line-height: 1.8;
}

.small {
  font-size: 0.875rem;
}

.text-muted {
  color: var(--sahel-gray) !important;
}

.text-primary {
  color: var(--sahel-primary) !important;
}

.text-accent {
  color: var(--sahel-accent) !important;
}

/* ==========================================================================
   BOUTONS
   ========================================================================== */

.sahel-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.875rem 1.75rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  border: none;
  transition: var(--transition-base);
  min-height: 48px;
  gap: 0.5rem;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

/* Effet de brillance au hover */
.sahel-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s ease;
}

.sahel-btn:hover::before {
  left: 100%;
}

.sahel-btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--shadow-md);
}

.sahel-btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-primary);
  color: white;
}

.sahel-btn-primary:active {
  transform: translateY(-1px);
}

.sahel-btn-secondary {
  background: var(--gradient-secondary);
  color: white;
  box-shadow: var(--shadow-md);
}

.sahel-btn-secondary:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-secondary);
  color: white;
}

.sahel-btn-secondary:active {
  transform: translateY(-1px);
}

.sahel-btn-outline {
  background: transparent;
  border: 2px solid var(--sahel-primary);
  color: var(--sahel-primary);
  border-radius: var(--radius-full);
}

.sahel-btn-outline:hover {
  background: var(--sahel-primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-primary);
}

.sahel-btn-outline:active {
  transform: translateY(0);
}

.sahel-btn-accent {
  background: var(--gradient-accent);
  color: white;
  box-shadow: var(--shadow-md);
}

.sahel-btn-accent:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-accent);
  color: white;
}

.sahel-btn-accent:active {
  transform: translateY(-1px);
}

/* Bouton fantôme (transparent avec fond au hover) */
.sahel-btn-ghost {
  background: transparent;
  color: var(--sahel-primary);
}

.sahel-btn-ghost:hover {
  background: rgba(10, 66, 117, 0.08);
  transform: none;
}

.sahel-btn-lg {
  padding: 1rem 2.25rem;
  font-size: 1rem;
  min-height: 56px;
  border-radius: var(--radius-full);
}

.sahel-btn-sm {
  padding: 0.5rem 1.25rem;
  font-size: 0.8rem;
  min-height: 38px;
  border-radius: var(--radius-full);
}

/* ==========================================================================
   BOUTONS NAVIGATION HEADER (sans effets carrés)
   ========================================================================== */

/* Boutons spécifiques au header - pas de transform */
.nav-btn,
.header-btn,
.navbar .sahel-btn,
.sahel-nav-btn {
  border-radius: var(--radius-full);
  transform: none !important;
  transition:
    background-color 0.25s ease,
    box-shadow 0.25s ease,
    opacity 0.25s ease;
}

.nav-btn:hover,
.header-btn:hover,
.navbar .sahel-btn:hover,
.sahel-nav-btn:hover {
  transform: none !important;
}

/* Liens de navigation - style pill */
.nav-link,
.navbar-nav .nav-link {
  border-radius: var(--radius-full);
  padding: 0.5rem 1rem;
  transition:
    background-color 0.25s ease,
    color 0.25s ease;
}

.nav-link:hover,
.navbar-nav .nav-link:hover {
  background-color: rgba(10, 66, 117, 0.08);
  border-radius: var(--radius-full);
}

.nav-link.active {
  background-color: rgba(10, 66, 117, 0.12);
  border-radius: var(--radius-full);
}

/* ==========================================================================
   CARTES
   ========================================================================== */

.sahel-card {
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: var(--transition-base);
  overflow: hidden;
}

.sahel-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

.sahel-card-body {
  padding: var(--space-lg);
}

.sahel-card-header {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.sahel-card-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  background: var(--sahel-light);
}

/* ==========================================================================
   SECTIONS
   ========================================================================== */

.sahel-section {
  padding: clamp(var(--space-xl), 8vw, var(--space-3xl)) 0;
}

.sahel-section--light {
  background: var(--sahel-light);
}

.sahel-section--dark {
  background: var(--gradient-dark);
  color: white;
}

.sahel-section--primary {
  background: var(--gradient-primary);
  color: white;
}

/* En-tête de section */
.section-header {
  margin-bottom: var(--space-2xl);
}

.section-title {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 800;
  color: var(--sahel-dark);
  margin-bottom: 1rem;
  letter-spacing: -0.03em;
}

.section-subtitle {
  font-size: clamp(1rem, 2vw, 1.125rem);
  color: var(--sahel-gray);
  max-width: 600px;
}

.section-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(10, 66, 117, 0.1);
  color: var(--sahel-primary);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.section-desc {
  font-size: 1.05rem;
  color: var(--sahel-gray);
  max-width: 600px;
  margin: 0 auto;
}

/* ==========================================================================
   GRILLES
   ========================================================================== */

.sahel-grid {
  display: grid;
  gap: var(--space-lg);
}

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

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

.sahel-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* ==========================================================================
   UTILITAIRES D'ESPACEMENT
   ========================================================================== */

.mt-auto {
  margin-top: auto;
}
.mb-auto {
  margin-bottom: auto;
}
.mx-auto {
  margin-left: auto;
  margin-right: auto;
}

.mt-0 {
  margin-top: 0;
}
.mt-1 {
  margin-top: var(--space-xs);
}
.mt-2 {
  margin-top: var(--space-sm);
}
.mt-3 {
  margin-top: var(--space-md);
}
.mt-4 {
  margin-top: var(--space-lg);
}
.mt-5 {
  margin-top: var(--space-xl);
}

.mb-0 {
  margin-bottom: 0;
}
.mb-1 {
  margin-bottom: var(--space-xs);
}
.mb-2 {
  margin-bottom: var(--space-sm);
}
.mb-3 {
  margin-bottom: var(--space-md);
}
.mb-4 {
  margin-bottom: var(--space-lg);
}
.mb-5 {
  margin-bottom: var(--space-xl);
}

.py-1 {
  padding-top: var(--space-xs);
  padding-bottom: var(--space-xs);
}
.py-2 {
  padding-top: var(--space-sm);
  padding-bottom: var(--space-sm);
}
.py-3 {
  padding-top: var(--space-md);
  padding-bottom: var(--space-md);
}
.py-4 {
  padding-top: var(--space-lg);
  padding-bottom: var(--space-lg);
}
.py-5 {
  padding-top: var(--space-xl);
  padding-bottom: var(--space-xl);
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */

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

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

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-15px);
  }
}

@keyframes bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

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

@keyframes shimmer {
  0% {
    background-position: -200% center;
  }
  100% {
    background-position: 200% center;
  }
}

/* Classes d'animation */
.fade-in {
  animation: fadeIn 0.6s ease-out;
}
.fade-in-up {
  animation: fadeInUp 0.6s ease-out;
}
.fade-in-down {
  animation: fadeInDown 0.6s ease-out;
}
.fade-in-left {
  animation: fadeInLeft 0.6s ease-out;
}
.fade-in-right {
  animation: fadeInRight 0.6s ease-out;
}
.slide-in {
  animation: slideIn 0.6s ease-out;
}
.float {
  animation: float 3s ease-in-out infinite;
}
.bounce {
  animation: bounce 2s ease-in-out infinite;
}
.spin {
  animation: spin 1s linear infinite;
}

/* Délais d'animation */
.delay-100 {
  animation-delay: 100ms;
}
.delay-200 {
  animation-delay: 200ms;
}
.delay-300 {
  animation-delay: 300ms;
}
.delay-400 {
  animation-delay: 400ms;
}
.delay-500 {
  animation-delay: 500ms;
}

/* Performance */
.will-change {
  will-change: transform;
  backface-visibility: hidden;
}

/* ==========================================================================
   RESPONSIVE - SYSTÈME ADAPTATIF OPTIMISÉ
   ========================================================================== */

/* === XLarge Screens (>= 1400px) === */
@media (min-width: 1400px) {
  :root {
    --space-3xl: 7rem;
  }
}

/* === Large Screens (1200px - 1399px) === */
@media (min-width: 1200px) and (max-width: 1399.98px) {
  :root {
    --space-3xl: 5.5rem;
  }
}

/* === Desktop (992px - 1199px) === */
@media (min-width: 992px) and (max-width: 1199.98px) {
  :root {
    --space-3xl: 5rem;
  }

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

/* === Tablet Landscape (768px - 991px) === */
@media (min-width: 768px) and (max-width: 991.98px) {
  :root {
    --space-2xl: 3.5rem;
    --space-3xl: 4.5rem;
  }

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

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

/* === Tablet Portrait & Mobile Large (< 991.98px) === */
@media (max-width: 991.98px) {
  html {
    scroll-padding-top: 70px;
  }

  .sahel-section {
    padding: var(--space-2xl) 0;
  }

  .section-header {
    text-align: center;
    margin-bottom: var(--space-xl);
  }

  .section-subtitle {
    margin-left: auto;
    margin-right: auto;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.75rem;
  }
}

/* === Mobile (< 767.98px) === */
@media (max-width: 767.98px) {
  :root {
    --space-2xl: 3rem;
    --space-3xl: 4rem;
  }

  .sahel-section {
    padding: var(--space-xl) 0;
  }

  .sahel-grid-2,
  .sahel-grid-3,
  .sahel-grid-4 {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1.35rem;
  }

  .sahel-btn {
    width: 100%;
    justify-content: center;
  }

  .sahel-card-body {
    padding: var(--space-md);
  }
}

/* === Small Mobile (< 575.98px) === */
@media (max-width: 575.98px) {
  :root {
    --space-xs: 0.375rem;
    --space-sm: 0.75rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 2.5rem;
    --container-padding: 1rem;
  }

  h1 {
    font-size: 1.6rem;
    line-height: 1.15;
  }

  h2 {
    font-size: 1.4rem;
    line-height: 1.2;
  }

  h3 {
    font-size: 1.25rem;
  }

  .lead {
    font-size: 0.95rem;
  }

  .sahel-btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    min-height: 44px;
  }

  .sahel-btn-lg {
    padding: 0.875rem 1.5rem;
    font-size: 0.95rem;
    min-height: 50px;
  }
}

/* === Extra Small Mobile (< 375px) === */
@media (max-width: 374.98px) {
  :root {
    --space-lg: 1.25rem;
    --space-xl: 1.75rem;
  }

  h1 {
    font-size: 1.45rem;
  }

  h2 {
    font-size: 1.3rem;
  }

  .sahel-section {
    padding: var(--space-lg) 0;
  }
}

/* === Touch Devices (no hover) === */
@media (hover: none) {
  .sahel-btn:hover,
  .sahel-card:hover {
    transform: none !important;
  }

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

  .sahel-card:active {
    transform: scale(0.99);
  }
}

/* ==========================================================================
   ACCESSIBILITÉ
   ========================================================================== */

/* Focus visible pour la navigation au clavier */
*:focus-visible {
  outline: 2px solid var(--sahel-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--sahel-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Focus rond pour les boutons */
.sahel-btn:focus-visible {
  outline-offset: 4px;
  border-radius: var(--radius-full);
}

/* Réduction des animations pour les préférences utilisateur */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Contraste élevé */
@media (prefers-contrast: high) {
  :root {
    --sahel-dark: #000000;
    --sahel-gray: #4a4a4a;
    --sahel-primary: #0055dd;
  }

  .sahel-btn-outline {
    border-width: 3px;
  }
}

/* Mode sombre (optionnel - pour futures évolutions) */
@media (prefers-color-scheme: dark) {
  /* Préparation pour un futur mode sombre */
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
  body {
    background: white;
    color: black;
    font-size: 12pt;
  }

  .sahel-header,
  .sahel-footer,
  .sahel-btn,
  .navbar,
  .no-print {
    display: none !important;
  }

  .sahel-card {
    box-shadow: none;
    border: 1px solid #ddd;
    break-inside: avoid;
  }

  h1,
  h2,
  h3 {
    color: black;
    break-after: avoid;
  }

  a {
    text-decoration: underline;
    color: black;
  }

  img {
    max-width: 100% !important;
  }
}
