/* -------------------------------------------------
   Header overlay safety - keep header above Leaflet
------------------------------------------------- */
header,
.site-header,
#masthead {
  position: relative;
  z-index: 9999;
}

#map,
.leaflet-container {
  position: relative;
  z-index: 1;
}

/* Optional: only if your homepage header overlays content */
.ferrymap-home {
  padding-top: 90px; /* tweak to your header height */
}
@media (max-width: 768px) {
  .ferrymap-home {
    padding-top: 110px;
  }
}
.map-operator-control {
  display: none !important;
}
/* Astra page builder padding - remove it only on pages that render [ferry_map] */
body.ferrymap-has-home-map #primary.site-main,
body.ferrymap-has-home-map #primary .site-main > article {
  padding-top: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}
/* -------------------------------------------------
   Map sizing
------------------------------------------------- */
#map {
  width: 100%;
  height: 100vh;
  margin: 0;
  padding: 0;
}

@media (max-width: 768px) {
  #map {
    height: 66vh;
  }
}

/* -------------------------------------------------
   Route styles
------------------------------------------------- */
.route-active {
  stroke: #004080;
  stroke-width: 2;
  opacity: 1;
}

.route-hover {
  stroke: #0056b3;
  stroke-width: 2;
  opacity: 1;
}

.route-abandoned {
  stroke: grey;
  stroke-width: 2;
  stroke-dasharray: 4;
  opacity: 1;
  z-index: 300;
}
.route-abandoned:hover {
  stroke: darkgrey;
  stroke-width: 2.5;
  opacity: 1;
}

/* Operator background network lines */
.route-operator-background {
  stroke: #0a1927;
  stroke-width: 1.2;
  opacity: 0.4;
  pointer-events: none;
}

/* Keep markers above lines */
.leaflet-pane.leaflet-overlay-pane {
  z-index: 400;
}
.leaflet-pane.leaflet-marker-pane {
  z-index: 600;
}

/* -------------------------------------------------
   Marker styles
------------------------------------------------- */
.marker-default {
  fill: #0056b3;
  stroke: #000000;
  stroke-width: 2;
  fill-opacity: 1;
}

.marker-grey {
  fill: #d3d3d3;
  stroke: #000000;
  stroke-width: 2;
  fill-opacity: 1;
  transform-origin: center;
}

.marker-active {
  fill: red;
  stroke: #000000;
  stroke-width: 2;
  fill-opacity: 1;
}

/* Prevent scaling/transform on hover */
.marker-default:hover,
.marker-grey:hover,
.marker-active:hover {
  transform: none;
}

/* -------------------------------------------------
   Leaflet popup base
------------------------------------------------- */
.leaflet-popup {
  margin-bottom: 10px;
}

.leaflet-popup-content-wrapper {
  background-color: #edf5fd;
  border: none;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  padding: 0;
  margin-top: -5px;
  min-width: 240px;
}

.leaflet-popup-content {
  padding: 3px 5px;
  color: #ffffff;
  font-size: 10px;
}

/* Hide popup tip */
.leaflet-popup-tip,
.leaflet-popup-tip-container {
  display: none;
  background: none;
}

/* Close button */
.leaflet-container a.leaflet-popup-close-button {
  color: #000000;
  background: rgba(0, 0, 0, 0);
  font-size: 16px;
  line-height: 16px;
  border: none;
  cursor: pointer;
  opacity: 1;
  filter: none;
  position: absolute;
  top: 8px;
  right: -2px;
  border-radius: 0 4px 4px 0;
  transition: font-weight 0.2s ease;
}
.leaflet-container a.leaflet-popup-close-button:hover {
  font-weight: bold;
  color: #000000;
}
.leaflet-container a.leaflet-popup-close-button:focus {
  outline: none;
}

/* Zoom controls - no underline */
.leaflet-control-zoom-in,
.leaflet-control-zoom-out,
.leaflet-control-zoom-in:hover,
.leaflet-control-zoom-out:hover {
  text-decoration: none;
}

/* Popup mobile */
@media (max-width: 600px) {
  .leaflet-popup-content-wrapper {
    width: 200px;
  }
  .leaflet-popup-content {
    font-size: 12px;
  }
}

/* -------------------------------------------------
   Custom popup layout (your popup HTML)
------------------------------------------------- */
.popup-container {
  font-family: sans-serif;
  font-size: 14px;
  max-width: 340px;
}

.popup-header {
  display: flex;
  align-items: center;
  margin: 5px 0 15px;
}

.popup-anchor-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  margin-right: 10px;
  margin-left: -15px;
  margin-top: 10px;
  box-shadow: 0 4px 8px rgba(94, 89, 89, 0.3);
}

.popup-header-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.popup-label {
  color: #8b8b8b;
  font-size: 11px;
  text-transform: uppercase;
  margin-top: 10px;
  margin-bottom: 2px;
}

.popup-title {
  font-weight: bold;
  font-size: 16px;
  color: #000000;
}

.popup-operators {
  margin-top: 8px;
}

.popup-separator {
  font-size: 12px;
  font-weight: 600;
  color: #6d6d6d;
  margin-bottom: 5px;
  border-top: 1px solid #ccc;
  padding-top: 6px;
}

.popup-operator-row {
  display: flex;
  align-items: flex-start;
  margin-bottom: 3px;
  line-height: 20px;
  padding: 3px 0 3px 5px;
  border-radius: 5px;
}

.popup-operator-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  margin-right: 10px;
  flex-shrink: 0;
  box-sizing: content-box;
  box-shadow: 0 4px 8px rgba(61, 59, 59, 0.3);
}

.popup-operator-name,
.popup-operator-routes {
  display: block;
  width: 100%;
}

.popup-operator-name {
  font-size: 14px;
  font-weight: 500;
  color: #333;
}

.popup-operator-routes {
  font-size: 11px;
  color: #8b8b8b;
  margin-top: 2px;
  margin-left: 0;
}

/* -------------------------------------------------
   Operator dropdown UI
------------------------------------------------- */
.map-operator-control {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 1000;
  background: rgb(39 56 119);
  padding: 8px 8px 0;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
  font-family: sans-serif;
}

#operator-filter-form {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 0;
  flex-wrap: nowrap;
  font-size: 14px;
}

#operator-select {
  padding: 6px 10px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background-color: #f7f7f7;
  min-width: 160px;
}

#operator-filter-form button {
  padding: 6px 12px;
  font-size: 15px;
  min-height: 40px;
  background: #ffffff;
  color: #4a4e5f;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

#operator-filter-form button::after {
  content: '↻';
  margin-left: 4px;
  font-weight: bold;
}

#operator-filter-form button:hover {
  background: #d8e8ff;
}

@media (max-width: 768px) {
  .map-operator-control {
    top: 10px;
    right: 10px;
  }
  #operator-select {
    font-size: 13px;
    min-width: 130px;
  }
  #operator-filter-form button {
    padding: 5px 10px;
    font-size: 13px;
    min-height: 36px;
  }
}

/* -------------------------------------------------
   Operator info box
------------------------------------------------- */
.map-operator-info {
  position: absolute;
  top: 90px;
  right: 20px;
  z-index: 999;
  background: rgb(39 56 119);
  border-radius: 14px;
  padding: 9px;
  width: 280px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
  font-family: sans-serif;
  font-size: 14px;
  line-height: 1.4;
  box-sizing: border-box;
}

.map-operator-info-inner {
  background: #ffffff;
  border-radius: 10px;
  padding: 12px 14px;
  position: relative;
}

.map-operator-info img {
  float: left;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  margin: 0 12px 0 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.map-operator-info h3 {
  margin: 6px 0 4px;
  font-size: 16px;
}

.map-operator-info ul {
  padding-left: 18px;
  margin: 8px 0;
}

.map-operator-info ul li {
  margin-bottom: 2px;
  line-height: 1.2;
  font-size: 13px;
}

.operator-links-inline {
  font-size: 13px;
  margin-top: 10px;
  white-space: normal;
  line-height: 1.6;
}

.operator-links-inline a {
  display: inline;
  margin-right: 16px;
  text-decoration: underline;
  color: #004080;
}

/* Minimize / restore buttons */
.info-box-toggle,
.info-box-restore {
  position: absolute;
  top: 6px;
  right: 6px;
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  color: #666;
  line-height: 1;
}

.info-box-toggle:hover,
.info-box-restore:hover {
  color: #000;
}

.info-box-restore {
  display: none;
}

/* Minimized state */
.map-operator-info.minimized {
  background: transparent;
  padding: 0;
  box-shadow: none;
}

.map-operator-info.minimized .map-operator-info-inner {
  padding: 6px;
  background: transparent;
  box-shadow: none;
  min-height: 0;
}

.map-operator-info.minimized .info-box-toggle {
  display: none;
}

.map-operator-info.minimized .info-box-restore {
  display: inline;
  background: #ffffff;
  color: #333;
  font-weight: bold;
  font-size: 22px;
  border-radius: 50%;
  padding: 10px;
  border: 8px solid #004080;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.map-operator-info.minimized img,
.map-operator-info.minimized h3,
.map-operator-info.minimized ul,
.map-operator-info.minimized p,
.map-operator-info.minimized a {
  display: none;
}
