/* =========================================
   DIV-TABLES (011-ui-css-div-tables.mdc)
   Farben aus colors.css
   ========================================= */

.base-div-table {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--color-border-highlight);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    background: var(--color-surface);
}

.base-div-table-header {
    display: flex;
    align-items: center;
    width: 100%;
    background: var(--gradient-brand);
    border-bottom: 1px solid var(--color-table-border);
}

.base-div-table-body {
    display: block;
}

.base-div-table-row {
    display: grid;
    gap: 0;
    border-bottom: 1px solid var(--color-table-border);
    background: var(--color-table-row-bg);
    min-width: 0;
}

.base-div-table-row:hover {
    background: var(--color-table-row-hover);
    box-shadow: inset 0 0 0 1px var(--color-primary);
}

.base-div-table-cell {
    padding: 0.75rem 1rem;
    border-right: 1px solid var(--color-table-border);
    background: inherit;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-width: 0;
    font-size: var(--font-size-base);
    color: var(--color-text);
}

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

.base-div-table-header-row {
    width: 100%;
    display: grid;
    gap: 0;
}

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

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

.base-div-table-header-row[data-columns="3"] {
    grid-template-columns: repeat(3, 1fr);
}

.base-div-table-header-row[data-columns="4"] {
    grid-template-columns: repeat(4, 1fr);
}

.base-div-table-header-row[data-columns="5"] {
    grid-template-columns: repeat(5, 1fr);
}

.base-div-table-header-row[data-columns="6"] {
    grid-template-columns: repeat(6, 1fr);
}

.base-div-table-header-row[data-columns="7"] {
    grid-template-columns: repeat(7, 1fr);
}

.base-div-table-header-cell {
    padding: 0.75rem 1rem;
    border-right: 1px solid var(--color-table-border);
    background: inherit;
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--color-text-inverse);
    min-width: 0;
    font-size: var(--font-size-base);
    letter-spacing: 0.04em;
}

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

/* 2 Spalten: URL breit, Aktionen schmal */
.base-div-table-row[data-columns="2"] {
    grid-template-columns: 1fr auto;
}

/* 3–7 Spalten: gleichmäßig */
.base-div-table-row[data-columns="3"] {
    grid-template-columns: repeat(3, 1fr);
}

.base-div-table-row[data-columns="4"] {
    grid-template-columns: repeat(4, 1fr);
}

/* Content-Checker-URLs: Checkbox schmal, URL nutzt Rest, Letzter Check und Letzter Status auto */
.base-div-table-content-checker-urls .base-div-table-header-row[data-columns="4"],
.base-div-table-content-checker-urls .base-div-table-row[data-columns="4"] {
    grid-template-columns: 64px minmax(0, 1fr) 190px 150px;
}

/* Dashboard-URLs: URL nutzt volle restliche Breite, andere Spalten nur so breit wie Content */
.base-div-table-dashboard-urls .base-div-table-header-row[data-columns="4"],
.base-div-table-dashboard-urls .base-div-table-row[data-columns="4"] {
    grid-template-columns: 64px minmax(0, 1fr) 150px 190px;
}

/* Dashboard-URLs: Bereits ab iPad als gestapelte Karten darstellen */
@media (max-width: 1023px) {
    .base-div-table-dashboard-urls .base-div-table-header {
        display: none;
    }

    .base-div-table-dashboard-urls .base-div-table-row {
        grid-template-columns: 1fr;
        border-bottom: 1px solid var(--color-table-border);
    }

    .base-div-table-dashboard-urls .base-div-table-cell {
        display: block;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--color-table-border);
        padding: 0.75rem 1rem;
    }

    .base-div-table-dashboard-urls .base-div-table-cell:last-child {
        border-bottom: none;
    }

    .base-div-table-dashboard-urls .base-div-table-cell::before {
        content: attr(data-label) ": ";
        font-weight: var(--font-weight-bold);
        display: block;
        margin-bottom: 0.25rem;
        color: var(--color-text);
    }
}

.base-div-table-row[data-columns="5"] {
    grid-template-columns: repeat(5, 1fr);
}

.base-div-table-row[data-columns="6"] {
    grid-template-columns: repeat(6, 1fr);
}

.base-div-table-row[data-columns="7"] {
    grid-template-columns: repeat(7, 1fr);
}

.base-content-checker-history-title {
    font-size: var(--font-size-h4);
    font-weight: var(--font-weight-bold);
    color: var(--color-text);
    margin-bottom: 0.75rem;
}

.base-content-checker-history-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    margin-bottom: 0.5rem;
    background: var(--color-background-secondary);
    border: 1px solid var(--color-table-border);
    border-radius: 8px;
}

.base-content-checker-history-label {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-bold);
    color: var(--color-text);
}

.base-content-checker-history-value {
    font-size: var(--font-size-base);
    color: var(--color-text);
    margin-right: 0.75rem;
}

.base-content-checker-status-ok {
    display: inline-block;
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-bold);
    color: var(--color-success);
    background: var(--color-surface-hover);
    border: 1px solid var(--color-success);
    border-radius: 999px;
    padding: 0.125rem 0.625rem;
    margin-right: 0.75rem;
}

.base-content-checker-status-not-ok {
    display: inline-block;
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-bold);
    color: var(--color-error);
    background: var(--color-surface-hover);
    border: 1px solid var(--color-error);
    border-radius: 999px;
    padding: 0.125rem 0.625rem;
    margin-right: 0.75rem;
}

.base-content-checker-history-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    margin-top: 0.875rem;
    padding: 0.5rem;
    background: var(--color-surface-hover);
    border: 1px solid var(--color-border-highlight);
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
}

.base-content-checker-history-page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-link);
    border: 1px solid var(--color-table-border);
    border-radius: 8px;
    padding: 0.375rem 0.625rem;
    text-decoration: none;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    min-width: 2.25rem;
    background: var(--color-surface);
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.base-content-checker-history-page-link:hover {
    background: var(--color-surface-hover);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.base-content-checker-history-page-link-active {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-inverse);
    background: var(--color-primary);
    border: 1px solid var(--color-primary);
    border-radius: 8px;
    padding: 0.375rem 0.625rem;
    text-decoration: none;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-bold);
    min-width: 2.25rem;
    box-shadow: var(--shadow-sm);
}

.base-dashboard-history-title {
    font-size: var(--font-size-h4);
    font-weight: var(--font-weight-bold);
    color: var(--color-text);
    margin-bottom: 0.75rem;
}

.base-dashboard-history-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    margin-bottom: 0.5rem;
    background: var(--color-background-secondary);
    border: 1px solid var(--color-table-border);
    border-radius: 8px;
}

.base-dashboard-history-label {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-bold);
    color: var(--color-text);
}

.base-dashboard-history-value {
    font-size: var(--font-size-base);
    color: var(--color-text);
    margin-right: 0.75rem;
}

.base-dashboard-history-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    margin-top: 0.875rem;
    padding: 0.5rem;
    background: var(--color-surface-hover);
    border: 1px solid var(--color-border-highlight);
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
}

.base-dashboard-history-page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-link);
    border: 1px solid var(--color-table-border);
    border-radius: 8px;
    padding: 0.375rem 0.625rem;
    text-decoration: none;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    min-width: 2.25rem;
    background: var(--color-surface);
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.base-dashboard-history-page-link:hover {
    background: var(--color-surface-hover);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.base-dashboard-history-page-link-active {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-inverse);
    background: var(--color-primary);
    border: 1px solid var(--color-primary);
    border-radius: 8px;
    padding: 0.375rem 0.625rem;
    text-decoration: none;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-bold);
    min-width: 2.25rem;
    box-shadow: var(--shadow-sm);
}

.base-content-checker-history-table {
    border: 1px solid var(--color-table-border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.base-content-checker-history-table-header {
    display: grid;
    grid-template-columns: 220px 1fr 1fr;
    background: var(--gradient-brand);
    border-bottom: 1px solid var(--color-table-border);
}

.base-content-checker-history-table-head-cell {
    padding: 0.625rem 0.75rem;
    border-right: 1px solid var(--color-table-border);
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
    color: var(--color-text-inverse);
    letter-spacing: 0.04em;
}

.base-content-checker-history-table-head-cell:last-child {
    border-right: none;
}

.base-content-checker-history-table-row {
    display: grid;
    grid-template-columns: 220px 1fr 1fr;
    border-bottom: 1px solid var(--color-table-border);
    background: var(--color-surface);
}

.base-content-checker-history-table-row:hover {
    background: var(--color-surface-hover);
}

.base-content-checker-history-table-row:last-of-type {
    border-bottom: none;
}

.base-content-checker-history-table-cell {
    padding: 0.625rem 0.75rem;
    border-right: 1px solid var(--color-table-border);
    font-size: var(--font-size-base);
    color: var(--color-text);
}

.base-content-checker-history-table-cell:last-child {
    border-right: none;
}

.base-dashboard-history-table {
    border: 1px solid var(--color-table-border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.base-dashboard-history-table-header {
    display: grid;
    grid-template-columns: 240px 1fr;
    background: var(--gradient-brand);
    border-bottom: 1px solid var(--color-table-border);
}

.base-dashboard-history-table-head-cell {
    padding: 0.625rem 0.75rem;
    border-right: 1px solid var(--color-table-border);
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
    color: var(--color-text-inverse);
    letter-spacing: 0.04em;
}

.base-dashboard-history-table-head-cell:last-child {
    border-right: none;
}

.base-dashboard-history-table-row {
    display: grid;
    grid-template-columns: 240px 1fr;
    border-bottom: 1px solid var(--color-table-border);
    background: var(--color-surface);
}

.base-dashboard-history-table-row:hover {
    background: var(--color-surface-hover);
}

.base-dashboard-history-table-row:last-of-type {
    border-bottom: none;
}

.base-dashboard-history-table-cell {
    padding: 0.625rem 0.75rem;
    border-right: 1px solid var(--color-table-border);
    font-size: var(--font-size-base);
    color: var(--color-text);
}

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

/* Mobile: Pro Zeile eine Spalte, Label via data-label */
@media (max-width: 576px) {
    .base-div-table-header {
        display: none;
    }

    .base-div-table-row {
        grid-template-columns: 1fr;
        border-bottom: 1px solid var(--color-table-border);
    }

    .base-div-table-cell {
        display: block;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--color-table-border);
        margin-bottom: 0;
        padding: 0.75rem 1rem;
    }

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

    .base-div-table-cell::before {
        content: attr(data-label) ": ";
        font-weight: var(--font-weight-bold);
        display: block;
        margin-bottom: 0.25rem;
        color: var(--color-text);
    }

    .base-content-checker-history-item {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.375rem;
    }

    .base-content-checker-history-value {
        margin-right: 0;
    }

    .base-content-checker-status-ok {
        margin-right: 0;
    }

    .base-content-checker-status-not-ok {
        margin-right: 0;
    }

    .base-dashboard-history-item {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.375rem;
    }

    .base-dashboard-history-value {
        margin-right: 0;
    }

    .base-content-checker-history-table-header,
    .base-dashboard-history-table-header {
        display: none;
    }

    .base-content-checker-history-table-row,
    .base-dashboard-history-table-row {
        grid-template-columns: 1fr;
    }

    .base-content-checker-history-table-cell,
    .base-dashboard-history-table-cell {
        border-right: none;
        border-bottom: 1px solid var(--color-table-border);
    }

    .base-content-checker-history-table-cell:last-child,
    .base-dashboard-history-table-cell:last-child {
        border-bottom: none;
    }
}
