/* Responsive Styles for Map (max-width: 768px) */
@media screen and (max-width: 768px) {
  /* Reduce padding and spacing for main content */
  .main-content {
    padding: 20px 10px;
  }

  .map-caption {
    padding: 20px;
    margin-bottom: 20px;
  }

  .map-caption .map-title {
    font-size: 22px;
  }

  .map-caption .map-subtitle {
    font-size: 14px;
  }

  #MapContainer {
    height: 500px;
    max-width: 100%;
    border-radius: 0;
  }

  #map {
    border-width: 2px;
  }

  /* Stack coords and search tools vertically */
  .map-header {
    position: absolute;
    top: -1px;
    right: 11px; /* stick to right */
    max-width: 170px; /* smaller width */
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    border-radius: 10px;
    z-index: 1001;
  }

  .map-icon-btn {
    padding: 4px 6px;
    font-size: 14px;
  }

  /* Hide divider on mobile */
  .search-divider {
    display: none !important;
  }

  /* Hide coordinates on mobile */
  .coords {
    display: none;
  }

  /* Reorder buttons into two rows */
  .map-search {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  /* Row 1: Search, Refresh */
  .map-icon-btn:nth-of-type(1) {
    order: 1;
    flex: 0 0 calc(50% - 3px);
  }
  .map-icon-btn:nth-of-type(2) {
    order: 2;
    flex: 0 0 calc(50% - 3px);
  }

  /* Row 2: Zoom In, Zoom Out, Fullscreen */
  .map-icon-btn:nth-of-type(3) {
    order: 3;
    flex: 0 0 calc(33.333% - 4px);
  }
  .map-icon-btn:nth-of-type(4) {
    order: 4;
    flex: 0 0 calc(33.333% - 4px);
  }
  .map-icon-btn:nth-of-type(5) {
    order: 5;
    flex: 0 0 calc(33.333% - 4px);
  }

  .map-search-input {
    width: 100%;
  }

  .map-toggle-btn {
    top: 10px;
    right: 7px;
    opacity: 80%;
  }

  /* Adjust tomb layer floating panel */
  .tomb-layer-floating-panel {
    position: absolute;
    top: 10px;
    left: 8px; /* stick to left */
    right: auto;
    width: 150px;
    font-size: 12.5px;
    padding: 10px 0;
    border-radius: 10px;
    z-index: 1001;
  }
  .tomb-panel-header {
    height: auto;
    padding: 8px 10px;
  }

  .tomb-panel-header .header-title {
    font-size: 13px;
    gap: 4px;
  }

  .tomb-panel-header .toggle-icon {
    font-size: 13px;
    right: 10px;
  }

  .tomb-layer-list {
    gap: 6px;
    padding: 0 10px;
  }

  .tomb-layer-list label {
    font-size: 12.5px;
  }

  .color-box {
    width: 12px;
    height: 12px;
    margin: 0 4px;
  }

  .suggestion-box {
    position: absolute;
    top: 100%; /* directly below input */
    left: 0;
    width: 100%; /* same width as search bar */
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid #ccc;
    border-radius: 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 2000; /* above map and panels */
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  }

  .suggestion-box li {
    padding: 6px 10px;
    font-size: 13px;
    cursor: pointer;
  }

  .suggestion-box li:hover {
    background: #f1f1f1;
  }

  .map-result-panel {
    font-size: 12px;
    padding: 8px 10px;
    max-width: 85%;
  }

  .map-thumb-container {
    width: 50px;
    height: 50px;
  }

  .map-thumb-container::after {
    font-size: 12px;
  }

  #info-panel {
    position: relative;
    top: 57%;
    left: 10px;
    transform: translateY(-50%) scale(0.75);
    transform-origin: center;
    width: 85%;
    padding: 28px 10px 10px;
    border-radius: 8px;
  }

  .close-button {
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 18px;
    line-height: 1;
    z-index: 10;
  }

  #panel-content img {
    max-width: 90%;
    border-width: 2px;
    margin: 10px auto;
  }
}
