* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: #f5f5f5;
  color: #333;
}

#app {
  display: flex;
  width: 100%;
  height: 100%;
  flex-direction: column;
}

.map-container {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 400px;
  background-color: #e0e0e0;
  position: relative;
  z-index: 1;
}

.map-container .leaflet-container {
  width: 100%;
  height: 100%;
  z-index: 1;
  font-family: inherit;
}

.info-panel {
  padding: 16px;
  background-color: white;
  border-top: 1px solid #ddd;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
  z-index: 10;
  max-height: 200px;
  overflow-y: auto;
  overflow-x: hidden;
  font-size: 14px;
  line-height: 1.6;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.info-panel p {
  margin: 4px 0;
  word-wrap: break-word;
}

.info-panel strong {
  display: block;
  margin-top: 8px;
  margin-bottom: 4px;
  font-weight: 600;
  color: #222;
}

.info-panel .error {
  color: #d32f2f;
  padding: 8px;
  background-color: #ffebee;
  border-radius: 4px;
}

.leaflet-popup-content {
  font-family: inherit;
  margin: 0;
  padding: 4px;
}

.leaflet-popup-content-wrapper {
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.leaflet-popup-tip {
  background-color: white;
}

/* Mobile responsive design */
@media screen and (max-width: 768px) {
  #app {
    flex-direction: column;
  }

  .map-container {
    flex: 1;
    min-height: 100%;
  }

  .info-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 30vh;
    border-top: 1px solid #ddd;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    z-index: 1000;
  }

  .info-panel.expanded {
    max-height: 70vh;
  }
}

/* Mobile fullscreen on portrait */
@media screen and (max-width: 480px) and (orientation: portrait) {
  html,
  body,
  #app {
    height: 100vh;
    height: 100dvh;
  }

  .map-container {
    flex: 1;
    min-height: 0;
  }

  .info-panel {
    max-height: 25vh;
    font-size: 13px;
  }
}

/* Mobile landscape */
@media screen and (max-width: 768px) and (orientation: landscape) {
  .map-container {
    flex: 1;
    min-height: 0;
  }

  .info-panel {
    max-height: 35vh;
    font-size: 12px;
    padding: 12px;
  }
}

/* Desktop layout */
@media screen and (min-width: 769px) {
  #app {
    flex-direction: row;
  }

  .map-container {
    flex: 1;
    height: 100%;
  }

  .info-panel {
    width: 480px;
    height: 100%;
    max-height: none;
    border-left: 1px solid #ddd;
    border-top: none;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    padding: 20px;
  }
}

/* Loading state */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

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

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

/* Ensure proper touch behavior on mobile */
.leaflet-container {
  touch-action: manipulation;
}

/* High DPI support */
@media only screen and (-webkit-min-device-pixel-ratio: 2),
  only screen and (min-device-pixel-ratio: 2) {
  .leaflet-marker-icon {
    image-rendering: crisp-edges;
  }
}
