/* ============================================================
   Wassertemperaturen Zürich – Stylesheet
   ============================================================ */

:root {
  --primary: #0077b6;
  --primary-dark: #005f8a;
  --primary-light: #90e0ef;
  --accent: #00b4d8;
  --warm: #e76f51;
  --cold: #457b9d;
  --bg: #f0f4f8;
  --surface: #ffffff;
  --text: #1d3557;
  --text-secondary: #6b7280;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.2s ease;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* Header */
.header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 1.25rem 2rem;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  font-size: 2rem;
}

.logo-svg {
  height: 52px;
  width: auto;
}

.logo h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  font-size: 0.85rem;
  opacity: 0.85;
  font-weight: 300;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.last-update {
  font-size: 0.8rem;
  opacity: 0.8;
}

.btn-primary {
  background: var(--primary);
  color: white;
  padding: 0.55rem 1.25rem;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  white-space: nowrap;
  box-shadow: var(--shadow);
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-refresh {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  backdrop-filter: blur(4px);
}

.btn-refresh:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* Tabs */
.tabs {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  overflow-x: auto;
}

.tab {
  padding: 0.85rem 1.5rem;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 3px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
  font-family: inherit;
}

.tab:hover {
  color: var(--primary);
  background: rgba(0, 119, 182, 0.04);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-icon {
  margin-right: 0.4rem;
}

/* Main */
.main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem 2rem 3rem;
  position: relative;
  min-height: 60vh;
}

/* Loading */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(240, 244, 248, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 50;
  border-radius: var(--radius);
  transition: opacity 0.3s;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Views */
.view {
  display: none;
}

.view.active {
  display: block;
}

/* Section */
.section {
  margin-bottom: 2rem;
}

.section-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text);
}

/* Summary Cards */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.summary-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.summary-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.summary-card.warmest {
  border-top: 3px solid var(--warm);
}

.summary-card.coldest {
  border-top: 3px solid var(--cold);
}

.summary-icon {
  font-size: 1.8rem;
  margin-bottom: 0.4rem;
}

.summary-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.summary-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* Zürichsee Cards */
.zurichsee-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.zurichsee-card {
  background: linear-gradient(135deg, #0077b6 0%, #00b4d8 100%);
  color: white;
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

.zurichsee-card .station-name {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.zurichsee-card .station-source {
  font-size: 0.75rem;
  opacity: 0.8;
  margin-bottom: 0.75rem;
}

.zurichsee-card .temp-display {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.zurichsee-card .temp-value {
  font-size: 2.5rem;
  font-weight: 700;
}

.zurichsee-card .temp-unit {
  font-size: 1.2rem;
  opacity: 0.8;
}

.zurichsee-card .temp-details {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  opacity: 0.9;
}

/* Filter Bar */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.search-input,
.filter-select {
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  transition: var(--transition);
}

.search-input {
  flex: 1;
  min-width: 200px;
}

.search-input:focus,
.filter-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 119, 182, 0.1);
}

/* Data Table */
.table-container {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  background: #f8fafc;
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
  user-select: none;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.data-table th:hover {
  color: var(--primary);
}

.data-table td {
  padding: 0.7rem 1rem;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}

.data-table tbody tr:hover {
  background: rgba(0, 119, 182, 0.03);
}

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

.temp-cell {
  font-weight: 600;
  font-size: 1rem;
}

.trend-positive {
  color: var(--warm);
}

.trend-negative {
  color: var(--cold);
}

.trend-neutral {
  color: var(--text-secondary);
}

.type-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 500;
}

.type-badge.lake {
  background: #dbeafe;
  color: #1e40af;
}

.type-badge.river {
  background: #d1fae5;
  color: #065f46;
}

.source-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 500;
  background: #f3f4f6;
  color: #6b7280;
}

/* Cards Grid (Lakes / Rivers View) */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.station-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
  border-left: 4px solid var(--primary);
}

.station-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.station-card.lake {
  border-left-color: #3b82f6;
}

.station-card.river {
  border-left-color: #10b981;
}

.station-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.station-card .card-name {
  font-weight: 600;
  font-size: 1rem;
}

.station-card .card-temp {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.station-card .card-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.station-card .card-details .detail-value {
  font-weight: 500;
  color: var(--text);
}

.station-card .card-footer {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Map */
.map-container {
  height: 600px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

/* Footer */
.footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer a {
  color: var(--primary);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

.footer-note {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  opacity: 0.7;
}

/* Error State */
.error-message {
  background: #fef2f2;
  color: #991b1b;
  padding: 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  border: 1px solid #fecaca;
  font-size: 0.85rem;
}

/* No Data */
.no-data {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
  .header {
    padding: 1rem;
  }

  .header-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .logo h1 {
    font-size: 1.15rem;
  }

  .tabs {
    padding: 0 1rem;
  }

  .tab {
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
  }

  .main {
    padding: 1rem;
  }

  .summary-cards {
    grid-template-columns: 1fr 1fr;
  }

  .summary-value {
    font-size: 1.5rem;
  }

  .filter-bar {
    flex-direction: column;
  }

  .search-input {
    min-width: unset;
  }

  .zurichsee-card .temp-value {
    font-size: 2rem;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  .map-container {
    height: 400px;
  }

  .data-table th,
  .data-table td {
    padding: 0.5rem 0.6rem;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .summary-cards {
    grid-template-columns: 1fr;
  }

  .zurichsee-cards {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Chart / Historischer Verlauf
   ============================================================ */
.chart-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  background: var(--surface);
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.chart-control-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.chart-controls label {
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.chart-daterange {
  margin-top: -0.25rem;
}

.chart-placeholder {
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  color: var(--text-secondary);
  line-height: 1.8;
}

.chart-placeholder code {
  background: #f1f5f9;
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 0.85em;
  color: var(--primary);
}

.chart-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.chart-stat-pill {
  background: var(--surface);
  border-radius: 99px;
  padding: 0.35rem 0.9rem;
  font-size: 0.8rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.chart-stat-pill .stat-label {
  color: var(--text-secondary);
  font-weight: 500;
}

.chart-stat-pill .stat-value {
  font-weight: 700;
  color: var(--text);
}

.plotly-chart {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.75rem;
  margin-bottom: 1.25rem;
  min-height: 300px;
}

