/* ==========================================================================
   Map Controls & UI Elements
   ========================================================================== */

/* Custom Map Controls */
.custom-map-controls {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 10px;
  top: 20px;
  left: 20px;
  z-index: 10;
}

/* ==========================================================================
   Layer Switcher
   ========================================================================== */
.layer-switcher-control {
  position: absolute;
  bottom: 0.75rem;
  left: 0.75rem;
  z-index: 1000;
  pointer-events: auto;
}

.layer-toggle-button {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
  background-color: transparent;
}

.layer-toggle-button:hover {
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  transform: scale(1.05);
}

/* Thumbnail as full background */
.layer-thumbnail {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.dark-mode {
  background-size: cover;
  background-image: url(../../images/dark-mode-thumbnail.webp);
}

.satellite-mode {
  background-image: url(../../images/satellite-thumbnail.webp);
  background-size: cover;
}

.layer-label {
  font-size: 12px;
  font-weight: 500;
  color: white;
  text-align: center;
  margin-bottom: 4px;
}

/* Responsive adjustments for layer switcher */
@media (max-width: 768px) {
  .layer-switcher-control {
    bottom: 70px; /* Adjust position on mobile */
    left: 10px;
  }

  .layer-toggle-button {
    width: 45px; /* Smaller size on mobile */
    height: 45px;
    border-radius: 10px;
  }

  .layer-label {
    font-size: 10px;
  }
}

/* Ensure layer switcher stays inside map on very small screens */
@media (max-width: 480px) {
  .layer-switcher-control {
    bottom: 60px;
    left: 5px;
  }

  .layer-toggle-button {
    width: 40px;
    height: 40px;
    border-radius: 8px;
  }
}

/* ==========================================================================
   Google Maps Controls Overrides
   ========================================================================== */

/* Common button styles */
.gm-svpc,
.gm-control-active,
.gm-style-mtc button,
.gm-fullscreen-control,
.gmnoprint button {
  border-radius: 4px !important;
  background-color: rgba(18, 18, 18, 0.85) !important;
  color: white !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  margin: 2px !important;
}

/* Size adjustments for buttons */
.gm-svpc,
.gm-control-active {
  width: 36px !important;
  height: 36px !important;
  transform: scale(0.85);
  transform-origin: bottom right;
}

/* Fix Street View Compass */
.gm-svpc {
  width: 40px !important;
  height: 40px !important;
  transform: scale(1) !important;
  margin: 0 !important;
  overflow: visible !important;
}

/* Icon adjustments */
.gm-style-mtc button img,
.gm-svpc img,
.gm-control-active img {
  filter: brightness(0) invert(1) !important;
  width: 20px !important;
  height: 20px !important;
  transform-origin: center !important;
}

.gm-svpc img {
  width: 24px !important;
  height: 24px !important;
  transform: translate(-50%, -50%) !important;
  position: absolute;
  top: 50%;
  left: 50%;
  filter: brightness(0) invert(1) !important;
}

/* Hover effects */
.gm-svpc:hover,
.gm-control-active:hover,
.gm-style-mtc button:hover,
.gm-fullscreen-control:hover,
.gmnoprint button:hover {
  background-color: rgba(30, 30, 30, 0.95) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  transform: scale(1.05);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3) !important;
}

/* Control containers */
.gm-bundled-control,
.gm-bundled-control-on-bottom {
  background: transparent !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: space-between !important;
  height: 100vh !important;
  margin-bottom: 40px !important;
}

.gm-bundled-control > div,
.gm-bundled-control-on-bottom > div,
.gm-style > div:nth-child(1) > div:nth-child(3),
.gm-style > div:nth-child(1) > div:nth-child(4),
.gmnoprint div[draggable='false'],
.gm-style .gm-style-mtc > div,
.gm-style .gmnoprint > div {
  background: transparent !important;
  box-shadow: none !important;
  background-color: transparent !important;
}

/* Dropdown menu styling */
.gm-style-mtc div[role='menu'] {
  background-color: rgba(18, 18, 18, 0.95) !important;
  border-radius: 4px !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.gm-style-mtc div[role='menu'] li {
  color: white !important;
}

.gm-style-mtc div[role='menu'] li:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
}

/* Hide specific elements */
.gm-style-mtc ul li:nth-child(2),
.gmnoprint
  div[style*='height: 1px'][style*='background-color: rgb(230, 230, 230)'],
.gmnoprint [style*='height: 1px'],
.gmnoprint
  div[draggable='false'][style*='overflow: hidden'][style*='height: 1px'] {
  display: none !important;
}

/* Hide Street View and Fullscreen controls */
.gm-svpc,
.gm-fullscreen-control {
  display: none !important;
}

/* Compass specific styles */
.gm-compass-needle {
  transform-origin: center center !important;
}

.gm-compass {
  display: none;
}
