body {
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  margin: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}
.container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  text-align: center;
  padding: 2rem;
  max-width: 1400px;
  width: 100%;
}
h1 {
  font-size: 3rem;
  margin-bottom: 1rem;
}
p {
  font-size: 1.2rem;
  opacity: 0.9;
}

/* Search form */
#city-search-form {
  margin: 2rem 0;
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
}

/* Wrapper gives the suggestions list an anchor for absolute positioning */
#city-input-wrapper {
  position: relative;
}

#city-input {
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  min-width: 250px;
  transition: all 0.3s ease;
  width: 100%;
  box-sizing: border-box;
}

#city-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

#city-input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.2);
}

/* Suggestions dropdown */
#city-suggestions {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: rgba(50, 30, 80, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  list-style: none;
  margin: 0;
  padding: 0.25rem 0;
  z-index: 100;
  max-height: 260px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  text-align: left;
}

#city-suggestions.open {
  display: block;
}

#city-suggestions li {
  padding: 0.6rem 1rem;
  cursor: pointer;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.15s ease;
}

#city-suggestions li:hover,
#city-suggestions li.active {
  background: rgba(255, 255, 255, 0.15);
  color: white;
}

#city-search-form button {
  padding: 0.75rem 2rem;
  font-size: 1rem;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

#city-search-form button:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

#city-search-form button:active {
  transform: translateY(0);
}

/* Status message shown before/during/on error */
#status-message {
  margin-top: 2rem;
}

/* 2-column grid on wide screens, 1-column on narrow */
#plots-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-top: 2rem;
}

@media (max-width: 768px) {
  #plots-grid {
    grid-template-columns: 1fr;
  }
}

.plot-cell {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 0.5rem;
  height: 22rem;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.plot-cell:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* Modal/Lightbox styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal.open {
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 1;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  cursor: pointer;
}

.modal-content {
  position: relative;
  background: rgba(255, 255, 255, 1);
  border-radius: 16px;
  padding: 2rem;
  max-width: 95vw;
  max-height: 90vh;
  width: 1200px;
  z-index: 1001;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-close {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: rgba(0, 0, 0, 0.2);
  border: none;
  font-size: 2rem;
  color: #333;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  transition: all 0.2s ease;
  z-index: 1002;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.3);
  transform: scale(1.1);
}

#modal-plot-container {
  width: 100%;
  height: 70vh;
  min-height: 500px;
}

@media (max-width: 768px) {
  #modal-plot-container {
    height: 60vh;
    min-height: 400px;
  }

  .modal-content {
    padding: 1rem;
  }
}

/* Time range toggle */
.range-btn {
  padding: 6px 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  color: #fff;
}

.range-btn.active {
  background: #fff;
  color: #111;
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  border-radius: 4px;
}

.range-btn:focus-visible {
  outline: 2px solid #4a90e2;
  outline-offset: -2px;
}

footer {
  margin-top: auto;
  padding-bottom: 2rem;
  font-size: 0.85rem;
  opacity: 0.6;
  text-align: left;
}

footer a {
  color: white;
}
