/**
 * Contact Map Block Styles
 */

/* Contact Map Block */
.wp-block-algo-contact-map {
  position: relative;
  width: calc(100% - 4rem);
  background-color: #f1f2f2;
  border: 1px solid #08394d;
  margin: 2rem;
  border-radius: 10px;
  overflow: hidden;
}

/* Toolbar */
.wp-block-algo-contact-map .contact-map__toolbar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
  padding: 22px 26px;
  background-color: #08394d;
  border-radius: 10px;
  margin: 0 26px;
  position: absolute;
  top: 1rem;
  left: 1rem;
  right: 1rem;
  z-index: 6;
  margin: 0;
}

@media (min-width: 960px) {
  .wp-block-algo-contact-map .contact-map__toolbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.wp-block-algo-contact-map.is-view-list .contact-map__toolbar {
  position: relative;
  margin: 0 1rem 1rem;
  left: 0;
  right: 0;
  width: calc(100% - 2rem);
}

.wp-block-algo-contact-map .contact-map__title {
  margin: 0;
  font-size: 22px;
  font-weight: 500;
  color: #fff;
  line-height: 1.2;
}

.wp-block-algo-contact-map .contact-map__controls {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

@media (min-width: 960px) {
  .wp-block-algo-contact-map .contact-map__controls {
    gap: 30px;
  }
}

/* Filter dropdown */
.wp-block-algo-contact-map .contact-map__filter {
  position: relative;
  display: flex;
  align-items: center;
}

.wp-block-algo-contact-map .contact-map__filter-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 60px;
  padding: 12px 50px 12px 24px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  cursor: pointer;
  min-width: 200px;
}

.wp-block-algo-contact-map .contact-map__filter-select:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(108, 196, 189, 0.5);
}

.wp-block-algo-contact-map .contact-map__filter-select option {
  background-color: #08394d;
  color: #fff;
}

@media (min-width: 960px) {
  .wp-block-algo-contact-map .contact-map__filter-select {
    min-width: 270px;
  }
}

.wp-block-algo-contact-map .contact-map__filter-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: #fff;
}

/* View toggle */
.wp-block-algo-contact-map .contact-map__view-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wp-block-algo-contact-map .contact-map__view-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s ease;
}

.wp-block-algo-contact-map .contact-map__view-btn:hover {
  color: rgba(255, 255, 255, 0.8);
}

.wp-block-algo-contact-map .contact-map__view-btn.is-active {
  color: #fff;
}

@media (max-width: 599px) {
  .wp-block-algo-contact-map .contact-map__view-btn span {
    display: none;
  }
}

/* Map container */
.wp-block-algo-contact-map .contact-map__map-container {
  position: relative;
  display: none;
}

.wp-block-algo-contact-map .contact-map__map-container.is-active {
  display: block;
}

.wp-block-algo-contact-map .contact-map__map {
  width: 100%;
  min-height: 95vh;
  height: 500px;
}

@media (min-width: 782px) {
  .wp-block-algo-contact-map .contact-map__map {
    height: 600px;
  }
}

@media (min-width: 1280px) {
  .wp-block-algo-contact-map .contact-map__map {
    height: 700px;
  }
}

/* Popup */
.wp-block-algo-contact-map .contact-map__popup {
  position: absolute;
  top: 0;
  left: 0;
  transform: translate(-50%, -100%);
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.2);
  width: 280px;
  pointer-events: auto;
  z-index: 3;
  transition: opacity 0.2s ease, transform 0.2s ease;
  user-select: text;
}

.wp-block-algo-contact-map .contact-map__popup::after {
  content: '';
  position: absolute;
  bottom: -12px;
  font-weight: 600;
  color: #000;
  line-height: 1.2;
}

.wp-block-algo-contact-map .contact-map__popup-content {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 31px rgba(0, 0, 0, 0.15);
  padding: 20px;
  min-width: 220px;
  max-width: 280px;
}

.wp-block-algo-contact-map .contact-map__popup-region {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
  color: #000;
  line-height: 1.2;
}

.wp-block-algo-contact-map .contact-map__popup-locations {
  margin: 0;
  font-size: 14px;
  font-weight: 400;
  color: #717c7d;
  line-height: 1.3;
}

.wp-block-algo-contact-map .contact-map__popup-divider {
  height: 1px;
  background-color: #e5e5e5;
  margin: 15px 0;
}

.wp-block-algo-contact-map .contact-map__popup-name {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: #08394d;
  line-height: 1.3;
}

.wp-block-algo-contact-map .contact-map__popup-contact p,
.wp-block-algo-contact-map .contact-map__popup-contact a {
  margin: 0;
  font-size: 14px;
  font-weight: 400;
  color: #717c7d;
  line-height: 1.3;
  display: block;
}

/* List container */
.wp-block-algo-contact-map .contact-map__list-container {
  display: none;
  flex-direction: column;
  gap: 12px;
  padding: 1rem;
  background-color: #f1f2f2;
  min-height: 500px;
  max-height: 95vh;
  overflow-y: auto;
}

.wp-block-algo-contact-map .contact-map__list-container.is-active {
  display: flex;
}

.wp-block-algo-contact-map .contact-map__list-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 15px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 31px rgba(0, 0, 0, 0.15);
  padding: 20px 25px;
}

@media (min-width: 782px) {
  .wp-block-algo-contact-map .contact-map__list-item {
    grid-template-columns: 1fr auto 1fr 1fr;
    align-items: flex-start;
    gap: 30px;
    padding: 20px 40px;
  }
}

@media (min-width: 1280px) {
  .wp-block-algo-contact-map .contact-map__list-item {
    padding: 20px 65px;
  }
}

.wp-block-algo-contact-map .contact-map__list-region {
  min-width: 0;
}

.wp-block-algo-contact-map .contact-map__list-region-name {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
  color: #000;
  line-height: 1.2;
}

.wp-block-algo-contact-map .contact-map__list-region-locations {
  margin: 0;
  font-size: 14px;
  font-weight: 400;
  color: #717c7d;
  line-height: 1.3;
}

.wp-block-algo-contact-map .contact-map__list-divider {
  display: block;
  width: 100%;
  height: 1px;
  background-color: #e5e5e5;
}

@media (min-width: 782px) {
  .wp-block-algo-contact-map .contact-map__list-divider {
    width: 1px;
    height: 50px;
  }
}

.wp-block-algo-contact-map .contact-map__list-rep {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wp-block-algo-contact-map .contact-map__list-rep-label {
  font-size: 14px;
  font-weight: 600;
  color: #08394d;
  line-height: 1.3;
}

.wp-block-algo-contact-map .contact-map__list-rep-name {
  font-size: 14px;
  font-weight: 600;
  color: #08394d;
  line-height: 1.3;
}

.wp-block-algo-contact-map .contact-map__list-contact p,
.wp-block-algo-contact-map .contact-map__list-contact a {
  margin: 0;
  font-size: 14px;
  font-weight: 400;
  color: #717c7d;
  line-height: 1.3;
  display: block;
}

/* Mapbox overrides */
.wp-block-algo-contact-map .mapboxgl-ctrl-group {
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.wp-block-algo-contact-map .mapboxgl-ctrl-group button {
  width: 30px;
  height: 30px;
}

/* Pin marker (custom Mapbox marker) */
.wp-block-algo-contact-map .contact-map__pin-marker {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: rgba(8, 57, 77, 0.2); /* outer ring */
  box-shadow: 0 0 0 4px rgba(241, 242, 242, 0.4); /* subtle edge against map */
  cursor: pointer;
}

.wp-block-algo-contact-map .contact-map__pin-marker::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: #08394d; /* inner dark dot */
}
