
/* ==========================================================
   ServerPACS v559
   Corrección:
   - botones sin solaparse
   - envío múltiple visible
   - paginación visible
   ========================================================== */

/* ---------- regla general anti-solapamiento ---------- */
button,
.btn,
a[role="button"]{
  box-sizing:border-box!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
}

/* Ningún bloque de acciones debe pisar tabla */
.topbar,
.toolbar,
.header,
#topbar,
#toolbar,
.actions,
#topActions,
.table-actions,
.bulk-actions,
.selection-actions,
.pager,
.pagination{
  display:flex!important;
  flex-wrap:wrap!important;
  align-items:center!important;
  gap:6px!important;
  min-height:auto!important;
  overflow:visible!important;
  position:relative!important;
}

/* Cabecera: si no caben, scroll horizontal limpio */
.topbar,
.toolbar,
.header,
#topbar,
#toolbar{
  padding-right:58px!important; /* deja sitio al botón menú */
  overflow-x:auto!important;
  overflow-y:visible!important;
  scrollbar-width:thin!important;
}

/* Botones superiores compactos */
.topbar button,
.toolbar button,
.header button,
#topbar button,
#toolbar button,
.actions button,
#topActions button{
  min-width:30px!important;
  max-width:150px!important;
  min-height:28px!important;
  height:28px!important;
  padding:4px 8px!important;
  font-size:11px!important;
  flex:0 0 auto!important;
}

/* ---------- barra fija de acciones de estudios ---------- */
#sp559StudyActionsBar{
  position:sticky!important;
  top:0!important;
  z-index:1200!important;
  display:flex!important;
  align-items:center!important;
  justify-content:space-between!important;
  flex-wrap:wrap!important;
  gap:8px!important;
  margin:8px 0!important;
  padding:8px!important;
  border:1px solid #354c60!important;
  border-radius:6px!important;
  background:#17212c!important;
  color:#edf6ff!important;
  box-shadow:0 6px 18px rgba(0,0,0,.20)!important;
}

.sp559-left-actions,
.sp559-right-actions{
  display:flex!important;
  align-items:center!important;
  flex-wrap:wrap!important;
  gap:6px!important;
}

#sp559SelectedInfo{
  font-size:12px!important;
  color:#aab7c4!important;
  padding:4px 8px!important;
  border:1px solid #34495a!important;
  border-radius:999px!important;
  background:#101923!important;
}

.sp559-action-btn{
  min-height:30px!important;
  height:30px!important;
  padding:5px 9px!important;
  border-radius:5px!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:5px!important;
  font-size:12px!important;
  font-weight:900!important;
  width:auto!important;
  max-width:none!important;
}

#sp559SendManyBtn{
  background:linear-gradient(#3b9ae0,#1f75b4)!important;
  border-color:#56aee9!important;
  color:#fff!important;
}

#sp559DownloadManyBtn{
  background:linear-gradient(#40b27a,#2c7d55)!important;
  border-color:#5dd89a!important;
  color:#fff!important;
}

#sp559ClearSelectionBtn{
  background:linear-gradient(#455568,#283848)!important;
  border-color:#586f84!important;
  color:#fff!important;
}

/* ---------- acciones por fila: solo iconos, sin romper ancho ---------- */
tbody td button,
tbody td .btn,
td .sp-delete-row-action-v552{
  flex:0 0 auto!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  width:27px!important;
  min-width:27px!important;
  max-width:27px!important;
  height:25px!important;
  min-height:25px!important;
  padding:0!important;
  margin:1px!important;
  font-size:0!important;
  vertical-align:middle!important;
}

tbody td button::before,
tbody td .btn::before,
td .sp-delete-row-action-v552::before{
  font-size:13px!important;
}

/* ---------- paginación siempre visible ---------- */
#sp559PagerBar{
  position:sticky!important;
  bottom:0!important;
  z-index:1100!important;
  display:flex!important;
  justify-content:space-between!important;
  align-items:center!important;
  flex-wrap:wrap!important;
  gap:8px!important;
  margin:8px 0 0!important;
  padding:8px!important;
  border:1px solid #354c60!important;
  border-radius:6px!important;
  background:#17212c!important;
  box-shadow:0 -6px 18px rgba(0,0,0,.20)!important;
}

.sp559-pager-left,
.sp559-pager-right{
  display:flex!important;
  align-items:center!important;
  flex-wrap:wrap!important;
  gap:6px!important;
}

#sp559PagerBar button,
#sp559PagerBar select{
  min-height:28px!important;
  height:28px!important;
  padding:4px 8px!important;
  font-size:12px!important;
}

#sp559PagerInfo{
  color:#aab7c4!important;
  font-size:12px!important;
}

/* Restaurar cualquier paginador original escondido */
.pager,
.pagination,
[class*="pager" i],
[class*="pagination" i]{
  display:flex!important;
  visibility:visible!important;
  opacity:1!important;
}

/* Si hay paginadores repetidos originales, que no se solapen */
.pager button,
.pagination button,
[class*="pager" i] button,
[class*="pagination" i] button{
  min-width:28px!important;
  width:auto!important;
  max-width:90px!important;
  font-size:11px!important;
}

/* ---------- tabla: deja espacio a barras ---------- */
.table-wrap,
.table-container,
.data-grid,
.grid{
  overflow:auto!important;
  max-height:calc(100vh - 230px)!important;
}

html.sp556-header-hidden .table-wrap,
html.sp556-filters-hidden .table-wrap,
html.sp556-metrics-hidden .table-wrap,
html.sp550-hide-header .table-wrap,
html.sp550-hide-filters .table-wrap,
html.sp550-hide-metrics .table-wrap{
  max-height:calc(100vh - 150px)!important;
}

/* ---------- menú lateral derecho no tapa acciones importantes ---------- */
#sp556MenuButton,
#sp554MenuButton{
  top:8px!important;
  right:8px!important;
  z-index:31020!important;
}

/* ---------- modo claro ---------- */
html[data-servpacs-theme='light'] #sp559StudyActionsBar,
html[data-servpacs-theme='light'] #sp559PagerBar{
  background:#ffffff!important;
  color:#263645!important;
  border-color:#c5d5df!important;
  box-shadow:0 6px 18px rgba(80,110,130,.16)!important;
}

html[data-servpacs-theme='light'] #sp559SelectedInfo{
  background:#f6f9fb!important;
  color:#526b80!important;
  border-color:#d6e2ea!important;
}

html[data-servpacs-theme='light'] #sp559PagerInfo{
  color:#526b80!important;
}

/* ---------- responsive ---------- */
@media(max-width:760px){
  #sp559StudyActionsBar,
  #sp559PagerBar{
    align-items:stretch!important;
  }

  .sp559-left-actions,
  .sp559-right-actions,
  .sp559-pager-left,
  .sp559-pager-right{
    width:100%!important;
    justify-content:flex-start!important;
  }

  .sp559-action-btn{
    flex:1 1 120px!important;
  }

  #sp559PagerBar button,
  #sp559PagerBar select{
    flex:1 1 auto!important;
  }
}
