/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue-dark:  #0d2b4e;
  --blue-mid:   #1a4a7a;
  --blue-light: #2d7dd2;
  --blue-pale:  #e8f1fb;
  --accent:     #f0a500;
  --white:      #ffffff;
  --gray-light: #f4f6f9;
  --gray-border:#dde3ec;
  --gray-text:  #6b7a90;
  --shadow:     0 4px 24px rgba(13,43,78,.12);
  --radius:     14px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(160deg, var(--blue-dark) 0%, var(--blue-mid) 55%, #1e5fa0 100%);
  min-height: 100vh;
  color: var(--white);
  display: flex;
  flex-direction: column;
}

/* ===== Header ===== */
header {
  text-align: center;
  padding: 2.5rem 1rem 1.8rem;
}
.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}
.logo-img {
  width: 260px;
  max-width: 100%;
  height: auto;
  display: block;
}
.tagline {
  font-size: 1rem;
  color: rgba(255,255,255,.7);
}

/* ===== Main ===== */
main {
  flex: 1;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

/* ===== Search ===== */
.search-wrapper {
  position: relative;
  margin-bottom: 1.4rem;
}
.search-box {
  display: flex;
  background: var(--white);
  border-radius: 50px;
  box-shadow: var(--shadow);
  border: 2px solid transparent;
  transition: border-color .2s;
  overflow: hidden;
}
.search-box:focus-within { border-color: var(--blue-light); }

#search-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 1rem 1.4rem;
  font-size: 1rem;
  color: var(--blue-dark);
  background: transparent;
}
#search-input::placeholder { color: #aab4c4; }

#search-btn {
  background: var(--blue-light);
  border: none;
  color: var(--white);
  padding: 0 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
  border-radius: 0 48px 48px 0;
  min-width: 56px;
}
#search-btn:hover:not(:disabled) { background: var(--blue-dark); }
#search-btn:disabled { opacity: .6; cursor: default; }
#search-btn svg { width: 20px; height: 20px; }
#search-btn.loading svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Suggestions ===== */
.suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(13,43,78,.18);
  list-style: none;
  z-index: 1000;
  overflow: hidden;
  border: 1px solid var(--gray-border);
}
.suggestions li {
  padding: .75rem 1.4rem;
  color: var(--blue-dark);
  cursor: pointer;
  font-size: .95rem;
  border-bottom: 1px solid var(--gray-border);
  transition: background .1s;
}
.suggestions li:last-child { border-bottom: none; }
.suggestions li:hover,
.suggestions li.active { background: var(--blue-pale); color: var(--blue-light); }

/* ===== Error ===== */
.error-msg {
  background: rgba(220,53,69,.15);
  border: 1px solid rgba(220,53,69,.4);
  color: #ffcdd2;
  padding: .9rem 1.2rem;
  border-radius: var(--radius);
  margin-bottom: 1.4rem;
  font-size: .95rem;
  text-align: center;
}

/* ===== Results ===== */
.results {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

/* ===== Current Weather Card ===== */
.weather-card {
  background: rgba(255,255,255,.97);
  color: var(--blue-dark);
  border-radius: var(--radius);
  padding: 1.6rem 1.8rem;
  box-shadow: var(--shadow);
}
.weather-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1.2rem;
}
.weather-header h2 { font-size: 1.2rem; font-weight: 700; }
.station-label { font-size: .82rem; color: var(--gray-text); margin-top: .2rem; }
.station-label strong { color: var(--blue-mid); }
.time-label { font-size: .8rem; color: var(--gray-text); text-align: right; white-space: nowrap; }

.weather-main {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  margin-bottom: 1.4rem;
}
.temp-big {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .25rem;
}
.temp-num {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--blue-mid);
  line-height: 1;
  white-space: nowrap;
  display: block;
}
.temp-icon {
  color: var(--blue-light);
  display: flex;
}
.temp-icon svg {
  width: 26px;
  height: 26px;
}
.weather-main-divider {
  width: 2px;
  height: 4.5rem;
  background: var(--gray-border);
  border-radius: 2px;
  flex-shrink: 0;
  align-self: center;
}
.weather-desc-block {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: .9rem;
}
.weather-desc-icon {
  font-size: 4rem;
  line-height: 1;
  flex-shrink: 0;
}
.weather-desc {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--blue-mid);
  line-height: 1.25;
}

.weather-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: .8rem;
}
.weather-item {
  background: var(--gray-light);
  border-radius: 10px;
  padding: .9rem .8rem;
  text-align: center;
  border: 1px solid var(--gray-border);
}
.weather-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: .4rem;
  color: var(--blue-light);
}
.weather-icon svg {
  width: 30px;
  height: 30px;
}
.weather-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--blue-mid);
  line-height: 1.1;
  margin-bottom: .25rem;
}
.weather-value small { font-size: .65rem; font-weight: 400; color: var(--gray-text); }
.weather-label { font-size: .7rem; color: var(--gray-text); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }

/* ===== Section titles ===== */
.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: rgba(255,255,255,.85);
  margin-bottom: .75rem;
  letter-spacing: .02em;
}

/* ===== Forecast ===== */
.forecast-section { /* intentionally minimal wrapper */ }

.forecast-cards {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: .75rem;
  overflow-x: auto;
  padding-bottom: .5rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.3) transparent;
}
.forecast-cards::-webkit-scrollbar { height: 4px; }
.forecast-cards::-webkit-scrollbar-thumb { background: rgba(255,255,255,.3); border-radius: 2px; }
.forecast-card {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  backdrop-filter: blur(4px);
  border-radius: var(--radius);
  padding: 1rem .9rem;
  text-align: center;
  color: var(--white);
  transition: background .2s;
  flex: 0 0 145px;
  min-width: 145px;
}
.forecast-card:hover { background: rgba(255,255,255,.18); }

.fc-day {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: rgba(255,255,255,.7);
  margin-bottom: .4rem;
}
.fc-icon { font-size: 2rem; margin-bottom: .3rem; }
.fc-desc {
  font-size: .72rem;
  color: rgba(255,255,255,.7);
  margin-bottom: .5rem;
  min-height: 1rem;
}
.fc-temp { font-size: 1.15rem; font-weight: 700; margin-bottom: .3rem; }
.fc-max { color: #ffd580; }
.fc-min { color: rgba(255,255,255,.65); }
.fc-wind { font-size: .8rem; color: rgba(255,255,255,.8); margin-bottom: .15rem; display: flex; align-items: center; justify-content: center; gap: .3rem; }
.fc-winddir { font-size: .72rem; color: rgba(255,255,255,.6); display: flex; align-items: center; justify-content: center; gap: .3rem; }
.fc-precip { font-size: .75rem; color: #90caf9; margin-top: .3rem; display: flex; align-items: center; justify-content: center; gap: .3rem; }
.fc-svg {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  color: rgba(255,255,255,.7);
}
.fc-svg svg {
  width: 14px;
  height: 14px;
}

/* ===== Map ===== */
.map-section {
  margin-bottom: 1.2rem;
}

/* Leaflet temperature legend */
.map-temp-legend {
  background: rgba(255,255,255,.93);
  border-radius: 10px;
  padding: .65rem .85rem;
  box-shadow: 0 2px 10px rgba(0,0,0,.2);
  font-size: .74rem;
  color: #1a2e45;
  line-height: 1;
  min-width: 130px;
}
.tl-title {
  font-weight: 700;
  font-size: .76rem;
  color: var(--blue-dark);
  margin-bottom: .5rem;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.tl-row {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .18rem 0;
}
.tl-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1.5px solid rgba(0,0,0,.12);
}

#map {
  height: 480px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  z-index: 0;
}
.map-legend {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  margin-top: .5rem;
  font-size: .78rem;
  color: rgba(255,255,255,.6);
}
.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.6);
  vertical-align: middle;
}

/* ===== Footer ===== */
footer {
  text-align: center;
  padding: 1.2rem;
  font-size: .8rem;
  color: rgba(255,255,255,.4);
}
footer a { color: rgba(255,255,255,.6); text-decoration: none; }
footer a:hover { color: var(--white); }

/* ===== Responsive ===== */
@media (max-width: 540px) {
  .logo h1 { font-size: 2rem; }
  header { padding: 1.8rem 1rem 1.4rem; }
  .weather-card { padding: 1.2rem; }
  .temp-big { font-size: 2.8rem; }
  .weather-grid { grid-template-columns: repeat(2, 1fr); }
  .forecast-card { flex: 0 0 125px; min-width: 125px; }
  #map { height: 300px; }
}
