/* -------------------- RESET -------------------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  overflow-x: hidden;
}

body {
  font-family: "Segoe UI", Roboto, sans-serif;
  background: #0d0f18; /* dark background */
  color: #f1f5f9;       /* light text */
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* -------------------- HEADER -------------------- */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: rgba(20, 24, 31, 0.9); /* slightly transparent */
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  width: 100%;
}

.logo {
  font-size: 1.5rem;
  font-weight: 600;
  color: #6366f1; /* purple-blue logo */
}

.nav {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  align-items: center;
  width: 100%;
  max-width: 600px;
}

.nav input,
.nav button,
.nav .icon-btn {
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav input {
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  flex: 1;
  background: #15192a; /* input background */
  color: #f1f5f9;      /* input text */
}

.nav input:focus {
  outline: none;
  border-color: #6366f1; /* input focus border */
}

.nav button,
.nav .icon-btn {
  padding: 0 0.75rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: #6366f1; /* button background */
  color: #fff;         /* button text */
  font-weight: 500;
  transition: background 0.2s;
  flex: 0 0 auto;
}

.nav button:hover,
.nav .icon-btn:hover {
  background: #4f46e5; /* button hover */
}

.icon-btn img {
  max-width: 20px;
  height: auto;
}

#themeBtn {
  background: none;   /* remove bg */
  border: none;       /* remove border */
  padding: 0;         /* no padding */
  cursor: pointer;    /* show pointer on hover */
}

#themeIcon {
  width: 32px;   /* adjust size */
  height: 32px;
}



/* -------------------- MAIN -------------------- */
.site-main { flex: 1; display: flex; flex-direction: column; gap: 1rem; padding: 1rem; width: 100%; }
.card {
  background: #15192a; border-radius: 12px; padding: 1rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.06); width: 100%; overflow: hidden;
}
/* Current Weather */
.current { text-align: center; }
.current-card { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.current-city { font-size: clamp(1rem,4vw,1.4rem); font-weight: bold; color: #fff; }
.current-meta { font-size: clamp(0.8rem,3vw,1rem); color: #9ca3af; }
.current-icon img { width: clamp(60px,18vw,100px); }
.current-temp { font-size: clamp(1.5rem,8vw,2.5rem); font-weight: bold; color: #6366f1; }
.current-desc { font-size: clamp(0.9rem,4vw,1.1rem); text-transform: capitalize; color: #e2e8f0; }
/* Stats */
#statsGrid { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.stat {
  flex: 1 1 100px; text-align: center; padding: 0.6rem;
  background: #1e2233; border-radius: 8px; border: 1px solid rgba(255,255,255,0.05);
}
.stat img { width: 28px; height: 28px; margin: 0.3rem 0; }
.stat .label { font-size: 0.8rem; color: #9ca3af; }
.stat .value { font-weight: bold; font-size: 0.95rem; color: #fff; }
/* Sun & Temps */
#sunGrid { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.sun-tile {
  flex: 1 1 100px; text-align: center; padding: 0.6rem;
  background: #1e2233; border-radius: 8px; border: 1px solid rgba(255,255,255,0.05);
}
.sun-tile img { width: 28px; height: 28px; margin: 0.3rem 0; }
.sun-tile .label { font-size: 0.8rem; color: #9ca3af; }
.sun-tile .value { font-weight: bold; font-size: 0.95rem; color: #fff; }
/* Forecast */
.section-title { font-size: clamp(1rem,4vw,1.2rem); margin-bottom: 0.5rem; font-weight: 600; color: #e0e7ff; }
.forecast-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.forecast-tile {
  flex: 1 1 70px; text-align: center; padding: 0.5rem;
  background: #1e2233; border-radius: 8px; border: 1px solid rgba(255,255,255,0.05);
}
.forecast-tile img { width: clamp(20px,8vw,40px); margin: 0.25rem 0; }
.bold { font-weight: bold; } .muted { font-size: 0.8rem; color: #9ca3af; }
/* Chart */
.chart-card { width: 100%; aspect-ratio: 16/9; background: #15192a; border-radius: 12px; padding: 0.5rem; margin-top: 1rem; }
.chart-legend-wrapper { overflow-x: auto; white-space: nowrap; margin-bottom: 10px; padding-bottom: 5px; }
.chart-legend-wrapper ul { display: inline-flex !important; flex-wrap: nowrap !important; gap: 20px; }
/* Map */
#map { width: 100%; min-height: 200px; height: clamp(200px,40vh,350px); border-radius: 12px; border: 1px solid rgba(99,102,241,0.3); overflow: hidden; }
/* Footer */
.site-footer {
  text-align: center; padding: 1rem; font-size: 0.9rem;
  background: rgba(20,24,31,0.9); color: #9ca3af;
  border-top: 1px solid rgba(255,255,255,0.08); width: 100%;
}

/* -------------------- RESPONSIVENESS -------------------- */
/* Small Tablets & Phones */
@media (min-width: 768px) and (max-width: 1023px) {
  .site-header { flex-wrap: wrap; justify-content: space-between; }
  .site-main { grid-template-columns: 1fr; }
  .nav input { flex: 1 1 200px; }
  .chart-card { height: 280px; }
}

@media (min-width: 481px) and (max-width: 767px) {
  .logo { font-size: 1.4rem; }
  .nav { flex-wrap: wrap; }
  .nav input { flex: 1 1 200px; }
  .site-main { grid-template-columns: 1fr; }
  .section-title { font-size: clamp(1.3rem, 6vw, 1.6rem); }
  .chart-card { height: 260px; }
}

@media (min-width: 361px) and (max-width: 480px) {
  .site-header { flex-direction: column; align-items: center; gap: 0.75rem; }
  .logo { font-size: 1.3rem; text-align: center; width: 100%; }
  .nav { flex-direction: row; flex-wrap: nowrap; width: 100%; gap: 0.5rem; justify-content: center; }
  .nav input { flex: 1; min-width: 0; }
  .nav button, .nav .icon-btn { flex: 0 0 auto; width: auto; }
  #map { min-height: 180px; }
  .section-title { font-size: clamp(1.4rem, 6vw, 1.7rem); }
  .chart-card { height: 250px; }
}

@media (max-width: 360px) {
  .site-header { flex-direction: column; align-items: center; gap: 0.5rem; }
  .logo { font-size: 1.1rem; text-align: center; width: 100%; }
  .nav { flex-direction: row; flex-wrap: nowrap; width: 100%; gap: 0.4rem; justify-content: center; }
  .nav input { flex: 1; font-size: 0.85rem; padding: 0.4rem 0.6rem; min-width: 0; }
  .nav button, .nav .icon-btn { font-size: 0.85rem; padding: 0.4rem 0.6rem; flex: 0 0 auto; width: auto; }
  .forecast-grid { grid-template-columns: repeat(auto-fit, minmax(55px, 1fr)); }
  .section-title { font-size: clamp(1.4rem, 7vw, 1.8rem); }
  .chart-card { height: 230px; }
}