/* Styles personnalisés pour Bootstrap */
/* définition des polices et couleurs de base */
body {
  font-family: 'Segoe UI', sans-serif;
  background-color: #eaeef2;
  padding-top: 0;
  position: relative;
}

/*espacement du conteneur principal*/
main.container {
  padding-top: 3rem;
  padding-bottom: 2rem;
}

/*style des cartes et des ombres */
.card {
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  border-radius: 8px;
  margin-bottom: 20px;
}

/*style de l'en-tête avec ombre*/
header {
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  z-index: 1030;
}

/*couleur des titres dans les en-têtes de carte */
.card-header h2, 
.card-header h3 {
  margin-bottom: 0;
  color: #005a9c;
}

/* style des titres principaux avec bordure */
h2 {
  border-bottom: 2px solid #549bce;
  padding-bottom: 0.5rem;
  color: #005a9c;
}

/* style du conteneur de stratégie */
.strategy-container {
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

/* style pour l'en-tête de stratégie */
.strategy-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

/* style pour les champs de stratégie */
.strategy-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

/*style pour les sélecteurs de stratégie */
.strategy-select {
  width: 100%;
}
/* style du bouton de suppression */
.remove-strategy {
  color: #dc3545;
  border: 1px solid #dc3545;
  background: none;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
}

/* effet au survol */
.remove-strategy:hover {
  background-color: #dc3545;
  color: white;
  transform: translateY(-1px); 
  box-shadow: 0 2px 4px rgba(220, 53, 69, 0.2);
}
/* effet au clic */
.remove-strategy:active {
  transform: translateY(0);
  box-shadow: none;
}


/* style des sections principales avec ombre et espacement */
main.container > section.card {
  padding-top: 60px;
  margin-top: -85px;
  background-color: white;
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.1);
  border: none;
  overflow: visible;
  position: relative;
  margin-bottom: 8rem;
  padding-bottom: 5rem;
}

/*bordure supérieure pour toutes les sections*/
main.container > section.card {
  border-top-width: 7px;
  border-top-style: solid;
}

/*couleurs spécifiques pour chaque section*/
body main.container > section#instance-selection.card {
  border-top-color: #3498db;
  z-index: 1;
}

body main.container > section#solver-config.card {
  border-top-color: #3498db;
  z-index: 1;
}

body main.container > section#solver-results.card {
  border-top-color: #3498db;
  z-index: 1;
}

/*Ligne de séparation après chaque section */
main.container > section.card::after {
  content: '';
  position: absolute;
  bottom: -4rem;
  left: 5%;
  right: 5%;
  height: 4px;
  background: linear-gradient(to right, transparent, #aaa, transparent);
}

/*suppression de la ligne après la dernière section*/
main.container > section.card:last-child::after {
  display: none;
}

/*styles pour les en-têtes de section avec numérotation  */
main.container > section.card > .card-header {
  background: linear-gradient(to right, #f8f9fa, #ffffff);
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  display: flex;
  align-items: center;
}

/* Numérotation pour la première section */
#instance-selection > .card-header::before {
  background-color: #3498db;
  display: inline-block;
  width: 35px;
  height: 35px;
  line-height: 35px;
  text-align: center;
  color: white;
  border-radius: 50%;
  margin-right: 15px;
  font-weight: bold;
}

/*numérotation pour la deuxième section*/
#solver-config > .card-header::before {
  background-color: #3498db;
  display: inline-block;
  width: 35px;
  height: 35px;
  line-height: 35px;
  text-align: center;
  color: white;
  border-radius: 50%;
  margin-right: 15px;
  font-weight: bold;
}

/*numérotation pour la troisième section */
#solver-results > .card-header::before {
  background-color: #3498db;
  display: inline-block;
  width: 35px;
  height: 35px;
  line-height: 35px;
  text-align: center;
  color: white;
  border-radius: 50%;
  margin-right: 15px;
  font-weight: bold;
}



/* réduction de la marge pour la dernière section */
main.container > section.card:last-child {
  margin-bottom: 4rem;
}



/* style de la liste des contraintes en grille */
.constraint-list {
  max-height: 300px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
  margin-top: 0.5rem;
}

/* style des éléments de contrainte */
.constraint-item {
  display: flex;
  align-items: center;
  padding: 0.5rem;
  border-radius: 4px;
  background-color: #f9f9f9;
}

/* style des cases à cocher dans les contraintes */
.constraint-item input[type="checkbox"] {
  width: auto;
  margin-right: 0.5rem;
}

/* Masquage de la liste des contraintes */
.constraint-list.show {
  display: none;
}

/* animation des boutons au survol */
.btn:hover {
  transform: translateY(-2px);
  transition: transform 0.2s ease;
}

/*style des cases à cocher cochées */
.form-check-input:checked {
  background-color: #005a9c;
  border-color: #005a9c;
}

/* style du conteneur des stratégies */
.strategy-container {
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
  background-color: #f8f9fa;
}

/* style de l'en-tête des stratégies */
.strategy-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

/* disposition des champs de stratégie en grille */
.strategy-fields {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

/* animation du statut du solveur en succès */
#solver-status.badge.bg-success {
  animation: pulse 1.5s infinite;
}

/* animation de pulsation */
@keyframes pulse {
  0% { opacity: 0.8; }
  50% { opacity: 1; }
  100% { opacity: 0.8; }
}

/* style de l'éditeur JSON en mode avancé */
#advanced-config-json {
  font-family: monospace;
  font-size: 14px;
}

/* couleurs pour les boutons d'action spécifiques */
#view-full-timetable, #start-solver {
  background-color: #22c55e;
}

#export-solution, button[type="reset"] {
  background-color: #6b7280;
}

/* disposition des statistiques de solution en grille */
#solution-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* style des boutons dans l'en-tête des cartes */
.card-header .btn-group .btn {
  padding: 0.4rem 1rem;
  border-color: #d1e6ff;
  background-color: #f8fbff;
  transition: all 0.3s ease;
  font-weight: 500;
}

/* Animation des boutons au survol */
.card-header .btn-group .btn:hover {
  background-color: #e6f2ff;
  border-color: #005a9c;
  color: #005a9c;
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0, 90, 156, 0.15);
}

/* Adaptations pour les écrans mobiles */
@media (max-width: 768px) {
  /* Passage à une colonne pour les grilles en mode mobile */
  .constraint-list,
  .strategy-fields,
  #solution-stats {
    grid-template-columns: 1fr;
  }
  
  /* réorganisation de l'en-tête de carte en mode mobile */
  .card-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  /* Ajustement des marges des titres */
  .card-header h2 {
    margin-bottom: 0.5rem;
  }
  
  /* Ajustement des groupes de boutons */
  .card-header .btn-group {
    width: 100%;
    display: flex;
  }
  
  /* Ajustement des boutons individuels */
  .card-header .btn-group .btn {
    flex: 1;
    font-size: 0.85rem;
    padding: 0.3rem 0.5rem;
  }
  

  
  /* Ajustement du padding des sections */
  main.container > section.card {
    padding-top: 85px;
    margin-top: -60px;
    margin-bottom: 3rem;
  }
  
  /* Ajustement de la taille des indicateurs numériques */
  main.container > section.card > .card-header::before {
    width: 28px;
    height: 28px;
    line-height: 28px;
    margin-right: 10px;
    font-size: 0.9rem;
  }
}

/* Adaptations pour les très petits écrans */
@media (max-width: 576px) {
  /* Passage en colonne pour les groupes de boutons */
  .card-header .btn-group {
    flex-direction: column;
  }
  
  /*ajustement des boutons pour les petits écrans */
  .card-header .btn-group .btn {
    width: 100%;
    margin-bottom: 0.5rem;
    border-radius: 0.25rem !important;
  }
  
  /*suppression des marges droites pour les boutons*/
  .card-header .btn-group .btn:not(:last-child) {
    margin-right: 0;
  }
}

/*style pour la boîte de suggestions*/
.row.mb-3 {
  position: relative;
}


/*style du conteneur de confirmation*/
#confirmation-container {
  margin-top: 0.5rem;
}

/* style des éléments de sélection*/
.selection-item {
  background-color: #faf8f8;
  border-radius: 5px;
  padding: 10px;
  margin-bottom: 10px;
}

/*effet de survol sur les éléments de sélection */
.selection-item:hover {
  background-color: #e9ecef;
}

/*style du conteneur des éléments de sélection*/
#selection-items-container {
  max-height: 300px;
  overflow-y: auto;
  padding-right: 10px;
}

/*style des boutons d'édition et de suppression*/
.edit-selection, .remove-selection {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}

/* style commun pour toutes les sections */
.tab-pane {
  border-radius: 20px;
  background-color: white;
  padding: 50px;                
  margin: 0px 0;             
  box-shadow: 0 4px 8px rgba(0,0,0,0.1); 
  overflow: hidden;
}

/* style spécifique pour chaque section */
#selection-content,
#filtering-content,
#config-content,
#results-content {
  margin-top: 10px;           
  margin-bottom: 20px;         
  border-top: 12px solid #3498db;
}



/* Ajout d'espacement pour les éléments à l'intérieur des sections */
.card {
  margin-bottom: 30px;  
}

.card-header {
  padding: 25px;           
}

.card-body {
  padding: 30px;           
}

/* Espacement pour les groupes de formulaires */
.form-group {
  margin-bottom: 25px;        
}

/* Espacement pour les rangées */
.row {
  margin-bottom: 30px;       
}


/* Barre d'onglets principale - fond blanc qui s'étend sur toute la largeur */
.container .nav-tabs,
#main-tabs {
  width: 100%;
  background-color: white;
  border-bottom: 1px solid #dee2e6;
  padding: 0.5rem 0;
  margin: 0 !important;
  display: flex;
  justify-content: flex-start;
}

/* Alignement avec le titre "Pilotage" */
.container .nav-tabs .nav-item:first-child,
#main-tabs .nav-item:first-child {
  margin-left: 290px; 
}

/* Conteneur des onglets */
.container.mt-4.mb-3 {
  max-width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin: 0 !important;
  background-color: white;
}

/* Style des onglets individuels */
.container .nav-tabs .nav-link,
#main-tabs .nav-link {
  color: #0056b3;
  font-weight: 500;
  padding: 0.5rem 1.5rem;
  margin: 0 5px;
  border: none;
}

/* style de l'onglet actif */
.container .nav-tabs .nav-link.active,
#main-tabs .nav-link.active {
  color: #0056b3;
  font-weight: 800;
  background-color: transparent;
}

header.bg-primary {
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
  border-bottom: 0 !important;
}

/*  spécifiquement le conteneur des onglets */
.container.mt-4.mb-3,
div.container[class*="mt-"][class*="mb-"] {
  margin: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

/* forcer tous les éléments entre l'en-tête et le contenu à ne pas avoir d'espace */
body > header ~ div:not(.tab-content) {
  margin: 0 !important;
  padding: 0 !important;
}

/* forcer la suppression de tous les espaces entre éléments consécutifs */
* + * {
  margin-top: 0 !important;
}

.rules-container {
  max-height: 400px; /* hauteur fixe */
  overflow-y: auto;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 10px;
  background: #f9f9f9;
}

.rule-box {
  background: #fff;
  border: 1px solid #dee2e6;
  border-left: 4px solid #0d6efd;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 6px;
  font-family: monospace;
  white-space: pre-wrap;
  font-size: 13px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.rule-box.selected {
  background-color: #e3f2fd;
  border-left-color: #198754;
}

.rule-header {
  font-weight: bold;
  color: #0d6efd;
  margin-bottom: 5px;
  font-size: 14px;
}

.rule-content {
  font-family: monospace;
  white-space: pre-wrap;
  font-size: 13px;
}

/* JSON Coloration */
.rule-content .key     { color: #d63384; }
.rule-content .string  { color: #198754; }
.rule-content .number  { color: #fd7e14; }
.rule-content .boolean { color: #6610f2; }
.rule-content .null    { color: #6c757d; }

.table-responsive {
  max-height: 600px;
  overflow-y: auto;
}

.rule-checkbox {
  cursor: pointer;
}

tr.selected {
  background-color: rgba(0, 123, 255, 0.1) !important;
}

.badge {
  font-size: 0.8em;
  padding: 0.4em 0.6em;
}

#rules-search {
  min-width: 200px;
}

tr.inactive {
  opacity: 0.6;
  background-color: #f5f5f5 !important;
}

.table-responsive {
  max-height: 500px;
  overflow-y: auto;
}

.table thead {
  position: sticky;
  top: 0;
  background-color: white;
  z-index: 1;
  border-bottom: 2px solid #dee2e6;
}


/* ajout de la possibilité de trier les colonnes */
.sortable {
  cursor: pointer;
  position: relative;
}

.sort-icon::after {
  content: "⇵";
  opacity: 0.3;
  margin-left: 5px;
  font-size: 12px;
}

.sortable.asc .sort-icon::after {
  content: "↑";
  opacity: 1;
}

.sortable.desc .sort-icon::after {
  content: "↓";
  opacity: 1;
}

/* Garder l'en-tête lors du défilement */
.table thead {
  position: sticky;
  top: 0;
  background-color: white;
  z-index: 1;
  border-bottom: 2px solid #dee2e6;
}


/*  dans resulat.js */
:root {
  /* Couleurs */
  --white: #fff;
  --gray-100: #f8f9fa;
  --gray-200: #e9ecef;
  --gray-300: #dee2e6;
  --gray-400: #adb5bd;
  --gray-500: #6c757d;
  --gray-600: #495057;
  --gray-700: #2b2d42;
  --blue: #4361ee;
  --success: #28a745;
  --warning: #ffc107;
  --danger: #dc3545;
  
  /* Tailles */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --gap-sm: 8px;
  --gap-md: 12px;
  --gap-lg: 15px;
  
  /* Polices */
  --text-xs: 0.7rem;
  --text-sm: 0.8rem;
  --text-md: 0.9rem;
  --text-lg: 1.1rem;
  --text-xl: 1.3rem;
  --text-2xl: 1.8rem;
}

/* Structure */
.stats-wrapper {
  display: flex;
  gap: var(--gap-lg);
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  
}

.stats-column {
  flex: 1 1 48%;
  padding: var(--gap-lg);
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);

  min-width: 420px;
  max-width: 800px;
  min-height: 400px;
}


/* Titres */
.column-title {
  font-size: var(--text-lg);
  margin-bottom: 1.2rem;
  padding-bottom: var(--gap-sm);
  border-bottom: 1px solid var(--gray-300);
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
}

/* Cartes communes */
.stat-item,
.metric-card,
.indicator,
.time-card {
  display: flex;
  align-items: center;
  gap: var(--gap-md);
  padding: var(--gap-md);
  border-radius: var(--radius-md);
  background: var(--gray-100);
}

/* Colonne Résultats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap-md);
}

.stat-item i {
  font-size: var(--text-2xl);
  padding: var(--gap-sm);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.7);
}

.stat-content {
  display: flex;
  flex-direction: column;
}

.stat-content .value {
  font-size: var(--text-xl);
  font-weight: 700;
}

.stat-content .label {
  font-size: var(--text-sm);
  color: var(--gray-500);
}

/* Colonne Performance */
.performance-stats {
  display: flex;
  flex-direction: column;
  gap: var(--gap-lg);
}

.time-card {
  background: linear-gradient(135deg, var(--gray-100), var(--gray-200));
}

.card-header {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  font-size: var(--text-md);
  color: var(--gray-600);
  margin-bottom: 10px;
}

.main-value {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--gray-700);
  margin: 5px 0;
}

.time-details {
  display: flex;
  gap: var(--gap-lg);
  font-size: var(--text-sm);
  color: var(--gray-500);
}

.time-details span {
  font-weight: 500;
  color: var(--gray-600);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap-md);
}

.metric-card i {
  font-size: var(--text-xl);
  color: var(--blue);
}

.metric-value {
  font-size: var(--text-xl);
  font-weight: 700;
}

.metric-label {
  font-size: var(--text-sm);
  color: var(--gray-500);
}

.metric-detail {
  font-size: var(--text-xs);
  color: var(--gray-400);
  margin-top: 2px;
}

/* Indicateurs clés */
.key-indicators {
  display: flex;
  gap: var(--gap-md);
  margin-bottom: var(--gap-lg);
}

.indicator i {
  font-size: var(--text-2xl);
}

.indicator-value {
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: 1;
}

.indicator-label {
  font-size: var(--text-sm);
  opacity: 0.9;
}

.indicator-detail {
  font-size: var(--text-xs);
  opacity: 0.7;
  margin-top: 2px;
}

.indicator.success {
  background-color: rgba(40, 167, 69, 0.1);
  color: var(--success);
}

.indicator.efficiency {
  background-color: rgba(255, 193, 7, 0.1);
  color: var(--warning);
}

.indicator.purity {
  background-color: rgba(220, 53, 69, 0.1);
  color: var(--danger);
}

/* Responsive */
@media (max-width: 768px) {
  .stats-wrapper {
    flex-direction: column;
  }
  
  .stats-grid,
  .metrics-grid {
    grid-template-columns: 1fr;
  }
  
  .key-indicators {
    flex-direction: column;
  }
}


/**/
.select-with-search-container {
  width: 50%;
}

.select-dropdown {
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.select-option:hover {
  background-color: #f8f9fa;
}

.select-option {
  transition: background-color 0.2s;
}



/* La barre de progression */ 

.progress {
  height: 30px;
  margin: 20px 0;
  border-radius: 5px;
  background-color: #e9ecef;
}

.progress-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  transition: width 0.6s ease;
  white-space: nowrap;
  padding: 0 10px;
}

#solver-status {
  font-size: 0.9rem;
  padding: 5px 10px;
  margin-left: 10px;
}