/* Variables de couleur */
:root {
  --cfd-primary: #2c3e50;
  --cfd-secondary: #3498db;
  --cfd-accent: #e74c3c;
  --cfd-light: #ecf0f1;
  --cfd-dark: #2c3e50;
  --cfd-text: #333;
  --cfd-border: #ddd;
}

/* Structure principale */
.cfd-front-container {
  display: flex;
  flex-direction: column;
  max-width: 1400px;
  margin: 1rem auto;
  padding: 0 1rem;
  gap: 1.5rem;
  font-family: "Arial", sans-serif;
}

.cfd-info-section {
  width: 100%;
  padding: 1rem;
}

/* Section carte */
.cfd-map-section {
  width: 100%;
  order: -1; /* La carte vient en premier sur mobile */
}

.cfd-map-wrapper {
  width: 100%;
  height: 100%;
  padding: 0.5rem;
  overflow: hidden;
  perspective: 1000px;
  transform-style: preserve-3d;
}

.cfd-map-wrapper svg {
  width: 100%;
  height: 100%;
  fill: #90c900;
  transform-style: preserve-3d;
}

/* Contenu par défaut */
.cfd-default-content {
  color: var(--cfd-text);
}

.cfd-default-content h2 {
  color: var(--cfd-primary);
  font-size: 1.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
}

.cfd-welcome-message {
  margin-bottom: 1.5rem;
  line-height: 1.6;
  font-size: 0.9rem;
}

.cfd-welcome-message p {
  margin-bottom: 1rem;
}

/* Section avec image et texte côte à côte */
.cfd-default-content > div[style*="display: flex"] {
  display: flex !important;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  text-align: center;
  width: 100%;
}

.cfd-default-content img {
  width: 90px !important;
  height: auto !important;
  object-fit: contain;
}

.cfd-contact-info {
  background: var(--cfd-light);
  padding: 1.25rem;
  border-radius: 8px;
  margin-top: 1.5rem;
  font-size: 0.9rem;
}

.cfd-contact-info h3 {
  color: var(--cfd-primary);
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

.cfd-contact-icon {
  font-size: 1.1rem;
}

/* Contenu dynamique */
.cfd-dynamic-content {
  color: var(--cfd-text);
}

/* Style du bouton Retour */
.cfd-back-button {
  display: none;
  margin-bottom: 1.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--cfd-accent);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: bold;
  transition: background-color 0.3s ease;
  width: 100%;
}

.cfd-back-button:hover {
  background: #c0392b;
}

.cfd-region h2,
.cfd-region h3 {
  color: var(--cfd-primary);
  font-size: 1.4rem;
  margin-bottom: 1rem;
}

.cfd-region-name {
  font-weight: bold;
}

.cfd-info-details {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  font-size: 0.9rem;
}

.cfd-info-president {
  font-weight: 900;
  color: var(--cfd-dark);
}

.cfd-info-president strong {
  font-weight: 600;
}

/* Cartes départements */
.cfd-departments-section h3 {
  color: var(--cfd-primary);
  font-size: 1.3rem;
  margin-bottom: 1rem;
}

.cfd-departments-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.cfd-dept-card {
  background: white;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  border: 1px solid var(--cfd-border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cfd-dept-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.cfd-dept-name {
  color: #000;
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
}

.cfd-dept-details {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0;
}

.cfd-dept-details p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.4;
  color: #333;
}

.cfd-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.cfd-btn {
  padding: 0.75rem 1rem;
  background-color: #90c900;
  color: white;
  border-radius: 25px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  border: none;
  cursor: pointer;
  text-align: center;
  width: 100%;
}

.cfd-btn:hover {
  background-color: #7ab000;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(144, 201, 0, 0.3);
}

.cfd-btn-site {
  background-color: #7ab000;
}

.cfd-btn-site:hover {
  background-color: #6a9e00;
}

.cfd-view-more {
  padding: 0.5rem 1rem;
  background: var(--cfd-secondary);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.85rem;
}

.cfd-view-more:hover {
  background: var(--cfd-primary);
}

/* Style des boutons dans les cartes */
.cfd-dept-details .buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.cfd-dept-details .buttons a,
.cfd-dept-details .buttons button {
  display: block;
  padding: 0.75rem;
  border-radius: 5px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  color: #fff;
  border: none;
  cursor: pointer;
  transition: background-color 0.3s ease;
  width: 100%;
  font-size: 0.85rem;
}

.cfd-btn-call {
  background-color: #28a745;
}

.cfd-btn-call:hover {
  background-color: #218838;
}

.cfd-btn-email {
  background-color: #007bff;
}

.cfd-btn-email:hover {
  background-color: #0056b3;
}

.cfd-btn-website {
  background-color: #6c757d;
}

.cfd-btn-website:hover {
  background-color: #5a6268;
}

/* Interactions SVG */
.region,
.department {
  transition: all 0.2s;
  cursor: pointer;
  stroke: #fff;
  transform-style: preserve-3d;
}

.region:hover,
.department:hover {
  fill: #def1bb !important;
  stroke-width: 1px;
  transform: translate3d(0, -2px, 2px);
}

.region.selected,
.department.selected {
  fill: #BBD675 !important;
  stroke: #fff;
  stroke-width: 1px;
  opacity: 1 !important;
}

.pulse-circle {
  transform-origin: center;
  animation: pulse2 2s infinite;
}

@keyframes pulse2 {
  0% {
    r: 6;
    opacity: 0.6;
  }
  50% {
    r: 14;
    opacity: 0;
  }
  100% {
    r: 6;
    opacity: 0.6;
  }
}

.marker.hidden {
  opacity: 0;
  pointer-events: none;
}

.pulse-circle.hidden {
  animation: none;
  display: none;
}

/* Tooltip */
.cfd-tooltip {
  position: absolute;
  background: var(--cfd-dark);
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  pointer-events: none;
  z-index: 1000;
  max-width: 150px;
}

/* ============================================
   TABLETTE (768px - 1023px)
   ============================================ */
@media (min-width: 768px) {
  .cfd-front-container {
    flex-direction: row-reverse;
  }

  .cfd-info-section {
    flex: 1;
    overflow-y: auto;
  }

  .cfd-map-section {
    flex: 1;
    order: 0; /* Remet la carte à droite */
    position: sticky;
    top: 20px;
    align-self: flex-start;
  }

  .cfd-welcome-message {
    font-size: 1rem;
  }

  .cfd-default-content > div[style*="display: flex"] {
    flex-direction: row !important;
    text-align: left;
    align-items: center;
    width: 100%;
  }

  .cfd-default-content img {
    width: 120px !important;
  }

  .cfd-region h2,
  .cfd-region h3 {
    font-size: 1.6rem;
  }

  .cfd-departments-section h3 {
    font-size: 0.75rem;
  }

  .cfd-departments-grid {
    grid-template-columns: repeat(1, 1fr);
    gap: 0.75rem;
  }

  .cfd-dept-card {
    padding: 0.75rem;
  }

  .cfd-dept-name {
    font-size: 0.6rem;
  }

  .cfd-dept-details p {
    font-size: 0.5rem;
  }

  .cfd-buttons {
    flex-direction: row;
    gap: 0.75rem;
  }

  .cfd-btn {
    width: auto;
    font-size: 0.6rem;
    padding: 0.4rem 0.8rem;
  }

  .cfd-dept-details .buttons {
    flex-direction: row;
    gap: 0.5rem;
  }

  .cfd-dept-details .buttons a,
  .cfd-dept-details .buttons button {
    font-size: 0.9rem;
    padding: 0.75rem;
  }

  .cfd-back-button {
    width: auto;
  }

  .cfd-contact-info {
    padding: 1.5rem;
    font-size: 1rem;
  }

  .cfd-contact-info h3 {
    font-size: 1.3rem;
  }

  .cfd-tooltip {
    font-size: 14px;
    max-width: 200px;
  }
}

/* ============================================
   DESKTOP (1024px et plus)
   ============================================ */
@media (min-width: 1024px) {
  .cfd-front-container {
    flex-direction: row-reverse;
  }

  .cfd-info-section {
    flex: 0 0 50%;
  }

  .cfd-map-section {
    flex: 0 0 50%;
  }

  .cfd-default-content h2 {
    font-size: 2rem;
  }

  .cfd-welcome-message {
    font-size: 1rem;
    margin-bottom: 2rem;
  }

  .cfd-default-content img {
    width: auto !important;
    max-width: 120px;
  }

  .cfd-region h2,
  .cfd-region h3 {
    font-size: 1.8rem;
  }

  .cfd-departments-section h3 {
    font-size: 1.5rem;
  }

  .cfd-departments-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
  }

  .cfd-dept-card {
    padding: 1.5rem;
  }

  .cfd-dept-name {
    font-size: 1.25rem;
  }

  .cfd-dept-details p {
    font-size: 0.9rem;
  }

  .cfd-info-details {
    font-size: 1rem;
  }

  .cfd-contact-info {
    padding: 1.75rem;
  }

  .cfd-btn{
    color: white;
    font-size: 1rem;
  }
}

/* ============================================
   TRÈS GRAND ÉCRAN (1400px et plus)
   ============================================ */
@media (min-width: 1400px) {
  
  .cfd-departments-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }
}