/*
 * Widget "Siet odbornikov" - mapa ambulancii pre hpv.sk.
 * Samostatne, nezavisle od stylov webu - vsetko naskopene pod .amb-widget.
 */

.amb-widget {
  --amb-purple: #6e1e8c;
  --amb-purple-dark: #4c1462;
  --amb-purple-light: #f3e8f8;
  --amb-text: #2a1a30;
  --amb-muted: #6b5f70;
  --amb-bg: #fdecdb;
  --amb-border: #e7d9ee;

  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--amb-text);
  background: var(--amb-bg);
  padding: 0 clamp(16px, 5vw, 56px) 32px;
  max-width: 1200px;
  margin: 0 auto;
}

.amb-widget *,
.amb-widget *::before,
.amb-widget *::after {
  box-sizing: border-box;
}

.amb-title {
  font-family: 'Work Sans', sans-serif;
  margin: 0;
  padding: 0;
  text-align: center;
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 700;
  color: var(--amb-purple-dark);

}

.amb-subtitle {
  margin: 0 0 50px;
  text-align: center;
  font-size: 24px;
  color: var(--amb-text);
}

/* --- combobox --- */

.amb-search {
  position: relative;
  max-width: 420px;
  margin: 0 0 24px;
}

.amb-search-input {
  width: 100%;
  padding: 7px 44px 7px 44px;
  font-size: 16px;
  line-height: 1.3;
  color: var(--amb-text);
  background: #fff;
  border: none;
}

.amb-search-input:focus {
  outline: 3px solid var(--amb-purple);
  outline-offset: 1px;
}

.amb-search-input::placeholder {
  color: #8a7f8f;
}

.amb-search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%238a7f8f' stroke-width='1.8'%3E%3Ccircle cx='9' cy='9' r='6.25'/%3E%3Cline x1='13.7' y1='13.7' x2='18' y2='18'/%3E%3C/svg%3E");
}

.amb-search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  width: 26px;
  height: 26px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--amb-muted);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.amb-search-clear:hover {
  color: var(--amb-purple-dark);
}

.amb-search-clear:focus-visible {
  outline: 3px solid var(--amb-purple);
  outline-offset: 1px;
}

.amb-listbox {
  position: absolute;
  /* Leaflet controls/panes bezia az po z-index 1000 - musime byt nad nimi,
     inak by combobox dropdown vizualne zapadol pod mapu. */
  z-index: 1100;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--amb-border);
  box-shadow: 0 8px 24px rgba(40, 10, 50, 0.15);
}

.amb-option {
  padding: 10px 12px;
  cursor: pointer;
  font-size: 15px;
}

.amb-option.is-active,
.amb-option:hover {
  background: var(--amb-purple-light);
  color: var(--amb-purple-dark);
}

.amb-option[aria-selected="true"] {
  font-weight: 600;
}

/* --- map --- */

.amb-map {
  height: 480px;
  overflow: hidden;
  border: 1px solid var(--amb-border);
}

@media (max-width: 767px) {
  .amb-map {
    height: 320px;
  }
}

.amb-marker-icon {
  background: transparent;
  border: none;
}

.amb-marker-dot {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--amb-purple);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.amb-cluster-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(110, 30, 140, 0.25);
  border: 2px solid var(--amb-purple);
}

.amb-cluster-icon span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--amb-purple);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

/* --- leaflet popup override --- */

.amb-popup .leaflet-popup-content-wrapper {
  border-radius: 0;
  box-shadow: 0 10px 30px rgba(40, 10, 50, 0.25);
}

.amb-popup .leaflet-popup-content {
  margin: 16px 18px;
  min-width: 220px;
}

/* trojuholnik (tip) presunuty z leva-stredu (default dole v strede) na
   lavu hranu, vo vyske nazvu ambulancie - popupAnchor v JS je dolaseny tak,
   aby hrot mieril presne na znacku na mape. */
.amb-popup .leaflet-popup-tip-container {
  left: -19px;
  top: 18px;
  width: 20px;
  height: 17px;
  margin: 0;
  overflow: hidden;
}

.amb-popup .leaflet-popup-tip {
  margin: 0 0 0 13px;
}

.amb-popup-content {
  font-family: inherit;
  color: var(--amb-text);
  position: relative;
  padding-bottom: 22px;
}

.amb-popup-title {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 700;
}

.amb-popup-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}

.amb-popup-contact {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.amb-popup-content .amb-popup-row {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
}

.amb-popup-label {
  font-weight: 600;
  margin-right: 4px;
}

.amb-popup-hours {
  margin-bottom: 12px;
}

.amb-popup-hours p {
  margin: 0;
  font-size: 14px;
  white-space: pre-line;
}

.amb-popup-tel {
  white-space: pre-line;
}

.amb-popup a {
  color: var(--amb-purple);
}

.amb-popup-badge {
  position: absolute;
  right: -19px;
  bottom: -17px;
  display: inline-block;
  padding: 6px 12px;
  background: var(--amb-purple);
  color: #fff;
  border-radius: 10px 0 0 0;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* --- contact line --- */

.amb-contact {
  text-align: center;
  margin: 20px 0 8px;
  font-size: 15px;
}

.amb-contact a {
  color: var(--amb-purple-dark);
  font-weight: 600;
}

/* --- boxes --- */

.amb-boxes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 24px;
}

@media (max-width: 991px) {
  .amb-boxes {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .amb-boxes {
    grid-template-columns: 1fr;
  }
}

.amb-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--amb-border);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  color: var(--amb-text);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.amb-box:hover {
  border-color: var(--amb-purple);
}

.amb-box:focus-visible {
  outline: 3px solid var(--amb-purple-dark);
  outline-offset: 2px;
}

.amb-box-lekar {
  font-weight: 700;
}

.amb-box-nazov {
  color: var(--amb-muted);
}

.amb-box.is-active {
  background: var(--amb-purple);
  color: #fff;
}

.amb-box.is-active .amb-box-nazov {
  color: rgba(255, 255, 255, 0.85);
}
