/* DataTable custom styles - Updated 2025-10-29 11:40 */

/* OVERRIDE OLD STYLES - Remove top spacing for length menu */
.dataTables_wrapper .dataTables_length {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}


/* Add spacing for pagination and info display */
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Make sure tables take full width in responsive mode */
.table-responsive {
  width: 100%;
  padding: 0.5rem 1rem 1rem 1rem;
}

/* Make the datatable responsive */
table.dataTable {
  width: 100% !important;
  margin-bottom: 1rem !important;
  margin-top: 0.5rem !important;
}

/* Add spacing for the "Showing X to Y of Z entries" text */
.dataTables_info {
  margin-left: 1rem;
  margin-bottom: 1rem;
}

/* Add spacing to the table header and cells */
table.dataTable thead th,
table.dataTable tbody td {
  padding: 0.75rem 1rem;
}

/* Style for created_at and updated_at columns */
.datetime-cell {
  padding-right: 1rem !important;
  white-space: nowrap !important;
}

.datetime-column {
  white-space: nowrap !important;
  font-size: 0.85rem;
  display: inline-flex !important;
  align-items: center !important;
}

.datetime-column i {
  margin-right: 0.35rem;
  color: #6c757d;
}

/* Force nowrap for datetime columns */
table.dataTable td.datetime-cell {
  white-space: nowrap !important;
}

/* REMOVED OLD FLOAT-BASED POSITIONING - Using flexbox now */

/* Add icons for datetime columns */
.created-at-icon, .updated-at-icon {
  opacity: 0.7;
  margin-right: 0.5rem;
  display: inline-block;
  flex-shrink: 0;
}

/* Add spacing to the card body */
.card-body {
  margin-bottom: 1rem;
}

/* Add spacing to the filter area */
.p-3.border-bottom.bg-light {
  margin-bottom: 0.5rem;
}

/* Footer layout - Rows Per Page and Pagination side by side */
.dataTables_wrapper .row:last-child {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 1rem 1.5rem !important;
  border-top: 1px solid #dee2e6 !important;
  margin-top: 1rem !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Style the length menu (Rows Per Page) */
.dataTables_wrapper .dataTables_length {
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  padding: 0.5rem 0 !important;
  margin: 0 0 0 10px !important;
  float: none !important;
}

.dataTables_wrapper .dataTables_length label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  font-weight: 500;
  color: #495057;
  font-size: 0.9rem;
}

.dataTables_wrapper .dataTables_length select {
  width: auto;
  padding: 0.375rem 2rem 0.375rem 0.75rem;
  border: 1px solid #ced4da;
  border-radius: 0.25rem;
  background-color: #fff;
  font-size: 0.875rem;
}

/* Style the pagination */
.dataTables_wrapper .dataTables_paginate {
  padding: 0 !important;
  margin: 0 !important;
  float: none !important;
}

.dataTables_wrapper .dataTables_paginate .pagination {
  margin: 0;
  gap: 0.25rem;
  /* A 63-page table cannot always fit on one line. */
  flex-wrap: wrap;
  justify-content: flex-end;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  padding: 0.375rem 0.75rem;
  margin: 0;
  border: 1px solid #dee2e6;
  border-radius: 0.25rem;
  background-color: #fff;
  color: #495057;
  cursor: pointer;
  transition: all 0.2s;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background-color: #e9ecef;
  border-color: #dee2e6;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background-color: #0d6efd;
  border-color: #0d6efd;
  color: #fff;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Right side container for pagination + info.
   Wraps rather than overflows. With ~60 pages the buttons plus the "showing X
   of Y" text are wider than half a row, and a flex-end container overflows to
   the LEFT — putting First and Previous on top of the Rows Per Page select.
   Allowing a wrap keeps every control where it belongs at any width. */
.dataTables_wrapper .dt-footer-right {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  flex-wrap: wrap !important;
  gap: 0.5rem 1.5rem !important;
  padding: 0.5rem 0 !important;
  min-width: 0;
}

/* Below the lg breakpoint the length menu is on its own line above, so the
   footer reads left-to-right like the rest of the page. */
@media (max-width: 991.98px) {
  .dataTables_wrapper .dt-footer-right {
    justify-content: flex-start !important;
  }
}

/* Kept for the older tables that still render the 6/6 footer. */
.dataTables_wrapper .col-md-6.text-end {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  flex-wrap: wrap !important;
  gap: 0.5rem 1.5rem !important;
  padding: 0.5rem 0 !important;
}

/* Pagination comes first in DOM */
.dataTables_wrapper .dataTables_paginate {
  display: inline-flex !important;
  padding: 0 !important;
  margin: 0 !important;
  float: none !important;
}

/* Show info text after pagination */
.dataTables_wrapper .dataTables_info {
  display: inline-block !important;
  padding: 0 !important;
  margin: 0 !important;
  float: none !important;
  font-size: 0.8rem !important;
  color: #6c757d !important;
  white-space: nowrap !important;
  font-weight: 400 !important;
}
