/* ==========================================================================
   Base layout
   ========================================================================== */

html,
body,
#map {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
}

#map {
  position: fixed;
  inset: 0;
  background: #f0efe9;
}

/* tables */
table,
th,
td {
  border: 1px solid #ddd;
  border-collapse: collapse;
}

th,
td {
  padding: 5px;
}

/* SweetAlert */
.swal2-container {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

.swal2-title {
  font-size: 1.25em !important;
}

.swal2-html-container {
  font-size: 1em !important;
}

/* ==========================================================================
   Leaflet: controls + buttons
   ========================================================================== */

.leaflet-top {
  z-index: 9999;
}

.leaflet-right {
  max-width: 60vw;
}

.leaflet-control-layers-base label {
  cursor: pointer;
  user-select: none;
}

.leaflet-container a {
  -webkit-tap-highlight-color: transparent;
}

.leaflet-control-layers,
.leaflet-touch .leaflet-control-layers {
  border-radius: 50%;
}

.leaflet-control-layers-toggle,
.leaflet-touch .leaflet-control-layers-toggle {
  width: 56px;
  height: 56px;
  line-height: 56px;
}

.leaflet-control-layers-expanded,
.leaflet-touch .leaflet-control-layers-expanded {
  padding: 5px;
  border-radius: 5px;
}

.leaflet-control-scale-line {
  background: rgb(211 211 211 / 50%);
}

.leaflet-container .leaflet-control-attribution {
  background: rgb(211 211 211 / 100%);
}

.leaflet-bar {
  border-radius: 50%;
}

.leaflet-bar a,
.leaflet-bar a:hover,
.leaflet-touch .leaflet-bar a {
  width: 56px;
  height: 56px;
  line-height: 56px;
}

.leaflet-bar a:first-child,
.leaflet-touch .leaflet-bar a:first-child {
  border-top-left-radius: 50%;
  border-top-right-radius: 50%;
}

.leaflet-bar a:last-child,
.leaflet-touch .leaflet-bar a:last-child {
  border-bottom-left-radius: 50%;
  border-bottom-right-radius: 50%;
}

.leaflet-touch .leaflet-control-layers,
.leaflet-touch .leaflet-bar {
  border: 0;
  box-shadow: 0 1px 5px rgb(0 0 0 / 65%);
}

.leaflet-control-locate.active a {
  color: #2074b6;
}

.leaflet-control-locate.active.following a {
  color: #fc8428;
}

/* MapCenterCoord control */
.leaflet-container .leaflet-control-mapcentercoord {
  background-color: rgb(211 211 211 / 50%);
  box-shadow: 0 0 5px #bbb;
  padding: 5px;
  margin: 5px;
  color: #333;
  font-family: sans-serif;
  font-size: 12px;
}

.leaflet-control-mapcentercoord-icon {
  background: url("../img/map-center-icon1.svg") 50% 50% no-repeat;
  margin: -18px 0 0 -18px;
  width: 36px;
  height: 36px;
  left: 50%;
  top: 50%;
  content: "";
  display: block;
  position: absolute;
  z-index: -1;
}

@media (max-width: 768px) {
  .leaflet-control-layers-list {
    font-size: medium;
  }
}

/* ==========================================================================
   Leaflet: popup
   ========================================================================== */

.leaflet-popup {
  position: absolute;
  text-align: center;
  margin-bottom: 20px;
}

.leaflet-popup h3 {
  text-align: center;
}

/* close button (yours) */
.leaflet-popup-close-button {
  position: absolute;
  top: 0;
  left: 0;
  padding: 4px 4px 0 0;
  border: none;
  text-align: center;
  width: 18px;
  height: 14px;
  font: 16px/14px Tahoma, Verdana, sans-serif;
  color: #c3c3c3;
  text-decoration: none;
  font-weight: bold;
  background: transparent;
}

/* IMPORTANT: remove horizontal scroll that often causes width weirdness */
.leaflet-popup-content-wrapper {
  padding: 1px;
  text-align: left;
  border-radius: 5px;
  overflow: hidden;
}

/* content box */
.leaflet-popup-content {
  margin: 5px;
  line-height: 1.4;
  max-height: 70vh;
  overflow: auto;

  /* keep your “almost full width” logic */
  min-width: 96%;
  max-width: 98vw;
}

/* “typed” popups */
.leaflet-popup-pdf,
.leaflet-popup-video {
  min-width: 100lvw;
  max-width: 1024px;
}

.leaflet-popup-images {
  min-width: 301px;
  max-width: 600px;
}

/* typed content */
.leaflet-popup-content-pdf,
.leaflet-popup-content-video {
  min-width: 100%;
}

.leaflet-popup-content-images {
  display: flex;
  gap: 20px;
  width: fit-content;
}

/* old scrolled helper */
.leaflet-popup-scrolled {
  width: auto !important;
  height: auto !important;
  overflow: auto;
  max-height: 70vw;
  max-width: 70vw;
  border-bottom: unset !important;
  border-top: unset !important;
}

/* remove leaflet tip */
.leaflet-popup-tip-container,
.leaflet-popup-tip {
  display: none !important;
}

/* images */
.hiden-images {
  width: 1px;
  height: 1px;
}

img.images-photo {
  object-fit: cover;
}

/* ==========================================================================
   Progress bar
   ========================================================================== */

.progress {
  position: relative;
  height: 4px;
  display: none;
  width: 100%;
  background-color: darkgray;
  background-clip: padding-box;
  overflow: hidden;
  z-index: 999;
}

.progress .indeterminate {
  background-color: white;
}

.progress .indeterminate::before,
.progress .indeterminate::after {
  content: "";
  position: absolute;
  background-color: inherit;
  top: 0;
  left: 0;
  bottom: 0;
  will-change: left, right;
}

.progress .indeterminate::before {
  animation: indeterminate 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;
}

.progress .indeterminate::after {
  animation: indeterminate-short 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) infinite;
  animation-delay: 1.15s;
}

@keyframes indeterminate {
  0% {
    left: -35%;
    right: 100%;
  }

  60% {
    left: 100%;
    right: -90%;
  }

  100% {
    left: 100%;
    right: -90%;
  }
}

@keyframes indeterminate-short {
  0% {
    left: -200%;
    right: 100%;
  }

  60% {
    left: 107%;
    right: -8%;
  }

  100% {
    left: 107%;
    right: -8%;
  }
}

/* ==========================================================================
   Layer control accordion (kept, minimal cleanup)
   ========================================================================== */

.ac-container {
  width: auto;
  text-align: left;
  overflow: hidden auto;
  height: auto;
}

.ac-container article label {
  display: inline;
  cursor: pointer;
}

div[id^="leaflet-control-accordion-layers"]>label {
  font-family: BebasNeueRegular, "Arial Narrow", Arial, sans-serif;
  padding: 5px 20px;
  position: relative;
  z-index: 20;
  display: block;
  height: 30px;
  color: #777;
  text-shadow: 1px 1px 1px rgb(255 255 255 / 80%);
  line-height: 33px;
  font-size: 19px;
  background: linear-gradient(to top, #fff 1%, #eaeaea 100%);
  box-shadow: 0 0 0 1px rgb(155 155 155 / 30%),
    1px 0 0 0 rgb(255 255 255 / 90%) inset,
    0 2px 2px rgb(0 0 0 / 10%);
  box-sizing: content-box;
  cursor: pointer;
  width: auto;
  margin: 0;
}

div[id^="leaflet-control-accordion-layers"]>label:hover {
  background: #fff;
}

.ac-container input.menu {
  display: none;
}

.ac-container input.menu:checked+label,
.ac-container input.menu:checked+label:hover {
  background: #c6e1ec;
  color: #737373;
  text-shadow: 0 1px 1px rgb(255 255 255 / 60%);
  box-shadow: 0 0 0 1px rgb(155 155 155 / 30%),
    0 2px 2px rgb(0 0 0 / 10%);
}

.ac-container article {
  background: rgb(255 255 255 / 50%);
  margin-top: -1px;
  overflow: hidden;
  height: 0;
  padding: 0;
  line-height: 0;
  position: relative;
  z-index: 10;
  transition: height 0.3s ease-in-out, box-shadow 0.6s linear;
}

.ac-container input.menu:checked~article {
  transition: height 0.5s ease-in-out, box-shadow 0.1s linear;
}

.ac-container input.menu:checked~article.ac-large {
  height: auto;
  max-height: 100px;
  padding: 8px 0;
  overflow-y: auto;
  line-height: 18px;
}

.ac-container .group-toggle-container {
  text-align: right;
  margin-right: 3px;
  display: none;
  height: 20px;
}

.ac-container input.menu:checked~.group-toggle-container {
  display: block;
  line-height: 1em;
}

.menu-item-radio,
.menu-item-checkbox {
  font-family: Ubuntu-Regular, Arial, sans-serif;
  font-size: 13px;
}

.bt_delete {
  float: right;
  background-image: url("images/delete.png");
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: 0 0;
  border: none;
  cursor: pointer;
  height: 16px;
  width: 16px;
  vertical-align: middle;
}

.leaflet-control-layers:hover {
  box-shadow: 0 1px 5px rgb(0 0 0 / 40%);
  border-radius: 5px;
}

/* ==========================================================================
   Install button
   ========================================================================== */

.leaflet-button {
  margin-left: 10px;
  margin-top: 10px;
  transform: translateX(0%);
  padding: 2px 5px;
  color: gray;
  font-size: 1.25em;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  box-shadow: 5px 5px 7px gray;
}

.install-btn {
  font: 14px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  cursor: pointer;
}

/* ==========================================================================
   INTRO (single source of truth)  ✅
   ========================================================================== */

#intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
}

#intro-overlay.intro-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 160ms ease, visibility 160ms ease;
}

#intro-overlay.intro-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

#intro-overlay .intro-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* modal card */
#intro-overlay .intro-modal {
  position: relative;
  z-index: 1;

  width: min(840px, calc(100vw - 32px));
  height: auto;
  max-height: calc(100vh - 80px);
  /* ~40px top/bottom */

  background: #fff;
  border-radius: 24px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
  overflow: hidden;

  display: flex;
  flex-direction: column;
}

/* close */
#intro-overlay .intro-close {
  position: absolute;
  top: 10px;
  right: 14px;
  z-index: 5;
  border: 0;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

/* slides container */
#intro-overlay .intro-inner {
  position: relative;
  flex: 1;
  overflow: hidden;
}

/* slide */
#intro-overlay .intro-slide {
  display: none;
  height: 100%;
  box-sizing: border-box;

  /* left/right padding = “safe area” for arrows */
  padding: 22px 72px 28px;

  overflow: auto;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

#intro-overlay .intro-slide.active {
  display: flex;
}

/* image */
#intro-overlay .intro-slide img {
  width: 100%;
  max-width: 720px;
  height: auto;
  max-height: 42vh;
  object-fit: contain;
  border-radius: 12px;
}

/* text */
#intro-overlay .intro-slide h2,
#intro-overlay .intro-slide h3,
#intro-overlay .intro-slide p {
  max-width: 720px;
  margin: 0;
  text-align: center;
  line-height: 1.4;
}

/* nav arrows */
#intro-overlay .intro-nav {
  position: absolute;
  z-index: 6;
  border: 0;
  cursor: pointer;

  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .18);

  display: flex;
  align-items: center;
  justify-content: center;

  /* IMPORTANT: override inline top/transform if it exists */
  top: clamp(140px, 24vh, 260px) !important;
  transform: translateY(-50%) !important;
}

#intro-overlay .intro-prev {
  left: 14px;
}

#intro-overlay .intro-next {
  right: 14px;
}

@media (max-width: 768px) {
  #intro-overlay .intro-modal {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 48px);
    border-radius: 18px;
  }

  #intro-overlay .intro-slide {
    padding: 16px 60px 18px;
    /* safe area for arrows on mobile */
    gap: 12px;
  }

  #intro-overlay .intro-slide img {
    max-height: 45vh;
  }

  #intro-overlay .intro-nav {
    width: 46px;
    height: 46px;
    top: clamp(130px, 26vh, 240px) !important;
  }

  #intro-overlay .intro-prev {
    left: 10px;
  }

  #intro-overlay .intro-next {
    right: 10px;
  }
}

/* help button (“?”) if you use it */
.leaflet-bottom.leaflet-left .intro-help-btn {
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.intro-help-btn img {
  width: 28px;
  height: 28px;
  display: block;
}

/* ==========================================================================
   PDF popup: glass effect
   ========================================================================== */

.leaflet-popup-pdf {
  background: transparent;
}

.leaflet-popup-pdf .leaflet-popup-content-wrapper {
  background: rgba(10, 10, 10, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  border-radius: 10px;
}

.leaflet-popup-content-pdf {
  background: transparent;
}

.leaflet-popup-content-pdf .popup-pdf-wrapper {
  width: min(90vw, 800px);
  height: min(70vh, 600px);
  display: flex;
  justify-content: center;
}

.popup-pdf-frame {
  width: 100%;
  height: 100%;
  border: none;
}