/* ==========================================
   VISUALISATION INTERACTIVE - FORCE DIRECTED GRAPH
   RNI France - D3.js
   ========================================== */

/* ========== SECTION FILTRES ========== */
.filtres-section {
  background: white;
  padding: 2rem 0;
  border-bottom: 1px solid #e5e7eb;
}

.filtres-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  background: #f9fafb;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.filtre-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filtre-group label {
  font-size: 0.95rem;
  color: #1e3a8a;
  font-weight: 600;
  display: block;
}

.filtre-group label i {
  margin-right: 0.5rem;
  color: #2563eb;
}

.filtre-select {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.95rem;
  color: #374151;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
}

.filtre-select:hover {
  border-color: #2563eb;
}

.filtre-select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.filtre-select option {
  padding: 0.5rem;
  font-size: 0.95rem;
}

.filtre-actions {
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.btn-filtre {
  background: linear-gradient(135deg, #2563eb, #1e3a8a);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-filtre:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.btn-filtre i {
  margin-right: 0.5rem;
}

/* ========== SECTION GRAPHE ========== */
.graphe-section {
  padding: 2rem 0 4rem 0;
  background: #f9fafb;
}

.graphe-wrapper {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 2rem;
  min-height: 800px;
}

/* Légende */
.graphe-legende {
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  height: fit-content;
  position: sticky;
  top: 100px;
}

.graphe-legende h4 {
  font-size: 1.1rem;
  color: #1e3a8a;
  margin-bottom: 1.5rem;
  font-weight: 600;
}

.graphe-legende h4 i {
  margin-right: 0.5rem;
  color: #2563eb;
}

.legende-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.legende-node {
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.legende-item span {
  font-size: 0.9rem;
  color: #374151;
  font-weight: 500;
}

.graphe-legende hr {
  margin: 1.5rem 0;
  border: none;
  border-top: 1px solid #e5e7eb;
}

.legende-info {
  font-size: 0.85rem;
  color: #6b7280;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.legende-info i {
  color: #2563eb;
  width: 16px;
}

/* Container graphe */
#graphe-container {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
  min-height: 800px;
}

#graphe-svg {
  width: 100%;
  height: 800px;
  display: block;
}

.graphe-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: #2563eb;
}

.graphe-loading i {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.graphe-loading p {
  font-size: 1.1rem;
  font-weight: 500;
}

/* Styles des nœuds et liens SVG */
.node {
  cursor: pointer;
  transition: all 0.3s ease;
}

.node:hover {
  filter: brightness(1.2);
}

.node-circle {
  stroke: white;
  stroke-width: 3;
  transition: all 0.3s ease;
}

.node:hover .node-circle {
  stroke-width: 4;
  filter: drop-shadow(0 0 8px rgba(0, 0, 0, 0.3));
}

.node-label {
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
  font-weight: 600;
  fill: #1f2937;
  text-anchor: middle;
  pointer-events: none;
  user-select: none;
}

.node-gouvernement .node-label {
  font-size: 16px;
  fill: #1e3a8a;
}

.node-secteur .node-label {
  font-size: 14px;
}

.node-projet .node-label {
  font-size: 10px;
  fill: #6b7280;
}

.link {
  stroke: #d1d5db;
  stroke-opacity: 0.6;
  stroke-width: 2;
  fill: none;
}

.link-gouvernement {
  stroke: #2563eb;
  stroke-opacity: 0.4;
  stroke-width: 3;
}

.link-secteur {
  stroke: #9ca3af;
  stroke-opacity: 0.3;
  stroke-width: 1.5;
}

/* ========== MODAL PROJET ========== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s ease;
}

.modal-overlay.active {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background: white;
  border-radius: 16px;
  max-width: 800px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  position: relative;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: #f3f4f6;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.modal-close:hover {
  background: #e5e7eb;
  transform: scale(1.1);
}

.modal-close i {
  font-size: 1.2rem;
  color: #6b7280;
}

.modal-body {
  padding: 2.5rem;
}

.modal-header {
  margin-bottom: 2rem;
  padding-right: 3rem;
}

.modal-header h2 {
  font-size: 1.75rem;
  color: #1e3a8a;
  margin-bottom: 1rem;
  line-height: 1.3;
}

.modal-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  color: white;
  font-size: 0.9rem;
  font-weight: 600;
}

.modal-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.modal-info-item {
  background: #f9fafb;
  padding: 1.25rem;
  border-radius: 10px;
  border-left: 4px solid #2563eb;
}

.modal-info-item i {
  color: #2563eb;
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  display: block;
}

.info-label {
  display: block;
  font-size: 0.85rem;
  color: #6b7280;
  margin-bottom: 0.25rem;
  font-weight: 500;
}

.info-value {
  display: block;
  font-size: 1.1rem;
  color: #1f2937;
  font-weight: 600;
}

.modal-description {
  background: #f9fafb;
  padding: 1.5rem;
  border-radius: 10px;
  border-left: 4px solid #2563eb;
}

.modal-description h3 {
  font-size: 1.1rem;
  color: #1e3a8a;
  margin-bottom: 1rem;
  font-weight: 600;
}

.modal-description p {
  font-size: 0.95rem;
  line-height: 1.7;
  color: #4b5563;
}

/* ========== NOUVELLES MODALS (GOUVERNEMENT & SECTEUR) ========== */
.modal-large {
  max-width: 1000px;
}

.stats-grid-modal {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card-modal {
  color: white;
  padding: 1.5rem;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.stat-card-modal i {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.9;
}

.stat-card-modal .stat-number {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.stat-card-modal .stat-label {
  display: block;
  font-size: 0.9rem;
  opacity: 0.9;
  font-weight: 500;
}

.categories-list {
  margin-top: 2rem;
  padding: 1.5rem;
  background: #f9fafb;
  border-radius: 10px;
}

.categories-list h3 {
  font-size: 1.1rem;
  color: #1e3a8a;
  margin-bottom: 1rem;
  font-weight: 600;
}

.category-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: white;
  border-radius: 8px;
  margin-bottom: 0.75rem;
  border-left: 4px solid;
  cursor: pointer;
  transition: all 0.3s ease;
}

.category-item:hover {
  transform: translateX(5px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.category-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.category-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.2rem;
}

.category-stats {
  text-align: right;
}

.category-stats .count {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e3a8a;
}

.category-stats .label {
  font-size: 0.85rem;
  color: #6b7280;
}

.projets-secteur-list {
  margin-top: 2rem;
}

.projets-secteur-list h3 {
  font-size: 1.1rem;
  color: #1e3a8a;
  margin-bottom: 1rem;
  font-weight: 600;
}

.projet-item-list {
  background: white;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  margin-bottom: 0.75rem;
  border-left: 4px solid #2563eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s ease;
  cursor: pointer;
  pointer-events: auto;
}

.projet-item-list:hover {
  transform: translateX(5px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.projet-item-title {
  font-weight: 600;
  color: #1e3a8a;
  margin-bottom: 0.25rem;
}

.projet-item-info {
  font-size: 0.85rem;
  color: #6b7280;
}

.projet-item-budget {
  font-size: 1.1rem;
  font-weight: 700;
  color: #059669;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1200px) {
  .graphe-wrapper {
    grid-template-columns: 1fr;
  }

  .graphe-legende {
    position: relative;
    top: 0;
  }

  .modal-large {
    max-width: 90%;
  }
}

@media (max-width: 768px) {
  .filtres-panel {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  #graphe-svg {
    height: 600px;
  }

  #graphe-container {
    min-height: 600px;
  }

  .modal-body {
    padding: 1.5rem;
  }

  .modal-header h2 {
    font-size: 1.4rem;
  }

  .modal-info-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .stats-grid-modal {
    grid-template-columns: repeat(2, 1fr);
  }

  .projet-item-list {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

@media (max-width: 480px) {
  #graphe-svg {
    height: 500px;
  }

  #graphe-container {
    min-height: 500px;
  }

  .modal-content {
    width: 95%;
    max-height: 95vh;
  }

  .stats-grid-modal {
    grid-template-columns: 1fr;
  }
}
