/**
 * Design System - CompteurV2
 * Charte graphique moderne inspirée de CandLibre
 * @version 2.0
 * @date 2026-02-12
 */

/* ============================================
   IMPORTS
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
  /* Couleurs principales */
  --primary-blue: #2563EB;
  --primary-blue-light: #EFF6FF;
  --primary-blue-dark: #1E40AF;
  --text-dark: #1E293B;
  --text-gray: #64748B;
  --text-light: #94A3B8;

  /* Couleurs d'état */
  --success: #10B981;
  --success-light: #ECFDF5;
  --success-dark: #059669;

  --warning: #F59E0B;
  --warning-light: #FFFBEB;
  --warning-dark: #D97706;

  --danger: #EF4444;
  --danger-light: #FEF2F2;
  --danger-dark: #DC2626;

  --info: #06B6D4;
  --info-light: #CFFAFE;
  --info-dark: #0891B2;

  /* Backgrounds des cards */
  --bg-purple-light: #F3F4FF;
  --bg-blue-light: #EFF6FF;
  --bg-green-light: #ECFDF5;
  --bg-red-light: #FEF2F2;
  --bg-yellow-light: #FFFBEB;
  --bg-gray-light: #F8FAFC;

  /* Icônes */
  --icon-purple: #8B5CF6;
  --icon-blue: #3B82F6;
  --icon-green: #10B981;
  --icon-red: #EF4444;
  --icon-yellow: #F59E0B;

  /* Espacements */
  --spacing-xs: 8px;
  --spacing-sm: 12px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-2xl: 48px;

  /* Border radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;
}

/* ============================================
   GLOBAL STYLES
   ============================================ */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text-dark);
  background-color: var(--bg-gray-light);
  font-size: 14px;
  line-height: 1.6;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  color: var(--text-dark);
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary-blue);
  margin-bottom: 8px;
}

.page-subtitle {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-gray);
  margin-bottom: var(--spacing-lg);
}

/* ============================================
   KPI CARDS
   ============================================ */
.kpi-card {
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--spacing-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all var(--transition-base);
  margin-bottom: var(--spacing-md);
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-content {
  flex: 1;
}

.kpi-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-gray);
  margin-bottom: 4px;
  display: block;
}

.kpi-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.2;
}

.kpi-subvalue {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-light);
  margin-top: 4px;
}

.kpi-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  margin-left: var(--spacing-md);
}

/* KPI Card Variants */
.kpi-card-purple .kpi-icon {
  background: var(--bg-purple-light);
  color: var(--icon-purple);
}

.kpi-card-blue .kpi-icon {
  background: var(--bg-blue-light);
  color: var(--icon-blue);
}

.kpi-card-green .kpi-icon {
  background: var(--bg-green-light);
  color: var(--icon-green);
}

.kpi-card-red .kpi-icon {
  background: var(--bg-red-light);
  color: var(--icon-red);
}

.kpi-card-yellow .kpi-icon {
  background: var(--bg-yellow-light);
  color: var(--icon-yellow);
}

/* ============================================
   BADGES
   ============================================ */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.5;
}

.badge-success {
  background: var(--success-light);
  color: var(--success-dark);
}

.badge-warning {
  background: var(--warning-light);
  color: var(--warning-dark);
}

.badge-danger {
  background: var(--danger-light);
  color: var(--danger-dark);
}

.badge-info {
  background: var(--info-light);
  color: var(--info-dark);
}

.badge-primary {
  background: var(--primary-blue-light);
  color: var(--primary-blue-dark);
}

/* ============================================
   CARDS
   ============================================ */
.card {
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: none;
  margin-bottom: var(--spacing-lg);
}

.card-header {
  padding: var(--spacing-lg);
  border-bottom: 1px solid #E2E8F0;
  background: white;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-dark);
  margin: 0;
}

.card-body {
  padding: var(--spacing-lg);
}

/* ============================================
   TABLES
   ============================================ */
.table {
  width: 100%;
  margin-bottom: 0;
  border-collapse: separate;
  border-spacing: 0;
}

.table thead th {
  background: var(--bg-gray-light);
  color: var(--text-gray);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  border: none;
}

.table thead th:first-child {
  border-radius: var(--radius-sm) 0 0 0;
}

.table thead th:last-child {
  border-radius: 0 var(--radius-sm) 0 0;
}

.table tbody tr {
  transition: background-color var(--transition-fast);
}

.table tbody tr:nth-child(even) {
  background: #FAFBFC;
}

.table tbody tr:hover {
  background: #F1F5F9;
}

.table tbody td {
  padding: 16px;
  border-top: 1px solid #E2E8F0;
  color: var(--text-dark);
  font-size: 14px;
}

.table-responsive {
  border-radius: var(--radius-md);
  overflow: hidden;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  transition: all var(--transition-fast);
  border: none;
  font-size: 14px;
}

.btn-primary {
  background: var(--primary-blue);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-blue-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: var(--success-dark);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: var(--danger-dark);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* ============================================
   NAVBAR
   ============================================ */
.navbar {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 1030;
  transition: all var(--transition-base);
}

.navbar-brand {
  font-weight: 700;
  color: var(--primary-blue) !important;
  font-size: 20px;
  letter-spacing: -0.5px;
}

.nav-link {
  display: flex !important;
  align-items: center;
  white-space: nowrap;
  color: var(--text-gray) !important;
  font-weight: 500;
  font-size: 14px;
  padding: 8px 12px !important;
  margin: 0 2px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.nav-link i {
  margin-right: 8px;
  /* Espace fixe entre icône et texte */
}

.nav-link:hover {
  color: var(--primary-blue) !important;
  background-color: var(--primary-blue-light);
  transform: translateY(-1px);
}

.nav-link.active {
  color: var(--primary-blue) !important;
  background-color: var(--primary-blue-light);
  font-weight: 600;
}

/* Dropdown Menu Styling */
.dropdown-menu {
  border: none;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  padding: 8px;
  margin-top: 10px;
  animation: fadeInUp 0.2s ease-out;
}

.dropdown-item {
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-weight: 500;
  color: var(--text-dark);
  transition: all 0.15s ease;
}

.dropdown-item:hover {
  background-color: var(--bg-gray-light);
  color: var(--primary-blue);
  transform: translateX(4px);
}

.dropdown-item i {
  color: var(--text-light);
  width: 20px;
  transition: color 0.15s ease;
}

.dropdown-item:hover i {
  color: var(--primary-blue);
}

.dropdown-divider {
  margin: 8px 0;
  border-top: 1px solid #E2E8F0;
}

/* ============================================
   NOTIFICATION BADGE
   ============================================ */
.notification-badge {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

.notification-badge .badge-count {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--danger);
  color: white;
  border-radius: var(--radius-full);
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
}

/* ============================================
   PROGRESS BAR
   ============================================ */
.progress {
  height: 8px;
  border-radius: var(--radius-full);
  background: #E2E8F0;
  overflow: hidden;
}

.progress-bar {
  background: var(--success);
  transition: width var(--transition-base);
  border-radius: var(--radius-full);
}

/* ============================================
   FORMS
   ============================================ */
.form-control {
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 14px;
  transition: all var(--transition-fast);
  font-family: 'Inter', sans-serif;
  height: 48px;
}

textarea.form-control {
  height: auto !important;
  min-height: 100px;
  padding: 12px 16px;
}

.form-control:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px var(--primary-blue-light);
  outline: none;
}

.form-label {
  font-weight: 500;
  color: var(--text-dark);
  margin-bottom: 6px;
  font-size: 14px;
}

select.form-control {
  height: 48px !important;
  line-height: 48px !important;
  padding: 0 16px !important;
  -webkit-appearance: auto !important;
  -moz-appearance: auto !important;
  appearance: auto !important;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp var(--transition-base) ease-out;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.slide-in-right {
  animation: slideInRight var(--transition-base) ease-out;
}

/* ============================================
   UTILITIES
   ============================================ */
.text-primary {
  color: var(--primary-blue) !important;
}

.text-success {
  color: var(--success) !important;
}

.text-warning {
  color: var(--warning) !important;
}

.text-danger {
  color: var(--danger) !important;
}

.text-gray {
  color: var(--text-gray) !important;
}

.bg-light {
  background: var(--bg-gray-light) !important;
}

.shadow-sm {
  box-shadow: var(--shadow-sm);
}

.shadow-md {
  box-shadow: var(--shadow-md);
}

.shadow-lg {
  box-shadow: var(--shadow-lg);
}

.rounded-sm {
  border-radius: var(--radius-sm);
}

.rounded-md {
  border-radius: var(--radius-md);
}

.rounded-lg {
  border-radius: var(--radius-lg);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .kpi-card {
    flex-direction: column;
    text-align: center;
  }

  .kpi-icon {
    margin-left: 0;
    margin-top: var(--spacing-md);
  }

  .page-title {
    font-size: 24px;
  }

  .kpi-value {
    font-size: 28px;
  }
}

/* ============================================
   SKELETON LOADING STATES
   ============================================ */
.skeleton {
  background: linear-gradient(90deg,
      #f0f0f0 25%,
      #e0e0e0 50%,
      #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

.skeleton-kpi {
  height: 120px;
  margin-bottom: 1rem;
}

.skeleton-line {
  height: 16px;
  margin-bottom: 8px;
  border-radius: 4px;
}

.skeleton-title {
  width: 60%;
  height: 20px;
}

.skeleton-value {
  width: 40%;
  height: 32px;
  margin-top: 12px;
}

.skeleton-table-row {
  height: 48px;
  margin-bottom: 8px;
}

/* ============================================
   BREADCRUMB NAVIGATION
   ============================================ */
.breadcrumb-nav {
  background: transparent;
  padding: 1rem 0 0.5rem 0;
  margin-bottom: 1rem;
}

.breadcrumb {
  background: transparent;
  padding: 0;
  margin: 0;
  font-size: 0.875rem;
  display: flex;
  flex-wrap: wrap;
  list-style: none;
}

.breadcrumb-item {
  color: var(--text-gray);
}

.breadcrumb-item a {
  color: var(--primary-blue);
  text-decoration: none;
  transition: color 0.2s;
}

.breadcrumb-item a:hover {
  color: var(--primary-blue-dark);
  text-decoration: underline;
}

.breadcrumb-item.active {
  color: var(--text-dark);
  font-weight: 500;
}

.breadcrumb-item+.breadcrumb-item::before {
  content: '/';
  padding: 0 0.5rem;
  color: var(--text-light);
}

/* ============================================
   NAVIGATION ACTIVE STATE
   ============================================ */
/* ============================================
   deprecated - removed active state
   ============================================ */

/* ============================================
   ACCESSIBILITY - WCAG 2.1 AA COMPLIANCE
   ============================================ */
/* Improved contrast ratios (minimum 4.5:1) */
.badge-info {
  background: #0891B2 !important;
  /* Darker cyan for better contrast */
  color: #FFFFFF !important;
}

.badge-warning {
  background: #D97706 !important;
  /* Darker amber */
  color: #FFFFFF !important;
}

.badge-success {
  background: #059669 !important;
  /* Darker green */
  color: #FFFFFF !important;
}

.badge-danger {
  background: #DC2626 !important;
  /* Darker red */
  color: #FFFFFF !important;
}

/* ============================================
   BUTTON LOADING STATES
   ============================================ */
.btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}

.btn-loading .btn-text {
  visibility: hidden;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: button-spin 0.6s linear infinite;
}

@keyframes button-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================
   ENHANCED HOVER STATES
   ============================================ */
.kpi-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.kpi-card:hover .kpi-icon {
  transform: scale(1.1);
  transition: transform 0.3s ease;
}

/* Clickable cards */
.kpi-card.clickable {
  cursor: pointer;
}

.kpi-card.clickable:active {
  transform: translateY(-2px);
}

/* ============================================
   STAGGERED ANIMATIONS
   ============================================ */
.fade-in-up:nth-child(1) {
  animation-delay: 0.1s;
}

.fade-in-up:nth-child(2) {
  animation-delay: 0.2s;
}

.fade-in-up:nth-child(3) {
  animation-delay: 0.3s;
}

.fade-in-up:nth-child(4) {
  animation-delay: 0.4s;
}

.fade-in-up:nth-child(5) {
  animation-delay: 0.5s;
}

.fade-in-up:nth-child(6) {
  animation-delay: 0.6s;
}

/* ============================================
   MOBILE OPTIMIZATIONS
   ============================================ */
@media (max-width: 768px) {
  .breadcrumb {
    font-size: 0.75rem;
  }

  .breadcrumb-item+.breadcrumb-item::before {
    padding: 0 0.25rem;
  }

  .nav-link.active {
    border-left-width: 3px !important;
  }
}