/**
 * SQL DataTables Frontend Styles
 */

/* DataTable Container */
.sql-datatable-container {
    position: relative;
    min-height: 200px;
    overflow: hidden;
    width: 100%;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    height: auto;
    background-color: rgba(255, 255, 255, 1.0);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    border-radius: 5px;
}

/* Ensure the DataTable wrapper is properly contained */
.sql-dataTables_wrapper {
    position: relative;
    width: 100%;
}

/* Target any scrollable containers DataTables might create */
.sql-dataTables_scroll,
.sql-dataTables_scrollBody,
.sql-dataTables_scrollHead {
    position: relative;
    width: 100% !important;
}

.loading-overlay .spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(0, 0, 0, 0.1);
    border-top: 5px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Loading text */
.loading-overlay div:last-child {
    font-weight: bold;
    color: #333;
    font-size: 16px;
}

/* Error Messages */
.sql-datatable-error {
    padding: 15px;
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
    border-radius: 4px;
    margin: 10px 0;
}

/* Responsive Design Improvements */
@media screen and (max-width: 767px) {

    div.sql-dataTables_wrapper div.sql-dataTables_length,
    div.sql-dataTables_wrapper div.sql-dataTables_filter,
    div.sql-dataTables_wrapper div.sql-dataTables_info,
    div.sql-dataTables_wrapper div.sql-dataTables_paginate {
        text-align: left;
        margin-bottom: 10px;
    }

    div.sql-dataTables_wrapper div.sql-dataTables_paginate ul.pagination {
        justify-content: flex-start !important;
    }

    .datatables-footer-buttons {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }
}

/* DataTables Custom Styling */
table.sql-dataTable thead th,
table.sql-dataTable thead td {
    padding: 10px 18px;
    border-bottom: 1px solid #ddd;
}

table.sql-dataTable tbody th,
table.sql-dataTable tbody td {
    padding: 8px 10px;
}

table.sql-dataTable.no-footer {
    border-bottom: 1px solid #ddd;
}

.sql-dataTables_wrapper .sql-dataTables_paginate .paginate_button {
    padding: 0.5em 1em;
}

.sql-dataTables_wrapper .sql-dataTables_paginate .paginate_button.current,
.sql-dataTables_wrapper .sql-dataTables_paginate .paginate_button.current:hover {
    background: #f1f1f1;
    border-color: #ddd;
    color: #333 !important;
}

.sql-dataTables_wrapper .sql-dataTables_paginate .paginate_button:hover {
    background: #f9f9f9;
    border-color: #ddd;
    color: #333 !important;
}