/**
 * Trilobita DocVault - Public Styles
 *
 * @package TrilobitaDocVault
 */

/* ── Container ── */

.trdv-documents-wrap {
    max-width: 100%;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* ── Search Box ── */

.trdv-search-box {
    margin-bottom: 15px;
}

.trdv-search-input {
    width: 100%;
    max-width: 400px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.trdv-search-input:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 1px #0073aa;
}

/* ── Table ── */

.trdv-table-container {
    overflow-x: auto;
}

.trdv-documents-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #e1e1e1;
    font-size: 14px;
}

.trdv-documents-table thead th {
    background: #f7f7f7;
    border-bottom: 2px solid #ddd;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

.trdv-documents-table thead th:hover {
    background: #efefef;
}

.trdv-documents-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #e1e1e1;
    vertical-align: middle;
}

.trdv-documents-table tbody tr:hover {
    background: #f9f9f9;
}

.trdv-documents-table tbody tr:last-child td {
    border-bottom: none;
}

/* ── Column widths ── */

.trdv-col-type {
    width: 80px;
    text-align: center;
}

.trdv-col-size {
    width: 100px;
    text-align: right;
}

.trdv-col-date {
    width: 140px;
}

.trdv-col-download {
    width: 100px;
    text-align: center;
}

/* ── Sort Icons ── */

.trdv-sort-icon::after {
    content: '\25B4\25BE';
    font-size: 10px;
    margin-left: 4px;
    color: #aaa;
    letter-spacing: -2px;
}

th.trdv-sort-asc .trdv-sort-icon::after {
    content: '\25B4';
    color: #333;
}

th.trdv-sort-desc .trdv-sort-icon::after {
    content: '\25BE';
    color: #333;
}

/* ── Download Button ── */

.trdv-download-btn {
    display: inline-block;
    padding: 4px 12px;
    background: #0073aa;
    color: #fff;
    text-decoration: none;
    border-radius: 3px;
    font-size: 13px;
    line-height: 1.5;
    transition: background 0.2s;
}

.trdv-download-btn:hover {
    background: #005a87;
    color: #fff;
    text-decoration: none;
}

/* ── No Results ── */

.trdv-no-results {
    text-align: center;
    padding: 30px 12px !important;
    color: #666;
    font-style: italic;
}

/* ── Pagination ── */

.trdv-pagination {
    margin-top: 15px;
    text-align: center;
}

.trdv-pagination .page-numbers {
    display: inline-block;
    padding: 5px 10px;
    margin: 0 2px;
    border: 1px solid #ddd;
    border-radius: 3px;
    text-decoration: none;
    color: #333;
    font-size: 13px;
}

.trdv-pagination .page-numbers.current {
    background: #0073aa;
    border-color: #0073aa;
    color: #fff;
}

.trdv-pagination .page-numbers:hover:not(.current) {
    background: #f7f7f7;
}

/* ── Loading State ── */

.trdv-documents-wrap.trdv-loading .trdv-table-container {
    opacity: 0.5;
    pointer-events: none;
}

/* ── Responsive ── */

@media screen and (max-width: 768px) {
    .trdv-search-input {
        max-width: 100%;
    }

    .trdv-documents-table {
        font-size: 13px;
    }

    .trdv-documents-table thead th,
    .trdv-documents-table tbody td {
        padding: 8px;
    }
}

@media screen and (max-width: 480px) {
    .trdv-col-size,
    .trdv-col-date {
        display: none;
    }
}

/* ── Document Block ── */

.trdv-document-block {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
    margin: 20px 0;
}

.trdv-document-block.aligncenter {
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.trdv-document-block.alignleft {
    float: left;
    margin-right: 20px;
    max-width: 350px;
}

.trdv-document-block.alignright {
    float: right;
    margin-left: 20px;
    max-width: 350px;
}

.trdv-document-icon {
    flex-shrink: 0;
}

.trdv-file-icon {
    display: block;
    width: 48px;
    height: 48px;
    background: #0073aa;
    border-radius: 6px;
    position: relative;
}

.trdv-file-icon::after {
    content: 'FILE';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
}

.trdv-file-icon-pdf::after { content: 'PDF'; }
.trdv-file-icon-doc::after,
.trdv-file-icon-docx::after { content: 'DOC'; }
.trdv-file-icon-xls::after,
.trdv-file-icon-xlsx::after { content: 'XLS'; }
.trdv-file-icon-ppt::after,
.trdv-file-icon-pptx::after { content: 'PPT'; }
.trdv-file-icon-odt::after { content: 'ODT'; }
.trdv-file-icon-ods::after { content: 'ODS'; }
.trdv-file-icon-odp::after { content: 'ODP'; }
.trdv-file-icon-rtf::after { content: 'RTF'; }
.trdv-file-icon-csv::after { content: 'CSV'; }
.trdv-file-icon-txt::after { content: 'TXT'; }

.trdv-file-icon-pdf { background: #e74c3c; }
.trdv-file-icon-doc,
.trdv-file-icon-docx,
.trdv-file-icon-rtf { background: #2b579a; }
.trdv-file-icon-xls,
.trdv-file-icon-xlsx,
.trdv-file-icon-csv { background: #217346; }
.trdv-file-icon-ppt,
.trdv-file-icon-pptx { background: #d24726; }
.trdv-file-icon-odt,
.trdv-file-icon-ods,
.trdv-file-icon-odp { background: #00728b; }
.trdv-file-icon-txt { background: #646970; }

.trdv-document-content {
    flex: 1;
    min-width: 0;
}

.trdv-document-title {
    margin: 0 0 8px;
    font-size: 16px;
    line-height: 1.3;
}

.trdv-document-title a {
    color: inherit;
    text-decoration: none;
}

.trdv-document-title a:hover {
    color: #0073aa;
}

.trdv-document-meta {
    margin: 0 0 12px;
    font-size: 13px;
    color: #666;
}

.trdv-document-meta span {
    display: inline-block;
    margin-right: 12px;
}

.trdv-document-meta .trdv-meta-type {
    background: #e1e1e1;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
}

.trdv-download-button {
    display: inline-block;
    padding: 8px 16px;
    background: #0073aa;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.trdv-download-button:hover {
    background: #005a87;
    color: #fff;
}

/* ── Minimal Layout ── */

.trdv-document-minimal {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.trdv-minimal-link {
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
}

.trdv-minimal-link:hover {
    color: #005a87;
    text-decoration: underline;
}

.trdv-minimal-type {
    display: inline-block;
    background: #e1e1e1;
    color: #555;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Inline Link Shortcode ── */

.trdv-inline-link {
    color: #0073aa;
    text-decoration: none;
    border-bottom: 1px dotted currentColor;
}

.trdv-inline-link:hover {
    color: #005a87;
    border-bottom-style: solid;
}

/* ── Responsive Document Block ── */

@media screen and (max-width: 480px) {
    .trdv-document-block {
        flex-direction: column;
        text-align: center;
    }

    .trdv-document-block.alignleft,
    .trdv-document-block.alignright {
        float: none;
        margin-left: auto;
        margin-right: auto;
        max-width: 100%;
    }
}
