/* =========================================================
   DataTables 2.x Wrapper Theme (W3.CSS Style)
   ========================================================= */

:root {
    --dt-border-color: #ccc;
    --dt-focus-color: #000;
    --dt-bg-color: #fff;
    --dt-text-color: #000;
    --dt-hover-bg: #f1f1f1;
    --dt-active-bg: #616161;
    --dt-active-text: #fff;
}

/* --- 1. Structural Grid (Holds the top/bottom controls) --- */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -12px;
    margin-left: -12px;
}
.row > * {
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    padding-right: 12px;
    padding-left: 12px;
}
.justify-content-between { justify-content: space-between !important; }
.align-items-center { align-items: center !important; }
.d-md-flex { display: flex !important; }
.col-md-auto { flex: 0 0 auto; width: auto; }

/* Make the length dropdown and search input look like W3 inputs */
.dataTables_wrapper select, .dataTables_wrapper input {
	border: 1px solid #ccc;
	padding: 8px;
	border-radius: 4px; /* Optional: W3 usually does square, but this looks nicer */
}

/* Fix alignment of export buttons */
.dt-buttons {
	margin-bottom: 16px;
	float: left; /* Or remove float to stack them */
}

/* Ensure FixedHeader plays nice with W3 containers */
table.dataTable.fixedHeader-floating {
	background-color: white;
	box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
}

/* The specific spacing classes DataTables actually injects */
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.me-auto { margin-right: auto !important; }
.ms-auto { margin-left: auto !important; }

/* --- 2. Form Controls (Search & Length Dropdown) --- */
.form-control, .form-select {
    display: block;
    width: 100%;
    padding: 6px 12px;
    font-size: 16px;
    color: var(--dt-text-color);
    background-color: var(--dt-bg-color);
    border: 1px solid var(--dt-border-color);
    border-radius: 4px; /* Slight rounding, fits W3 well */
    transition: border-color 0.15s ease-in-out;
}

/* W3-style focus (Dark border, no blue glow) */
.form-control:focus, .form-select:focus {
    border-color: var(--dt-focus-color);
    outline: none;
}

.form-control-sm, .form-select-sm {
    padding: 4px 8px;
    font-size: 14px;
}

/* --- 3. Pagination (Mimicking w3-bar / w3-button) --- */
.pagination {
    display: flex;
    padding-left: 0;
    list-style: none;
    margin: 0;
}

.page-link {
    position: relative;
    display: block;
    padding: 6px 12px;
    color: var(--dt-text-color);
    text-decoration: none;
    background-color: var(--dt-bg-color);
    border: 1px solid var(--dt-border-color);
    margin-left: -1px; /* Overlaps borders nicely */
    transition: background-color 0.15s;
}

.page-item:first-child .page-link {
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
}
.page-item:last-child .page-link {
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

/* Hover State */
.page-link:hover {
    background-color: var(--dt-hover-bg);
    color: var(--dt-text-color);
}

/* Active/Current Page State (Dark Gray instead of Blue) */
.page-item.active .page-link, .page-link.active {
    color: var(--dt-active-text);
    background-color: var(--dt-active-bg);
    border-color: var(--dt-active-bg);
}

/* Disabled State (Previous/Next buttons when at the ends) */
.page-item.disabled .page-link {
    color: #595959;
    pointer-events: none;
    background-color: var(--dt-bg-color);
    border-color: var(--dt-border-color);
}