/* =========================================================
   CLINIC LOCATION MAP
   ========================================================= */

.live-map-box,
.live-map-box * {
  box-sizing: border-box;
}

.live-map-box {
  position: relative;
  height: 580px;
  border: 1px solid #cfdbe7;
  border-radius: 14px;
  overflow: hidden;
  background: #eef4f8;
  box-shadow: 0 18px 42px rgba(16, 42, 67, 0.16);
}

.leaflet-map {
  width: 100%;
  height: 580px;
}

/* =========================================================
   FULLSCREEN
   ========================================================= */

body.map-fullscreen-open {
  overflow: hidden;
}

.live-map-box.is-map-fullscreen {
  position: fixed;
  inset: 16px;
  z-index: 99999;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  border-radius: 16px;
  background: #ffffff;
}

.live-map-box.is-map-fullscreen .leaflet-map {
  width: 100%;
  height: 100%;
}

.live-map-box.is-map-fullscreen .map-info-panel {
  height: 100%;
}

/* =========================================================
   LEAFLET CUSTOM CONTROLS
   ========================================================= */

.map-fullscreen-control,
.map-help-leaflet-control {
  display: grid !important;
  place-items: center;
  width: 38px !important;
  height: 38px !important;
  margin-bottom: 8px;
  border: 1px solid #cfdbe7 !important;
  border-radius: 10px !important;
  background: #ffffff !important;
  color: #005ea8 !important;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(16, 42, 67, 0.14);
}

.map-fullscreen-control:hover,
.map-help-leaflet-control:hover,
.map-fullscreen-control:focus-visible,
.map-help-leaflet-control:focus-visible {
  background: #eef6fc !important;
  outline: 3px solid #8cc8ff;
  outline-offset: 2px;
}

/* =========================================================
   MARKERS
   ========================================================= */

.custom-map-marker-wrap {
  background: transparent;
  border: 0;
}

.custom-map-marker {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;

  width: 32px;
  height: 32px;

  border: 2px solid #ffffff;
  border-radius: 50%;

  background: #005ea8;
  color: #ffffff;

  font-size: 16px;
  line-height: 1;

  box-shadow:
    0 10px 22px rgba(0, 77, 128, 0.28),
    0 0 0 7px rgba(0, 94, 168, 0.14);

  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    filter 0.2s ease,
    box-shadow 0.2s ease;
}

.custom-map-marker::after {
  content: "";
  position: absolute;
  inset: -8px;
  border: 1px solid rgba(0, 94, 168, 0.28);
  border-radius: 50%;
}

.custom-map-marker i {
  pointer-events: none;
}

.custom-map-marker.is-dimmed {
  opacity: 0.65;
  transform: scale(0.88);
  filter: grayscale(0.35) saturate(0.75);
  box-shadow:
    0 4px 10px rgba(0, 77, 128, 0.18),
    0 0 0 5px rgba(0, 94, 168, 0.08);
}

.custom-map-marker.is-selected {
  opacity: 1;
  transform: scale(1.18);
  filter: none;
  z-index: 10;
  box-shadow:
    0 12px 28px rgba(0, 77, 128, 0.36),
    0 0 0 8px rgba(0, 94, 168, 0.2);
}

.custom-map-marker.is-selected::after {
  border-color: rgba(0, 94, 168, 0.55);
}

/* =========================================================
   INFO PANEL
   ========================================================= */

.map-info-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;

  width: min(430px, 94%);
  height: 100%;

  overflow: hidden;
  background: #ffffff;

  border-left: 1px solid #cfdbe7;
  box-shadow: -22px 0 44px rgba(16, 42, 67, 0.2);

  transform: translateX(100%);
  opacity: 0;
  visibility: hidden;

  transition:
    transform 0.32s ease,
    opacity 0.22s ease,
    visibility 0.32s ease;

  pointer-events: none;
}

.map-info-panel.is-visible {
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.map-info-panel__card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 100%;
  background: #ffffff;
}

.map-info-panel__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding-bottom: 1rem;
}

/* Header */

.map-info-panel__header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;

  padding: 1.5rem 4rem 1.35rem 1.5rem;

  background: linear-gradient(135deg, #004b85 0%, #006eb6 100%);
  color: #ffffff;
}

.map-info-panel__icon {
  flex: 0 0 auto;

  display: grid;
  place-items: center;

  width: 52px;
  height: 52px;

  border-radius: 14px;
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;

  font-size: 1.35rem;
}

.map-info-panel__title {
  margin: 0 0 0.5rem;
  color: #ffffff;
  font-size: 1.28rem;
  font-weight: 800;
  line-height: 1.25;
}

.map-popup__badge {
  display: inline-flex;
  align-items: center;

  padding: 0.35rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;

  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;

  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Close Button */

.map-info-panel__close {
  position: absolute;
  top: 5px;
  right: 5px;

  display: grid;
  place-items: center;

  width: 40px;
  height: 40px;
  font-size: 1rem;

  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 999px;

  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;

  cursor: pointer;
  z-index: 2;
}

.map-info-panel__close:hover {
  background: rgba(255, 255, 255, 0.24);
}

.map-info-panel__close:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 2px;
}

/* Detail Cards */

/* Detail Cards */

.map-info-panel__detail {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;

  margin: 1rem 1.5rem 0;
  padding: 1rem;

  border: 1px solid #d9e2ec;
  border-radius: 14px;

  background: #ffffff;
  color: #243b53;

  box-shadow: 0 6px 16px rgba(16, 42, 67, 0.06);

  text-align: center;
}

.map-info-panel__detail i {
  display: grid;
  place-items: center;

  width: 45px;
  height: 45px;

  border-radius: 10px;

  background: #eef6fc;
  color: #005ea8;

  font-size: 1.2rem; /* ~25% larger than .95rem */

  flex-shrink: 0;
}

.map-info-panel__detail p {
  margin: 0;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  color: #243b53;
  font-size: 0.96rem;
  line-height: 1.55;

  text-align: center;
}

.map-info-panel__street {
  display: block;
  color: #102a43;
  font-weight: 800;
}

.map-info-panel__city {
  display: block;
  margin-top: 0.15rem;
  color: #486581;
  font-weight: 600;
}

.map-info-panel__detail a {
  color: #005ea8;
  font-weight: 800;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.map-info-panel__detail a:hover {
  color: #004b85;
}

.map-info-panel__detail a:focus-visible {
  outline: 3px solid #8cc8ff;
  outline-offset: 3px;
  border-radius: 4px;
}

/* Sticky Primary Action */

.map-info-panel__actions {
  flex: 0 0 auto;
  margin: 0;
  padding: 1rem 1.5rem 1.25rem;

  background: #ffffff;
  border-top: 1px solid #d9e2ec;
  box-shadow: 0 -10px 24px rgba(16, 42, 67, 0.08);
}

.map-info-panel__link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;

  width: 100%;
  min-height: 54px;

  padding: 0.9rem 1.15rem;
  border-radius: 12px;

  background: #005ea8;
  color: #ffffff !important;

  text-align: center;
  text-decoration: none;

  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.2;

  box-shadow: 0 10px 22px rgba(0, 94, 168, 0.24);

  transition:
    background-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.map-info-panel__link:hover {
  background: #004b85;
  box-shadow: 0 12px 26px rgba(0, 94, 168, 0.3);
  transform: translateY(-1px);
}

.map-info-panel__link:focus-visible {
  outline: 3px solid #8cc8ff;
  outline-offset: 3px;
}

.map-info-panel__link:active {
  transform: translateY(0);
}

/* =========================================================
   HELP OVERLAY
   ========================================================= */

.map-help-overlay {
  position: absolute;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.map-help-overlay__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 42, 67, 0.45);
}

.map-help-overlay__panel {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  padding: 1.25rem;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 18px 42px rgba(16, 42, 67, 0.28);
}

.map-help-overlay__panel h3 {
  margin: 0 2.5rem 0.75rem 0;
  color: #102a43;
  font-size: 1.2rem;
  font-weight: 800;
}

.map-help-overlay__panel ul {
  margin: 0;
  padding-left: 1.25rem;
}

.map-help-overlay__panel li {
  margin: 0.5rem 0;
  color: #243b53;
  line-height: 1.45;
}

.map-help-overlay__close {
  position: absolute;
  top: 12px;
  right: 12px;

  display: grid;
  place-items: center;

  width: 36px;
  height: 36px;

  border: 1px solid #cfdbe7;
  border-radius: 999px;

  background: #ffffff;
  color: #102a43;

  cursor: pointer;
}

.map-help-overlay__close:hover,
.map-help-overlay__close:focus-visible {
  background: #eef6fc;
  outline: 3px solid #8cc8ff;
  outline-offset: 2px;
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 768px) {
  .map-info-panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;

    width: 100%;
    height: 68%;
    max-height: 68%;

    border-left: 0;
    border-top: 1px solid #cfdbe7;

    transform: translateY(100%);
    box-shadow: 0 -20px 42px rgba(16, 42, 67, 0.22);
  }

  .map-info-panel.is-visible {
    transform: translateY(0);
  }

  .map-info-panel__header {
    padding: 1.25rem 4rem 1.15rem 1.25rem;
  }

  .map-info-panel__detail {
    margin-right: 1.25rem;
    margin-left: 1.25rem;
  }

  .map-info-panel__actions {
    padding-right: 1.25rem;
    padding-left: 1.25rem;
  }

  .live-map-box.is-map-fullscreen {
    inset: 8px;
    border-radius: 12px;
  }
}

/* =========================================================
   ACCESSIBILITY
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  .map-info-panel,
  .map-info-panel__link,
  .custom-map-marker {
    transition: none;
  }
}

/* =========================================================
   MAP INFO PANEL
   Better alignment for untranslated clinic names/addresses
========================================================= */

/* Detail cards */
.map-info-panel__detail {
    justify-content: flex-start;
    align-items: flex-start;
    text-align: left;
}

.map-info-panel__detail p {
    align-items: flex-start;
    justify-content: flex-start;
    text-align: left;
    flex: 1;
}

/* Header */
.map-info-panel__header {
    align-items: flex-start;
}

.map-info-panel__header > div {
    flex: 1;
}

.map-info-panel__title {
    text-align: left;
}

/* Address */
.map-info-panel__street,
.map-info-panel__city {
    text-align: left;
}

/* Phone */
.map-info-panel__detail a,
.map-info-panel__detail p[dir="ltr"] {
    text-align: left;
}

/* =========================================================
   RTL
   Keep official names/addresses left aligned while
   interface labels still support RTL.
========================================================= */

html:lang(ar) .map-info-panel__header,
html:lang(fa) .map-info-panel__header,
html[dir="rtl"] .map-info-panel__header {
    direction: ltr;
}

html:lang(ar) .map-info-panel__detail,
html:lang(fa) .map-info-panel__detail,
html[dir="rtl"] .map-info-panel__detail {
    direction: ltr;
    justify-content: flex-start;
    text-align: left;
}

html:lang(ar) .map-info-panel__detail p,
html:lang(fa) .map-info-panel__detail p,
html[dir="rtl"] .map-info-panel__detail p {
    align-items: flex-start;
    justify-content: flex-start;
    text-align: left;
}

html:lang(ar) .map-info-panel__title,
html:lang(ar) .map-info-panel__street,
html:lang(ar) .map-info-panel__city,
html:lang(fa) .map-info-panel__title,
html:lang(fa) .map-info-panel__street,
html:lang(fa) .map-info-panel__city,
html[dir="rtl"] .map-info-panel__title,
html[dir="rtl"] .map-info-panel__street,
html[dir="rtl"] .map-info-panel__city {
    text-align: left;
}