/* ====================================
   DATATABLES THEME STYLING
   ==================================== */

/* Hide length selector */
.dataTables_length {
  display: none;
}

/* Search Filter Container */
.dataTables_filter {
  margin-bottom: 1.5rem;
  padding: 0px 10px;
}

.dataTables_filter label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--primary-color);
  font-weight: 600;
  font-size: 1rem;
}

/* Search Input */
.dataTables_filter input[type="search"],
input[type="search"] {
  padding: 0.625rem 1rem;
  font-size: 1rem;
  color: var(--text-primary);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: all 0.3s ease;
  min-width: 250px;
}

.dataTables_filter input[type="search"]:focus,
input[type="search"]:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(46, 80, 119, 0.12);
  background: var(--surface);
}

.dataTables_filter input[type="search"]::placeholder {
  color: var(--text-muted);
}

/* Pagination Buttons */
.paginate_button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0.5rem 0.75rem;
  margin: 0 0.25rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--primary-color);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
}

.paginate_button:hover {
  color: var(--surface);
  background: var(--primary-color);
  border-color: var(--primary-color);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(46, 80, 119, 0.2);
}

/* Current/Active Page */
.paginate_button.current {
  color: var(--surface);
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-hover)
  );
  border-color: var(--primary-color);
  box-shadow: 0 2px 8px rgba(46, 80, 119, 0.25);
  pointer-events: none;
}

/* Disabled Pagination Buttons */
.paginate_button.disabled {
  color: var(--text-muted);
  background: var(--border-light);
  border-color: var(--border);
  cursor: not-allowed;
  opacity: 0.6;
}

.paginate_button.disabled:hover {
  transform: none;
  box-shadow: none;
  background: var(--border-light);
}

/* Previous/Next Buttons */
.paginate_button.previous,
.paginate_button.next {
  font-weight: 700;
  padding: 0.5rem 1rem;
}

.paginate_button.previous::before {
  content: "←";
  margin-right: 0.375rem;
}

.paginate_button.next::after {
  content: "→";
  margin-left: 0.375rem;
}

/* DataTables Info Text */
.dataTables_info {
  margin: 1rem 0.5rem;
  padding: 0.5rem 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
}

/* Pagination Container */
.dataTables_paginate {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  margin: 1.5rem 0;
  padding: 1rem 0;
}

/* DataTables Wrapper Styling */
.dataTables_wrapper {
  padding: 1rem 0;
}

.dataTables_wrapper .dataTables_filter {
  text-align: left;
  margin-bottom: 1rem;
}

.dataTables_wrapper .dataTables_paginate {
  text-align: center;
  padding-top: 1rem;
  border-top: 1px solid var(--border-light);
}

/* ====================================
   RESPONSIVE DESIGN
   ==================================== */

@media (max-width: 768px) {
  /* Search Input */
  .dataTables_filter input[type="search"],
  input[type="search"] {
    min-width: 100%;
    max-width: 100%;
  }

  .dataTables_filter label {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Pagination */
  .dataTables_paginate {
    flex-wrap: wrap;
    gap: 0.375rem;
  }

  .paginate_button {
    min-width: 32px;
    height: 32px;
    padding: 0.375rem 0.625rem;
    font-size: 0.875rem;
    margin: 0.125rem;
  }

  .paginate_button.previous,
  .paginate_button.next {
    padding: 0.375rem 0.75rem;
  }

  /* Info Text */
  .dataTables_info {
    text-align: center;
    font-size: 0.875rem;
  }
}

@media (max-width: 480px) {
  /* Hide some page numbers on small screens, show only nearby pages */
  .paginate_button:not(.previous):not(.next):not(.current) {
    display: none;
  }

  /* Show only first, last, and current page */
  .paginate_button:first-of-type,
  .paginate_button:last-of-type,
  .paginate_button.current {
    display: inline-flex;
  }

  .dataTables_info {
    font-size: 0.8rem;
  }
}

/* ====================================
   LOADING STATE (OPTIONAL)
   ==================================== */

.dataTables_processing {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 200px;
  padding: 1.5rem;
  text-align: center;
  background: var(--surface);
  border: 2px solid var(--primary-color);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(46, 80, 119, 0.2);
  color: var(--primary-color);
  font-weight: 600;
  font-size: 1rem;
  z-index: 1000;
}

.dataTables_processing::before {
  content: "";
  display: block;
  width: 32px;
  height: 32px;
  margin: 0 auto 0.75rem;
  border: 3px solid var(--border-light);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ====================================
   EMPTY STATE
   ==================================== */

.dataTables_empty {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 500;
}

/* ====================================
   ADDITIONAL ENHANCEMENTS
   ==================================== */

/* Better visual feedback for sortable columns */
table.dataTable thead th.sorting,
table.dataTable thead th.sorting_asc,
table.dataTable thead th.sorting_desc {
  cursor: pointer;
  position: relative;
  padding-right: 2rem;
}

table.dataTable thead th.sorting:hover,
table.dataTable thead th.sorting_asc:hover,
table.dataTable thead th.sorting_desc:hover {
  background-color: var(--primary-hover);
}

/* Sort indicators */
table.dataTable thead th.sorting::after,
table.dataTable thead th.sorting_asc::after,
table.dataTable thead th.sorting_desc::after {
  position: absolute;
  right: 0.75rem;
  opacity: 0.5;
}

table.dataTable thead th.sorting_asc::after {
  content: "↑";
  opacity: 1;
}

table.dataTable thead th.sorting_desc::after {
  content: "↓";
  opacity: 1;
}
