/* ===================================
   Hourly Forecast Chart
   Combined precipitation (bars) + temperature (line) chart for 48 hours
   =================================== */

.hourly-chart-container {
  background: rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-top: var(--space-md);
  border: 1px solid var(--border-light);
}

.hourly-chart-title {
  font-size: var(--text-small);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  margin-bottom: var(--space-sm);
  text-align: center;
}

/* Wrapper outer container with fixed Y-axis */
.hourly-chart-wrapper-outer {
  position: relative;
  display: flex;
  gap: 0;
}

/* Fixed Y-axis on the left */
.hourly-y-axis-fixed {
  position: sticky;
  left: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.95);
  border-right: 1px solid var(--border-light);
  padding-right: 4px;
}

/* Chart wrapper with horizontal scroll */
.hourly-chart-wrapper {
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--space-xs);
  flex: 1;
}

/* Scrollbar styling */
.hourly-chart-wrapper::-webkit-scrollbar {
  height: 4px;
}

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

.hourly-chart-wrapper::-webkit-scrollbar-thumb {
  background: var(--stone-grey);
  border-radius: var(--radius-sm);
}

.hourly-chart-wrapper::-webkit-scrollbar-thumb:hover {
  background: var(--lake-blue);
}

/* SVG chart */
.hourly-chart-svg {
  display: block;
  min-width: 100%;
  width: auto; /* Will be set dynamically based on data */
  height: 220px;
}

/* Precipitation bars */
.precip-bar {
  fill: rgba(74, 144, 164, 0.6);
  transition: opacity var(--duration-fast) var(--ease-smooth);
}

.precip-bar:hover {
  opacity: 0.9;
  fill: rgba(74, 144, 164, 0.8);
}

/* Temperature line */
.temp-line {
  fill: none;
  stroke: #ff6b6b;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Temperature dots */
.temp-dot {
  fill: #ff6b6b;
  stroke: white;
  stroke-width: 2;
  transition: r var(--duration-fast) var(--ease-smooth);
}

.temp-dot:hover {
  r: 5;
}

/* Axis lines */
.chart-axis {
  stroke: var(--border-light);
  stroke-width: 1;
  fill: none;
}

/* Grid lines */
.chart-grid {
  stroke: var(--border-light);
  stroke-width: 0.5;
  stroke-dasharray: 2 2;
  opacity: 0.5;
}

/* Labels */
.chart-label {
  font-size: 10px;
  font-family: var(--font-main);
  fill: var(--text-tertiary);
}

.chart-label-primary {
  font-size: 11px;
  font-family: var(--font-main);
  font-weight: var(--weight-semibold);
  fill: var(--text-secondary);
}

/* Hour labels - more readable */
.hour-label {
  font-size: 11px;
  font-family: var(--font-main);
  fill: var(--text-secondary);
  text-anchor: middle;
  font-weight: var(--weight-medium);
}

.hour-label.major {
  font-weight: var(--weight-semibold);
  fill: var(--text-primary);
  font-size: 12px;
}

.hour-label.minor {
  font-weight: var(--weight-normal);
}

/* Hide minor labels on mobile by default */
@media (max-width: 768px) {
  .hour-label.hide-mobile {
    display: none;
  }
}

/* Y-axis labels */
.y-axis-label {
  font-size: 10px;
  font-family: var(--font-main);
  fill: var(--text-tertiary);
  text-anchor: end;
}

.y-axis-label.temp {
  fill: #ff6b6b;
  text-anchor: start;
}

/* Legend */
.chart-legend {
  display: flex;
  justify-content: center;
  gap: var(--space-lg);
  margin-top: var(--space-sm);
  font-size: var(--text-xsmall);
  color: var(--text-tertiary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.legend-color {
  width: 16px;
  height: 12px;
  border-radius: var(--radius-sm);
}

.legend-color.precip {
  background: rgba(74, 144, 164, 0.6);
}

.legend-color.temp {
  background: #ff6b6b;
  height: 3px;
}

/* Responsive */
@media (max-width: 768px) {
  .hourly-chart-container {
    padding: var(--space-sm);
  }

  .hourly-chart-svg {
    height: 200px;
  }

  .chart-legend {
    font-size: 10px;
    gap: var(--space-md);
  }

  /* Smaller font for hour labels on mobile */
  .hour-label {
    font-size: 9px;
  }

  .hour-label.major {
    font-size: 10px;
  }

  /* Reduce Y-axis fixed width on mobile */
  .hourly-y-axis-fixed {
    padding-right: 2px;
  }
}

@media (max-width: 480px) {
  .hourly-chart-container {
    padding: 8px;
  }

  /* Even smaller on very small screens */
  .hour-label {
    font-size: 8px;
  }

  .hour-label.major {
    font-size: 9px;
  }

  .chart-legend {
    font-size: 9px;
    gap: 8px;
  }
}

/* ===================================
   Interactive Tooltip
   =================================== */
.hourly-chart-container {
  position: relative;
  overflow: visible;
}

.hourly-tooltip {
  position: absolute;
  background: #FFFFFF;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  pointer-events: none;
  transform: translate(-50%, -100%);
  min-width: 180px;
  margin-top: -8px;
  overflow: hidden;
}

.hourly-tooltip::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid #FFFFFF;
}

/* Intensity band at top of tooltip */
.tooltip-intensity-band {
  width: 100%;
  padding: 6px 10px;
  text-align: center;
  font-size: 11px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.3px;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* Tooltip content area */
.tooltip-content {
  padding: var(--space-sm);
  background: #FFFFFF;
}

.tooltip-time {
  font-size: 12px;
  font-weight: var(--weight-semibold);
  color: #1a1a1a;
  margin-bottom: var(--space-xs);
  text-align: center;
}

.tooltip-temp,
.tooltip-precip {
  font-size: 13px;
  color: #333333;
  margin: 4px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: var(--weight-medium);
}

/* Clickable elements */
.clickable {
  transition: opacity 0.2s ease;
}

.precip-bar.clickable:hover {
  opacity: 0.8;
}

.temp-dot.clickable:hover {
  r: 4;
}

@media (max-width: 768px) {
  .hourly-tooltip {
    min-width: 140px;
    padding: 8px;
    font-size: 11px;
  }

  .tooltip-time {
    font-size: 11px;
  }

  .tooltip-temp,
  .tooltip-precip {
    font-size: 12px;
  }
}
