/* CSS volutamente essenziale: colori, font e stile dei controlli sono ereditati dal tema WordPress. */
#store-locator,
#store-locator *,
#store-locator *::before,
#store-locator *::after {
  box-sizing: border-box;
}
#store-locator .store-locator__filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1rem;
}
#store-locator .store-locator__field {
  display: grid;
  gap: .35rem;
  min-width: 180px;
  flex: 1 1 220px;
}
#store-locator select,
#store-locator button,
#store-locator input {
  font: inherit;
}
#store-locator .store-locator__count {
  margin: 0 0 .75rem;
}
#store-locator .store-locator__table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
#store-locator .store-locator__table {
  width: 100%;
  border-collapse: collapse;
  border: 0 !important;
}
#store-locator .store-locator__table tr,
#store-locator .store-locator__table th,
#store-locator .store-locator__table td {
  border: 0 !important;
}
#store-locator th,
#store-locator td {
  text-align: left;
  vertical-align: top;
}
/* Colori forzati sulle celle, per impedire al tema WordPress di sovrascriverli. */
#store-locator .store-locator__table tbody tr,
#store-locator .store-locator__table tbody tr > td {
  background-color: #ffffff !important;
  background-image: none !important;
}
#store-locator .store-locator__table tbody tr.store-locator__row--alternate,
#store-locator .store-locator__table tbody tr.store-locator__row--alternate > td {
  background-color: #f2f2f2 !important;
  background-image: none !important;
}
#store-locator .store-locator__table tbody td:first-child {
  font-weight: 700 !important;
}
#store-locator .store-locator__table tr[hidden] {
  display: none !important;
}

/* Contrasto garantito sui link della tabella, anche in hover, a prescindere dal tema WordPress. */
#store-locator .store-locator__table a,
#store-locator .store-locator__table a:visited {
  color: #000 !important;
  text-decoration: none;
}
#store-locator .store-locator__table a:hover,
#store-locator .store-locator__table a:focus-visible {
  color: #000 !important;
  text-decoration: underline !important;
}

/* Su smartphone la tabella diventa un accordion: si vede solo il nome del
   rivenditore, i dettagli si aprono al tocco. */
@media (max-width: 767px) {
  #store-locator .store-locator__table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  #store-locator .store-locator__table,
  #store-locator .store-locator__table tbody,
  #store-locator .store-locator__table tr,
  #store-locator .store-locator__table td {
    display: block;
    width: 100%;
  }
  #store-locator .store-locator__table tr {
    margin-bottom: .75rem;
    border: 1px solid #000 !important;
    border-radius: 6px;
    overflow: hidden;
  }
  #store-locator .store-locator__table td {
    padding: .6rem .75rem;
  }
  #store-locator .store-locator__table td::before {
    content: attr(data-label) ": ";
    font-weight: 700;
  }

  /* La prima cella (nome rivenditore) è l'intestazione cliccabile dell'accordion */
  #store-locator .store-locator__table td:first-child {
    cursor: pointer;
    position: relative;
    padding-right: 2.5rem;
  }
  #store-locator .store-locator__table td:first-child::before {
    content: none;
  }
  #store-locator .store-locator__table td:first-child::after {
    content: "";
    position: absolute;
    top: 1.15rem;
    right: .9rem;
    width: .55rem;
    height: .55rem;
    border-right: 2px solid #000;
    border-bottom: 2px solid #000;
    transform: translateY(-50%) rotate(45deg);
    transition: transform .15s ease;
  }
  #store-locator .store-locator__table tr.store-locator__row--expanded td:first-child::after {
    transform: translateY(-50%) rotate(-135deg);
  }
  #store-locator .store-locator__table td:first-child:focus-visible {
    outline: 2px solid #000;
    outline-offset: -2px;
  }

  /* Dettagli nascosti finché la scheda non viene aperta */
  #store-locator .store-locator__table td:not(:first-child) {
    display: none;
  }
  #store-locator .store-locator__table tr.store-locator__row--expanded td:not(:first-child) {
    display: block;
    border-top: 1px solid #000 !important;
  }
}
