/* Table styles */
.pldb-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    color: #333;
}

/* Override theme content width when shortcode is present */
body:has(.pldb-table) {
    --wp--style--global--content-size: 1380px;
    --wp--style--global--wide-size: 1380px;
}

body:has(.pldb-table) .wp-site-blocks,
body:has(.pldb-table) .entry-content {
    margin-left: auto;
    margin-right: auto;
}

.pldb-table thead {
    background: #f5f5f5;
}

.pldb-table th,
.pldb-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.pldb-table th {
    font-weight: 600;
    color: #333;
}

.pldb-table caption {
    font-size: 1.3em;
    font-weight: 600;
    text-align: left;
    padding: 12px 0;
    color: #333;
    caption-side: top;
}

/* Sortable column headers */
.pldb-sort {
    text-decoration: none;
    color: inherit;
    display: block;
    width: 100%;
}

.pldb-sort:hover,
.pldb-sort:focus {
    color: #0073aa;
    outline: 1px solid #0073aa;
    outline-offset: 1px;
}

.pldb-sort::after {
    content: '\f156';
    font-family: dashicons;
    font-size: 14px;
    opacity: 0.3;
    margin-left: 4px;
}

.pldb-sort[data-dir="asc"]::after {
    content: '\f142';
    opacity: 1;
}

.pldb-sort[data-dir="desc"]::after {
    content: '\f140';
    opacity: 1;
}

/* Search styles */
.pldb-search-form {
    margin: 20px 0;
}

.pldb-search-container {
    display: flex;
    max-width: 600px;
}

.pldb-search-input {
    flex: 1;
    padding: 12px 18px;
    border: 2px solid #ddd;
    border-radius: 4px 0 0 4px;
    font-size: 18px;
}

.pldb-search-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.25);
}

.pldb-search-button {
    padding: 12px 24px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
}

.pldb-search-button:hover,
.pldb-search-button:focus {
    background: #005a87;
    outline: none;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.pldb-search-results {
    margin-top: 30px;
}

/* Pagination styles */
.pldb-pagination {
    margin: 20px 0;
    text-align: center;
}

.pldb-page-link,
.pldb-page-current {
    display: inline-block;
    margin: 0 5px;
    padding: 5px 10px;
    border-radius: 3px;
}

.pldb-page-link {
    text-decoration: none;
    border: 1px solid #ddd;
    color: #0073aa;
    background: #fff;
}

.pldb-page-link:hover,
.pldb-page-link:focus {
    background: #f5f5f5;
    outline: none;
    box-shadow: 0 0 0 2px #0073aa;
}

.pldb-page-current {
    background: #0073aa;
    color: #fff;
}

.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}

@media (prefers-color-scheme: dark) {
    .pldb-table {
        background: #1e1e1e;
        color: #e0e0e0;
    }
    .pldb-table thead {
        background: #2d2d2d;
    }
    .pldb-table th,
    .pldb-table td {
        border-bottom: 1px solid #444;
        color: #e0e0e0;
    }
    .pldb-table caption {
        color: #e0e0e0;
    }
    .pldb-sort:hover {
        color: #4a9eff;
    }
    .pldb-search-input {
        background: #2d2d2d;
        color: #e0e0e0;
        border-color: #444;
    }
    .pldb-page-link {
        background: #2d2d2d;
        border-color: #444;
        color: #4a9eff;
    }
}

@media (max-width: 768px) {
    .pldb-table {
        font-size: 14px;
    }
    .pldb-table th,
    .pldb-table td {
        padding: 8px;
    }
}
