/* 
 * STYLES POUR LA PAGE TERRITOIRE
 * Organisation par sections:
 * 1. Section titre principal
 * 2. Menu de navigation
 * 3. Section risque entreprise
 * 4. Section risques
 * 5. Section accompagnements
 * 6. Section aides
 * 7. Section conseils pratiques
 * 8. Styles des boutons
 * 9. Media queries pour responsive
 */

/* -----------------------------------------------------
    2. Section titre principal
    ----------------------------------------------------- */
.titre-principal {
  text-align: center;
  padding: 40px 0;
  margin-bottom: 0 !important;
}

.titre-principal h1 {
  margin-bottom: 0 !important;
}

/* -----------------------------------------------------
    3. Menu de navigation
    ----------------------------------------------------- */
.menu-navigation {
  padding: 0;
  position: relative;
}

.menu-nav-wrapper {
  display: flex;
  justify-content: space-around;
  background-color: var(--primary-color);
  border-radius: 8px;
  padding: 0;
  /* Correction de la valeur manquante */
}

/* Style général des liens de navigation */
.menu-nav-wrapper .nav-item {
  color: var(--white);
  text-decoration: none;
  padding: 15px 20px;
  display: inline-block;
  font-weight: 500;
  position: relative;
  transition: all 0.3s ease;
}

.menu-nav-wrapper .nav-item:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Styles du sous-menu */
.menu-nav-wrapper .nav-item-with-submenu {
  position: relative;
}

/* Indicateur de sous-menu (flèche) */
.submenu-indicator {
  font-size: 10px;
  margin-left: 5px;
  display: inline-block;
  transition: transform 0.3s ease;
}

.nav-item-with-submenu:hover .submenu-indicator {
  transform: rotate(180deg);
}

/* Conteneur du sous-menu */
.menu-nav-wrapper .submenu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  z-index: 1000;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  background-color: var(--primary-color);
  border-radius: 0 0 8px 8px;
  overflow: hidden;
}

/* Affichage du sous-menu au survol (desktop) */
.menu-nav-wrapper .nav-item-with-submenu:hover .submenu {
  display: block;
}

/* Liens du sous-menu */
.menu-nav-wrapper .submenu a {
  color: var(--white);
  padding: 12px 15px;
  text-decoration: none;
  display: block;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.menu-nav-wrapper .submenu a:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* -----------------------------------------------------
    4. Section risque entreprise
    ----------------------------------------------------- */
.risque-entreprise {
  padding: 50px 0;
}

.risque-entreprise .row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -15px;
}

.risque-entreprise .col-md-6 {
  flex: 0 0 50%;
  max-width: 50%;
  padding: 0 15px;
}

/* Carte région */
.carte-region {
  position: relative;
  text-align: center;
  margin: 20px 0;
}

.carte-region img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin-bottom: 20px;
}

/* -----------------------------------------------------
    5. Section risques
    ----------------------------------------------------- */
.risques-section {
  position: relative;
  padding: 60px 0;
}

/* -----------------------------------------------------
    6. Section accompagnements
    ----------------------------------------------------- */

.accompagnements-section {
  position: relative;
  padding: 60px 0;
  background-color: var(--primary-color);
  color: var(--text-color);
}

/* Couleur du texte selon l'état de scroll et le device */
.territoire-page {
  color: var(--text-color);
  /* Noir par défaut sur desktop */
}

/* Sections spécifiques avec fond coloré gardent le texte blanc */
.accompagnements-section {
  color: white !important;
}

/* Contenu de la section accompagnements - passer au-dessus de la décoration */
.accompagnements-section .container {
  position: relative;
  z-index: 2;
}

/* -----------------------------------------------------
    7. Section aides
    ----------------------------------------------------- */
.aides-disposition {
  position: relative;
  padding: 60px 0;
  background-color: #f9f9f9;
}

/* Décoration vectorielle */
.left-decoration {
  position: absolute;
  bottom: 0;
  background-image: url("../assets/images/vector-territoire.svg");
  background-repeat: no-repeat;
  background-size: contain;
  z-index: 1;
}

.aides-row {
  display: flex;
  gap: 40px;
  z-index: 2;
  position: relative;
  justify-content: center;
  align-items: center;
}

.aides-left {
  width: 100%;
}

.aides-right {
  width: 100%;
}

.aides-left h2 {
  margin-bottom: 1.5rem;
}

.intro-aides {
  font-weight: 400;
  line-height: 1.6;
  margin-bottom: 30px;
}

/* Accordéon des aides */
.aides-accordion {
  margin-top: 20px;
}

.aide-item {
  background-color: var(--white);
  color: var(--text-color);
  margin-bottom: 10px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.aide-header {
  padding: 30px;
  background-color: var(--white);
  display: flex;
  gap: 2px;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.aide-header h3 {
  margin: 0;
  font-size: 1.1rem !important;
  font-weight: 600;
}

/* Icône +/- pour l'accordéon */
.toggle-icon {
  width: 20px;
  height: 20px;
  position: relative;
  margin-left: 10px;
}

.toggle-icon:before,
.toggle-icon:after {
  content: "";
  position: absolute;
  background-color: var(--primary-color);
  transition: transform 0.3s ease;
}

.toggle-icon:before {
  width: 20px;
  height: 2px;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
}

.toggle-icon:after {
  width: 2px;
  height: 20px;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
}

.aide-item.open .toggle-icon:after {
  transform: translateX(-50%) rotate(90deg);
}

.aide-content {
  padding: 0;
  max-height: 0;
  overflow: hidden;
}

.aide-item.open .aide-content {
  padding: 0 30px 30px;
  max-height: 1000px;
}

/* -----------------------------------------------------
    8. Section conseils pratiques
    ----------------------------------------------------- */
.fiches-pratiques-section {
  padding: 50px 0;
}

/* Header de section avec titre et lien voir tout */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.section-header h2 {
  margin: 0;
  flex: 1;
}

.voir-tout-link {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
  font-size: 16px;
  transition: all 0.3s ease;
  position: relative;
}

.voir-tout-link:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.voir-tout-link:after {
  content: "→";
  margin-left: 5px;
  transition: transform 0.3s ease;
}

.voir-tout-link:hover:after {
  transform: translateX(3px);
}

.conseils-pratiques {
  padding: 50px 0;
}

/* Système d'onglets */
.tabs-nav {
  display: flex;
  margin-bottom: 30px;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 5px;
}

.tab-link {
  padding: 10px 20px;
  background-color: #f0f0f0;
  text-decoration: none;
  color: var(--text-color);
  border-radius: 25px;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.3s ease;
  white-space: nowrap;
  border: none;
  cursor: pointer;
}

.tab-link:hover {
  opacity: 0.8;
  color: unset !important;
}

.tab-link.active {
  color: var(--white);
  background-color: var(--accent-color);
}

.tab-link.active:hover {
  color: white !important;
}

/* Contenu des onglets */
.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Grille des fiches */
.fiches-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.fiche-item {
  border: 1px solid var(--grey);
  padding: 20px;
  border-radius: 10px;
  background-color: var(--white);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.fiche-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.fiche-item h4 {
  margin: 0 0 15px 0;
  font-size: 16px;
  font-weight: 500;
  display: flex;
  align-items: center;
}

.fiche-item h4:before {
  content: "";
  display: inline-block;
  width: 24px;
  height: 24px;
  margin-right: 10px;
  background-color: var(--primary-color);
  mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14 2H6C4.9 2 4 2.9 4 4V20C4 21.1 4.9 22 6 22H18C19.1 22 20 21.1 20 20V8L14 2ZM16 18H8V16H16V18ZM16 14H8V12H16V14ZM13 9V3.5L18.5 9H13Z"/></svg>');
  -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14 2H6C4.9 2 4 2.9 4 4V20C4 21.1 4.9 22 6 22H18C19.1 22 20 21.1 20 20V8L14 2ZM16 18H8V16H16V18ZM16 14H8V12H16V14ZM13 9V3.5L18.5 9H13Z"/></svg>');
  mask-repeat: no-repeat;
  -webkit-mask-repeat: no-repeat;
  mask-size: contain;
  -webkit-mask-size: contain;
}

.fiche-actions {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

/* Message quand aucune fiche disponible */
.no-fiches {
  padding: 20px;
  background-color: #f9f9f9;
  border-radius: 10px;
  text-align: center;
  font-style: italic;
  color: #757575;
}

/* -----------------------------------------------------
    9. Styles des boutons
    ----------------------------------------------------- */
.btn-carte,
.btn-en-savoir-plus,
.btn-voir,
.btn-telecharger {
  align-self: flex-start;
  background-color: var(--primary-color);
  color: white;
  text-decoration: none;
  padding: 8px 20px;
  border-radius: 25px;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.3s ease;
  text-transform: uppercase;
  margin-top: auto;
  -webkit-border-radius: 25px;
  -moz-border-radius: 25px;
  -ms-border-radius: 25px;
  -o-border-radius: 25px;
}

@media (max-width: 768px) {
  .btn-carte,
  .btn-en-savoir-plus,
  .btn-voir,
  .btn-telecharger {
    align-self: center;
    text-align: center;
    width: 100%;
    display: block;
  }
}


/* Style du bouton carte */
.btn-carte {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  margin: 10px 0;
}

.btn-carte::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-right: 10px;
  background-color: white;
  mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20.5 3l-.16.03L15 5.1 9 3 3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1 5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5zM10 5.47l4 1.4v11.66l-4-1.4V5.47zm-5 .99l3-1.01v11.7l-3 1.16V6.46zm14 11.08l-3 1.01V6.86l3-1.16v11.84z"/></svg>');
  -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20.5 3l-.16.03L15 5.1 9 3 3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1 5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5zM10 5.47l4 1.4v11.66l-4-1.4V5.47zm-5 .99l3-1.01v11.7l-3 1.16V6.46zm14 11.08l-3 1.01V6.86l3-1.16v11.84z"/></svg>');
  mask-repeat: no-repeat;
  -webkit-mask-repeat: no-repeat;
  mask-size: contain;
  -webkit-mask-size: contain;
}

/* Style bouton télécharger */
.btn-telecharger {
  display: flex;
  align-items: center;
  background-color: var(--accent-color);
}

/* Style bouton en savoir plus */
.btn-en-savoir-plus::before {
  content: "+";
  margin-right: 10px;
  font-weight: bold;
  font-size: 1rem;
  line-height: 1;
}

/* Style des boutons d'action dans les fiches */
.btn-voir,
.btn-telecharger {
  padding: 8px 15px;
  font-size: 12px;
  text-align: center;
  flex: 1;
  align-items: center;
  display: flex;
  justify-content: center;
}

/* -----------------------------------------------------
    10. Media queries pour responsive
    ----------------------------------------------------- */
@media (max-width: 768px) {

  /* Menu navigation version mobile */
  .menu-nav-wrapper {
    flex-direction: column;
  }

  .menu-nav-wrapper .nav-item {
    padding: 12px 15px;
    width: 100%;
    box-sizing: border-box;
  }

  /* Correction du sousmenu en version mobile */
  .menu-nav-wrapper .nav-item-with-submenu {
    position: static;
    /* Important: permet d'éviter que le sousmenu se superpose */
  }

  .menu-nav-wrapper .submenu {
    position: static;
    width: 100%;
    box-shadow: none;
    border-radius: 0;
    background-color: rgba(0, 0, 0, 0.1);
  }

  /* Cache le hover sur mobile et utilise uniquement la classe .open */
  .menu-nav-wrapper .nav-item-with-submenu:hover .submenu {
    display: none;
  }

  .menu-nav-wrapper .nav-item-with-submenu.open .submenu {
    display: block;
  }

  .menu-nav-wrapper .submenu a {
    padding-left: 30px;
    /* Indentation pour montrer la hiérarchie */
  }

  /* Header de section responsive */
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .voir-tout-link {
    font-size: 14px;
  }

  /* Les autres sections en responsive */
  .risque-entreprise .row {
    flex-direction: column;
  }

  .risque-entreprise .col-md-6 {
    flex: 0 0 100%;
    max-width: 100%;
    margin-bottom: 30px;
  }

  .intro-risques {
    max-width: 100%;
  }

  /* Section aides en responsive */
  .aides-row {
    flex-direction: column;
    gap: 0px;
  }

  /* Fiches en responsive */
  .fiches-wrapper {
    grid-template-columns: 1fr;
  }

  .fiche-actions {
    flex-direction: column;
  }
}

/* -----------------------------------------------------
   Styles pour la grille d'accompagnements
   ----------------------------------------------------- */

.accompagnements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
  margin-top: 30px;
}

.accompagnement-card {
  background-color: #ffffff;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  padding: 25px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.accompagnement-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.accompagnement-card h3 {
  margin-top: 0;
  margin-bottom: 15px;
  font-size: 20px;
  color: #333;
  font-weight: 600;
}

.accompagnement-card .accompagnement-description {
  margin-bottom: 20px;
  flex-grow: 1;
  font-size: 15px;
  line-height: 1.5;
  color: #666;
}

.accompagnement-card .en-savoir-plus {
  align-self: flex-start;
  background-color: var(--primary-color);
  color: white;
  text-decoration: none;
  padding: 8px 20px;
  border-radius: 25px;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.3s ease;
  text-transform: uppercase;
  margin-top: auto;
  -webkit-border-radius: 25px;
  -moz-border-radius: 25px;
  -ms-border-radius: 25px;
  -o-border-radius: 25px;
}

@media (max-width: 768px) {
  .accompagnement-card .en-savoir-plus {
    align-self: center;
    text-align: center;
    width: 100%;
    display: block;
  }
}

.accompagnement-card .en-savoir-plus:hover {
  background-color: #2c4a8e;
  color: white;
  text-decoration: none;
}

/* Responsive pour la grille d'accompagnements */
@media (max-width: 768px) {

  .accompagnement-card .en-savoir-plus {
    align-self: center;
    justify-content: center;
    width: 100%;
  }
  .accompagnements-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .accompagnement-card {
    padding: 20px;
  }
}