/**
 * Dealer Locator Shortcode Styles
 * Migrated from legacy joa theme
 *
 * @package joacamp
 */

/* ==========================================================================
   CSS Custom Properties (Variables)
   ========================================================================== */

:root {
  /* Colors */
  --joa-color-white: #ffffff;
  --joa-color-white-rgb: 255, 255, 255;
  --joa-color-dark-green: #194957;
  --joa-color-dark-green-rgb: 25, 73, 87;
  --joa-color-blue-turquoise: #4bbcce;
  --joa-color-blue-turquoise-light: #d7f4f7;
  --joa-color-blue-turquoise-light-rgb: 215, 244, 247;
  --joa-color-gray-light: #f5f5f5;
  --joa-color-gray-lighter: #fafafa;
  --joa-color-green-yellow: #e9f24b;

  /* Layout */
  --joa-content-margin: 40px;
  --joa-site-global-margin: 40px;

  /* Typography */
  --joa-fs-14: 0.875rem;
  --joa-fs-15: 0.9375rem;
  --joa-fs-16: 1rem;
  --joa-fs-20: 1.25rem;

  /* Dealer Locator specific */
  --joa-fs-dealer-marker-popup: var(--joa-fs-14);
  --joa-fs-dealer-marker-popup-title: var(--joa-fs-16);
  --joa-ln-dealer-marker-popup-title: 1.3em;
  --joa-fs-dealer-marker-popup-description: var(--joa-fs-14);
  --joa-dealer-color-marker-popup: var(--joa-color-dark-green);
  --joa-color-dealer-marker-popup-description: #666;
  --joa-dealers-list-title-fs: var(--joa-fs-16);

  /* UI */
  --joa-ui-filter-color: var(--joa-color-dark-green);
  --joa-ui-filter-bg-color: var(--joa-color-white);
  --joa-ui-filter-fs: var(--joa-fs-15);
  --joa-ui-filter-ln: 1.13333em;
  --joa-fs-ui-select: var(--joa-fs-16);
  --joa-color-ui-select-select-text: var(--joa-color-white);
  --joa-color-ui-select-select: var(--joa-color-dark-green);

  /* Button Link */
  --joa-block-button-as-link-color: var(--joa-color-dark-green);
  --joa-block-button-as-link-color-hover: var(--joa-color-blue-turquoise);
}

/* ==========================================================================
   Dealer Locator Shortcode Container
   ========================================================================== */

.dealer-locator-shortcode {
  width: 100%;
  max-width: 1248px;
  margin: 0 auto;
}

/* ==========================================================================
   Map Container
   ========================================================================== */

#leaflet-map-dealer-locator {
  position: absolute;
  width: 100%;
  height: 100%;
  margin: auto;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 1000;
}

#leaflet-map-dealer-locator-wrapper {
  position: relative;
  width: 100%;
  padding-top: 58.04%;
  min-height: 400px;
  background-color: var(--joa-color-gray-light);
}

#leaflet-wait {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: 1009;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: bold;
}

/* ==========================================================================
   Dealer Locator Main Component
   ========================================================================== */

.dealer-locator {
  margin-bottom: var(--joa-content-margin);
}

/* Tools Bar */
.dealer-locator__tools {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0;
  background-color: var(--joa-color-gray-lighter);
  padding: calc(var(--joa-site-global-margin) / 4);
}

@media (max-width: 782px) {
  .dealer-locator__tools {
    padding: calc(var(--joa-site-global-margin) / 2);
    display: block;
  }
}

.dealer-locator__tools-column {
  display: block;
}

@media (max-width: 782px) {
  .dealer-locator__tools-column {
    width: 100%;
  }

  .dealer-locator__tools-column + .dealer-locator__tools-column {
    margin-top: 0;
  }
}

/* Buttons Container */
.dealer-locator__buttons {
  display: flex;
  flex-wrap: wrap;
  margin-left: -4px;
  margin-right: -4px;
}

.dealer-locator__countries,
.dealer-locator__geolocalisation {
  padding: 4px;
}

/* Base Button */
.dealer-locator__button {
  cursor: pointer;
  text-decoration: none !important;
  display: inline-block;
  padding: 0.8em 0.5em;
  border-radius: 8px;
  transition: all 0.3s;
  font-weight: 600;
  font-size: var(--joa-ui-filter-fs);
  line-height: var(--joa-ui-filter-ln);
  color: white;
  background-color: var(--joa-ui-filter-bg-color);
  border: none;
}

/* Geolocation Button */
.dealer-locator__button--get-location {
  font-size: var(--joa-fs-ui-select);
  color: var(--joa-color-ui-select-select-text);
  background-color: black;
}

.dealer-locator__button--get-location .Icon {
  width: 12px;
  height: 19px;
  margin-right: 8px;
  vertical-align: middle;
}

/* Category Button */
.dealer-locator__button--set-category {
  padding: 0.8em 0.8em 0.8em 1.8em;
}

/* ==========================================================================
   Categories Filter
   ========================================================================== */

.dealer-locator__categories {
  display: flex;
  flex-wrap: wrap;
  margin-left: -4px;
  margin-right: -4px;
}

.dealer-locator__category {
  padding: 4px;
  cursor: pointer;
}

.dealer-locator__category:hover label:before {
  box-shadow: inset 0 0 0 2px #fff;
}

.dealer-locator__category-label {
  position: relative;
  cursor: pointer;
}

.dealer-locator__category-checkbox {
  opacity: 0.00001;
  position: relative;
  z-index: -1;
  cursor: pointer;
}

.dealer-locator__category-checkbox + label:before {
  content: "";
  display: inline-block;
  width: 27px;
  height: 27px;
  position: absolute;
  z-index: 1;
  left: -35px;
  margin: auto;
  top: 0;
  bottom: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px #fff;
  cursor: pointer;
  transition: all 0.3s;
}

.dealer-locator__category-checkbox + label:hover:before,
.dealer-locator__category-checkbox:hover + label:before,
.dealer-locator__category-checkbox:focus + label:before {
  box-shadow: inset 0 0 0 2px #fff;
}

.dealer-locator__category-checkbox + label:after {
  content: "";
  display: inline-block;
  width: 15px;
  height: 15px;
  position: absolute;
  z-index: 1;
  left: -29px;
  margin: auto;
  top: 0;
  bottom: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: all 0.3s;
}

.dealer-locator__category-checkbox:checked + label:after {
  background: #fff;
}

/* ==========================================================================
   Map Marker Popup
   ========================================================================== */

.dealer-locator__marker-popup {
  width: 100%;
  font-size: var(--joa-fs-dealer-marker-popup);
}

.dealer-locator__marker-content {
  /* min-height: calc(2 * var(--joa-content-margin)); */
  padding-right: 16px;
}

.dealer-locator__marker-title {
  font-size: var(--joa-fs-dealer-marker-popup-title);
  line-height: var(--joa-ln-dealer-marker-popup-title);
  color: var(--joa-dealer-color-marker-popup);
  font-weight: 600;
}

.dealer-locator__marker-description {
  font-size: var(--joa-fs-dealer-marker-popup-description);
  color: var(--joa-color-dealer-marker-popup-description);
  margin-top: 0.5em;
  margin-bottom: 1rem;
}

.dealer-locator__marker-button {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: var(--joa-fs-dealer-marker-popup) !important;
}

.dealer-locator__marker-button-link {
  font-size: var(--joa-fs-dealer-marker-popup) !important;
  color: white;
  width: 100%;
  background-color: black;
  border-radius: 32px;
  padding: 10px 20px;
  display: inline-block;
  text-align: center;
  text-decoration: none;
}

/* ==========================================================================
   Countries Filter (Select dropdown)
   ========================================================================== */

.dealer-locator__countries {
  position: relative;
}

.dealer-locator__countries-inner {
  position: relative;
}

.dealer-locator__countries select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: black url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8"><path fill="%23ffffff" d="M6 8L0 0h12z"/></svg>') no-repeat right 12px center;
  background-size: 12px 8px;
  border: none;
  border-radius: 8px;
  padding: 0.66666em 2.5em 0.66666em 1em;
  font-size: var(--joa-fs-ui-select);
  font-weight: 600;
  color: var(--joa-color-ui-select-select-text);
  cursor: pointer;
  min-width: 200px;
}

.dealer-locator__countries select:focus {
  outline: 2px solid var(--joa-color-blue-turquoise);
  outline-offset: 2px;
}

/* ==========================================================================
   Dealers Finder Section
   ========================================================================== */

.who-section-dealers-finder {
  --joa-fs-dealers-finder: var(--joa-fs-20);
  padding: calc(var(--joa-site-global-margin) * 1.5) 20px;
  margin-top: var(--joa-content-margin);
}

.who-section-dealers-finder__inner {
  font-size: var(--joa-fs-dealers-finder);
  max-width: 1200px;
  margin: 0 auto;
}

.who-section-dealers-finder__title {
  margin-bottom: 1.2em;
  font-size: 1.2em;
  font-weight: 600;
}

.who-section-dealers-finder__select {
  position: relative;
  display: inline-block;
  vertical-align: middle;
  width: 100%;
  max-width: 420px;
  appearance: none;
  border: none;
  background: transparent;
  font-size: 1em;
  color: inherit;
  line-height: 1.16em;
}

.who-section-dealers-finder__select:before {
  content: '';
  display: block;
  position: absolute;
  right: 42px;
  margin: auto;
  top: 0;
  bottom: 0;
  width: 20px;
  height: 12px;
  background: transparent url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="12" viewBox="0 0 20 12"><path fill="%23194957" d="M10 12L0 0h20z"/></svg>') center center / 20px 12px no-repeat;
  pointer-events: none;
}

.who-section-dealers-finder__select--is-open:before {
  transform: rotate(180deg);
}

.who-section-dealers-finder__select-option {
  position: relative;
  display: block;
  line-height: 1.3em;
  padding: 1.2em 4.3em 1.2em 1.2em;
  cursor: pointer;
  text-align: left;
  max-width: 100%;
  background-color: var(--joa-color-white);
  box-shadow: 0px 20px 30px rgba(104, 104, 104, 0.06);
}

.who-section-dealers-finder__select-option--selected {
  position: static;
  display: block;
}

.who-section-dealers-finder__select-option-list {
  position: absolute;
  z-index: 1;
  overflow: hidden;
  min-width: 100%;
  top: calc(100% - 6px);
  background-color: var(--joa-color-white);
  box-shadow: 0px 20px 30px rgba(104, 104, 104, 0.06);
  max-height: 0;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s, transform 0.3s;
  list-style: none;
  margin: 0;
  padding: 0;
}

.who-section-dealers-finder__select-option-list .who-section-dealers-finder__select-option {
  transition: all 0.3s;
  padding-top: 0.8em;
  padding-bottom: 0.8em;
}

.who-section-dealers-finder__select-option-list .who-section-dealers-finder__select-option:hover,
.who-section-dealers-finder__select-option-list .who-section-dealers-finder__select-option:focus,
.who-section-dealers-finder__select-option-list .who-section-dealers-finder__select-option:active {
  background-color: rgba(var(--joa-color-blue-turquoise-light-rgb), 0.5);
}

.who-section-dealers-finder__select-option-list-item {
  list-style: none;
}

.who-section-dealers-finder__select-option-list-item[aria-hidden="true"] {
  display: none;
}

/* Open state */
.who-section-dealers-finder__select--is-open .who-section-dealers-finder__select-option {
  display: block;
}

.who-section-dealers-finder__select--is-open .who-section-dealers-finder__select-option-list {
  max-height: 300px;
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   Dealers List Section
   ========================================================================== */

.who-section-dealers-list {
  position: relative;
  padding: var(--joa-content-margin) 0;
}

@media (max-width: 782px) {
  .who-section-dealers-list {
    overflow: hidden;
  }
}

.dealers-list {
  --joa-dealers-item-width: 33.333%;
  --joa-grid-gutter: 40px;
  --joa-grid-hover-effect-size: 28px;
  --joa-content-link-color: var(--joa-color-dark-green);

  display: flex;
  flex-wrap: wrap;
  margin-left: calc(-0.5 * var(--joa-grid-gutter));
  margin-right: calc(-0.5 * var(--joa-grid-gutter));
  margin-top: calc(-0.5 * var(--joa-grid-gutter)) !important;
  list-style: none;
  padding: 0;
}

.dealers-list a {
  text-decoration: none;
}

@media (max-width: 1000px) {
  .dealers-list {
    --joa-dealers-item-width: 50%;
  }
}

@media (max-width: 782px) {
  .dealers-list {
    --joa-dealers-item-width: 100%;
  }
}

.dealers-list__heading {
  font-size: 1.5em;
  font-weight: 600;
  color: var(--joa-color-dark-green);
  margin-bottom: var(--joa-content-margin);
}

.dealers-list__loader {
  position: absolute;
  z-index: 5;
  height: 100%;
  width: 100%;
  margin: auto;
  left: 0;
  right: 0;
  top: 0;
  display: flex;
  justify-content: center;
  background: rgba(var(--joa-color-white-rgb), 0.85);
}

.dealers-list__loader-image {
  width: 40px;
  height: 40px;
}

.dealers-list__item {
  flex-basis: var(--joa-dealers-item-width);
  padding: calc(0.5 * var(--joa-grid-gutter));
  list-style: none;
  text-align: left;
}

.dealers-list__item-title {
  display: block;
  padding-top: 0.5em;
  font-size: var(--joa-dealers-list-title-fs);
  font-weight: 600;
  margin-bottom: 0.5em;
}

.dealers-list__item-inner {
  display: flex;
  height: 100%;
  width: 100%;
  justify-content: center;
  cursor: pointer;
}

.dealers-list__item-card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  flex-direction: column;
  width: 100%;
  background-color: var(--joa-color-white);
  box-shadow: 0px 20px 30px rgba(104, 104, 104, 0.06);
  border-radius: 16px;
}

.dealers-list__item-card:before {
  content: '';
  display: block;
  position: absolute;
  margin: auto;
  box-sizing: border-box;
  width: calc(100% + var(--joa-grid-hover-effect-size));
  left: calc(-0.5 * var(--joa-grid-hover-effect-size));
  height: calc(100% + var(--joa-grid-hover-effect-size));
  top: calc(-0.5 * var(--joa-grid-hover-effect-size));
  border: 2px solid transparent;
  transform: scale(0.94);
  transition: all 0.3s;
  z-index: -1;
}

/* @media (min-width: 783px) {
  .dealers-list__item-card:hover:before,
  .dealers-list__item-card:focus:before,
  .dealers-list__item-card:focus-within:before,
  .dealers-list__item-card:active:before {
    transform: scale(1);
    border: 2px solid var(--joa-color-dark-green);
  }
} */

.dealers-list__item-card:hover .dealers-list__link,
.dealers-list__item-card:focus .dealers-list__link,
.dealers-list__item-card:focus-within .dealers-list__link,
.dealers-list__item-card:active .dealers-list__link {
  color: #E03C31 !important;
}

.dealers-list__item-content {
  padding: 2.18em;
}

.dealers-list__item-adress {
  font-size: var(--joa-fs-15);
  line-height: 1.4;
  color: #666;
}

.dealers-list__item-buttons {
  margin-top: 1em;
}

.dealers-list__button {
  margin-bottom: 0 !important;
}

.dealers-list__link {
  color: var(--joa-block-button-as-link-color);
  font-weight: 600;
  font-size: var(--joa-fs-15);
  transition: color 0.3s;
  text-decoration: none;
  position: relative;
}

.dealers-list__link:after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: #E03C31;
  transition: width 0.3s;
}

.dealers-list__item-card:hover .dealers-list__link:after,
.dealers-list__item-card:focus .dealers-list__link:after,
.dealers-list__item-card:focus-within .dealers-list__link:after,
.dealers-list__item-card:active .dealers-list__link:after {
  width: 100%;
}

/* ==========================================================================
   Leaflet Popup Overrides
   ========================================================================== */

.leaflet-popup {
  font-size: 16px;
}

.leaflet-popup .leaflet-popup-content-wrapper {
  border-radius: 0;
  box-shadow: none;
  padding: 20px;
  width: 262px;
}

.leaflet-popup .leaflet-popup-content {
  margin: 0;
  width: auto !important;
}

.leaflet-container .leaflet-popup a.leaflet-popup-close-button {
  width: 16px;
  height: 16px;
  font-size: 24px;
  line-height: 16px;
  padding: 0;
  top: 12px;
  right: 12px;
  color: var(--joa-color-dark-green);
}

/* ==========================================================================
   Responsive adjustments
   ========================================================================== */

@media (max-width: 600px) {
  .dealer-locator-shortcode {
    padding: 0 10px;
  }

  #leaflet-map-dealer-locator-wrapper {
    min-height: 300px;
    padding-top: 80%;
  }

  .dealer-locator__buttons {
    flex-direction: column;
  }

  .dealer-locator__geolocalisation,
  .dealer-locator__countries {
    width: 100%;
    padding: 4px 0;
  }

  .dealer-locator__button--get-location,
  .dealer-locator__countries select {
    width: 100%;
  }

  .dealer-locator__categories {
    margin-top: 10px;
  }
}
