/* APK Pagination Final 2027
   Purpose: final override for DataTables / Bootstrap pagination in light + dark mode.
   Loaded last to prevent legacy white chips / white text bugs. */

:root{
  --apk-page-radius: 999px;
}

/* Base pagination wrapper */
:where(.dataTables_wrapper) :where(.dataTables_paginate),
:where(.pagination, ul.pagination){
  display:flex!important;
  align-items:center!important;
  justify-content:flex-end!important;
  gap:10px!important;
  flex-wrap:wrap!important;
  width:100%!important;
  max-width:100%!important;
  padding:14px 4px 4px!important;
  margin:12px 0 0!important;
  overflow-x:auto!important;
  overflow-y:hidden!important;
  scrollbar-width:thin!important;
  position:relative!important;
  z-index:3!important;
}

/* All pagination chips: DataTables and Bootstrap */
:where(.dataTables_wrapper) :where(.dataTables_paginate .paginate_button),
:where(.dataTables_wrapper) :where(.dataTables_paginate a.paginate_button),
:where(.dataTables_wrapper) :where(.dataTables_paginate span .paginate_button),
:where(.pagination) :where(.page-link),
:where(ul.pagination) :where(.page-link){
  position:relative!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  min-width:44px!important;
  height:44px!important;
  padding:0 16px!important;
  margin:0!important;
  border-radius:var(--apk-page-radius)!important;
  border:1px solid rgba(59,130,246,.22)!important;
  background:#ffffff!important;
  color:#0f2b55!important;
  -webkit-text-fill-color:#0f2b55!important;
  text-decoration:none!important;
  font-weight:900!important;
  line-height:1!important;
  box-shadow:0 10px 24px rgba(37,99,235,.08)!important;
  opacity:1!important;
  cursor:pointer!important;
  user-select:none!important;
  transition:transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease!important;
}

:where(.dataTables_wrapper) :where(.dataTables_paginate .paginate_button:hover),
:where(.pagination) :where(.page-link:hover),
:where(ul.pagination) :where(.page-link:hover){
  transform:translateY(-1px)!important;
  border-color:rgba(37,99,235,.45)!important;
  box-shadow:0 14px 30px rgba(37,99,235,.14)!important;
}

/* Active/current page */
:where(.dataTables_wrapper) :where(.dataTables_paginate .paginate_button.current),
:where(.dataTables_wrapper) :where(.dataTables_paginate .paginate_button.current:hover),
:where(.pagination) :where(.page-item.active .page-link),
:where(ul.pagination) :where(.page-item.active .page-link),
:where(.pagination) :where(li.active > a, li.active > span),
:where(ul.pagination) :where(li.active > a, li.active > span){
  background:linear-gradient(135deg,#2563eb 0%,#7c3aed 68%,#ec4899 100%)!important;
  border-color:transparent!important;
  color:#ffffff!important;
  -webkit-text-fill-color:#ffffff!important;
  box-shadow:0 14px 34px rgba(79,70,229,.34)!important;
}

/* Previous / Next should be wider and readable */
:where(.dataTables_wrapper) :where(.dataTables_paginate .paginate_button.previous,.dataTables_paginate .paginate_button.next),
:where(.pagination) :where(.page-item:first-child .page-link,.page-item:last-child .page-link),
:where(ul.pagination) :where(.page-item:first-child .page-link,.page-item:last-child .page-link){
  min-width:86px!important;
  padding:0 18px!important;
  white-space:nowrap!important;
}

/* Disabled and ellipsis should not turn into white/blank pills */
:where(.dataTables_wrapper) :where(.dataTables_paginate .paginate_button.disabled),
:where(.dataTables_wrapper) :where(.dataTables_paginate .ellipsis),
:where(.pagination) :where(.page-item.disabled .page-link),
:where(ul.pagination) :where(.page-item.disabled .page-link){
  background:#eef4ff!important;
  border-color:rgba(148,163,184,.25)!important;
  color:#64748b!important;
  -webkit-text-fill-color:#64748b!important;
  opacity:1!important;
  cursor:not-allowed!important;
  pointer-events:none!important;
  box-shadow:none!important;
}

/* Force child text/icons to inherit the fixed contrast */
:where(.dataTables_wrapper) :where(.dataTables_paginate .paginate_button *),
:where(.pagination) :where(.page-link *),
:where(ul.pagination) :where(.page-link *){
  color:inherit!important;
  -webkit-text-fill-color:inherit!important;
  opacity:1!important;
}

/* DARK MODE: no white chips, no missing text */
html[data-apk-theme="dark"] :where(.dataTables_wrapper) :where(.dataTables_paginate),
html[data-apk-theme="dark"] :where(.pagination, ul.pagination){
  background:transparent!important;
  border-color:transparent!important;
}

html[data-apk-theme="dark"] :where(.dataTables_wrapper) :where(.dataTables_paginate .paginate_button),
html[data-apk-theme="dark"] :where(.dataTables_wrapper) :where(.dataTables_paginate a.paginate_button),
html[data-apk-theme="dark"] :where(.dataTables_wrapper) :where(.dataTables_paginate span .paginate_button),
html[data-apk-theme="dark"] :where(.pagination) :where(.page-link),
html[data-apk-theme="dark"] :where(ul.pagination) :where(.page-link){
  background:#10233d!important;
  background-image:linear-gradient(180deg,rgba(30,64,120,.95),rgba(15,31,55,.98))!important;
  border-color:rgba(96,165,250,.34)!important;
  color:#eaf2ff!important;
  -webkit-text-fill-color:#eaf2ff!important;
  box-shadow:0 10px 24px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.05)!important;
  opacity:1!important;
}

html[data-apk-theme="dark"] :where(.dataTables_wrapper) :where(.dataTables_paginate .paginate_button:hover),
html[data-apk-theme="dark"] :where(.pagination) :where(.page-link:hover),
html[data-apk-theme="dark"] :where(ul.pagination) :where(.page-link:hover){
  background:#163357!important;
  background-image:linear-gradient(180deg,rgba(37,99,235,.30),rgba(20,46,78,.98))!important;
  border-color:rgba(147,197,253,.58)!important;
  color:#ffffff!important;
  -webkit-text-fill-color:#ffffff!important;
  box-shadow:0 14px 34px rgba(37,99,235,.24), inset 0 1px 0 rgba(255,255,255,.08)!important;
}

html[data-apk-theme="dark"] :where(.dataTables_wrapper) :where(.dataTables_paginate .paginate_button.current),
html[data-apk-theme="dark"] :where(.dataTables_wrapper) :where(.dataTables_paginate .paginate_button.current:hover),
html[data-apk-theme="dark"] :where(.pagination) :where(.page-item.active .page-link),
html[data-apk-theme="dark"] :where(ul.pagination) :where(.page-item.active .page-link),
html[data-apk-theme="dark"] :where(.pagination) :where(li.active > a, li.active > span),
html[data-apk-theme="dark"] :where(ul.pagination) :where(li.active > a, li.active > span){
  background:linear-gradient(135deg,#2563eb 0%,#7c3aed 55%,#ec4899 100%)!important;
  border-color:rgba(255,255,255,.16)!important;
  color:#ffffff!important;
  -webkit-text-fill-color:#ffffff!important;
  box-shadow:0 16px 38px rgba(124,58,237,.42), 0 0 0 1px rgba(255,255,255,.08) inset!important;
}

html[data-apk-theme="dark"] :where(.dataTables_wrapper) :where(.dataTables_paginate .paginate_button.disabled),
html[data-apk-theme="dark"] :where(.dataTables_wrapper) :where(.dataTables_paginate .ellipsis),
html[data-apk-theme="dark"] :where(.pagination) :where(.page-item.disabled .page-link),
html[data-apk-theme="dark"] :where(ul.pagination) :where(.page-item.disabled .page-link){
  background:#0b1729!important;
  background-image:none!important;
  border-color:rgba(148,163,184,.22)!important;
  color:#94a3b8!important;
  -webkit-text-fill-color:#94a3b8!important;
  opacity:1!important;
  box-shadow:none!important;
}

html[data-apk-theme="dark"] :where(.dataTables_wrapper) :where(.dataTables_paginate .paginate_button *),
html[data-apk-theme="dark"] :where(.pagination) :where(.page-link *),
html[data-apk-theme="dark"] :where(ul.pagination) :where(.page-link *){
  color:inherit!important;
  -webkit-text-fill-color:inherit!important;
  opacity:1!important;
}

@media (max-width: 768px){
  :where(.dataTables_wrapper) :where(.dataTables_paginate),
  :where(.pagination, ul.pagination){
    justify-content:flex-start!important;
    flex-wrap:nowrap!important;
    padding-bottom:10px!important;
  }
  :where(.dataTables_wrapper) :where(.dataTables_paginate .paginate_button),
  :where(.pagination) :where(.page-link),
  :where(ul.pagination) :where(.page-link){
    min-width:40px!important;
    height:40px!important;
    padding:0 13px!important;
  }
}
