/* Base layout and background styling */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background-color: #004aad !important;
}

/* Main map container */
#map-container {
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

/* SVG object styling */
object {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transition: transform 1s ease-in-out, opacity 0.5s ease;
}

/* Hidden detail map styling */
.detail-map {
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}

/* Active detail map display */
.showing {
  opacity: 1;
  pointer-events: auto;
  z-index: 1;
}

/* Back to main map button */
#backToMapBtn {
  background: white;
  border: none;
  color: #007bff;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: underline;
}

/* Back to main map button hover styling */
#backToMapBtn:hover {
  background-color: #888;
  color: white;
}

/* Modal overlay and layout */
.modal {
  display: none;
  position: fixed;
  z-index: 999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px 20px 40px;
  box-sizing: border-box;
  overflow-y: auto;
}

/* Modal content box */
.modal-content {
  background: white;
  text-align: center;
  margin: auto;
  width: 30%;
  max-width: 700px;
  border-radius: 12px;
  padding: 30px 20px;
  position: relative;
  color: #333;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
  max-height: 94vh;
  overflow-y: auto;
  box-sizing: border-box;
}

/* Modal heading styling */
.modal-content h2 {
  color: #004aad;
  margin-top: 0;
  font-size: 1.5rem;
  border-bottom: 2px solid #fdd835;
  padding-bottom: 10px;
}

/* Modal image formatting */
.modal-content img {
  width: 50%;
  height: auto;
  margin: 15px 0;
  border-radius: 8px;
  border: 2px solid #fdd835;
}

/* Modal description text */
.modal-content p {
  line-height: 1.6;
  text-align: left !important;
}

/* Close button styling */
.close {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 24px;
  font-weight: bold;
  color: #888;
  cursor: pointer;
  transition: color 0.3s ease;
}

/* Close button hover styling */
.close:hover {
  color: #004aad;
}

/* Rotate phone warning overlay */
#rotate-warning {
  display: none;
  position: fixed;
  z-index: 9999;
  background-color: #004aad;
  color: white;
  font-size: 1.2rem;
  text-align: center;
  padding: 40px 20px;
  top: 0;
  left: 0;
  height: 100vh;
  width: 100vw;
  box-sizing: border-box;
}

/* Warning message wrapper */
#rotate-warning div {
  text-align: center;
}

/* Warning image styling with animation */
#rotate-warning img {
  margin-top: 20px;
  width: 120px;
  max-width: 60vw;
  height: auto;
  animation: rotateHint 2s ease-in-out infinite;
  opacity: 0.8;
}

/* Animation for rotate warning image */
@keyframes rotateHint {
  0%, 100% {
    transform: rotate(0deg);
  }
  50% {
    transform: rotate(15deg);
  }
}

/* Mobile layout adjustments */
@media (max-width: 768px) {
  #map-container {
    height: 100svh; 
  }

  object {
    height: 100%;
    width: 100%;
  }

  .modal-content {
    width: 85%;
    max-width: none;
  }
}

/* Hide map and show rotate warning on mobile portrait */
@media screen and (orientation: portrait) and (max-width: 768px) {
  #rotate-warning {
    display: flex;
    justify-content: center;
    align-items: center;
  }

  #map-container,
  header,
  object,
  .modal {
    display: none !important;
  }
}

/* Hide map and show rotate warning on tablet portrait */
@media screen and (orientation: portrait) and (max-width: 1024px) {
  #rotate-warning {
    display: flex;
    justify-content: center;
    align-items: center;
  }

  #map-container,
  header,
  object,
  .modal {
    display: none !important;
  }
}