/* Tabellen-Styling für Wasserflächen- und Pegel-Detailseiten */

.tabelle-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 1.5rem 3rem;
}

.tabelle-page h1 {
  margin: 0.5rem 0 0.3rem;
  color: var(--ns-blue);
  font-size: 1.6rem;
  font-weight: 600;
}

.tabelle-page .lead {
  color: var(--ns-text-muted);
  margin: 0 0 1rem;
  font-size: 0.92rem;
}

.tabelle-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  align-items: center;
  padding: 0.7rem 0.9rem;
  background: var(--ns-bg-elevated);
  border: 1px solid var(--ns-border);
  border-radius: var(--ns-radius);
  margin-bottom: 0.9rem;
}

.tabelle-controls .filter-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.86rem;
}

.tabelle-controls label {
  color: var(--ns-text-muted);
  font-size: 0.82rem;
}

.tabelle-controls select,
.tabelle-controls input[type="search"] {
  padding: 0.32rem 0.55rem;
  border: 1px solid var(--ns-border);
  border-radius: var(--ns-radius);
  font-size: 0.86rem;
  background: var(--ns-bg);
  color: var(--ns-text);
  font-family: inherit;
}

.tabelle-controls input[type="search"] {
  min-width: 200px;
}

.tabelle-controls .count {
  margin-left: auto;
  color: var(--ns-text-muted);
  font-size: 0.83rem;
}

.tabelle-wrap {
  background: var(--ns-bg-elevated);
  border: 1px solid var(--ns-border);
  border-radius: var(--ns-radius);
  overflow: hidden;
}

.tabelle-scroll {
  max-height: 70vh;
  overflow-y: auto;
}

table.tabelle {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

table.tabelle thead {
  position: sticky;
  top: 0;
  background: var(--ns-bg-elevated);
  z-index: 1;
  box-shadow: 0 1px 0 var(--ns-border);
}

table.tabelle th {
  text-align: left;
  padding: 0.6rem 0.7rem;
  font-weight: 600;
  color: var(--ns-text);
  font-size: 0.8rem;
  white-space: nowrap;
  user-select: none;
}

table.tabelle th.sortable {
  cursor: pointer;
}

table.tabelle th.sortable:hover {
  background: var(--ns-bg);
}

table.tabelle th .sort-arrow {
  display: inline-block;
  width: 0.7rem;
  margin-left: 0.2rem;
  color: var(--ns-text-subtle);
  font-size: 0.75rem;
}

table.tabelle th.sort-asc .sort-arrow,
table.tabelle th.sort-desc .sort-arrow {
  color: var(--ns-blue);
}

table.tabelle td {
  padding: 0.5rem 0.7rem;
  border-top: 1px solid var(--ns-border);
  color: var(--ns-text);
}

table.tabelle tbody tr {
  cursor: pointer;
  transition: background 0.1s;
}

table.tabelle tbody tr:hover {
  background: var(--ns-bg);
}

table.tabelle td.num,
table.tabelle th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

table.tabelle td.muted {
  color: var(--ns-text-muted);
  font-size: 0.82rem;
}

/* Reserve-Highlight-Klassen für Pegel + Wasserflächen */
.reserve-critical {
  color: #b91c1c;
  font-weight: 600;
}

.reserve-warning {
  color: #c2410c;
  font-weight: 500;
}

.reserve-ok {
  color: var(--ns-text);
}

.reserve-positive {
  color: #047857;
}

.delta-strong {
  font-weight: 600;
}

.status-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.status-badge.normal { background: #d1fae5; color: #065f46; }
.status-badge.flooded { background: #fed7aa; color: #9a3412; }
.status-badge.shrinking { background: #fef3c7; color: #92400e; }
.status-badge.dry { background: #fee2e2; color: #b91c1c; }
.status-badge.unknown { background: #e5e7eb; color: #6b7280; }
.status-badge.high { background: #fef3c7; color: #92400e; }
.status-badge.flood { background: #fed7aa; color: #9a3412; }
.status-badge.extreme_flood { background: #fee2e2; color: #b91c1c; }
.status-badge.low { background: #dbeafe; color: #1e40af; }

.empty-row {
  padding: 2rem;
  text-align: center;
  color: var(--ns-text-subtle);
}
/* Mobile-Optimierung für Tabellen
 *
 * Anhängen an /opt/rapsblicker/frontend/static/tabelle.css
 *
 * Idee: 
 * - Auf schmalen Screens werden weniger wichtige Spalten ausgeblendet
 * - Filter-Controls stapeln sich vertikal
 * - Schrift wird etwas größer für bessere Touch-Targets
 */

/* Tablets und kleiner */
@media (max-width: 1024px) {
  .tabelle-page {
    padding: 0.7rem 1rem 2rem;
  }

  .tabelle-page h1 {
    font-size: 1.35rem;
  }

  .tabelle-page .lead {
    font-size: 0.86rem;
  }

  table.tabelle {
    font-size: 0.8rem;
  }

  table.tabelle th,
  table.tabelle td {
    padding: 0.45rem 0.5rem;
  }
}

/* Phones */
@media (max-width: 700px) {
  .tabelle-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .tabelle-controls .filter-group {
    width: 100%;
    justify-content: space-between;
  }

  .tabelle-controls .filter-group select,
  .tabelle-controls .filter-group input[type="search"] {
    flex: 1;
    min-width: 0;
  }

  .tabelle-controls .count {
    margin-left: 0;
    text-align: right;
    width: 100%;
  }

  .tabelle-scroll {
    max-height: 65vh;
    overflow-x: auto;
    /* Bessere Touch-Scrollerfahrung */
    -webkit-overflow-scrolling: touch;
  }

  table.tabelle {
    /* Lass die Tabelle horizontal scrollen statt zu zerquetschen */
    min-width: 700px;
    font-size: 0.78rem;
  }

  table.tabelle th,
  table.tabelle td {
    padding: 0.4rem 0.5rem;
    white-space: nowrap;
  }

  /* Status-Badges schmaler */
  .status-badge {
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
  }

  /* Mini-Bargraph in Raps-Tabelle ausblenden für mehr Platz */
  .score-bar {
    display: none;
  }
}

/* Sehr kleine Phones */
@media (max-width: 400px) {
  .tabelle-page {
    padding: 0.5rem 0.6rem 2rem;
  }

  table.tabelle {
    min-width: 600px;
    font-size: 0.74rem;
  }
}

/* Daten-Hub Mobile */
@media (max-width: 700px) {
  .top10-grid {
    grid-template-columns: 1fr !important;
    gap: 0.85rem !important;
    margin: 0.85rem 0 2rem !important;
  }

  .top10-card {
    padding: 0.85rem 0.95rem 0.65rem !important;
  }

  .top10-card h2 {
    font-size: 0.95rem !important;
  }

  .top10-list .name {
    font-size: 0.85rem !important;
  }

  .top10-list .meta {
    font-size: 0.72rem !important;
  }
}
