/* ================================================================
   COMPOSANTS — Système de Design · Marque État Congolais
   ================================================================ */

/* ── BOUTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-principale);
  font-weight: 600;
  font-size: var(--text-sm);
  line-height: 1;
  padding: 10px 20px;
  border-radius: var(--radius-lg);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-normal);
  text-decoration: none;
  white-space: nowrap;
}
.btn:focus-visible {
  outline: 3px solid var(--primary-border);
  outline-offset: 2px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--text-inverse);
  box-shadow: 0 4px 12px var(--primary-glow);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px var(--primary-glow);
}

.btn-secondary {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
}
.btn-secondary:hover {
  background: var(--primary-border);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline:hover {
  background: var(--primary-light);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: rgba(0,0,0,0.04);
  color: var(--text-primary);
}

.btn-danger {
  background: linear-gradient(135deg, var(--rdc-rouge), #8B0000);
  color: var(--text-inverse);
  box-shadow: 0 4px 12px rgba(219,56,50,0.25);
}
.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(219,56,50,0.3);
}

.btn-success {
  background: linear-gradient(135deg, var(--color-success), #4a8c1a);
  color: var(--text-inverse);
  box-shadow: 0 4px 12px rgba(101,179,46,0.25);
}
.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(101,179,46,0.3);
}

.btn-sm { font-size: var(--text-xs); padding: 6px 14px; border-radius: var(--radius-md); }
.btn-lg { font-size: var(--text-base); padding: 14px 28px; border-radius: var(--radius-xl); }

.btn-icon {
  padding: 10px;
  border-radius: var(--radius-lg);
}
.btn-icon.btn-sm { padding: 6px; }
.btn-icon.btn-lg { padding: 14px; }

.btn:disabled, .btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── FORMULAIRES ── */
.form-label {
  display: block;
  font-family: var(--font-principale);
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.form-error-msg {
  font-size: var(--text-xs);
  color: var(--color-danger);
  margin-top: var(--space-1);
}

.input {
  width: 100%;
  font-family: var(--font-complement);
  font-size: var(--text-sm);
  padding: 10px 16px;
  border: 1px solid #E5E7EB;
  border-radius: var(--radius-lg);
  background: var(--bg-white);
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition-normal);
}
.input::placeholder { color: var(--text-muted); }
.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.input--error { border-color: var(--color-danger); }
.input--error:focus { box-shadow: 0 0 0 3px rgba(219,56,50,0.12); }
.input--success { border-color: var(--color-success); }
.input--success:focus { box-shadow: 0 0 0 3px rgba(101,179,46,0.12); }
.input:disabled {
  background: #F9FAFB;
  color: var(--text-muted);
  cursor: not-allowed;
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

.textarea {
  min-height: 120px;
  resize: vertical;
}

.checkbox, .radio {
  appearance: none;
  width: 18px; height: 18px;
  border: 2px solid #D1D5DB;
  background: var(--bg-white);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}
.checkbox { border-radius: var(--radius-sm); }
.radio    { border-radius: 50%; }
.checkbox:checked, .radio:checked {
  background: var(--primary);
  border-color: var(--primary);
}
.checkbox:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}
.radio:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Ccircle cx='4' cy='4' r='4' fill='white'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}
.checkbox:focus-visible, .radio:focus-visible {
  box-shadow: 0 0 0 3px var(--primary-light);
}

.toggle {
  appearance: none;
  width: 44px; height: 24px;
  background: #D1D5DB;
  border-radius: var(--radius-full);
  position: relative;
  cursor: pointer;
  transition: background var(--transition-normal);
}
.toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition-normal);
  box-shadow: var(--shadow-soft);
}
.toggle:checked {
  background: var(--primary);
}
.toggle:checked::after {
  transform: translateX(20px);
}

/* ── CARTES ── */
.card {
  background: var(--bg-white);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--elevation-1);
}
.card-hover {
  transition: all var(--transition-slow);
}
.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--elevation-2);
}
.glass-card {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-glass);
}
.stat-card {
  background: var(--bg-white);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  box-shadow: var(--elevation-1);
  transition: all var(--transition-slow);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--elevation-2);
}

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-family: var(--font-principale);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.5;
}
.badge-success { background: #D1FAE5; color: #065F46; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-danger  { background: #FEE2E2; color: #991B1B; }
.badge-info    { background: #DBEAFE; color: #1E40AF; }
.badge-neutral { background: #F3F4F6; color: #374151; }
.badge-outline {
  background: transparent;
  border: 1px solid currentColor;
}

/* ── ALERTES ── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
  font-family: var(--font-complement);
  font-size: var(--text-sm);
  border-left: 4px solid transparent;
}
.alert-info    { background: #EFF6FF; border-left-color: var(--rdc-bleu);      color: #1E40AF; }
.alert-success { background: #F0FDF4; border-left-color: var(--rdc-vert);      color: #166534; }
.alert-warning { background: #FFFBEB; border-left-color: var(--rdc-orange-vif); color: #92400E; }
.alert-error   { background: #FEF2F2; border-left-color: var(--rdc-rouge);     color: #991B1B; }

/* ── TOASTS ── */
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--elevation-3);
  min-width: 280px;
  font-family: var(--font-principale);
  font-size: var(--text-sm);
  animation: toastIn 0.3s ease;
}
@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── TABLEAUX ── */
.table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-complement);
  font-size: var(--text-sm);
}
.table th {
  font-family: var(--font-principale);
  font-weight: 600;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-align: left;
  padding: var(--space-3) var(--space-4);
  border-bottom: 2px solid #E5E7EB;
}
.table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid #F3F4F6;
  color: var(--text-primary);
}
.table tbody tr {
  transition: background var(--transition-fast);
}
.table tbody tr:hover {
  background: #F9FAFB;
}
.table-striped tbody tr:nth-child(even) {
  background: #FAFBFC;
}

/* ── NAVIGATION ── */
.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-family: var(--font-principale);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition-normal);
}
.nav-link:hover {
  background: var(--primary-light);
  color: var(--primary);
}
.nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-principale);
  font-size: var(--text-sm);
  color: var(--text-muted);
  list-style: none;
}
.breadcrumb li + li::before {
  content: '/';
  margin-right: var(--space-2);
  color: var(--text-muted);
}
.breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .current { color: var(--text-primary); font-weight: 600; }

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #E5E7EB;
}
.tab {
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-principale);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: all var(--transition-normal);
  background: none;
  border-top: none; border-left: none; border-right: none;
}
.tab:hover { color: var(--text-primary); }
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.pagination {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  list-style: none;
}
.pagination a, .pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px; height: 36px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-md);
  font-family: var(--font-principale);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition-fast);
}
.pagination a:hover { background: var(--primary-light); color: var(--primary); }
.pagination .active a {
  background: var(--primary);
  color: var(--text-inverse);
}

/* ── AVATARS ── */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-family: var(--font-principale);
  font-weight: 700;
  overflow: hidden;
  flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-xs { width: 24px; height: 24px; font-size: 10px; }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-md { width: 40px; height: 40px; font-size: 14px; }
.avatar-lg { width: 48px; height: 48px; font-size: 16px; }
.avatar-xl { width: 64px; height: 64px; font-size: 20px; }

/* ── MODALS ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  padding: var(--space-4);
}
.modal {
  background: var(--bg-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--elevation-4);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid #F3F4F6;
  font-family: var(--font-principale);
  font-weight: 700;
  font-size: var(--text-lg);
}
.modal-body {
  padding: var(--space-6);
  font-family: var(--font-complement);
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid #F3F4F6;
}

/* ── SPINNERS ── */
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
.spinner-lg { width: 40px; height: 40px; border-width: 4px; }

/* ── STEPPER ── */
.stepper {
  display: flex;
  align-items: flex-start;
  gap: 0;
}
.stepper-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
}
.stepper-step::after {
  content: '';
  position: absolute;
  top: 16px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: #E5E7EB;
}
.stepper-step:last-child::after { display: none; }
.stepper-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #E5E7EB;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-principale);
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--text-muted);
  z-index: 1;
  transition: all var(--transition-normal);
}
.stepper-label {
  font-family: var(--font-principale);
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-2);
  text-align: center;
}
.stepper-step.active .stepper-dot {
  background: var(--primary);
  color: var(--text-inverse);
}
.stepper-step.active .stepper-label { color: var(--primary); font-weight: 600; }
.stepper-step.complete .stepper-dot {
  background: var(--color-success);
  color: var(--text-inverse);
}
.stepper-step.complete::after {
  background: var(--color-success);
}

/* ── DIVIDER ── */
.divider {
  border: none;
  border-top: 1px solid #F3F4F6;
  margin: var(--space-8) 0;
}
