/* PERFECT RESPONSIVE TABLES - Twenty Twenty-Five */
/* Auto-width columns + thin borders + mobile scroll */

.wp-block-table table,
table {
    width: 100% !important;
    table-layout: auto !important;
    min-width: 100%;
    border-collapse: collapse !important;
    border-spacing: 0 !important;
    margin-bottom: 1.5em;
    font-size: 0.95em;
}

.wp-block-table table td,
.wp-block-table table th,
table td,
table th {
    width: auto !important;
    max-width: 0;
    padding: 0.75em 0.5em !important;
    vertical-align: top;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-sizing: border-box;
    border-style: solid;
    border-width: 1px 0 0 1px !important;
}

/* PERFECT HEADER BORDERS - All 4 sides */
.wp-block-table table th,
table th {
    border-left-width: 1px !important;
    border-top-width: 1px !important;
}

.wp-block-table table th:last-child,
table th:last-child {
    border-right-width: 1px !important;
}

/* Cell closing borders */
.wp-block-table table tr:last-child td,
table tr:last-child td {
    border-bottom-width: 1px !important;
}

.wp-block-table table tr td:last-child,
table tr td:last-child {
    border-right-width: 1px !important;
}

/* Word wrapping for long content */
.wp-block-table table td:not([style*="width"]):not([style*="max-width"]),
table td:not([style*="width"]):not([style*="max-width"]) {
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto;
    max-width: 300px;
}

/* MOBILE - Horizontal scroll */
@media (max-width: 768px) {
    .wp-block-table table,
    table {
        font-size: 0.9em;
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    .wp-block-table table td,
    .wp-block-table table th,
    table td,
    table th {
        padding: 0.5em 0.4em !important;
        min-width: 80px;
        white-space: normal !important;
        border-width: 1px !important;
    }
}

/* Gutenberg overrides */
.wp-block-table { overflow-x: auto; }
.wp-block-table .has-fixed-layout { table-layout: auto !important; }