/**
 * Neogy Maps – stessi layout e colori della mappa Energy Point
 * (vedi "custom css store locator" in themes/alperia/style.css).
 * I token del tema hanno un fallback, così il plugin funziona anche da solo.
 */
.neogy-maps {
  --neogy-turchese-50: var(--alperia-turchese-secondary-50, #EFF9FB);
  --neogy-turchese-600: var(--alperia-turchese-secondary-600, #2DA0BD);
  --neogy-turchese-700: var(--alperia-turchese-secondary-700, #1D7990);
  --neogy-turchese-900: var(--alperia-turchese-secondary-900, #144754);
  --neogy-white: var(--alperia-white, #FFFFFF);
  --neogy-gray: var(--alperia-gray, #333E48);
  --neogy-gray-50: #F2F5F7;
  --neogy-gray-00: #F7F9F8;
  --neogy-gray-100: var(--alperia-gray-100, #DADFE4);
  --neogy-gray-200: var(--alperia-gray-200, #B4C6D4);
  --neogy-error: var(--alperia-error-60, #C1292E);
  --neogy-focus: var(--alperia-focus, #3F82CF);

  margin-top: 20px;
  margin-bottom: 40px;
  color: var(--neogy-gray);
}

.neogy-maps *,
.neogy-maps *::before,
.neogy-maps *::after {
  box-sizing: border-box;
}

/*********************************************************
* Pulsanti filtro (AC/DC e regioni), come le categorie
* degli Energy Point (.alperia-store-category-item)
**********************************************************/
.neogy-maps__pills-wrap {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.neogy-maps__pills {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.neogy-maps__pills-wrap--regions .neogy-maps__pills {
  margin-bottom: 40px;
}

.neogy-maps__pills-wrap--currents {
  margin-bottom: 24px;
}

.neogy-maps__pill {
  position: relative;
  margin: 0;
}

.neogy-maps__pill-radio {
  position: absolute;
  top: 0;
  left: 0;
  margin: 0;
  pointer-events: none;
  appearance: none;
}

.neogy-maps__pill-label {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--neogy-turchese-700);
  border-radius: 8px;
  color: var(--neogy-turchese-700);
  font-weight: 500;
  line-height: 130%;
  transition: all 0.3s ease-in-out;
}

.neogy-maps__pill-label svg {
  flex: 0 0 auto;
}

.neogy-maps__pill-radio:not(:checked) + .neogy-maps__pill-label:hover {
  background-color: var(--neogy-turchese-900);
  border-color: var(--neogy-turchese-900);
  color: var(--neogy-white);
}

.neogy-maps__pill-radio:focus-visible + .neogy-maps__pill-label {
  outline: 4px solid var(--neogy-focus);
}

.neogy-maps__pill-radio:checked + .neogy-maps__pill-label {
  background-color: var(--neogy-turchese-700);
  border-color: var(--neogy-turchese-700);
  color: var(--neogy-white);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/*****************************
* Layout: card + mappa
* Mobile: mappa sopra, elenco sotto (come Energy Point).
******************************/
.neogy-maps__wrapper {
  display: flex;
  flex-direction: column-reverse;
}

.neogy-maps__map {
  width: 100%;
  height: 276px;
  margin-bottom: 40px;
  border-radius: 8px;
  overflow: hidden;
  background-color: var(--neogy-turchese-50);
}

@media screen and (min-width: 767px) {
  .neogy-maps__map {
    height: 476px;
  }
}

.neogy-maps__map-notice {
  margin: 0;
  padding: 24px;
}

.neogy-maps__results {
  width: 100%;
}

/************************************************
* Ricerca CAP / provincia (come .alperia-content-search)
*************************************************/
.neogy-maps__search {
  margin-bottom: 24px;
}

.neogy-maps__search-label {
  display: inline-block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--neogy-gray);
}

.neogy-maps__search-field {
  position: relative;
}

.neogy-maps__search-input {
  display: block;
  width: 100%;
  padding: 10px 46px 10px 14px;
  font: inherit;
  color: var(--neogy-gray);
  background-color: var(--neogy-white);
  border: 1px solid var(--neogy-gray-100);
  border-radius: 8px;
  box-shadow: 0 1px 4px 0 #0C0C0D1A;
}

.neogy-maps__search-input::placeholder {
  color: var(--neogy-gray-200);
}

.neogy-maps__search-input:focus,
.neogy-maps__search-input:focus-visible {
  outline: 2px solid var(--neogy-focus);
}

.neogy-maps__search-input.has-error {
  border-color: var(--neogy-error);
}

.neogy-maps__search-reset {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border: 0;
  background: transparent;
  color: var(--neogy-turchese-700);
  cursor: pointer;
}

.neogy-maps__search-reset[hidden] {
  display: none;
}

.neogy-maps__search-reset:focus-visible {
  outline: 2px solid var(--neogy-focus);
  border-radius: 8px;
}

.neogy-maps__search-error {
  display: none;
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 130%;
  color: var(--neogy-error);
}

.neogy-maps__search-error.is-visible {
  display: block;
}

.neogy-maps__count {
  /* Non nel design: resta per gli screen reader (aria-live) */
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.neogy-maps__list-scroll {
  position: relative; /* riferimento per offsetTop delle card */
  height: 600px;
  overflow-x: hidden;
  overflow-y: auto;
  margin-left: -16px;
  margin-right: -16px;
}

.neogy-maps__list {
  list-style: none;
  margin: 0;
  padding: 0 16px 16px 16px;
}

/********
* Card
*********/
.neogy-maps__card {
  position: relative;
  padding: 24px;
  cursor: pointer;
  margin: 0 0 10px;
  background-color: var(--neogy-white);
  border-radius: 8px;
  border: 1px solid transparent;
  box-shadow: 0 16px 16px -4px rgba(12, 12, 13, 0.08);
  transition: border-color 0.3s ease-in-out;
}

.neogy-maps__card.is-active {
  border-color: var(--neogy-turchese-700);
  cursor: default;
}

/* "X": visibile solo sulla card selezionata, la riporta allo stato di default */
.neogy-maps__card-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: inline-flex;
  padding: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--neogy-turchese-700);
  cursor: pointer;
}

.neogy-maps__card-close[hidden] {
  display: none;
}

.neogy-maps__card-close:hover {
  color: var(--neogy-turchese-900);
}

.neogy-maps__card-close:focus-visible {
  outline: 2px solid var(--neogy-focus);
}

/* Colonnine dello stesso punto, una sotto l'altra */
.neogy-maps__station + .neogy-maps__station {
  margin-top: 20px;
}

.neogy-maps__station[hidden] {
  display: none;
}

/* Spazio per la "X" accanto al nome della prima colonnina */
.neogy-maps__card.is-active .neogy-maps__station:first-of-type .neogy-maps__card-header {
  padding-right: 40px;
}

.neogy-maps__card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-bottom: 12px;
}

.neogy-maps__card-heading {
  margin: 0;
  font-size: inherit;
  line-height: inherit;
}

.neogy-maps__card-title {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  font: inherit;
  font-size: 26px;
  font-weight: 500;
  line-height: 130%;
  text-transform: uppercase;
  color: var(--neogy-gray);
  cursor: pointer;
  transition: color 0.3s ease-in-out;
}

.neogy-maps__card-title:hover,
.neogy-maps__card-title:focus-visible {
  color: var(--neogy-turchese-600);
}

.neogy-maps__card-title:focus-visible,
.neogy-maps__card-toggle:focus-visible {
  outline: 2px solid var(--neogy-focus);
  outline-offset: 2px;
}

.neogy-maps__card-id {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 16px;
  background-color: var(--neogy-turchese-50);
  font-size: 16px;
  line-height: 130%;
  color: var(--neogy-gray);
}

/* Accordion "Info connettori" */
.neogy-maps__card-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  margin: 0 0 12px;
  padding: 4px 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: medium;
  font-weight: 300;
  line-height: 130%;
  color: var(--neogy-turchese-700);
  cursor: pointer;
}

.neogy-maps__card-toggle-label {
  text-decoration: underline;
  text-underline-offset: 4px;
  text-transform: uppercase;
}

.neogy-maps__card-toggle:hover .neogy-maps__card-toggle-label {
  color: var(--neogy-turchese-900);
}

/* "+" che diventa "−" da aperto */
.neogy-maps__card-toggle-icon {
  position: relative;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
}

.neogy-maps__card-toggle-icon::before,
.neogy-maps__card-toggle-icon::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 2px;
  margin-top: -1px;
  border-radius: 1px;
  background-color: currentColor;
  transition: transform 0.3s ease-in-out;
}

.neogy-maps__card-toggle-icon::after {
  transform: rotate(90deg);
}

.neogy-maps__card-toggle[aria-expanded="true"] .neogy-maps__card-toggle-icon::after {
  transform: rotate(0deg);
}

.neogy-maps__station-connectors {
  list-style: none;
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  background-color: var(--neogy-gray-00);
}

.neogy-maps__station-connectors[hidden] {
  display: none;
}

.neogy-maps__station-connector {
  margin: 0;
  padding: 2px 0;
  font-size: medium;
  line-height: 140%;
}

.neogy-maps__station-connector-label {
  font-weight: 500;
}

.neogy-maps__current {
  white-space: nowrap;
}

.neogy-maps__current svg {
  display: inline-block;
  margin-right: 4px;
  vertical-align: -0.15em;
  color: var(--neogy-turchese-700);
}

.neogy-maps__card-address {
  margin: 20px 0 0;
  font-size: 18px;
  font-weight: 300;
  line-height: 140%;
}

.neogy-maps__card-address strong {
  font-weight: 500;
}

/* Come .alperia-booking-store degli Energy Point */
.neogy-maps__directions-button {
  display: block;
  width: 100%;
  margin-top: 24px;
  padding: 12px 8px;
  border: 1px solid var(--neogy-turchese-700);
  border-radius: 8px;
  background-color: var(--neogy-white);
  color: var(--neogy-turchese-700);
  font-size: 18px;
  font-weight: 500;
  line-height: 140%;
  text-align: center;
  text-decoration: none;
  transition: all 0.3s ease-in-out;
}

.neogy-maps__directions-button:hover {
  background-color: var(--neogy-turchese-50);
  box-shadow: 0 0 0 2px var(--neogy-turchese-700);
}

.neogy-maps__directions-button:focus,
.neogy-maps__directions-button:focus-visible {
  background-color: var(--neogy-turchese-50);
  box-shadow: 0 0 0 4px var(--neogy-focus);
  outline: none;
}

/***********
* Desktop
************/
@media screen and (min-width: 1024px) {
  .neogy-maps__pills-wrap--regions .neogy-maps__pills {
    justify-content: center;
  }

  .neogy-maps__wrapper {
    flex-direction: row;
    gap: 20px;
  }

  .neogy-maps__results {
    flex: 0 0 auto;
    width: calc(33.33333333% - 10px); /* gap 20 / 2 */
    height: 700px;
    display: flex;
    flex-direction: column;
  }

  .neogy-maps__list-scroll {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
  }

  .neogy-maps__map {
    flex: 0 0 auto;
    width: calc(66.66666667% - 10px); /* gap 20 / 2 */
    height: 656px;
    margin-bottom: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .neogy-maps *,
  .neogy-maps *::before,
  .neogy-maps *::after {
    transition: none !important;
  }
}
