/* 
 * Tabellen CSS für wissen4vertrieb.de
 * Definiert das Styling für Tabellen
 */

/* Basis-Tabelle */
.table {
  width: 100%;
  margin-bottom: var(--spacing-lg);
  color: var(--text-color);
  border-collapse: collapse;
}

.table th,
.table td {
  padding: var(--spacing-sm) var(--spacing-md);
  vertical-align: top;
  border-top: 1px solid var(--border-color);
}

.table thead th {
  vertical-align: bottom;
  border-bottom: 2px solid var(--border-color);
  background-color: var(--accent-color);
  color: var(--secondary-color);
  font-weight: 600;
}

.table tbody + tbody {
  border-top: 2px solid var(--border-color);
}

/* Tabellen-Varianten */
.table-sm th,
.table-sm td {
  padding: var(--spacing-xs) var(--spacing-sm);
}

.table-bordered {
  border: 1px solid var(--border-color);
}

.table-bordered th,
.table-bordered td {
  border: 1px solid var(--border-color);
}

.table-borderless th,
.table-borderless td,
.table-borderless thead th,
.table-borderless tbody + tbody {
  border: 0;
}

.table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(0, 0, 0, 0.03);
}

.table-hover tbody tr:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

/* Tabellen-Farben */
.table-primary,
.table-primary > th,
.table-primary > td {
  background-color: rgba(12, 192, 223, 0.1);
}

.table-secondary,
.table-secondary > th,
.table-secondary > td {
  background-color: rgba(0, 19, 115, 0.1);
}

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

/* Responsive Tabellen */
.table-responsive {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-responsive > .table {
  margin-bottom: 0;
}

/* Tabellen-Beschriftung */
.table-caption {
  caption-side: bottom;
  padding-top: var(--spacing-sm);
  padding-bottom: var(--spacing-sm);
  color: var(--light-text-color);
  text-align: center;
  font-style: italic;
  font-size: var(--text-sm);
}

/* Tabellen-Sortierung */
.table-sortable th {
  cursor: pointer;
  position: relative;
}

.table-sortable th::after {
  content: "↕";
  position: absolute;
  right: var(--spacing-sm);
  color: rgba(0, 0, 0, 0.3);
}

.table-sortable th.sort-asc::after {
  content: "↑";
  color: var(--primary-color);
}

.table-sortable th.sort-desc::after {
  content: "↓";
  color: var(--primary-color);
}

/* Responsive Anpassungen */
@media (max-width: 767px) {
  .table-responsive-vertical {
    max-width: 100%;
    overflow-y: hidden;
    overflow-x: auto;
    -ms-overflow-style: -ms-autohiding-scrollbar;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-color);
  }
  
  .table-responsive-vertical > .table {
    margin-bottom: 0;
  }
  
  .table-responsive-vertical > .table > thead,
  .table-responsive-vertical > .table > tbody,
  .table-responsive-vertical > .table > tfoot {
    display: block;
  }
  
  .table-responsive-vertical > .table > thead > tr,
  .table-responsive-vertical > .table > tbody > tr,
  .table-responsive-vertical > .table > tfoot > tr {
    display: block;
  }
  
  .table-responsive-vertical > .table > thead > tr > th,
  .table-responsive-vertical > .table > tbody > tr > th,
  .table-responsive-vertical > .table > tfoot > tr > th,
  .table-responsive-vertical > .table > thead > tr > td,
  .table-responsive-vertical > .table > tbody > tr > td,
  .table-responsive-vertical > .table > tfoot > tr > td {
    display: block;
    border: none;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    padding-left: 50%;
  }
  
  .table-responsive-vertical > .table > thead > tr > th:before,
  .table-responsive-vertical > .table > tbody > tr > th:before,
  .table-responsive-vertical > .table > tfoot > tr > th:before,
  .table-responsive-vertical > .table > thead > tr > td:before,
  .table-responsive-vertical > .table > tbody > tr > td:before,
  .table-responsive-vertical > .table > tfoot > tr > td:before {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 45%;
    padding-right: 10px;
    white-space: nowrap;
    content: attr(data-title);
    font-weight: 600;
  }
}

/* Ausrichtung von Tabellenzellen */
.table .text-right {
  text-align: right;
} 