/* Custom DataTables styling for TWS Reporteros
 * Integrates DataTables with the existing equifax_reports.css design system
 * Uses the project's turquoise (#20B2AA) branding */

/* Controls layout: length selector on left, search on right */
.dt-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
    padding: 0 2px;
}

.dt-length,
.dt-search {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #495057;
}

.dt-length label,
.dt-search label {
    margin: 0;
    font-weight: 400;
    white-space: nowrap;
}

/* Style the length dropdown */
.dt-length select,
.dataTables_length select {
    padding: 4px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 13px;
    color: #495057;
    background-color: #fff;
    margin: 0 4px;
    cursor: pointer;
}

.dt-length select:focus,
.dataTables_length select:focus {
    border-color: #20B2AA;
    outline: none;
    box-shadow: 0 0 0 2px rgba(32, 178, 170, 0.2);
}

/* Style the search input */
.dt-search input,
.dataTables_filter input {
    padding: 5px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 13px;
    color: #495057;
    background-color: #fff;
    margin-left: 4px;
    min-width: 180px;
}

.dt-search input:focus,
.dataTables_filter input:focus {
    border-color: #20B2AA;
    outline: none;
    box-shadow: 0 0 0 2px rgba(32, 178, 170, 0.2);
}

/* Footer layout: info on left, pagination on right */
.dt-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
    padding: 0 2px;
}

.dt-info,
.dataTables_info {
    font-size: 13px;
    color: #6c757d;
}

/* Pagination styling */
.dt-pagination .dataTables_paginate,
.dataTables_paginate {
    display: flex;
    align-items: center;
    gap: 0;
}

.dataTables_paginate .paginate_button {
    padding: 5px 12px;
    margin: 0 1px;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    font-size: 13px;
    color: #495057 !important;
    background: #fff;
    cursor: pointer;
    text-decoration: none !important;
    transition: all 0.2s ease;
}

.dataTables_paginate .paginate_button:hover {
    background-color: #e9ecef;
    border-color: #dee2e6;
    color: #212529 !important;
}

.dataTables_paginate .paginate_button.current,
.dataTables_paginate .paginate_button.current:hover {
    background-color: #20B2AA !important;
    border-color: #20B2AA !important;
    color: white !important;
    font-weight: 600;
}

.dataTables_paginate .paginate_button.disabled,
.dataTables_paginate .paginate_button.disabled:hover {
    color: #adb5bd !important;
    background: #f8f9fa;
    border-color: #dee2e6;
    cursor: not-allowed;
}

/* Keep thead styled after DataTables processes it */
table.data-table.dataTable thead {
    background-color: #20B2AA;
    color: white;
}

table.data-table.dataTable thead th {
    background-color: #20B2AA;
    color: white;
    border-bottom: 2px solid #17a085;
}

/* Sorting indicators */
table.dataTable thead .sorting,
table.dataTable thead .sorting_asc,
table.dataTable thead .sorting_desc {
    cursor: pointer;
    position: relative;
    padding-right: 20px !important;
}

table.data-table.dataTable thead .sorting::after,
table.data-table.dataTable thead .sorting_asc::after,
table.data-table.dataTable thead .sorting_desc::after {
    color: rgba(255, 255, 255, 0.6);
}

table.data-table.dataTable thead .sorting_asc::after,
table.data-table.dataTable thead .sorting_desc::after {
    color: white;
}

/* Remove DataTables default border */
table.dataTable.no-footer {
    border-bottom: none;
}

/* Ensure the table wrapper doesn't break the layout */
.dataTables_wrapper {
    margin: 20px 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .dt-controls {
        flex-direction: column;
        align-items: flex-start;
    }

    .dt-search input,
    .dataTables_filter input {
        min-width: 140px;
        width: 100%;
    }

    .dt-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .dataTables_paginate .paginate_button {
        padding: 4px 8px;
        font-size: 12px;
    }
}

/* Print: hide DataTables controls and show all rows */
@media print {
    .dt-controls,
    .dt-footer,
    .dataTables_length,
    .dataTables_filter,
    .dataTables_info,
    .dataTables_paginate {
        display: none !important;
    }

    /* Show all rows when printing */
    table.data-table.dataTable {
        box-shadow: none;
    }
}
