/* DataTables custom styles */

/* Export buttons styling */
.dt-buttons {
    margin-bottom: 1rem;
}

.btn-export {
    background-color: #3f51b5;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 8px;
    font-size: 0.875rem; /* Consistent button font size */
    transition: background-color 0.3s;
}

.btn-export:hover {
    background-color: #303f9f;
}

/* Table styling improvements */
table.dataTable {
    width: 100% !important;
    margin: 1em 4em 1em 0; /* Right margin for space from view edge */
    table-layout: fixed; /* Fixed layout for better column control */
    font-size: 0.7rem; /* Match nav menu font size */
}

table.dataTable thead th {
    background-color: #f5f5f5;
    border-bottom: 2px solid #ddd;
    padding: 10px 8px; /* Slightly reduced padding */
    font-weight: 600;
    font-size: 0.7rem; /* Match nav menu font size */
    white-space: normal; /* Allow header text to wrap */
    word-wrap: break-word;
}

table.dataTable tbody td {
    padding: 8px 8px; /* Reduced padding for more compact rows */
    vertical-align: top;
    white-space: normal; /* Allow cell text to wrap */
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 0; /* Enable text wrapping with fixed layout */
    font-size: 0.7rem; /* Match nav menu font size */
    line-height: 1.5; /* Maintain readability with proper line height */
    border-bottom: 1px solid #ddd; /* Row separation */
}

table.dataTable tbody tr:hover {
    background-color: #f9f9f9;
}

/* Thick border between category groups */
table.dataTable tbody tr.group-boundary td {
    border-top: 3px solid #999;
}

/* Search box styling */
.dataTables_filter {
    font-size: 0.875rem;
}

.dataTables_filter input {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-left: 8px;
    font-size: 0.875rem;
}

/* Pagination styling */
.dataTables_paginate .paginate_button {
    padding: 6px 12px;
    margin: 0 2px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

.dataTables_paginate .paginate_button.current {
    background-color: #3f51b5;
    color: white !important;
    border-color: #3f51b5;
}

.dataTables_paginate .paginate_button:hover:not(.current) {
    background-color: #f5f5f5;
}

/* Info text styling */
.dataTables_info {
    padding-top: 1em;
    font-size: 0.875rem;
    color: #666;
}

/* Length menu styling */
.dataTables_length select {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin: 0 8px;
}

/* Prevent horizontal scrolling */
.dataTables_wrapper {
    overflow-x: hidden;
    width: 100%;
    margin-right: 4rem; /* Space from right edge of view */
}

/* Ensure table container doesn't overflow */
.md-typeset table {
    display: table;
    width: calc(100% - 4rem);
    table-layout: fixed;
    font-size: 0.7rem; /* Match nav menu font size */
    margin-right: 4rem; /* Space from right edge of view */
}

/* Allow code/pre elements in tables to wrap */
table.dataTable code,
table.dataTable pre {
    white-space: pre-wrap;
    word-wrap: break-word;
}
