/**
 * 🎨 DESIGN SYSTEM PROFESSIONNEL - CRM MAINTENANCE
 * Version: 2.0 - Février 2026
 * Design moderne, cohérent, accessible
 */

/* =============================================
   SYSTÈME DE COULEURS PROFESSIONNEL
   ============================================= */
:root {
  /* Palette Rouge Principal (Interventions, Urgent) */
  --red-50: #fef2f2;
  --red-100: #fee2e2;
  --red-500: #ef4444;
  --red-600: #dc2626;
  --red-700: #b91c1c;
  --red-900: #7f1d1d;
  
  /* Palette Orange (SAV, Avertissements) */
  --orange-50: #fff7ed;
  --orange-100: #ffedd5;
  --orange-500: #f97316;
  --orange-600: #ea580c;
  
  /* Palette Jaune (En attente, Validation) */
  --yellow-50: #fefce8;
  --yellow-100: #fef3c7;
  --yellow-500: #eab308;
  --yellow-600: #ca8a04;
  
  /* Palette Verte (Validé, Terminé, Succès) */
  --green-50: #f0fdf4;
  --green-100: #dcfce7;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-700: #15803d;
  
  /* Palette Bleue (Info, Installation) */
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  
  /* Palette Violette (Admin, Priorité) */
  --purple-50: #faf5ff;
  --purple-100: #f3e8ff;
  --purple-500: #a855f7;
  --purple-600: #9333ea;
  
  /* Palette Grise (Texte, Bordures) */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  
  /* Texte */
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #6b7280;
  --text-white: #ffffff;
  
  /* Backgrounds */
  --bg-page: #f9fafb;
  --bg-card: #ffffff;
  --bg-hover: #f3f4f6;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  
  /* Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  
  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
}

/* =============================================
   BADGES DE SECTION (Dashboard)
   Style: Moderne, lisible, distinctif
   ============================================= */
.dashboard-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-lg);
  font-weight: 700;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.dashboard-badge:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Badge Clients en Panne (Rouge) */
.dashboard-badge--panne {
  background: linear-gradient(135deg, var(--red-50) 0%, var(--red-100) 100%);
  color: var(--red-700);
  border-color: var(--red-200);
}

.dashboard-badge--panne:hover {
  background: linear-gradient(135deg, var(--red-100) 0%, var(--red-200) 100%);
  border-color: var(--red-300);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

/* Badge SAV (Orange) */
.dashboard-badge--sav {
  background: linear-gradient(135deg, var(--orange-50) 0%, var(--orange-100) 100%);
  color: var(--orange-700);
  border-color: var(--orange-200);
}

.dashboard-badge--sav:hover {
  background: linear-gradient(135deg, var(--orange-100) 0%, var(--orange-200) 100%);
  border-color: var(--orange-300);
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.25);
}

/* Badge Entretiens (Vert) */
.dashboard-badge--entretien {
  background: linear-gradient(135deg, var(--green-50) 0%, var(--green-100) 100%);
  color: var(--green-700);
  border-color: var(--green-200);
}

.dashboard-badge--entretien:hover {
  background: linear-gradient(135deg, var(--green-100) 0%, var(--green-200) 100%);
  border-color: var(--green-300);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.25);
}

/* Badge Validation (Jaune) */
.dashboard-badge--validation {
  background: linear-gradient(135deg, var(--yellow-50) 0%, var(--yellow-100) 100%);
  color: var(--yellow-700);
  border-color: var(--yellow-200);
}

.dashboard-badge--validation:hover {
  background: linear-gradient(135deg, var(--yellow-100) 0%, var(--yellow-200) 100%);
  border-color: var(--yellow-300);
  box-shadow: 0 4px 12px rgba(234, 179, 8, 0.25);
}

/* Badge Clients (Bleu) */
.dashboard-badge--clients {
  background: linear-gradient(135deg, var(--blue-50) 0%, var(--blue-100) 100%);
  color: var(--blue-700);
  border-color: var(--blue-200);
}

.dashboard-badge--clients:hover {
  background: linear-gradient(135deg, var(--blue-100) 0%, var(--blue-200) 100%);
  border-color: var(--blue-300);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

/* Badge Installation (Violet) */
.dashboard-badge--installation {
  background: linear-gradient(135deg, var(--purple-50) 0%, var(--purple-100) 100%);
  color: var(--purple-700);
  border-color: var(--purple-200);
}

.dashboard-badge--installation:hover {
  background: linear-gradient(135deg, var(--purple-100) 0%, var(--purple-200) 100%);
  border-color: var(--purple-300);
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.25);
}

/* Compteur dans badge */
.dashboard-badge__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.5rem;
  background: white;
  border-radius: var(--radius-md);
  font-weight: 800;
  font-size: 1rem;
  box-shadow: var(--shadow-sm);
}

/* =============================================
   BOUTONS PROFESSIONNELS
   Style: Moderne, accessible, distinctif
   ============================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Bouton Principal (Rouge) */
.btn-primary {
  background: linear-gradient(135deg, var(--red-600) 0%, var(--red-700) 100%);
  color: white;
  border-color: var(--red-700);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--red-700) 0%, var(--red-900) 100%);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.35);
}

/* Bouton Secondaire (Gris foncé, texte blanc) */
.btn-secondary {
  background: #6B7280;
  color: #ffffff;
  border-color: #4B5563;
}

.btn-secondary:hover {
  background: #4B5563;
  border-color: #374151;
}

/* Bouton Succès (Vert) */
.btn-success {
  background: linear-gradient(135deg, var(--green-500) 0%, var(--green-600) 100%);
  color: white;
  border-color: var(--green-600);
}

.btn-success:hover {
  background: linear-gradient(135deg, var(--green-600) 0%, var(--green-700) 100%);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.35);
}

/* Bouton Danger (Rouge foncé) */
.btn-danger {
  background: linear-gradient(135deg, var(--red-500) 0%, var(--red-600) 100%);
  color: white;
  border-color: var(--red-600);
}

.btn-danger:hover {
  background: linear-gradient(135deg, var(--red-600) 0%, var(--red-700) 100%);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

/* Bouton Warning (Orange) */
.btn-warning {
  background: linear-gradient(135deg, var(--orange-500) 0%, var(--orange-600) 100%);
  color: white;
  border-color: var(--orange-600);
}

.btn-warning:hover {
  background: linear-gradient(135deg, var(--orange-600) 0%, var(--orange-700) 100%);
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.35);
}

/* Bouton Info (Bleu) */
.btn-info {
  background: linear-gradient(135deg, var(--blue-500) 0%, var(--blue-600) 100%);
  color: white;
  border-color: var(--blue-600);
}

.btn-info:hover {
  background: linear-gradient(135deg, var(--blue-600) 0%, var(--blue-700) 100%);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

/* Tailles de boutons */
.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.1rem;
}

/* Bouton icon seulement */
.btn-icon {
  padding: 0.75rem;
  aspect-ratio: 1;
}

/* =============================================
   BADGES DE STATUT
   Style: Couleurs distinctes, très lisibles
   ============================================= */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.875rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.875rem;
  line-height: 1.2;
  border: 2px solid;
  white-space: nowrap;
}

/* Statut: En panne / Urgent */
.status-badge--urgent {
  background: var(--red-50);
  color: var(--red-700);
  border-color: var(--red-300);
}

/* Statut: En cours */
.status-badge--encours {
  background: var(--blue-50);
  color: var(--blue-700);
  border-color: var(--blue-300);
}

/* Statut: Planifié */
.status-badge--planifie {
  background: var(--purple-50);
  color: var(--purple-700);
  border-color: var(--purple-300);
}

/* Statut: En attente */
.status-badge--attente {
  background: var(--yellow-50);
  color: var(--yellow-700);
  border-color: var(--yellow-300);
}

/* Statut: Validé / Terminé */
.status-badge--valide {
  background: var(--green-50);
  color: var(--green-700);
  border-color: var(--green-300);
}

/* Statut: Annulé / Clôturé */
.status-badge--annule {
  background: var(--gray-100);
  color: var(--gray-700);
  border-color: var(--gray-300);
}

/* Statut: SAV */
.status-badge--sav {
  background: var(--orange-50);
  color: var(--orange-700);
  border-color: var(--orange-300);
}

/* =============================================
   CARDS MODERNES
   Style: Élégantes, espacées, hover subtil
   ============================================= */
.card-pro {
  background: white;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.card-pro:hover {
  border-color: var(--gray-300);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-pro__header {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--gray-100);
}

.card-pro__title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.card-pro__body {
  color: var(--text-secondary);
  line-height: 1.6;
}

.card-pro__footer {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 2px solid var(--gray-100);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* Card cliquable */
.card-pro--clickable {
  cursor: pointer;
}

.card-pro--clickable:hover {
  border-color: var(--red-300);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.15);
}

/* =============================================
   HEADER & NAVIGATION
   Style: Épuré, professionnel
   ============================================= */
.header-pro {
  background: white;
  border-bottom: 3px solid var(--red-600);
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.header-pro__title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--red-600);
}

.header-pro__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* =============================================
   TEXTE & TYPOGRAPHIE
   Style: Hiérarchie claire, lisible
   ============================================= */
body[data-theme="technician"],
body[data-role="TECHNICIAN"],
body[data-role="ADMIN"] {
  color: var(--text-primary) !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary) !important;
  font-weight: 700;
  line-height: 1.2;
  margin-top: 0;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

p {
  color: var(--text-secondary) !important;
  line-height: 1.6;
}

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

.text-small {
  font-size: 0.875rem;
}

/* =============================================
   TABLES PROFESSIONNELLES
   Style: Moderne, lignes alternées
   ============================================= */
.table-pro {
  width: 100%;
  border-collapse: collapse;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: none;
}

/* Thème Technicien : fond blanc */
body[data-theme="technician"] .table-pro {
  background: white !important;
}

body[data-theme="technician"] .table-pro thead {
  background: white !important;
  border-bottom: 2px solid #e5e7eb;
}

body[data-theme="technician"] .table-pro th {
  color: #111827 !important;
  background: white !important;
}

body[data-theme="technician"] .table-pro td {
  color: #111827 !important;
  background: white !important;
  border-bottom: 1px solid #f3f4f6;
}

body[data-theme="technician"] .table-pro tbody tr {
  background: white !important;
}

body[data-theme="technician"] .table-pro tbody tr:hover {
  background: #f9fafb !important;
}

/* Thème Admin : fond sombre */
body[data-theme="admin"] .table-pro {
  background: rgba(51, 65, 85, 0.5) !important;
  border: 1px solid rgba(59, 130, 246, 0.3) !important;
}

body[data-theme="admin"] .table-pro thead {
  background: rgba(30, 64, 175, 0.4) !important;
  border-bottom: 2px solid rgba(59, 130, 246, 0.4) !important;
}

body[data-theme="admin"] .table-pro th {
  color: #cbd5e1 !important;
  background: rgba(30, 64, 175, 0.4) !important;
}

body[data-theme="admin"] .table-pro td {
  color: #f1f5f9 !important;
  background: transparent !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2) !important;
}

body[data-theme="admin"] .table-pro tbody tr {
  background: transparent !important;
}

body[data-theme="admin"] .table-pro tbody tr:hover {
  background: rgba(59, 130, 246, 0.15) !important;
}

/* Styles communs */
.table-pro th {
  padding: 0.5rem 0.75rem;
  text-align: left;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: none;
  letter-spacing: 0;
}

.table-pro td {
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
}

.table-pro tbody tr:last-child td {
  border-bottom: none;
}

/* =============================================
   FORMULAIRES MODERNES
   Style: Bordures nettes, focus visible
   ============================================= */
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-size: 1rem;
  color: var(--text-primary);
  background: white;
  transition: all 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--red-600);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
}

/* =============================================
   UTILITAIRES
   ============================================= */
.bg-page {
  background: var(--bg-page) !important;
}

.bg-white {
  background: white !important;
}

.shadow-sm {
  box-shadow: var(--shadow-sm);
}

.shadow-md {
  box-shadow: var(--shadow-md);
}

.rounded-lg {
  border-radius: var(--radius-lg);
}

.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }
.p-4 { padding: var(--space-4); }
.gap-4 { gap: var(--space-4); }
