/* /css/posts-table.css */
:root {
    --table-primary-color: #214F31;
    --table-border-color: #e0e0e0;
    --table-hover-color: #f5f5f5;
    --table-header-bg: #f8f9fa;
    --table-shadow-color: rgba(0, 0, 0, 0.1);
}

.table-container {
    position: relative;
    max-height: 500px;
    overflow: auto;
    border-radius: 8px;
    background: white;
    box-shadow: 0 4px 12px var(--table-shadow-color);
    margin: 20px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--table-primary-color) #f0f0f0;
}

/* Webkit Scrollbar Styles */
.table-container::-webkit-scrollbar { width: 8px; height: 8px; }
.table-container::-webkit-scrollbar-track { background: #f0f0f0; border-radius: 4px; }
.table-container::-webkit-scrollbar-thumb { background: var(--table-primary-color); border-radius: 4px; }
.table-container::-webkit-scrollbar-thumb:hover { background: #183823; }

.posts-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    font-size: 14px;
    table-layout: fixed;
}

.posts-table caption.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.posts-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--table-header-bg);
}

.posts-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--table-primary-color);
    border-bottom: 2px solid var(--table-primary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.posts-table tbody tr {
    transition: background-color 0.2s ease;
}

.posts-table tbody tr:hover,
.posts-table tbody tr:focus-within {
    background-color: var(--table-hover-color);
}

.posts-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--table-border-color);
    line-height: 1.4;
}

.posts-table td a {
    color: inherit;
    text-decoration: none;
    display: block;
    padding: 12px 15px; /* Make the whole cell clickable */
    margin: -12px -15px; /* Offset padding to fill cell */
    transition: color 0.2s ease;
}

.posts-table td a:hover,
.posts-table td a:focus {
    color: var(--table-primary-color);
    outline: none; /* Focus is handled by the row highlight */
}

.empty-message {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

/* ======================================== */
/* Responsive "Card" Layout for Mobile      */
/* ======================================== */
@media (max-width: 768px) {
    .table-container {
        max-height: none; /* Disable scroll container on mobile */
        border: 1px solid var(--table-border-color);
    }

    .posts-table thead {
        /* Hide table headers on mobile */
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        border: 0;
    }

    .posts-table tr {
        display: block;
        border-bottom: 2px solid var(--table-primary-color);
        margin-bottom: 15px;
    }
    
    .posts-table tr:last-child {
        margin-bottom: 0;
        border-bottom: none;
    }

    .posts-table td {
        display: block;
        text-align: right; /* Align content to the right */
        padding: 10px;
        border-bottom: 1px dotted var(--table-border-color);
    }
    
    .posts-table td:last-child {
        border-bottom: none;
    }

    .posts-table td::before {
        /* Use the data-label for context */
        content: attr(data-label);
        float: left; /* Align label to the left */
        font-weight: bold;
        text-transform: uppercase;
        color: var(--table-primary-color);
    }
    
    .posts-table td a {
        /* Adjust link padding for card layout */
        padding: 0;
        margin: 0;
        text-align: right;
    }
}