body {
  margin: 0;
  font-family: Arial, sans-serif;
  color: white;
  transition: background 1s ease;
  overflow-x: hidden;
}

/* Tema */
.dark { background: linear-gradient(to bottom, #0f2027, #203a43); }
.light { background: linear-gradient(to bottom, #0d6efd, #6ea8fe); }

/* Header & Controls */
header {
  position: sticky;
  top: 0;
  z-index: 1001;              /* pastikan tombol clickable di atas canvas */
  padding: 12px 10px;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

input, button {
  padding: 8px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  box-sizing: border-box;
}

button {
  background: rgba(255,255,255,0.2);
  color: white;
}

button:hover { background: rgba(255,255,255,0.4); }

/* Main & Cards */
main {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-width: 480px;     /* sama dengan lebar radar map */
  margin: auto;          /* center di layar kecil */
  box-sizing: border-box;
}

.card {
  width: 100%;           /* pastikan tidak overflow */
  box-sizing: border-box;
  padding: 15px;
  border-radius: 15px;
  backdrop-filter: blur(10px);
  background: rgba(255,255,255,0.2);
}

/* Forecast horizontal scroll */
.forecast {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  width: 100%;
  padding-bottom: 10px;
}

.forecast-day {
  min-width: 100px;
  background: rgba(255,255,255,0.2);
  border-radius: 12px;
  padding: 8px;
  box-sizing: border-box;
  text-align: center;
  flex-shrink: 0;
}

/* Radar Map */
.radar {
  position: relative;
  height: 300px;
  width: 100%;
  border-radius: 15px;
  overflow: hidden;
  margin: 10px 0;
}

#radarMap {
  height: 100%;
  width: 100%;
}

/* Radar Controls & Legend */
#radarControls {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  z-index: 1000;
  background: rgba(0,0,0,0.6);
  border-radius: 10px;
  padding: 8px;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  font-size: 10px;
}

.legend span {
  display: inline-block;
  width: 15px;
  height: 10px;
  margin-right: 5px;
  border-radius: 3px;
}

/* Canvas hujan */
canvas {
  position: fixed;
  top:0;
  left:0;
  pointer-events: none;   /* supaya tombol clickable */
  z-index: 0;
  width: 100%;
  height: 100%;
}

/* Loading */
#loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  z-index: 2000;
  display: none;
}

/* Footer */
footer {
  text-align: center;
  padding: 12px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border-top-left-radius: 15px;
  border-top-right-radius: 15px;
  font-size: 12px;
  margin-top: 15px;
}

/* Responsive tweaks */
@media (max-width: 480px) {
  header, main {
    padding: 8px;
  }
  .forecast-day {
    min-width: 90px;
  }
  button, input {
    flex: 1 1 auto;
  }
}
