/* src/index.css */
:root {
  --buncss-light: ;
  --buncss-dark: initial;
  color-scheme: dark;
  color: #ffffffde;
  background-color: #111;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Noto Sans, Ubuntu, Cantarell, Helvetica Neue, Avenir, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

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

body {
  background: #111;
  min-height: 100vh;
  margin: 0;
}

.dashboard {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 1320px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
}

.dashboard-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items:  center;
  gap: 1rem;
}

.dashboard-title {
  letter-spacing: -.5px;
  color: #fff;
  margin: 0;
  font-size: 1.8rem;
  font-weight: 700;
}

.section-heading {
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin: 0 0 .75rem;
  font-size: 1rem;
  font-weight: 600;
}

.date-range-selector {
  display: flex;
  flex-direction: column;
  align-items:  flex-end;
  gap: .5rem;
}

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.preset-btn {
  color: #ccc;
  cursor: pointer;
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 6px;
  padding: .3rem .75rem;
  transition: background .15s, color .15s;
  font-size: .85rem;
}

.preset-btn:hover {
  color: #fff;
  background: #2a2a2a;
  border-color: #555;
}

.apply-btn {
  color: #111;
  background: #f97316;
  border-color: #0000;
  font-weight: 600;
}

.apply-btn:hover {
  color: #000;
  background: #ea6c0a;
}

.custom-range {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items:  center;
  gap: .75rem;
}

.custom-range label {
  display: flex;
  color: #aaa;
  align-items:  center;
  gap: .4rem;
  font-size: .85rem;
}

.custom-range input[type="datetime-local"] {
  color: #eee;
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 6px;
  padding: .25rem .5rem;
  font-size: .85rem;
}

.latest-panel {
  display: flex;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items:  center;
  gap: 1rem;
  padding: 1rem 1.5rem;
}

.latest-panel--loading {
  color: #666;
  font-size: .9rem;
}

.latest-readings {
  display: flex;
  flex-wrap: wrap;
  align-items:  center;
  gap: 1.25rem;
}

.latest-divider {
  background: #2a2a2a;
  width: 1px;
  height: 2.5rem;
}

.latest-reading {
  display: flex;
  flex-direction: column;
  gap: .2rem;
}

.latest-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.latest-value--temp {
  color: #f97316;
}

.latest-value--hum {
  color: #38bdf8;
}

.latest-value--forecast {
  color: #eee;
  font-size: 1.6rem;
}

.forecast-min {
  color: #7dd3fc;
}

.forecast-max {
  color: #fca5a5;
}

.forecast-sep {
  color: #555;
}

.latest-label {
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #666;
  font-size: .72rem;
  font-weight: 600;
}

.latest-time {
  color: #555;
  white-space: nowrap;
  font-size: .8rem;
}

.forecast-panel {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
}

.forecast-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: .5rem;
}

.forecast-day {
  display: flex;
  background: #111;
  border: 1px solid #222;
  border-radius: 8px;
  flex-direction: column;
  align-items:  center;
  gap: .3rem;
  padding: .75rem .5rem;
}

.forecast-day--today {
  border-color: #f97316;
}

.forecast-day-name {
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #aaa;
  font-size: .75rem;
  font-weight: 700;
}

.forecast-day--today .forecast-day-name {
  color: #f97316;
}

.forecast-day-date {
  color: #555;
  font-size: .78rem;
}

.forecast-day-temps {
  display: flex;
  flex-direction: column;
  align-items:  center;
  gap: .1rem;
  margin-top: .25rem;
}

.forecast-day-max {
  color: #f97316;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
}

.forecast-day-min {
  color: #38bdf8;
  font-size: .95rem;
  font-weight: 600;
  line-height: 1;
}

.forecast-day-nodata {
  color: #444;
  margin-top: .25rem;
  font-size: .72rem;
}

@media (width <= 640px) {
  .forecast-days {
    grid-template-columns: repeat(4, 1fr);
  }
}

.chart-section {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  padding: 1.25rem .5rem .5rem;
}

.chart-container {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.chart-toggles {
  display: flex;
  gap: .5rem;
  padding: 0 .5rem;
}

.chart-toggle {
  color: #888;
  cursor: pointer;
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 6px;
  padding: .25rem .75rem;
  transition: background .15s, color .15s, border-color .15s;
  font-size: .8rem;
}

.chart-toggle--on {
  color: var(--toggle-color);
  border-color: var(--toggle-color);
  background: color-mix(in srgb, var(--toggle-color) 12%, transparent);
}

.chart-toggle:hover {
  background: #2a2a2a;
}

.chart-wrapper {
  width: 100%;
  height: 680px;
}

.chart-placeholder {
  display: flex;
  color: #666;
  justify-content: center;
  align-items:  center;
  height: 660px;
  font-size: .9rem;
}

.stats-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.stats-panel.loading, .stats-panel.empty {
  grid-template-columns: 1fr;
  color: #666;
  text-align: center;
  padding: 1rem;
  font-size: .9rem;
}

.stat-card {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  padding: 1rem 1.25rem;
}

.stat-label {
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #888;
  margin-bottom: .75rem;
  font-size: .8rem;
  font-weight: 600;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items:  end;
  gap: .5rem;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: .2rem;
}

.stat-item.center {
  text-align: center;
  align-items:  center;
}

.stat-item.right {
  text-align: right;
  align-items:  flex-end;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
}

.stat-value.low {
  color: #38bdf8;
}

.stat-value.avg {
  color: #eee;
  font-size: 1.15rem;
}

.stat-value.high {
  color: #f97316;
}

.stat-sub {
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: .72rem;
}

.monthly-section {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
}

.monthly-table-wrapper {
  overflow-x: auto;
}

.monthly-table {
  border-collapse: collapse;
  width: 100%;
  font-size: .9rem;
}

.monthly-table th {
  text-align: left;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #666;
  border-bottom: 1px solid #2a2a2a;
  padding: .5rem .75rem;
  font-size: .75rem;
  font-weight: 600;
}

.monthly-table td {
  white-space: nowrap;
  border-bottom: 1px solid #1e1e1e;
  padding: .6rem .75rem;
}

.monthly-table tbody tr:last-child td {
  border-bottom: none;
}

.monthly-table tbody tr:hover td {
  background: #222;
}

.month-cell {
  color: #ddd;
  font-weight: 600;
}

.temp-low {
  color: #38bdf8;
  font-weight: 600;
}

.temp-high {
  color: #f97316;
  font-weight: 600;
}

.time-cell {
  color: #666;
  font-size: .82rem;
}

.monthly-loading, .monthly-error, .monthly-empty {
  color: #666;
  text-align: center;
  padding: 1.5rem;
  font-size: .9rem;
}

@media (width <= 640px) {
  .dashboard-header {
    flex-direction: column;
    align-items:  flex-start;
  }

  .stats-panel {
    grid-template-columns: 1fr;
  }

  .date-range-selector {
    align-items:  flex-start;
  }
}

@media (prefers-reduced-motion) {
  *, :before, :after {
    animation: none !important;
    transition: none !important;
  }
}
