/* Tabellen-Verbesserungen für Light und Dark Mode */

/* Gemeinsame Tabellen-Styles */
.table {
  border-radius: 0.5rem;
  overflow: hidden;
  border-collapse: separate;
  border-spacing: 0;
  border: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  margin-bottom: 1.5rem;
}

.table th {
  font-weight: 600;
  border-top: none;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
}

.table td {
  vertical-align: middle;
  padding: 0.75rem;
}

.table-responsive {
  border-radius: 0.5rem;
  overflow: hidden;
}

/* Tabellen im Light Mode */
.light-mode .table {
  background-color: var(--white-color);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.light-mode .table-light,
.light-mode .table-light > th,
.light-mode .table-light > td {
  background-color: var(--white-color);
}

.light-mode .table th {
  background-color: var(--bs-primary);
  color: var(--bs-light);
  border-bottom: 2px solid var(--bs-primary);
}

/* Erste und letzte Header-Zelle ohne Rundung oben */
.light-mode .table th:first-child {
  border-top-left-radius: 0;
}

.light-mode .table th:last-child {
  border-top-right-radius: 0;
}

.light-mode .table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: var(--extra-light-color);
}

.light-mode .table-hover > tbody > tr:hover > * {
  background-color: rgba(30, 109, 141, 0.05);
}

.light-mode .table-bordered {
  border-color: var(--extra-light-color);
}

.light-mode .table td {
  border-bottom: 1px solid var(--extra-light-color);
}

/* Tabellen im Dark Mode */
.dark-mode .table {
  background-color: var(--bg-dark);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.dark-mode .table-light,
.dark-mode .table-light > th,
.dark-mode .table-light > td {
  background-color: var(--bg-dark);
}

.dark-mode .table th {
  background-color: var(--bs-primary);
  color: var(--bs-light);
  color: var(--text-dark); /* Verbesserte Lesbarkeit im Dark Mode */
  border-bottom: 2px solid var(--bs-primary);
}

/* Erste und letzte Header-Zelle ohne Rundung oben */
.dark-mode .table th:first-child {
  border-top-left-radius: 0;
}

.dark-mode .table th:last-child {
  border-top-right-radius: 0;
}

.dark-mode .table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: rgba(103, 103, 103, 0.4); /* Extra-Light-Color im Dark Mode */
}

.dark-mode .table-hover > tbody > tr:hover > * {
  background-color: rgba(30, 109, 141, 0.1);
}

.dark-mode .table-bordered {
  border-color: rgba(255, 255, 255, 0.1);
}

.dark-mode .table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Tabellen-Aktionsbuttons verschönern */
.table .btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 0.25rem;
  margin: 0 0.1rem;
}

.table .btn i {
  font-size: 1rem;
}

/* Verbesserte mobile Tabellen */
@media (max-width: 767.98px) {
  /* Horizontal scrollbare Tabellen statt zu breiter Tabellen */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    margin-bottom: 1rem;
  }
  
  /* Entfernt die feste Mindestbreite, die zu Überlauf führt */
  .table-responsive table {
    min-width: auto; /* Statt 650px */
    width: 100%;
  }
  
  /* Optimiert die Zellendarstellung */
  .table td, .table th {
    padding: 0.5rem;
    font-size: 0.9rem;
  }
  
  /* Buttons in Tabellen verkleinern */
  .table .btn {
    padding: 0.2rem 0.4rem;
  }
  
  .table .btn i {
    font-size: 0.9rem;
  }
}

/* Alternative Tabellendarstellung für sehr kleine Bildschirme */
@media (max-width: 480px) {
  /* Stack-Ansicht für sehr schmale Bildschirme */
  .mobile-stack-table thead {
    display: none; /* Header ausblenden */
  }
  
  .mobile-stack-table tr {
    display: block;
    border: 1px solid rgba(0,0,0,.125);
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    background-color: transparent !important;
  }
  
  .mobile-stack-table td {
    display: block;
    text-align: right;
    position: relative;
    padding-left: 50%;
    border-bottom: 1px solid rgba(0,0,0,.05);
  }
  
  .mobile-stack-table td:before {
    content: attr(data-label);
    position: absolute;
    left: 0.75rem;
    width: 45%;
    text-align: left;
    font-weight: bold;
  }
  
  .mobile-stack-table td:last-child {
    border-bottom: none;
  }
  
  /* Für normale Tabellen ohne data-label Attribut */
  .table td {
    white-space: normal; /* Text umbrechen lassen */
  }
}

/* Tabellenbeschriftung im mobilen Format */
.table caption {
  caption-side: top;
  font-weight: bold;
  padding: 0.5rem 0;
}

/* Tabellen im Postfach verbessern */
.dark-mode table tbody tr {
  background-color: var(--bg-dark);
}

.dark-mode .table-light.table-striped > tbody > tr:nth-of-type(odd) {
  background-color: rgba(103, 103, 103, 0.4); /* Extra-Light-Color im Dark Mode */
} 