/* Weather — your destinations */
:root {
  --bg: #f5f7fb;
  --bg-card: #ffffff;
  --bg-card-night: #1e2a47;
  --fg: #1a1f2e;
  --fg-muted: #64748b;
  --fg-night: #e8eef9;
  --fg-muted-night: #9aa7c2;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --danger: #ef4444;
  --border: #e2e8f0;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 16px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  line-height: 1.5;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.app-header {
  text-align: center;
  margin-bottom: 2rem;
}

.app-header h1 {
  font-size: 2.25rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}

.logo {
  display: inline-block;
  transform: translateY(-2px);
}

.tagline {
  color: var(--fg-muted);
  margin: 0.25rem 0 0;
}

/* Search */
.add-destination {
  max-width: 560px;
  margin: 0 auto 2.5rem;
  position: relative;
}

.search-form input {
  width: 100%;
  padding: 0.85rem 1.1rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius);
  outline: none;
  box-shadow: var(--shadow);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.search-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 10;
}

.search-results:empty {
  display: none;
}

.search-list {
  list-style: none;
  margin: 0;
  padding: 0.35rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 340px;
  overflow-y: auto;
}

.search-list li + li {
  margin-top: 2px;
}

.search-list form {
  margin: 0;
}

.search-hit {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  background: transparent;
  border: none;
  padding: 0.7rem 0.85rem;
  font: inherit;
  text-align: left;
  border-radius: 8px;
  cursor: pointer;
  color: var(--fg);
}

.search-hit:hover,
.search-hit:focus-visible {
  background: #eef2ff;
  outline: none;
}

.hit-name {
  font-weight: 600;
}

.hit-meta {
  color: var(--fg-muted);
  font-size: 0.875rem;
}

.search-empty {
  background: var(--bg-card);
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg-muted);
  margin: 0;
}

/* Destination grid */
.destinations {
  min-height: 120px;
}

.loading {
  text-align: center;
  color: var(--fg-muted);
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin: 0;
}

.empty-state h2 {
  margin: 0.5rem 0 0.25rem;
  font-size: 1.25rem;
}

.empty-state p {
  color: var(--fg-muted);
  margin: 0;
}

.destination-grid {
  display: grid;
  /* min(320px, 100%) keeps a single column from exceeding the viewport on narrow phones */
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  gap: 1.25rem;
}

/* Card */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  /* Grid items default to min-width:auto (= content width). The 24-chip hourly strip
     would otherwise force the card, and the page, wider than the viewport. */
  min-width: 0;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.05), 0 12px 28px rgba(15, 23, 42, 0.08);
}

.card-day {
  background: linear-gradient(145deg, #ffffff 0%, #eef4ff 100%);
}

.card-night {
  background: linear-gradient(145deg, #243154 0%, #141c35 100%);
  color: var(--fg-night);
}

.card-night .card-region,
.card-night .now-feels,
.card-night dt {
  color: var(--fg-muted-night);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.card-head h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.card-region {
  margin: 0.15rem 0 0;
  font-size: 0.875rem;
  color: var(--fg-muted);
}

.btn-remove {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(100, 116, 139, 0.12);
  color: inherit;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms ease, color 120ms ease;
}

.btn-remove:hover {
  background: var(--danger);
  color: white;
}

/* Now block */
.card-now {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 0.85rem;
}

.now-icon {
  font-size: 2.75rem;
  line-height: 1;
}

.now-temp {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.now-meta {
  display: flex;
  flex-direction: column;
}

.now-label {
  font-weight: 600;
}

.now-feels {
  color: var(--fg-muted);
  font-size: 0.875rem;
}

/* Stats */
.card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem 0.75rem;
  margin: 0;
}

.card-stats > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-stats dt {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
  margin: 0;
  font-weight: 600;
}

.card-stats dd {
  margin: 0;
  font-weight: 600;
  font-size: 0.95rem;
}

.uv-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.uv-low { background: #d1fae5; color: #065f46; }
.uv-moderate { background: #fef3c7; color: #92400e; }
.uv-high { background: #fed7aa; color: #9a3412; }
.uv-very-high { background: #fecaca; color: #991b1b; }
.uv-extreme { background: #e9d5ff; color: #6b21a8; }

.card-night .uv-chip {
  filter: brightness(0.9);
}

/* Forecast blocks (hourly + daily) */
.forecast-block {
  padding-top: 0.75rem;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  min-width: 0;
}

.forecast-label {
  margin: 0 0 0.35rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
  font-weight: 600;
}

.card-night .forecast-label {
  color: var(--fg-muted-night);
}

/* Hourly strip: horizontally scrollable row of 24 chips */
.hourly-strip {
  display: flex;
  gap: 0.2rem;
  overflow-x: auto;
  overflow-y: hidden;
  min-width: 0;
  max-width: 100%;
  padding-bottom: 0.35rem;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.hourly-strip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 8px;
}

.hour-chip {
  flex: 0 0 56px;
  text-align: center;
  padding: 0.35rem 0.1rem;
  border-radius: 8px;
  scroll-snap-align: start;
}

.hour-now {
  background: rgba(37, 99, 235, 0.1);
}

.card-night .hour-now {
  background: rgba(255, 255, 255, 0.1);
}

.hour-newday {
  border-left: 1px dashed rgba(148, 163, 184, 0.55);
  border-radius: 0 8px 8px 0;
}

.hour-time {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--fg-muted);
  font-weight: 600;
  white-space: nowrap;
}

.hour-now .hour-time {
  color: var(--accent);
}

.card-night .hour-time {
  color: var(--fg-muted-night);
}

.card-night .hour-now .hour-time {
  color: #bfdbfe;
}

.hour-icon {
  font-size: 1.2rem;
  line-height: 1;
  margin: 3px 0;
}

.hour-temp {
  font-size: 0.82rem;
  font-weight: 700;
}

.hour-rain {
  font-size: 0.68rem;
  color: var(--accent);
  min-height: 1em;
  white-space: nowrap;
}

.card-night .hour-rain {
  color: #93c5fd;
}

/* Daily strip */
.forecast-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.3rem;
}

.day-chip {
  text-align: center;
  padding: 0.4rem 0.15rem;
  border-radius: 8px;
}

.day-name {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
  font-weight: 600;
}

.card-night .day-name {
  color: var(--fg-muted-night);
}

.day-icon {
  font-size: 1.3rem;
  line-height: 1;
  margin: 2px 0;
}

.day-temps {
  font-size: 0.78rem;
  display: flex;
  justify-content: center;
  gap: 4px;
}

.day-max {
  font-weight: 700;
}

.day-min {
  color: var(--fg-muted);
}

.card-night .day-min {
  color: var(--fg-muted-night);
}

.error {
  color: var(--danger);
  margin: 0;
  font-size: 0.9rem;
}

@media (max-width: 480px) {
  .container { padding: 1.25rem 1rem 3rem; }
  .app-header h1 { font-size: 1.75rem; }
  .destination-grid { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 1rem; }
  .card-stats { grid-template-columns: repeat(2, 1fr); }
  .hour-chip { flex-basis: 52px; }
  .hourly-strip { scrollbar-width: none; }
  .hourly-strip::-webkit-scrollbar { display: none; }
}

/* Header links (e.g. rain radar) */
.header-links {
  margin: 0.6rem 0 0;
  font-size: 0.9rem;
}

.header-link {
  color: var(--accent);
  text-decoration: none;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
}

.header-link:hover,
.header-link:focus-visible {
  background: rgba(37, 99, 235, 0.16);
  text-decoration: underline;
}

/* Language switcher: in the account bar on the home page, on its own line on the auth pages */
.lang-switch {
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

.lang-switch:hover,
.lang-switch:focus-visible {
  text-decoration: underline;
}

.lang-bar {
  margin: 0.6rem 0 0;
  font-size: 0.9rem;
}

/* Account bar (top of the header) */
.account-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--fg-muted);
}

.account-bar a,
.link-button {
  color: var(--accent);
  text-decoration: none;
  font: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.account-bar a:hover,
.account-bar a:focus-visible,
.link-button:hover,
.link-button:focus-visible {
  text-decoration: underline;
}

.account-user {
  overflow-wrap: anywhere;
}

.account-user strong {
  color: var(--fg);
  font-weight: 600;
}

.account-sep {
  color: var(--border);
}

.inline-form {
  display: inline;
  margin: 0;
}

.anon-note {
  margin: 0.75rem auto 0;
  max-width: 560px;
  font-size: 0.85rem;
  color: var(--fg-muted);
}

.anon-note a {
  color: var(--accent);
}

/* Inline notices (import result, list cap) */
.notice {
  max-width: 560px;
  margin: 0 auto 1rem;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius);
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #3730a3;
  font-size: 0.9rem;
  text-align: center;
}

.notice[hidden] {
  display: none;
}

/* Account pages (login, sign up, notices) */
.auth-container {
  max-width: 480px;
}

.home-link {
  color: inherit;
  text-decoration: none;
}

.auth-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.auth-card h2 {
  margin: 0 0 1rem;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.label-hint {
  font-weight: 400;
  color: var(--fg-muted);
}

.auth-form input {
  width: 100%;
  padding: 0.75rem 0.9rem;
  font: inherit;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.auth-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
  background: var(--bg-card);
}

.btn-primary {
  margin-top: 0.25rem;
  padding: 0.8rem 1rem;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 120ms ease;
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--accent-hover);
}

.form-error {
  margin: 0 0 1rem;
  padding: 0.6rem 0.9rem;
  border-radius: 10px;
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: #991b1b;
  font-size: 0.9rem;
}

.message-text {
  margin: 0 0 1rem;
  color: var(--fg-muted);
}

.auth-switch {
  margin: 1.25rem 0 0;
  font-size: 0.9rem;
  color: var(--fg-muted);
  text-align: center;
}

.auth-switch a {
  color: var(--accent);
}

@media (max-width: 480px) {
  .auth-card { padding: 1.25rem 1rem; }
}

/* SEO/intro copy on the home page and the radar page's no-JS fallback */
.intro {
  max-width: 560px;
  margin: 0.6rem auto 0;
  color: var(--fg-muted);
  font-size: 0.95rem;
}

.radar-noscript {
  margin: 0.75rem 1rem;
  padding: 0.75rem 1rem;
  background: #fef3c7;
  color: #92400e;
  border-radius: 10px;
}
