/* Surf Forecast Styles */

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

:root {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-card: #16213e;
  --text-primary: #edf2f7;
  --text-secondary: #ffffff;
  --text-muted: #e0e0e0;
  --accent-blue: #4299e1;
  --accent-green: #48bb78;
  --accent-yellow: #ecc94b;
  --accent-orange: #ed8936;
  --accent-red: #fc8181;
  --border-color: #2d3748;
}

html, body {
  height: 100%;
  overflow-x: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
}

.container {
  min-height: 100%;
  padding: 12px;
  padding-bottom: 40px;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  gap: 12px;
  margin-bottom: 12px;
}

.header-row {
  display: contents;
}

.header-bottom {
  display: none;
}

.back-btn {
  color: var(--text-secondary);
  text-decoration: none;
  display: flex;
  align-items: center;
  padding: 8px;
  margin: -8px;
  border-radius: 8px;
}

.back-btn:hover {
  background: var(--bg-card);
}

.header h1 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 1px;
  flex: 1;
}

.location {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.location-select {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='%23a0aec0'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0 center;
  padding-right: 16px;
  padding-left: 0;
}

.location-select:focus {
  outline: none;
}

.location-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.sun-times {
  display: none;
  gap: 12px;
  align-items: center;
}

.sun-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sun-icon {
  font-size: 0.9rem;
}

.sun-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.rating {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.rating-epic { background: var(--accent-green); color: #1a1a2e; }
.rating-good { background: #68d391; color: #1a1a2e; }
.rating-fair { background: var(--accent-yellow); color: #1a1a2e; }
.rating-poor { background: var(--accent-orange); color: #1a1a2e; }
.rating-flat { background: #4a5568; color: var(--text-primary); }

/* Current Conditions */
.current-section {
  margin-bottom: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  position: relative;
}

.current-header {
  margin-bottom: 12px;
}

.current-header h2 {
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin: 0;
}

.current-header .rating {
  position: absolute;
  top: 12px;
  right: 12px;
}

.wave-visual {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  min-height: 160px;
}

.visual-scene {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  flex: 1;
}

.surfer-img {
  display: block;
  height: 150px;
  width: auto;
  position: relative;
  z-index: 2;
  opacity: 0.4;
  filter: brightness(0) saturate(100%) invert(52%) sepia(98%) saturate(400%) hue-rotate(176deg) brightness(102%) contrast(92%);
}

.wave-line {
  position: absolute;
  left: 60px;
  right: 0;
  height: 3px;
  bottom: 0;
  border-bottom: 3px dotted var(--accent-blue);
  animation: waveLineBob 3s ease-in-out infinite;
}

@keyframes waveLineBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

.visual-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  padding-bottom: 8px;
}

.stat-primary {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent-blue);
  line-height: 1;
}

.stat-unit {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.stat-secondary {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}

.stat-period {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.stat-divider {
  color: var(--text-muted);
  margin: 0 4px;
}

.stat-dir {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent-green);
}

.stat-wind {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.stat-wind-val {
  font-weight: 600;
  color: var(--text-secondary);
}

.stat-wind-dir {
  color: var(--text-muted);
}

/* Chart Section */
.chart-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

.chart-section h2 {
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.chart-container {
  height: 200px;
}

#forecastChart {
  width: 100% !important;
  height: 100% !important;
}

/* Hourly Section */
.hourly-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
}

.hourly-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.hourly-header h2 {
  margin: 0;
}

.hourly-section h2 {
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.expand-hint {
  font-size: 0.65rem;
  color: var(--text-muted);
  opacity: 0.7;
}

.close-btn {
  display: none;
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  z-index: 10;
}

.close-btn:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

.hourly-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 250px;
  overflow-y: auto;
}

/* Expanded state - taller in place */
.hourly-section.expanded {
  cursor: default;
}

.hourly-section.expanded .hourly-header {
  display: none;
}

.hourly-section.expanded .close-btn {
  display: flex;
}

.hourly-section.expanded .hourly-list {
  max-height: 70vh;
}

.hourly-item {
  display: grid;
  grid-template-columns: 70px 1fr 60px 50px 50px;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-card);
  border-radius: 8px;
  gap: 8px;
}

.hourly-time {
  font-size: 0.85rem;
  font-weight: 600;
}

.hourly-bar-container {
  height: 8px;
  background: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}

.hourly-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
}

.hourly-bar.epic { background: var(--accent-green); }
.hourly-bar.good { background: #68d391; }
.hourly-bar.fair { background: var(--accent-yellow); }
.hourly-bar.poor { background: var(--accent-orange); }
.hourly-bar.flat { background: #4a5568; }

.hourly-height {
  font-size: 0.9rem;
  font-weight: 600;
  text-align: right;
  color: var(--accent-blue);
}

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

.hourly-wind {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: right;
}

.loading {
  text-align: center;
  color: var(--text-muted);
  padding: 20px;
}

/* Guide Section */
.guide-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
}

.guide-section h2 {
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.guide-content {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.guide-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.guide-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.guide-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent-green);
}

/* Mobile */
@media (max-width: 500px) {
  .header {
    flex-wrap: wrap;
  }

  .header-row {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 8px;
  }

  .header-top {
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    justify-content: space-between;
  }

  .header-top h1 {
    flex: 0;
  }

  .header-bottom {
    display: flex;
    align-items: center;
    padding-top: 8px;
  }

  .sun-times {
    display: flex;
    gap: 12px;
  }

  .surfer-img {
    height: 140px;
  }

  .wave-line {
    left: 55px;
  }

  .stat-value {
    font-size: 2rem;
  }

  .hourly-item {
    grid-template-columns: 60px 1fr 50px 40px;
  }

  .hourly-wind {
    display: none;
  }
}
