/**
 * Carte des communes - Mobile First
 * Structure: Mobile par défaut → Tablet (750px+) → Desktop (1000px+) → Large (1600px+)
 */

/* ==========================================================================
   BASE STYLES (Mobile par défaut)
   ========================================================================== */

.village-block-communes {
  position: relative;
  padding-bottom: 10%;
}

.village-block-communes__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4rem;
  padding: 0 2rem;
}

.village-block-communes__left {
  width: 100%;
  padding: 0;
  background-color: transparent;
  border-radius: 0;
}

/* ==========================================================================
   ACCORDÉON MOBILE
   ========================================================================== */

.village-accordion-trigger {
  display: block;
  width: 100%;
  background-color: #DFEEE7;
  border: none;
  padding: 1rem 2rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-dark);
  text-align: left;
  cursor: pointer;
  border-radius: 10px;
  position: relative;
  transition: background-color 0.3s ease;
}

.village-accordion-trigger::after {
  content: "";
  position: absolute;
  right: 2rem;
  top: 50%;
  width: 16px;
  height: 10px;
  background-image: url("../../images/carte-page-communes/arrow-black.svg");
  background-size: contain;
  background-repeat: no-repeat;
  transform: translateY(-50%) rotate(0deg);
  transition: transform 0.3s ease;
}

.village-accordion-trigger.active::after {
  transform: translateY(-50%) rotate(180deg);
}

/* ==========================================================================
   LISTE DES VILLAGES
   ========================================================================== */

.village-block-communes-list {
  max-height: 0;
  background-color: #DFEEE7;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
  margin-top: -10px;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.village-block-communes-list.open {
  max-height: 1000px;
  padding: 1rem 2rem 1.5rem;
}

.village-block-communes-list__items {
  margin-top: 1rem;
}

.village-item {
  font-weight: 700;
  text-transform: uppercase;
  border-bottom: 1px solid #becbc5;
  padding: 6px;
  line-height: 200%;
  font-size: 0.875rem;
}

.village-block-communes-list__items .village-item:last-child {
  border-bottom: none;
}

.village-item a {
  pointer-events: auto;
  cursor: pointer;
  display: block;
  padding: 0.5rem 0;
  color: #333;
  text-decoration: none;
}

.village-item a:hover {
  color: var(--color-tertiary--dark);
}

/* ==========================================================================
   CARTE ET POI (cachés en mobile)
   ========================================================================== */

.interactive-map__pois {
  display: none;
}

/* ==========================================================================
   TABLET - 750px+
   ========================================================================== */

@media (min-width: 750px) {
  .village-block-communes {
    padding-bottom: unset;
  }

  .village-block-communes__inner {
    padding: 0;
  }
}

/* ==========================================================================
   DESKTOP - 1000px+
   ========================================================================== */

@media (min-width: 1000px) {
  /* Layout principal */
  .village-block-communes {
    padding-bottom: 2rem;
  }

  .village-block-communes__inner {
    flex-direction: row;
    gap: 2rem;
  }

  .village-block-communes__left {
    width: fit-content;
    background-color: #DFEEE7;
    padding: 1rem 2rem;
    border-top-right-radius: 50px;
    border-bottom-left-radius: 50px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: unset;
  }

  /* Masquer accordéon */
  .village-accordion-trigger {
    display: none;
  }

  /* Reset liste pour desktop */
  .village-block-communes-list {
    max-height: none;
    background-color: transparent;
    border-radius: 0;
    margin-top: 0;
    padding: 0;
    display: block;
  }

  .village-block-communes-list__items {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 0.5rem;
    margin-top: 0;
  }

  .village-block-communes-list__items .village-item:nth-last-child(-n+2) {
    border-bottom: none;
  }

  /* Style villages desktop */
  .village-item {
    transition: color 0.3s ease, border-color 0.3s ease;
  }

  .village-item:hover {
    color: var(--color-tertiary--dark);
    cursor: pointer;
  }

  .village-item a {
    pointer-events: auto;
    cursor: pointer;
    padding: 0;
    color: inherit;
    display: inline;
  }

  /* Carte interactive */
  .village-block-communes__map {
    position: relative;
    width: 100%;
    display: inline-block;
  }

  .village-block-communes__map img {
    width: 100%;
    height: auto;
    display: block;
  }

  /* Container POI */
  .interactive-map__pois {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
  }

  /* Points d'intérêt */
  .village-block-communes .poi {
    position: absolute;
    width: 50px;
    height: 50px;
    background: url('../../images/carte-homepage/icon-pin.svg') no-repeat center;
    background-size: contain;
    border-radius: 50%;
    pointer-events: auto;
    opacity: 0;
    z-index: 99;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s ease, transform 0.3s ease;
    cursor: default;
  }

  .village-block-communes .poi.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2);
  }

  /* Labels POI */
  .village-block-communes .poi span {
    position: absolute;
    top: -30px;
    left: 50%;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 2px 6px;
    font-size: 0.875rem;
    border-radius: 3px;
    white-space: nowrap;
    transform: translateX(-50%);
    cursor: default;
  }

  /* Positions des POI */
  .village-block-communes .poi[data-id="angles"] { bottom: 17%; left: 17%; }
  .village-block-communes .poi[data-id="barre"] { top: 17%; left: 55%; }
  .village-block-communes .poi[data-id="berlats"] { top: 32%; left: 14%; }
  .village-block-communes .poi[data-id="cambon-et-salvergues"] { top: 51%; left: 70%; }
  .village-block-communes .poi[data-id="castanet-le-haut"] { top: 40%; left: 78%; }
  .village-block-communes .poi[data-id="esperausses"] { top: 32%; left: 8%; }
  .village-block-communes .poi[data-id="fraisse-sur-agout"] { top: 62%; left: 52%; }
  .village-block-communes .poi[data-id="gijounet"] { top: 29%; left: 21%; }
  .village-block-communes .poi[data-id="la-salvetat-sur-agout"] { top: 60%; left: 33%; }
  .village-block-communes .poi[data-id="lacapelle-escroux"] { top: 14%; left: 26%; }
  .village-block-communes .poi[data-id="lacaune-les-bains"] { top: 34%; left: 34%; }
  .village-block-communes .poi[data-id="lamontelarie"] { top: 57%; left: 21%; }
  .village-block-communes .poi[data-id="le-soulie"] { top: 78%; left: 35%; }
  .village-block-communes .poi[data-id="moulin-mage"] { top: 26%; left: 49%; }
  .village-block-communes .poi[data-id="murat-sur-vebre"] { top: 34%; left: 64%; }
  .village-block-communes .poi[data-id="nages"] { top: 45%; left: 48%; }
  .village-block-communes .poi[data-id="rosis"] { top: 51%; left: 84%; }
  .village-block-communes .poi[data-id="senaux"] { top: 12%; left: 22%; }
  .village-block-communes .poi[data-id="st-salvi-de-carcaves"] { top: 0%; left: 16%; }
  .village-block-communes .poi[data-id="viane"] { top: 17%; left: 16%; }
}

/* ==========================================================================
   LARGE DESKTOP - 1600px+
   ========================================================================== */

@media (min-width: 1600px) {
  .village-block-communes__inner {
    padding: 0;
  }

  .village-block-communes__left {
    padding: 2rem 3rem;
    border-top-right-radius: 100px;
    border-bottom-left-radius: 100px;
  }

  .village-item {
    font-size: 1rem;
  }
}
