html, body {
  height: 100%;
  margin: 0;
  font-family: 'JetBrains Mono', monospace;
}

#map {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
}

#loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.spinner {
  border: 6px solid #f3f3f3;
  border-top: 6px solid #2563eb;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* === Sidebar wrapper === */
.sidebar-wrapper {
  position: absolute;
  top: 20px;
  bottom: 20px; 
  right: 20px;
  left: calc(((100% - 60px) / 4) * 2 + 40px);
  width: calc(((100% - 60px) / 4) * 2 + 0px);
  z-index: 1500;
}

.places-control {
  height: 100%;
  width: 100%;
  display: grid;
  grid-template-rows: 1fr auto; 
  background: #000;
  box-shadow: -2px 0 8px rgba(0,0,0,0.2);
  font-size: 20px;
  font-weight: 500;
  line-height: 25px;
  color: #fff;
  overflow: hidden;
}

#placesList {
  display: flex;
  flex-direction: column;
  gap: 14.5px;
  padding: 8px 16px;
  overflow-y: auto;
  margin-top: 30px;
}

.places-control label {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  font-size: 20px;
  font-weight: 500;
  line-height: 28px;
  padding: 4px 6px;
  border-radius: 4px;
}

.places-control input[type="checkbox"] {
  appearance: none;
  width: 22px;
  height: 22px;
  border: 2px solid #fff;
  background: #000;
  margin-right: 10px;
  position: relative;
  flex-shrink: 0;
}

.places-control input[type="checkbox"]:checked {
  background: #fff;
  border-color: #fff;
}

.places-control input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 12px;
  border: solid #000;
  border-width: 0 3px 3px 0;
  transform: translate(-50%, -50%) rotate(45deg);
}

/* === Footer default (initial state, centered button) === */
.panel-footer {
  background: #000;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;     
  justify-content: center;
  box-sizing: border-box;
  padding: 20px;
  height: auto;             
  min-height: 100px;
  border-top: 1px dashed #fff;
  transition: all 0.35s ease-in-out;
}

#computeBtn {
  background: #18467D;
  color: #fff;
  font-weight: 500;
  font-size: 18px;          
  line-height: 48px;        
  border: none;
  border-radius: 30px;
  cursor: pointer;
  text-transform: uppercase;
  height: 48px;             
  width: 100%;
  padding: 0;               
  transition: background 0.3s ease-in-out;
}

#computeBtn:hover {
  background: #163a6c;
}

#computeBtn:disabled {
  background: #999;
  cursor: not-allowed;
}

/* Footer Links (hidden initially) */
.footer-links {
  display: none;
  opacity: 0;
  transition: opacity 0.35s ease-in-out;
}

/* === Footer after compute (desktop: balanced layout) === */
.panel-footer.computed {
  display: grid;
  grid-template-columns: 1fr auto;
  width: 100%;
  gap: 60px;                        /* ✅ large screens */
  align-items: flex-start;
  justify-content: center;          
  padding: 20px;
  height: auto;             
  min-height: 140px;
  box-sizing: border-box;
}

.panel-footer.computed #computeBtn {
  width: auto;                      
  min-width: 220px;                 
  max-width: 300px;                 
  height: 48px !important;  
  line-height: 48px !important;
  font-size: 18px !important;
  border-radius: 30px;
  background: #18467D;
  margin: 0;
  padding: 0 !important;
  align-self: flex-start;
}

.panel-footer.computed .footer-links {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-start;  
  max-width: 320px;                 
  opacity: 1;
  margin: 0;
  padding: 0;
  height: auto;
}

.panel-footer.computed .footer-links a {
  color: #fff;
  font-size: 1.2rem;
  font-weight: 500;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1.4;
  text-decoration: none;
}

.panel-footer.computed .footer-links a span {
  border-bottom: 2px solid #fff; 
  padding-bottom: 0.15rem;
}

.panel-footer.computed .footer-links a:hover span {
  border-bottom-color: #00BFFF;
}

/* ✅ Restore icons */
.panel-footer.computed .footer-links a[id="gmapLink"]::after {
  content: "";
  width: 16px;
  height: 16px;
  background-image: url('Hyperlink arrow.svg');
  background-size: contain;
  background-repeat: no-repeat;
  display: inline-block;
}

.panel-footer.computed .footer-links a[id="copyLink"]::after {
  content: "";
  width: 16px;
  height: 16px;
  background-image: url('Vector.svg');
  background-size: contain;
  background-repeat: no-repeat;
  display: inline-block;
}

/* === Responsive Gaps === */
@media (max-width: 1200px) {
  .panel-footer.computed {
    gap: 40px; /* medium screens */
  }
}

@media (max-width: 800px) {
  .panel-footer.computed {
    gap: 28px; /* tablets */
  }
}

/* ✅ Mobile: bottom sheet (stacked, centered links) */
@media (max-width: 800px) {
  .sidebar-wrapper {
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    height: 50vh;
    margin: 0;
  }

  .places-control {
    width: 100%;
    height: 100%;
    grid-template-rows: 1fr auto;
    font-size: 22px;
  }

  .places-control label {
    font-size: 22px;
    line-height: 32px;
  }

  .places-control input[type="checkbox"] {
    width: 28px;
    height: 28px;
  }

  .panel-footer {
    height: auto !important;
  }

  .panel-footer.computed {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;  
    align-items: center !important;   
    gap: 20px !important;
    height: auto !important;
    min-height: 140px !important;
    padding: 20px !important;
    box-sizing: border-box;
  }

  #computeBtn {
    font-size: 18px !important;
    height: 48px !important; 
    line-height: 48px !important;
    width: 100% !important; /* ✅ full width on mobile */
    max-width: none !important; 
    min-width: 0 !important;
    padding: 0 !important;
  }

  .panel-footer.computed .footer-links {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: center;      
    height: auto;
  }

  .panel-footer.computed .footer-links a {
    font-size: 1.2rem;
    text-align: center;       
  }
}

/* === Debug Overlay Grid === */
.debug-grid {
  pointer-events: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  z-index: 9999;
}

.debug-grid div {
  background: rgba(128, 0, 128, 0.4);
}

/* Hide Google UI controls */
.gm-style .gm-control-active {
  display: none !important;
}

.gm-style-cc {
  right: 20px !important;
}
