*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #666666;
  --border: #e0e0e0;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --error: #ef4444;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f0f;
    --surface: #1a1a1a;
    --text: #f0f0f0;
    --text-secondary: #999999;
    --border: #333333;
    --accent: #60a5fa;
    --accent-hover: #3b82f6;
  }
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 1rem;
}

.app {
  max-width: 600px;
  margin: 0 auto;
}

/* Search */
.search-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.search-bar input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  outline: none;
}

.search-bar input:focus {
  border-color: var(--accent);
}

.search-bar button {
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: white;
  font-size: 1rem;
  cursor: pointer;
}

.search-bar button:hover {
  background: var(--accent-hover);
}

/* Unit toggle */
.unit-toggle {
  display: flex;
  justify-content: center;
  gap: 0;
  margin-bottom: 1.5rem;
}

.unit-toggle button {
  padding: 0.4rem 1rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
}

.unit-toggle button:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}

.unit-toggle button:last-child {
  border-radius: 0 var(--radius) var(--radius) 0;
  border-left: none;
}

.unit-toggle button.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* Current weather */
.current-weather {
  text-align: center;
  padding: 2rem 1rem;
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}

.location-name {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.current-icon {
  font-size: 4rem;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.current-temp {
  font-size: 3.5rem;
  font-weight: 300;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.current-condition {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.current-details {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Hourly */
#hourly {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.5rem;
}

#hourly h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.hourly-scroll {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  -webkit-overflow-scrolling: touch;
}

.hourly-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  min-width: 60px;
  flex-shrink: 0;
}

.hourly-time {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.hourly-icon {
  font-size: 1.25rem;
}

.hourly-temp {
  font-size: 0.875rem;
  font-weight: 500;
}

/* Daily */
#daily {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem;
}

#daily h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.daily-row {
  display: flex;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.daily-row:last-child {
  border-bottom: none;
}

.daily-day {
  width: 50px;
  font-size: 0.875rem;
}

.daily-icon {
  font-size: 1.25rem;
  width: 40px;
  text-align: center;
  position: relative;
  cursor: default;
}

.daily-icon[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.35rem 0.6rem;
  background: var(--text);
  color: var(--bg);
  font-size: 0.75rem;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s;
}

.daily-icon[data-tooltip]:hover::after,
.daily-icon[data-tooltip]:active::after {
  opacity: 1;
}

.daily-high {
  font-size: 0.875rem;
  font-weight: 600;
  width: 50px;
  text-align: right;
}

.daily-low {
  font-size: 0.875rem;
  color: var(--text-secondary);
  width: 50px;
  text-align: right;
}

/* States */
.loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary);
}

.error-message {
  text-align: center;
  padding: 1.5rem;
  color: var(--error);
  background: var(--surface);
  border-radius: var(--radius);
}

/* Mobile adjustments */
@media (max-width: 480px) {
  .search-bar {
    flex-direction: column;
  }

  .search-bar button {
    width: 100%;
  }

  .current-temp {
    font-size: 2.75rem;
  }

  .current-details {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .daily-day {
    width: 40px;
    font-size: 0.8rem;
  }

  .daily-high,
  .daily-low {
    width: 40px;
  }
}

/* Scrollbar */
.hourly-scroll::-webkit-scrollbar {
  height: 4px;
}

.hourly-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.hourly-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}
