/**
 * Div-Tables CSS - Dark Mode mit modernen Effekten
 * 
 * Tabellen-Darstellung mit Div-Elementen statt <table>
 * Unterstützt: .widget-table-* und .wiki-table-*
 */

/* .wiki-table-container, .widget-table-container | Änderungsprotokoll: 2026-06-02 | composer-agent | @skill-div-table-structure, @skill-change-provenance | iPad: kein overflow-x, max-width im Content */
.widget-table-container,
.wiki-table-container {
    max-width: 100%;
    margin: 2rem 0;
    border-radius: 12px;
    border: 1px solid var(--color-border-dark);
    background: var(--color-background-secondary);
    box-shadow: 0 4px 20px var(--color-shadow-light);
}

/* .wiki-table, .widget-table | Änderungsprotokoll: 2026-06-02 | composer-agent | @skill-div-table-structure, @skill-change-provenance | min-width 600px entfernt, Tabellen sprengen iPad-Content nicht */
.widget-table,
.wiki-table {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.wiki-article .wiki-table,
.wiki-section .wiki-table {
    max-width: 100%;
    min-width: 0;
}

/* Table Header */
.widget-table-header,
.wiki-table-header {
    display: flex;
    background: var(--color-background-tertiary);
    border-bottom: 2px solid var(--color-primary);
}

/* Table Row */
.widget-table-row,
.wiki-table-row {
    display: flex;
    border-bottom: 1px solid var(--color-border);
    transition: all 0.3s ease;
}

.widget-table-row:hover,
.wiki-table-row:hover {
    background: var(--color-hover-background);
    transform: translateX(4px);
}

.widget-table-row:last-child,
.wiki-table-row:last-child {
    border-bottom: none;
}

/* Table Cell */
.widget-table-cell,
.wiki-table-cell {
    flex: 1 1 0;
    min-width: 0;
    padding: 1rem 1.5rem;
    text-align: left;
    font-size: var(--font-size-medium);
    color: var(--color-text);
    min-height: 60px;
    display: flex;
    align-items: flex-start;
    overflow-wrap: break-word;
    word-break: break-word;
    box-sizing: border-box;
    border-right: 1px solid var(--color-border);
}

.widget-table-cell:last-child,
.wiki-table-cell:last-child {
    border-right: none;
}

/* Header Cells */
.widget-table-header .widget-table-cell,
.widget-table-header .wiki-table-cell,
.wiki-table-header .widget-table-cell,
.wiki-table-header .wiki-table-cell {
    font-weight: 700;
    color: var(--color-text-primary);
    text-transform: uppercase;
    font-size: var(--font-size-small);
    letter-spacing: 0.5px;
    align-items: center;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Responsive – Tablet/iPad: Spalten im Content-Bereich halten (011-ui-css-div-tables.mdc Regel 006) */
@media (max-width: 1024px) {
    .widget-table-header .widget-table-cell,
    .widget-table-header .wiki-table-cell,
    .wiki-table-header .widget-table-cell,
    .wiki-table-header .wiki-table-cell {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }

    .widget-table-cell,
    .wiki-table-cell {
        padding: 0.75rem 0.5rem;
        font-size: var(--font-size-small);
        min-height: 50px;
    }
}

@media (max-width: 768px) {
    .widget-table-row:hover,
    .wiki-table-row:hover {
        transform: none;
    }

    .widget-table-cell,
    .wiki-table-cell {
        padding: 0.5rem 0.5rem;
        font-size: var(--font-size-xs);
        min-height: 40px;
    }
}

/* Mobile: gestapelte Zeilen ohne horizontales Scrollen (011-ui-css-div-tables.mdc Regel 009) */
@media (max-width: 576px) {
    .widget-table-header,
    .wiki-table-header {
        display: none;
    }

    .widget-table-row,
    .wiki-table-row {
        flex-direction: column;
        margin-bottom: 0.75rem;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid var(--color-border);
    }

    .widget-table-row:last-child,
    .wiki-table-row:last-child {
        margin-bottom: 0;
        padding-bottom: 0;
        border-bottom: none;
    }

    .widget-table-cell,
    .wiki-table-cell {
        flex: none;
        width: 100%;
        min-width: 0;
        padding: 0.5rem 0.75rem;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
        min-height: auto;
    }

    .widget-table-cell:last-child,
    .wiki-table-cell:last-child {
        border-bottom: none;
    }

    /* Spaltenlabel vor Zellwert (z. B. „Woche: 1“ statt isolierter Zahl) */
    .wiki-table-cell[data-label]::before {
        content: attr(data-label) ': ';
        display: block;
        font-weight: 700;
        color: var(--color-text-primary);
        margin-bottom: 0.25rem;
        font-size: var(--font-size-xs);
        letter-spacing: 0.5px;
        text-transform: uppercase;
    }
}
