/* ====== General ====== */
html, body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  font-family: sans-serif;
  background: #fdf6e3;
}

/* ====== Map ====== */
#map {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100vw;
  height: 100vh;
  touch-action: none;
}

/* ====== Material Symbols ====== */
.material-symbols-outlined {
  font-variation-settings:
    'FILL' 0,
    'wght' 600,
    'GRAD' 0,
    'opsz' 24;
  font-size: 16px;
  color: rgba(0, 0, 0, 0.8);
}

/* ====== Attribution ====== */
.leaflet-control-attribution {
  position: fixed !important;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1001;
  background: rgba(255,255,255,0.85);
  margin: 0;
  padding: 0 8px;
  pointer-events: auto;
}

/* ====== Project Header ====== */
#project-header {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: #fdf6e3;
  padding: 6px 12px;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.2), 0px 0px 10px black;
  z-index: 1000;
  display: flex;
  align-items: center;
  border: 2px solid #eee8d5;
  font-size: 24px;
  font-family: sans-serif;
  height: 32px;
  border-radius: 32px;
  width: fit-content;
  font-weight: bold;
  text-decoration: none;
  color: rgba(0, 0, 0, 0.8);
  gap: 14px;
}

#project-header img {
  width: 24px;
  height: 24px;
  border-radius: 4px;
}

#velosofize-title {
  position: relative;
  z-index: 1;
  line-height: 1;
}

#velosofize-arrow {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 100%;
  margin-top: 0px;
  font-size: 24px;
  color: rgba(0,0,0,0.8);
  line-height: 1;
  pointer-events: none;
}

/* ====== Link Buttons ====== */
#link-buttons {
  display: none;
  position: absolute;
  top: 110%;
  left: 50%;
  transform: translateX(-50%);
  flex-direction: row;
  background: #fdf6e3;
  border: 2px solid #eee8d5;
  border-radius: 32px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  z-index: 2001;
  padding: 4px;
  gap: 8px;
}

#link-buttons a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: #eee8d5;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.4);
  transition: transform 0.2s;
  padding: 0;
}

#link-buttons a img {
  width: 26px;
  height: 26px;
}

#link-buttons a:hover {
  transform: scale(1.1);
  transition: transform 0.15s;
}

/* ====== Overlay Containers ====== */
.button-container {
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  background: none;
  gap: 8px;
  color: rgba(0, 0, 0, 0.8);
  border: none;
  box-shadow: none;
  align-items: flex-start;
  padding: 4px;
  box-sizing: border-box;
}

#container-overlays-buttons {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
}

#container-external-overlays-buttons {
  position: absolute;
  right: 56px;
  top: 50%;
  transform: translateY(-50%);
}

#container-misc-buttons {
  position: absolute;
  right: 2px;
  top: 10px;
}

#container-control-buttons {
  position: fixed;
  right: 2px;
  bottom: 24px;
}

/* ====== Overlay Toggles ====== */
.button-container-pod,
#overlay-button-label-popup {
  display: flex;
  /* color: rgba(0, 0, 0, 0.8); */
  /* border: rgba(0, 0, 0, 1); */
  border: 2px solid rgba(0, 0, 0, 0.3);
  box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3);
}

.button-container-pod {
  flex-direction: column;
  background: #fdf6e390;
  padding: 2px;
  box-sizing: border-box;
  border-radius: 32px;
  gap: 6px;
}

#overlay-button-label-popup {
  background: #fdf6e3;
  padding: 8px;
  border-radius: 12px;
  gap: 8px;
  z-index: 9999;
  max-width: 50vw;
  box-sizing: border-box;
  word-break: break-word;
  font-weight: bold;
}

.overlay-button-svg-or-img-symbol {
  width: 28px;
  height: 28px;
  vertical-align: middle;
}

/* ====== Main Buttons ====== */
#legend-button span,
#fullscreen-button span,
#upload-layer span {
  font-size: 28px;
  color: rgba(0, 0, 0, 0.8);
}

.overlay-toggle-button {
  padding: 4px 4px;
  font-size: 28px;
  cursor: pointer;
  border: 2px solid rgba(0, 0, 0, 0.4);
  background: #eee8d5;
  color: rgba(0, 0, 0, 0.8);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s ease, color 0.3s ease; /* Gradual fade effect */
  -webkit-tap-highlight-color: transparent; /* Remove blue tap highlight on mobile */
}

.overlay-toggle-button[data-active="false"] {
  background: #eee8d5; /* Inactive state background */
}

.overlay-toggle-button[data-active="true"] {
  background: #bddfa2; /* Active state background */
}

/* Prevent selection of icons as text */
.overlay-toggle-button,
.overlay-toggle-button *,
#close-legend-button,
#switch-language-legend-button,
.material-symbols-outlined,
.material-symbols-outlined * {
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
}

/* ====== Legend Overlay ====== */
#legend-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.8);
  z-index: 3000;
  align-items: center;
  justify-content: center;
}

#legend-overlay > div {
  position: relative;
  width: 90vw;
  max-width: 600px;
  height: 90vh;
  background: #eee8d5;
  border-radius: 12px;
  overflow: hidden;
}

#legend-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* ====== Legend Overlay Buttons ====== */
#close-legend-button,
#switch-language-legend-button {
  position: absolute;
  right: 16px;
  z-index: 10;
  background: #fdf6e3;
  color: rgba(0, 0, 0, 0.8);
  border: 2px solid #eee8d5;
  box-shadow: 0px 0px 10px black;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

#close-legend-button {
  top: 16px;
}

#switch-language-legend-button {
  top: 64px;
}

/* ====== Layer Switcher ====== */
#layer-switcher-container {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  background: #fdf6e3;
  color: rgba(0, 0, 0, 0.8);
  box-shadow: 0px 0px 10px black;
  border: 2px solid #e6e5e1;
  border-radius: 50%;
  z-index: 2000;
}

#layer-icon-btn {
  background: #000033;
  border: 2px solid #eee8d5;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

#layer-icon-img {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

/* ====== Layer Name Flash ====== */
#layer-name-flash {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  background: #fdf6e3;
  color: rgba(0, 0, 0, 0.8);
  font-weight: bold;
  font-size: 16px;
  text-align: center;
  padding: 12px 32px;
  border-radius: 12px;
  z-index: 3000;
  transition: opacity 0.5s;
}

.popup-link-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #e6e5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.overlay-pin-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    opacity: 1;
    border: 1px solid white;
}

.overlay-pin-symbol {
    position: absolute; 
    top: 3px;
    left: 3px;
    font-size: 12px;
    color: #e6e5e1;
}

/* ====== Misc ====== */
input[type="file"]#upload-layer {
  display: none;
}

/* ====== Responsive (optional) ====== */
@media (max-width: 600px) {
  #project-header {
    font-size: 18px;
    padding: 4px 8px;
    height: auto;
  }
  #legend-overlay > div {
    width: 98vw;
    max-width: 98vw;
    height: 90vh;
  }
  #layer-icon-img {
    width: 44px;
    height: 44px;
  }
}