/* ========================================
   Table Styles
   ======================================== */

/* Container voor responsive tabellen */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin: 32px 0;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    background: var(--tr-color-white);
}

/* Base table styling - voor alle tabellen in content */
table,
.docs-content table,
.article-content table,
.entry-content table,
.post-content table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    font-family: var(--tr-font-family);
    background: var(--tr-color-white);
    border-radius: 12px;
    overflow: hidden;
    margin: 24px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
}

/* Op mobiel: block display voor scroll */
@media (max-width: 768px) {
    table,
    .docs-content table,
    .article-content table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Scroll indicator op mobiel */
@media (max-width: 768px) {
    table::after,
    .docs-content table::after {
        content: '\2192';
        position: absolute;
        top: 50%;
        right: 8px;
        transform: translateY(-50%);
        background: rgba(16, 185, 129, 0.9);
        color: white;
        width: 32px;
        height: 32px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
        pointer-events: none;
        animation: scrollHint 2s ease-in-out infinite;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }

    @keyframes scrollHint {
        0%, 100% {
            opacity: 0.7;
            transform: translateY(-50%) translateX(0);
        }
        50% {
            opacity: 1;
            transform: translateY(-50%) translateX(-4px);
        }
    }
}

/* Table header */
table thead,
.docs-content table thead,
.article-content table thead {
    background: linear-gradient(135deg, var(--tr-color-primary) 0%, var(--tr-color-primary-hover) 100%);
    color: var(--tr-color-white);
    display: table-header-group;
}

table thead tr,
.docs-content table thead tr {
    border: none;
    display: table-row;
}

table tbody,
.docs-content table tbody {
    display: table-row-group;
}

table thead th,
.docs-content table thead th,
.article-content table thead th {
    padding: 18px 20px;
    text-align: left;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    border: none;
    color: var(--tr-color-white) !important;
    display: table-cell;
}

/* Table body */
table tbody tr,
.docs-content table tbody tr,
.article-content table tbody tr {
    border-bottom: 1px solid var(--tr-color-slate-300);
    transition: background-color 0.2s ease;
    display: table-row;
}

table tbody tr:last-child,
.docs-content table tbody tr:last-child {
    border-bottom: none;
}

table tbody tr:hover,
.docs-content table tbody tr:hover {
    background-color: var(--tr-color-primary-light);
}

table tbody tr:nth-child(even),
.docs-content table tbody tr:nth-child(even) {
    background-color: rgba(236, 235, 228, 0.3);
}

table tbody tr:nth-child(even):hover,
.docs-content table tbody tr:nth-child(even):hover {
    background-color: var(--tr-color-primary-light);
}

table tbody td,
.docs-content table tbody td,
.article-content table tbody td {
    padding: 16px 20px;
    color: var(--tr-color-slate-700);
    font-size: 0.95rem;
    line-height: 1.6;
    border: none;
    display: table-cell;
}

/* First column styling (vaak labels) */
table tbody td:first-child,
.docs-content table tbody td:first-child {
    font-weight: 500;
    color: var(--tr-color-slate-900);
}

/* Tabel caption */
table caption {
    padding: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--tr-color-slate-900);
    text-align: left;
    caption-side: top;
}

/* Variant: Compact table */
table.table-compact thead th {
    padding: 12px 16px;
    font-size: 0.875rem;
}

table.table-compact tbody td {
    padding: 10px 16px;
    font-size: 0.875rem;
}

/* Variant: Striped table (zonder hover effect) */
table.table-striped tbody tr:hover {
    background-color: inherit;
}

/* Variant: Bordered table */
table.table-bordered {
    border: 2px solid var(--tr-color-slate-300);
}

table.table-bordered thead th,
table.table-bordered tbody td {
    border: 1px solid var(--tr-color-slate-300);
}

table.table-bordered thead {
    background: var(--tr-color-primary);
}

/* Variant: Pink header */
table.table-pink thead {
    background: linear-gradient(135deg, var(--tr-color-primary) 0%, var(--tr-color-primary-hover) 100%);
}

/* Variant: Blue header */
table.table-blue thead {
    background: linear-gradient(135deg, var(--tr-color-info) 0%, var(--tr-color-info-hover) 100%);
}

/* Variant: Orange header */
table.table-orange thead {
    background: linear-gradient(135deg, var(--tr-color-warning) 0%, var(--tr-color-warning-hover) 100%);
}

/* Text alignment helpers */
table th.text-center,
table td.text-center {
    text-align: center;
}

table th.text-right,
table td.text-right {
    text-align: right;
}

/* Responsive table - horizontale scroll op mobiel */
@media (max-width: 768px) {
    /* Wrapper voor extra scroll ruimte indien gebruikt */
    .table-wrapper {
        margin: 24px 0;
        border-radius: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Tabel scrollt horizontaal met min-width */
    table,
    .docs-content table,
    .article-content table {
        font-size: 0.875rem;
        border-radius: 8px;
        margin: 24px 0;
    }

    table thead th,
    .docs-content table thead th {
        padding: 14px 12px;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    table tbody td,
    .docs-content table tbody td {
        padding: 12px;
        font-size: 0.875rem;
        white-space: nowrap;
    }

    /* Eerste kolom mag wel wrappen */
    table tbody td:first-child,
    .docs-content table tbody td:first-child {
        white-space: normal;
        min-width: 120px;
    }

    /* Stackable table variant voor zeer kleine schermen */
    table.table-stack thead {
        display: none;
    }

    table.table-stack tbody tr {
        display: block;
        margin-bottom: 16px;
        border: 1px solid var(--tr-color-slate-300);
        border-radius: 8px;
        overflow: hidden;
    }

    table.table-stack tbody td {
        display: block;
        text-align: right;
        padding: 12px;
        border-bottom: 1px solid var(--tr-color-slate-300);
        white-space: normal;
    }

    table.table-stack tbody td:last-child {
        border-bottom: none;
    }

    table.table-stack tbody td::before {
        content: attr(data-label);
        float: left;
        font-weight: 600;
        color: var(--tr-color-slate-900);
    }
}

@media (max-width: 480px) {
    table,
    .docs-content table,
    .article-content table {
        font-size: 0.8rem;
        border-radius: 6px;
    }

    table thead th,
    .docs-content table thead th {
        padding: 12px 10px;
        font-size: 0.75rem;
    }

    table tbody td,
    .docs-content table tbody td {
        padding: 10px 8px;
        font-size: 0.8rem;
    }

    table tbody td:first-child,
    .docs-content table tbody td:first-child {
        min-width: 100px;
    }
}
