:root {
  --vh: 100%;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: sans-serif;
  background: #f0f2f5;
  box-sizing: border-box;
}

.page {
  display: flex;
  flex-direction: column;
  height: calc(var(--vh, 1vh) * 100);
  padding: 1rem;
}

form {
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chart-wrapper {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Automatisch Höhe nutzen, aber auf mobilen Geräten etwas reduzieren */
canvas {
  flex-grow: 1;
  width: 100%;
  height: 100%;
  background: white;
  border: 1px solid #ccc;
  padding: 1rem;
  border-radius: 8px;
  box-sizing: border-box;
}

/* Optimierung für mobile Geräte: etwas weniger als 100% Höhe */
@media (max-width: 768px) {
  .chart-wrapper {
    height: calc(var(--vh, 1vh) * 95);
  }
}

#stats {
  transition: all 0.3s ease;
  overflow: hidden;
}

#stats.hidden {
  opacity: 0;
  height: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  border-width: 0 !important;
  pointer-events: none;
}

/* Responsives Tabellen-Wrapper-Element */
#stats-wrapper {
  overflow-x: auto;
  max-width: 100%;
}

/* Tabelle bleibt lesbar auf kleinen Bildschirmen */
#stats-table th,
#stats-table td {
  white-space: nowrap;
}

/* Neue Darstellung als Overlay */
#stats-overlay {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 70%;
  background: white;
  border-top: 2px solid #ccc;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  z-index: 1000;
}

#stats-overlay.visible {
  transform: translateY(0);
}

#stats-overlay table {
  width: 100%;
  border-collapse: collapse;
}

#stats-overlay th,
#stats-overlay td {
  padding: 0.5rem;
  text-align: right;
  white-space: nowrap;
}

#stats-overlay th:first-child,
#stats-overlay td:first-child {
  text-align: left;
}

