/* Base Div Table (für Tree-Layout mit details/summary wie Ärzte-Projekt) */
.base-div-table {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    box-sizing: border-box;
    background: var(--color-surface-secondary, #f5f5f5);
}

.base-div-table-header {
    width: 100%;
    background: var(--color-table-header-bg);
    border-bottom: 1px solid var(--color-border);
    box-sizing: border-box;
}

.base-div-table-row {
    display: grid;
    gap: 0;
    padding: 0;
    transition: background-color 0.15s ease;
    border-bottom: 1px solid var(--color-border);
}

.base-div-table-header .base-div-table-row {
    width: 100%;
    font-weight: 600;
    font-family: var(--font-family-primary, inherit);
    color: var(--color-text-secondary, #666);
    text-transform: uppercase;
    font-size: 0.75rem;
    background: var(--color-table-header-bg);
}

.base-div-table-body {
    width: 100%;
    box-sizing: border-box;
}

.base-div-table-body .base-div-table-row:hover {
    background: var(--color-table-row-hover-bg);
}

.base-div-table-cell {
    padding: 12px 16px;
    display: block;
    font-size: 0.875rem;
    font-family: var(--font-family-primary, inherit);
    color: var(--color-text, #1a1a1a);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    word-wrap: break-word;
    border-right: 1px solid var(--color-border);
    box-sizing: border-box;
}

.base-div-table-cell:last-child {
    border-right: none;
}

.base-div-table-header .base-div-table-cell {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: var(--color-table-header-bg);
    display: flex;
    align-items: center;
}

/* Tree-Table: aufklappbare Orte wie Ärzte-Projekt */
.base-div-table-tree {
    display: flex;
    flex-direction: column;
}

.base-div-table-tree .base-div-table-body {
    display: flex;
    flex-direction: column;
}

.base-div-table-tree-details {
    display: flex;
    flex-direction: column;
}

.base-div-table-tree summary.base-div-table-row {
    display: grid;
    list-style: none;
    cursor: pointer;
    align-items: center;
}

.base-div-table-tree summary.base-div-table-row::-webkit-details-marker,
.base-div-table-tree summary.base-div-table-row::marker {
    display: none;
}

.base-div-table-row-tree-parent {
    background: var(--color-table-header-bg);
    border-bottom: 1px solid var(--color-border);
    font-weight: 600;
}

.base-div-table-cell-tree-node {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    background: var(--color-table-header-bg);
    font-size: 0.875rem;
    font-family: var(--font-family-primary, inherit);
    color: var(--color-text, #1a1a1a);
}

.base-div-table-tree-expand-icon {
    display: inline-block;
    min-width: 1em;
    font-size: 0.85em;
    color: var(--color-text-secondary, #666);
}

.base-div-table-tree-details:not([open]) .base-div-table-tree-expand-icon::before {
    content: "\002B\00a0";
}

.base-div-table-tree-details[open] .base-div-table-tree-expand-icon::before {
    content: "\2212\00a0";
}

.base-div-table-tree-node-label {
    font-weight: 600;
    color: var(--color-text, #1a1a1a);
}

.base-div-table-tree-node-count {
    color: var(--color-text-secondary, #666);
    font-weight: 400;
}

.base-div-table-cell-tree-parent-empty {
    background: var(--color-table-header-bg);
}

.base-div-table-tree-children {
    display: flex;
    flex-direction: column;
}

.base-div-table-row-tree-child {
    border-bottom: 1px solid var(--color-border);
    background: var(--color-background, #fff);
}

.base-div-table-tree-children .base-div-table-row-tree-child:hover {
    background: var(--color-table-row-hover-bg);
}

.base-div-table-cell-tree-indent {
    padding-left: 2rem;
    border-left: 2px solid var(--color-border);
    box-sizing: border-box;
    background: var(--color-background, #fff);
}

.base-div-table-cell-tree-indent-empty {
    background: var(--color-background, #fff);
}

.base-div-table-row[data-columns="2"] {
    grid-template-columns: 1fr 1fr;
}

.widget-div-table {
    font-family: var(--font-family-primary);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    display: table;
    width: 100%;
    border: 1px solid var(--color-border);
}

.widget-div-table-header {
    font-family: var(--font-family-primary);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    display: table-header-group;
    background: var(--color-table-header-bg);
}

.widget-div-table-row {
    font-family: var(--font-family-primary);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    display: table-row;
}

.widget-div-table-header .widget-div-table-row {
    display: table-row;
}

.widget-div-table-header-cell {
    font-family: var(--font-family-primary);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    display: table-cell;
    padding: 10px;
    border: 1px solid var(--color-border);
    font-weight: bold;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.widget-div-table-body {
    font-family: var(--font-family-primary);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    display: table-row-group;
}

.widget-div-table-body .widget-div-table-row {
    display: table-row;
}

.widget-div-table-body .widget-div-table-row:hover {
    background: var(--color-table-row-hover-bg);
}

.widget-div-table-cell {
    font-family: var(--font-family-primary);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    display: table-cell;
    padding: 10px;
    border: 1px solid var(--color-border);
    white-space: normal;
    word-wrap: break-word;
}

.widget-div-table-header .widget-div-table-cell {
    font-weight: bold;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* VERPFLICHTEND: Mobile-Darstellung - Pro Zeile nur eine Spalte mit Spaltenname: Wert Format */
/* Regel 009 aus 011-ui-css-div-tables.mdc */
@media (max-width: 576px) {
    /* Header auf Mobile ausgeblendet */
    .widget-div-table-header {
        display: none;
    }
    
    /* Body-Zellen auf Mobile: volle Breite, Block-Display */
    .widget-div-table-body .widget-div-table-row {
        display: block;
        width: 100%;
        margin-bottom: 12px;
        border: 1px solid var(--color-border);
    }
    
    .widget-div-table-body .widget-div-table-cell {
        display: block;
        width: 100%;
        margin-bottom: 12px;
        border: none;
        border-bottom: 1px solid var(--color-border);
        padding: 8px 0;
    }
    
    /* Spaltenname als Label anzeigen (über data-label Attribut) */
    .widget-div-table-body .widget-div-table-cell::before {
        content: attr(data-label) ": ";
        font-weight: bold;
        display: block;
        margin-bottom: 4px;
    }
    
    /* Letzte Zelle einer Zeile: kein margin-bottom */
    .widget-div-table-body .widget-div-table-row .widget-div-table-cell:last-child {
        margin-bottom: 0;
        border-bottom: none;
    }
}
