/* ===============================
   Hard guarantees (prevent 0-height map)
   =============================== */

#vss-map {
  position: relative;
  width: 100%;
  min-height: 520px;
  height: 70vh;
}

/* Leaflet must have height, or it renders blank */
#vss-map .leaflet-container,
.leaflet-container {
  width: 100% !important;
  height: 100% !important;
}

/* Mobile: a bit taller */
@media (max-width: 768px) {
  #vss-map {
    height: 75vh;
    min-height: 520px;
  }
}

/* ===============================
   Bottom bar layout (desktop)
   =============================== */

.vss-bottom-bar {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 1000;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;

  padding: 12px;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 14px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  overflow: hidden;

  pointer-events: auto;
}

/* Force button background to ignore theme styles */
.vss-bottom-bar button {
  background-color: #e6e6e6 !important;
  color: #111111 !important;
  border: 1px solid #d0d0d0 !important;
  box-shadow: none !important;
  text-transform: none !important;
  white-space: nowrap;

  pointer-events: auto !important;
  touch-action: manipulation;
}

.vss-bottom-bar button:hover {
  background-color: #dcdcdc !important;
}

.vss-bottom-bar button:disabled {
  opacity: 0.6 !important;
  cursor: not-allowed !important;
}

/* ===============================
   Mobile: fixed bar, safe area, tap-safe
   =============================== */

@media (max-width: 768px) {
  .vss-bottom-bar {
    position: fixed !important;
    z-index: 999999 !important;

    left: 0;
    right: 0;

    bottom: calc(12px + env(safe-area-inset-bottom));

    width: 100%;
    border-radius: 0;
    justify-content: center;

    padding: 12px 10px calc(12px + env(safe-area-inset-bottom));

    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;

    pointer-events: auto !important;
    touch-action: manipulation;
  }

  .vss-bottom-bar button {
    flex: 0 0 auto;
  }

  /* Ensure the map content is not hidden behind fixed bar */
  #vss-map {
    padding-bottom: calc(92px + env(safe-area-inset-bottom));
    box-sizing: border-box;
  }
}

/* ===============================
   Leaflet geocoder search icon background (white)
   =============================== */

.leaflet-control-geocoder-icon,
.leaflet-control-geocoder-icon:hover,
.leaflet-control-geocoder-icon:focus,
.leaflet-control-geocoder a {
  background-color: #ffffff !important;
  border: 1px solid #d0d0d0 !important;
  box-shadow: none !important;
}

/* ===============================
   Modal
   =============================== */

#vss-modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 9999;
}

#vss-modal.active {
  display: block;
}

.vss-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.vss-modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 320px;
  max-width: calc(100% - 24px);
  transform: translate(-50%, -50%);
  background: #ffffff;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

.vss-modal-content h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.vss-modal-content input {
  width: 100%;
  padding: 10px;
  margin: 10px 0;
  border-radius: 10px;
  border: 1px solid #ccd6e0;
  font-size: 14px;
}

.vss-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Mobile: keep modal above the bottom bar area */
@media (max-width: 768px) {
  .vss-modal-content {
    top: 42%;
    transform: translate(-50%, -42%);
  }
}

/* Anonymous checkbox row (tight spacing, override theme) */
.vss-anon-row {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  margin: 6px 0 2px !important;
}

.vss-anon-checkbox {
  margin: 0 !important;
  padding: 0 !important;
  width: 18px !important;
  height: 18px !important;
  flex: 0 0 18px !important;
  display: inline-block !important;
  vertical-align: middle !important;
}

.vss-anon-label {
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.2 !important;
  cursor: pointer !important;
  display: inline-block !important;
}

/* ===============================
   Toast (never block clicks)
   =============================== */

#vss-toast {
  position: fixed !important;
  left: 50% !important;
  transform: translateX(-50%) !important;

  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;

  opacity: 0;
  transition: opacity 160ms ease;

  background: rgba(17, 17, 17, 0.95);
  color: #ffffff;

  pointer-events: none !important;
  z-index: 20000 !important;
  bottom: 18px !important;
}

#vss-toast.active {
  opacity: 1;
}

/* Mobile: keep toast clearly above the fixed bottom bar */
@media (max-width: 768px) {
  #vss-toast {
    bottom: calc(160px + env(safe-area-inset-bottom)) !important;
  }
}

/* ===============================
   Ensure WP Admin Bar stays visible
   =============================== */

#wpadminbar {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 999999 !important;
}
