/* =========================================================
   High-contrast light theme - DataTables 2.x
   WCAG-oriented variant of light.css

   Light theme - DataTables 2.x
   Styles the generated DataTables 2.x controls:
   length, search, info, paging, layout rows/cells,
   plus DataTables 2.x sorting arrows.

   Intended usage:
   - Load DataTables 2.x CSS first.
   - Load this file after it.

   Notes:
   - This file keeps table cell styling minimal.
   - It only adds the header layout needed for sort arrows.
   ========================================================= */


/* =========================================================
   Theme variables
   ========================================================= */

.dt-container {
  --dt-text: #111111;
  --dt-text-soft: #1f2937;
  --dt-text-muted: #374151;
  --dt-surface: #ffffff;
  --dt-surface-2: #f3f4f6;
  --dt-border: #4b5563;
  --dt-border-soft: #6b7280;
  --dt-primary: #003f8f;
  --dt-primary-hover: #002f6c;
  --dt-focus: #ffbf47;
  --dt-primary-ring: rgba(0, 63, 143, .28);
  --dt-shadow-sm: 0 1px 2px rgba(0, 0, 0, .18);
  --dt-shadow-md: 0 4px 12px rgba(0, 0, 0, .22);

  color: var(--dt-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}


/* =========================================================
   Layout rows/cells
   ========================================================= */

.dt-layout-row {
  gap: 1rem;
  align-items: center;
  margin: .75rem 0;
}

/* Keep the row that holds the actual table untouched */
.dt-layout-row.dt-layout-table {
  margin: 0;
}

/* Optional visual grouping for control rows only */
.dt-layout-row:not(.dt-layout-table) {
  padding: .2rem 0;
}

.dt-layout-cell {
  min-width: 0;
}

.dt-layout-start,
.dt-layout-end {
  display: flex;
  align-items: center;
}


/* =========================================================
   Length/search controls
   ========================================================= */

.dt-length,
.dt-search {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

.dt-length label,
.dt-search label {
  color: var(--dt-text-soft);
  font-size: .875rem;
  font-weight: 600;
}

.dt-length select.dt-input,
.dt-search input.dt-input {
  min-height: 40px;
  color: var(--dt-text);
  background-color: var(--dt-surface);
  border: 2px solid var(--dt-border);
  border-radius: 8px;
  padding: .5rem .75rem;
  font-size: .875rem;
  line-height: 1.2;
  box-shadow: var(--dt-shadow-sm);
  transition:
    background-color .15s ease,
    border-color .15s ease,
    box-shadow .15s ease;
}

.dt-search input.dt-input {
  min-width: 200px;
}

.dt-search input.dt-input::placeholder {
  color: #374151;
}

.dt-length select.dt-input:hover,
.dt-search input.dt-input:hover {
  background-color: #fff;
  border-color: #9ca3af;
}

.dt-length select.dt-input:focus,
.dt-search input.dt-input:focus {
  outline: 3px solid var(--dt-focus);
  outline-offset: 2px;
  background-color: #fff;
  border-color: var(--dt-primary);
  box-shadow: none;
}

/* Custom select arrow */
.dt-length select.dt-input {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 2.25rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .7rem center;
  background-size: 1rem;
}

.dt-container select.dt-input { 
    padding: 0px 10px !important;
}

/* =========================================================
   Info text
   ========================================================= */

.dt-info {
  color: var(--dt-text-soft);
  font-size: .875rem;
  font-weight: 500;
}


/* =========================================================
   Paging
   ========================================================= */

.dt-paging {
  display: flex;
  align-items: center;
}

.dt-paging nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border: 2px solid var(--dt-border);
  border-radius: 10px;
  background: var(--dt-surface);
  box-shadow: none;
}

.dt-paging-button,
.dt-paging nav a.dt-paging-button,
.dt-paging nav button.dt-paging-button {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  min-width: 40px;
  padding: 0 12px;
  font: inherit;
  font-size: .875rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none !important;
  color: var(--dt-text);
  background: #ffffff;
  border: 2px solid var(--dt-border);
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  transition:
    background-color .15s ease,
    border-color .15s ease,
    color .15s ease,
    box-shadow .15s ease,
    transform .12s ease;
}

.dt-paging-button:hover:not(.disabled):not(.current) {
  background: var(--dt-primary);
  border-color: var(--dt-primary);
  color: #ffffff;
  box-shadow: none;
  transform: none;
}

.dt-paging-button:active:not(.disabled):not(.current) {
  transform: translateY(0);
  box-shadow: none;
}

.dt-paging-button.current {
  background: var(--dt-primary);
  border-color: var(--dt-primary);
  color: #ffffff;
  box-shadow: inset 0 0 0 1px #ffffff;
  cursor: default;
}

.dt-paging-button.disabled {
  opacity: 1;
  color: #4b5563;
  background: #f3f4f6;
  border-color: #6b7280;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.dt-paging-button:focus-visible {
  outline: 3px solid var(--dt-focus);
  outline-offset: 2px;
  border-color: var(--dt-primary);
  box-shadow: none;
}

.dt-paging-button.first,
.dt-paging-button.previous,
.dt-paging-button.next,
.dt-paging-button.last {
  padding: 0 14px;
  min-width: 52px;
}

/* Anchor buttons should inherit button color */
.dt-paging nav a.dt-paging-button {
  color: inherit !important;
}


/* =========================================================
   DataTables 2.x sorting arrows
   ========================================================= */

/*
   DataTables 2.x creates this structure inside each sortable header:

   <th class="dt-orderable-asc dt-orderable-desc dt-ordering-asc">
     <div class="dt-column-header">
       <span class="dt-column-title">Name</span>
       <span class="dt-column-order"></span>
     </div>
   </th>
*/

.dt-container table.dataTable thead th,
.dt-container table.dataTable thead td {
  position: relative;
}

/* Make title and arrow align nicely */
.dt-container table.dataTable thead .dt-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  width: 100%;
}

.dt-container table.dataTable thead .dt-column-title {
  flex: 1 1 auto;
  min-width: 0;
}

.dt-container table.dataTable thead .dt-column-order {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  width: 1rem;
  height: 1.25rem;
  align-items: center;
  justify-content: center;
  opacity: .9;
}

/* Default sortable state: show both arrows faintly */
.dt-container table.dataTable thead th.dt-orderable-asc.dt-orderable-desc .dt-column-order::before,
.dt-container table.dataTable thead th.dt-orderable-asc.dt-orderable-desc .dt-column-order::after,
.dt-container table.dataTable thead td.dt-orderable-asc.dt-orderable-desc .dt-column-order::before,
.dt-container table.dataTable thead td.dt-orderable-asc.dt-orderable-desc .dt-column-order::after {
  position: absolute;
  right: 0;
  font-size: .72rem;
  line-height: 1;
  color: var(--dt-text-muted);
}

.dt-container table.dataTable thead th.dt-orderable-asc.dt-orderable-desc .dt-column-order::before,
.dt-container table.dataTable thead td.dt-orderable-asc.dt-orderable-desc .dt-column-order::before {
  content: "▲";
  top: .05rem;
}

.dt-container table.dataTable thead th.dt-orderable-asc.dt-orderable-desc .dt-column-order::after,
.dt-container table.dataTable thead td.dt-orderable-asc.dt-orderable-desc .dt-column-order::after {
  content: "▼";
  bottom: .05rem;
}

/* Active ascending column */
.dt-container table.dataTable thead th.dt-ordering-asc .dt-column-order::before,
.dt-container table.dataTable thead td.dt-ordering-asc .dt-column-order::before {
  color: #003f8f;
  opacity: 1;
}

.dt-container table.dataTable thead th.dt-ordering-asc .dt-column-order::after,
.dt-container table.dataTable thead td.dt-ordering-asc .dt-column-order::after {
  opacity: .25;
}

/* Active descending column */
.dt-container table.dataTable thead th.dt-ordering-desc .dt-column-order::before,
.dt-container table.dataTable thead td.dt-ordering-desc .dt-column-order::before {
  opacity: .25;
}

.dt-container table.dataTable thead th.dt-ordering-desc .dt-column-order::after,
.dt-container table.dataTable thead td.dt-ordering-desc .dt-column-order::after {
  color: #003f8f;
  opacity: 1;
}

/* Cursor and hover feedback */
.dt-container table.dataTable thead th.dt-orderable-asc,
.dt-container table.dataTable thead th.dt-orderable-desc,
.dt-container table.dataTable thead td.dt-orderable-asc,
.dt-container table.dataTable thead td.dt-orderable-desc {
  cursor: pointer;
}

.dt-container table.dataTable thead th.dt-orderable-asc:hover .dt-column-order,
.dt-container table.dataTable thead th.dt-orderable-desc:hover .dt-column-order,
.dt-container table.dataTable thead td.dt-orderable-asc:hover .dt-column-order,
.dt-container table.dataTable thead td.dt-orderable-desc:hover .dt-column-order {
  opacity: 1;
}

/* Keyboard focus on the order button */
.dt-container table.dataTable thead .dt-column-order:focus-visible {
  outline: 3px solid var(--dt-focus);
  outline-offset: 2px;
  border-radius: 4px;
  box-shadow: none;
}


/* =========================================================
   Empty footer cleanup
   ========================================================= */

.dt-container.dt-empty-footer table.dataTable tfoot {
  display: none;
}


/* =========================================================
   Small-screen behavior
   ========================================================= */

@media (max-width: 767px) {
  .dt-layout-row {
    gap: .75rem;
  }

  .dt-layout-start,
  .dt-layout-end {
    width: 100%;
  }

  .dt-length,
  .dt-search,
  .dt-paging {
    width: 100%;
  }

  .dt-search input.dt-input {
    width: 100%;
    min-width: 0;
  }

  .dt-paging nav {
    flex-wrap: wrap;
  }
}


/* =========================================================
   Reduced motion
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  .dt-length select.dt-input,
  .dt-search input.dt-input,
  .dt-paging-button {
    transition: none !important;
  }
}

/* =========================================================
   High-contrast table treatment
   ========================================================= */

.dt-container table.dataTable {
  color: var(--dt-text);
  background: #ffffff;
  border: 2px solid #111111;
  border-collapse: collapse;
}

.dt-container table.dataTable thead th,
.dt-container table.dataTable thead td {
  color: #ffffff;
  background: #003f8f;
  border: 1px solid #ffffff;
  font-weight: 700;
}

.dt-container table.dataTable tbody th,
.dt-container table.dataTable tbody td {
  color: #111111;
  background: #ffffff;
  border: 1px solid #4b5563;
}

.dt-container table.dataTable tbody tr:nth-child(even) th,
.dt-container table.dataTable tbody tr:nth-child(even) td {
  background: #f3f4f6;
}

.dt-container table.dataTable tbody tr:hover th,
.dt-container table.dataTable tbody tr:hover td {
  background: #e5eefb;
}

.dt-container table.dataTable tbody tr:focus-within th,
.dt-container table.dataTable tbody tr:focus-within td {
  outline: 3px solid var(--dt-focus);
  outline-offset: -3px;
}

/* Keep links clearly distinguishable without relying on color alone */
.dt-container table.dataTable a {
  color: #003f8f;
  text-decoration: underline;
  text-decoration-thickness: .1em;
  text-underline-offset: .15em;
}

.dt-container table.dataTable a:visited {
  color: #5b21b6;
}

.dt-container table.dataTable a:hover {
  text-decoration-thickness: .16em;
}

.dt-container table.dataTable a:focus-visible {
  outline: 3px solid var(--dt-focus);
  outline-offset: 2px;
}

/* Improve native high-contrast / forced-colors behavior */
@media (forced-colors: active) {
  .dt-length select.dt-input,
  .dt-search input.dt-input,
  .dt-paging nav,
  .dt-paging-button,
  .dt-container table.dataTable,
  .dt-container table.dataTable th,
  .dt-container table.dataTable td {
    forced-color-adjust: auto;
  }

  .dt-paging-button.current {
    outline: 2px solid CanvasText;
    outline-offset: 1px;
  }

  .dt-container table.dataTable thead th,
  .dt-container table.dataTable thead td {
    border-color: CanvasText;
  }
}

