:root {
  --primary-color: #4f46e5;
  --primary-hover: #4338ca;
  --secondary-color: #10b981;
  --bg-color: #f8fafc;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --glass-bg: rgba(255, 255, 255, 0.8);
  --navbar-height: 70px;
  --glass-border: rgba(255, 255, 255, 0.2);
}

.badge {
  padding: 6px 14px;
  font-weight: 600;
  border-radius: 8px;
  letter-spacing: 0.3px;
}

.badge.bg-primary-subtle {
  background: rgba(79, 70, 229, 0.1) !important;
  color: var(--primary-color) !important;
  border: 1px solid rgba(79, 70, 229, 0.15);
}

.badge.bg-success-subtle {
  background: rgba(16, 185, 129, 0.1) !important;
  color: #059669 !important;
  border: 1px solid rgba(16, 185, 129, 0.15);
}

.badge.bg-warning-subtle {
  background: rgba(245, 158, 11, 0.1) !important;
  color: #d97706 !important;
  border: 1px solid rgba(245, 158, 11, 0.15);
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
}

/* Navbar */
.navbar {
  background: var(--glass-bg) !important;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  min-height: var(--navbar-height);
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

@media (max-width: 991.98px) {
  .navbar {
    height: auto !important;
  }

  .navbar-collapse {
    background: white;
    margin: 0.5rem -0.5rem 0;
    padding: 1.5rem;
    border-radius: 20px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
  }

  .nav-item {
    border-bottom: 1px solid #f1f5f9;
  }

  .nav-item:last-of-type {
    border-bottom: none;
  }

  .nav-link::after {
    display: none;
  }
}

/* Stabilisation des modales : on désactive les transitions si elles causent du clignotement,
   mais on laisse Bootstrap gérer l'affichage (display/opacity) normalement. */
.modal.fade {
  transition: none !important;
}

.modal-dialog {
  transition: none !important;
  transform: none !important;
}

/* Stabilisation du rendu pour les navigateurs mobiles */
* {
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.navbar-brand {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--primary-color) !important;
}

.nav-link {
  font-weight: 500;
  color: var(--text-main) !important;
  margin: 0 10px;
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: var(--primary-color);
  transition: width 0.3s ease;
}

.nav-link:hover::after {
  width: 100%;
}

/* Hero Section */
.hero {
  position: relative;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: white;
  padding: 100px 0;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('/static/hero.jpg') center/cover no-repeat;
  opacity: 0.2;
  mix-blend-mode: overlay;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.btn-primary {
  background-color: var(--primary-color);
  border: none;
  padding: 12px 28px;
  border-radius: 12px;
  font-weight: 600;
  transition: transform 0.2s, background-color 0.2s;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -5px rgba(79, 70, 229, 0.4);
}

@media (max-width: 767.98px) {
  .hero {
    padding: 60px 20px;
  }

  .hero .display-3 {
    font-size: 2.5rem;
  }

  .hero .lead {
    font-size: 1.1rem;
    margin-bottom: 2rem !important;
  }
}

/* Cards */
.card {
  background: white;
  border: none;
  border-radius: 20px;
  box-shadow: var(--card-shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
}

.card-body {
  padding: 1.5rem;
}

.card-icon {
  width: 54px;
  height: 54px;
  background: #eef2ff;
  color: var(--primary-color);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 1.5rem;
  transition: transform 0.3s ease;
}

.card:hover .card-icon {
  transform: rotate(5deg) scale(1.1);
}

/* Sections */
.section-title {
  text-align: center;
  margin-bottom: 3rem;
  position: relative;
}

.section-title::after {
  content: '';
  display: block;
  width: 60px;
  height: 4px;
  background: var(--primary-color);
  margin: 15px auto 0;
  border-radius: 2px;
}

/* Footer */
footer {
  background: #1e293b;
  color: #f8fafc;
  padding: 60px 0 30px;
  margin-top: 6rem;
}

footer .text-muted {
  color: #cbd5e1 !important;
}

.footer-links a {
  color: #cbd5e1;
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: white;
}

@media (max-width: 767.98px) {
  footer {
    padding: 40px 0 20px;
    margin-top: 3rem;
    text-align: center;
  }

  footer .offset-md-2 {
    margin-left: 0 !important;
  }

  footer .col-md-4,
  footer .col-md-2 {
    margin-bottom: 2.5rem;
  }

  .footer-links {
    margin-bottom: 0;
  }

  .footer-links li {
    margin-bottom: 12px;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 1;
    transform: none;
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.animated {
  animation: none !important;
  opacity: 1 !important;
  transform: none !important;
  will-change: auto;
}

/* Dashboard Styles */
.sidebar {
  background: white;
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--card-shadow);
}

.sidebar-link {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  border-radius: 10px;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.2s;
  margin-bottom: 5px;
}

.sidebar-link i {
  margin-right: 12px;
  font-size: 1.1rem;
}

.sidebar-link:hover,
.sidebar-link.active {
  background: var(--primary-color);
  color: white;
}

.stat-card {
  padding: 25px;
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary-color);
}

/* Table Responsive Adjustments */
.table-responsive {
  border-radius: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  .table {
    min-width: 600px;
    /* Force un défilement horizontal si l'écran est trop petit */
  }

  .table td,
  .table th {
    padding: 12px 8px !important;
    font-size: 0.85rem;
  }

  .btn-sm {
    padding: 4px 8px;
    font-size: 0.75rem;
  }

  .badge {
    padding: 4px 8px;
    font-size: 0.7rem;
  }
}