/**
 * Downloads Table Styles
 */

/* Downloads wrapper */
.sbos-downloads-wrapper {
    margin: 0;
}

/* Table controls */
.sbos-table-controls {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

input.sbos-table-search {
    width: 100%;
    max-width: 350px;
    padding: 10px 15px 10px 40px;
    border: 1px solid #d7d1ca;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    color: #1d1d1f;
    background-image: url(/wp-content/themes/Divi-child_kraem/img/icon-search-blue.svg);
    background-position: 13px center;
    background-repeat: no-repeat;
    background-size: 16px;
}

.sbos-table-search:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

.sbos-table-search::placeholder {
    color: #999;
}

/* Download table */
.sbos-download-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 0!important;
    border: none!important;
}

.sbos-download-table thead {
    background: #f8f9fa;
}

.sbos-download-table th {
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    font-size: 14px;
    white-space: nowrap;
}

.sbos-download-table th.is-sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.2s ease;
}

.sbos-download-table th.is-sortable:hover {
    background-color: #e9ecef;
}

.sbos-download-table th .sort-indicator {
    margin-left: 8px;
    opacity: 0.5;
    font-size: 12px;
}

.sbos-download-table th .sort-indicator::after {
    content: ' ⇅';
}

.sbos-download-table th.sorted-asc .sort-indicator {
    opacity: 1;
}

.sbos-download-table th.sorted-asc .sort-indicator::after {
    content: ' ▲';
}

.sbos-download-table th.sorted-desc .sort-indicator {
    opacity: 1;
}

.sbos-download-table th.sorted-desc .sort-indicator::after {
    content: ' ▼';
}

.sbos-download-table td {
    padding: 24px 32px!important;
    border-bottom: 1px solid #E9EAEB;
    vertical-align: middle;
    /* font-size: 14px; */
}

.sbos-download-table tbody tr {
    transition: background-color 0.2s ease;
}

.sbos-download-table tbody tr:hover {
    background-color: #f8f9fa;
}

.sbos-download-table tbody tr:nth-child(even) {
    background-color: #fbfbfb;
}

.sbos-download-table tbody tr:nth-child(even):hover {
    background-color: #f1f3f4;
}

/* File cell */
.sbos-cell-file {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.sbos-file-ico {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sbos-file-ico img {
    width: 40px;
    height: 40px;
}

.sbos-file-text {
    flex: 1;
    min-width: 0;
}

.sbos-file-title {
    font-weight: 600;
    color: #212529;
    margin-bottom: 14px;
    line-height: 20px;
    word-break: break-word;
    font-size: 16px;
}

.sbos-file-desc {
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sbos-file-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #6c757d;
}

.sbos-file-size {
    font-weight: 500;
}

.sbos-download-count {
    position: relative;
    padding-left: 16px;
}

.sbos-download-count::before {
    content: '↓';
    position: absolute;
    left: 0;
    font-weight: bold;
    color: #28a745;
}

/* Download button cell */
.sbos-cell-dl {
    text-align: center;
    width: 60px;
}

.sbos-dl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    text-decoration: none;
    transition: all 0.2s ease;
    border-radius: 50%;
}

.sbos-dl-btn:hover {
    box-shadow: 0 4px 8px rgb(0 149 213 / 44%);
}

.sbos-dl-btn img {
    width: 40px;
    height: 40px;
}

.sbos-dl-na {
    color: #6c757d;
    font-size: 18px;
}

/* Search results */
.sbos-no-search-results {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
    font-style: italic;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-top: 20px;
}

/* Responsive design */
@media (max-width: 768px) {
    .sbos-table-controls {
        padding: 12px;
    }

    .sbos-table-search {
        max-width: 100%;
    }

    .sbos-download-table {
        font-size: 13px;
    }

    .sbos-download-table th,
    .sbos-download-table td {
        padding: 10px 8px;
    }

    .sbos-cell-file {
        gap: 10px;
    }

    .sbos-file-ico {
        width: 28px;
        height: 28px;
    }

    .sbos-file-ico img {
        width: 16px;
        height: 16px;
    }

    .sbos-file-title {
        font-size: 14px;
    }

    .sbos-file-desc {
        font-size: 12px;
    }

    .sbos-file-meta {
        font-size: 11px;
        gap: 8px;
    }

    .sbos-dl-btn {
        /* width: 60px; */
        /* height: 60px; */
    }

    .sbos-dl-btn img {
        /* width: 48px; */
        /* height: 34px; */
    }
}

@media (max-width: 600px) {
    .sbos-download-table,
    .sbos-download-table thead,
    .sbos-download-table tbody,
    .sbos-download-table th,
    .sbos-download-table td,
    .sbos-download-table tr {
        display: block;
    }

    .sbos-download-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .sbos-download-table tr {
        border: 1px solid #dee2e6;
        margin: 0px;
        padding: 15px;
        border-radius: 0;
        background: #fff;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }

    .sbos-download-table td {
        border: none;
        border-bottom: 1px solid #f1f3f4;
        position: relative;
        padding: 10px 0!important;
    }

    .sbos-download-table td:last-child {
        border-bottom: none;
        text-align: left;
    }

    .sbos-download-table td:before {
        content: attr(data-label) ': ';
        position: absolute;
        left: 0;
        top: 10px;
        width: 100px;
        white-space: nowrap;
        font-weight: 600;
        color: #495057;
        font-size: 12px;
    }

    .sbos-download-table .sbos-cell-file,
    .sbos-download-table .sbos-cell-dl {
        margin-left: 110px;
    }

    .sbos-download-table .sbos-cell-dl {
        text-align: left;
    }
}

@media (max-width: 480px) {
    .sbos-download-table tr {
        padding: 0 24px;
    }

    .sbos-download-table td:before {
        width: 80px;
        font-size: 11px;
        display: none;
    }

    .sbos-download-table .sbos-cell-file,
    .sbos-download-table .sbos-cell-dl {
        margin-left: 0;
    }

    .sbos-cell-file {
        gap: 8px;
    }

    .sbos-file-ico {
        /* width: 24px; */
        /* height: 24px; */
        display: none;
    }

    .sbos-file-ico img {
        width: 14px;
        height: 14px;
    }
}

/* Print styles */
@media print {
    .sbos-table-controls,
    .sbos-dl-btn {
        display: none !important;
    }

    .sbos-download-table {
        box-shadow: none;
        border: 1px solid #333;
    }

    .sbos-download-table th,
    .sbos-download-table td {
        border: 1px solid #333;
        padding: 8px;
    }

    .sbos-download-table tbody tr:nth-child(even) {
        background-color: transparent;
    }
}
