/** CSS inyectado con Tabla (DataGrid, barra roja, responsive). Placeholder del buscador: `tablaSearchStyles.js`. */
export const TABLA_GRID_INLINE_STYLES = `
  .anima-tabla__grid .MuiDataGrid-root {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--color-grey-400, #919191);
  }
  .anima-tabla__grid .MuiDataGrid-columnHeaders,
  .anima-tabla__grid .MuiDataGrid-columnHeaders .MuiDataGrid-columnHeader,
  .anima-tabla__grid .MuiDataGrid-main .MuiDataGrid-columnHeaders,
  .anima-tabla__grid .MuiDataGrid-main .MuiDataGrid-columnHeader,
  .anima-tabla__grid .anima-tabla__grid-header {
    background-color: var(--color-main-100, #D3DFE1) !important;
  }
  .anima-tabla__grid .MuiDataGrid-columnHeader {
    padding-left: var(--space-24, 24px) !important;
    padding-right: var(--space-16, 16px) !important;
  }
  .anima-tabla__grid .MuiDataGrid-columnHeader .MuiDataGrid-columnHeaderTitleContainer,
  .anima-tabla__grid .MuiDataGrid-columnHeaderTitle {
    font-family: var(--font-family-mono) !important;
    font-weight: 500 !important;
    font-style: normal !important;
    font-size: 14px !important;
    line-height: 21px !important;
    letter-spacing: 0.01em !important;
    color: var(--color-cyan-19) !important;
  }
  .anima-tabla__grid .MuiDataGrid-sortButton {
    opacity: 1 !important;
    visibility: visible !important;
    margin-left: 12px !important;
    background: none !important;
  }
  .anima-tabla__grid .MuiDataGrid-sortIcon {
    color: var(--color-cyan-19) !important;
    opacity: 1 !important;
  }
  .anima-tabla__grid .MuiDataGrid-cell {
    font-family: var(--font-family-sans) !important;
    font-weight: 400 !important;
    font-style: normal !important;
    font-size: 14px !important;
    line-height: 21px !important;
    letter-spacing: 0.01em !important;
    color: var(--color-cyan-19) !important;
    display: flex !important;
    align-items: center !important;
    padding-left: var(--space-24, 24px) !important;
    padding-right: var(--space-16, 16px) !important;
  }
  .anima-tabla__grid .MuiDataGrid-cell[data-field="administrador"] {
    font-family: var(--font-family-sans) !important;
    font-weight: 600 !important;
    font-style: normal !important;
    font-size: 16px !important;
    line-height: 24px !important;
    letter-spacing: 0 !important;
  }
  /* Quitar borde/outline de foco azul-gris al hacer clic (MUI DataGrid focus ring) */
  .anima-tabla__grid .MuiDataGrid-cell:focus,
  .anima-tabla__grid .MuiDataGrid-cell:focus-within,
  .anima-tabla__grid .MuiDataGrid-columnHeader:focus,
  .anima-tabla__grid .MuiDataGrid-columnHeader:focus-within {
    outline: none !important;
    outline-offset: 0 !important;
  }
  .anima-tabla__grid .MuiDataGrid-virtualScroller,
  .anima-tabla__grid .MuiDataGrid-scrollbar--vertical,
  .anima-tabla__grid .MuiDataGrid-main {
    scrollbar-width: none;
  }
  /* Ocultar scroll horizontal nativo del DataGrid (solo usamos el verde) */
  .anima-tabla__grid .MuiDataGrid-scrollbar--horizontal {
    display: none !important;
  }
  .anima-tabla__grid .MuiDataGrid-virtualScroller::-webkit-scrollbar,
  .anima-tabla__grid .MuiDataGrid-main::-webkit-scrollbar {
    display: none;
    height: 0;
  }
  .anima-tabla__grid .MuiDataGrid-virtualScroller::-webkit-scrollbar,
  .anima-tabla__grid .MuiDataGrid-scrollbar--vertical::-webkit-scrollbar,
  .anima-tabla__grid .MuiDataGrid-main::-webkit-scrollbar {
    display: none;
  }
  .anima-tabla__grid .MuiDataGrid-root {
    --DataGrid-scrollbarSize: 0px !important;
  }
  /* Filler junto al scroll vertical: en filas de datos lo colapsamos (scroll verde custom) */
  .anima-tabla__grid .MuiDataGrid-scrollbarFiller,
  .anima-tabla__grid .MuiDataGrid-scrollbarFiller--pinnedRight {
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    overflow: hidden;
    flex: 0 0 0 !important;
  }
  /* Cabeceras: mismo criterio que cuerpo (scroll vertical oculto); no duplicar flex con .MuiDataGrid-filler */
  .anima-tabla__grid .MuiDataGrid-columnHeaders .MuiDataGrid-scrollbarFiller,
  .anima-tabla__grid .MuiDataGrid-columnHeaders .MuiDataGrid-scrollbarFiller--pinnedRight {
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    flex: 0 0 0 !important;
    overflow: hidden !important;
  }
  /*
   * MUI X v8: la “columna” blanca y el scroll de más vienen de .MuiDataGrid-cellEmpty (flex:1), no de .cell--empty.
   * Sin ancho, el reparto lo hace la última columna con flex (p. ej. Acciones en ListaPersonas).
   */
  .anima-tabla__grid .MuiDataGrid-cellEmpty {
    flex: 0 0 0 !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    padding: 0 !important;
    border: none !important;
    overflow: hidden !important;
  }
  /* Filler del header (div tras las cabeceras): mismo problema que cellEmpty; no debe crecer en paralelo a columnas flex */
  .anima-tabla__grid .MuiDataGrid-columnHeaders .MuiDataGrid-filler {
    flex: 0 0 0 !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    overflow: hidden !important;
  }
  /* Fondo continuo en la fila de headers (flex) para evitar “baldosas” blancas al hacer scroll X */
  .anima-tabla__grid .MuiDataGrid-columnHeaders [role="row"] {
    background-color: var(--color-main-100, #d3dfe1) !important;
  }
  .anima-tabla__grid .MuiDataGrid-scrollbar--vertical {
    --size: 0px !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    overflow: hidden;
    flex: 0 0 0 !important;
  }
  .anima-tabla__grid .MuiDataGrid-scrollbar--vertical > div {
    width: 0 !important;
  }
  .anima-tabla__table-scroll-x {
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .anima-tabla__table-scroll-x::-webkit-scrollbar {
    display: none;
    height: 0;
  }
  /* Mobile: dos renglones a la izquierda (Registros, Página), botones a la derecha; tabla justo debajo con 1rem */
  @media (max-width: 768px) {
    .anima-tabla__container {
      flex: 0 0 auto !important;
      min-height: 0 !important;
    }
    .anima-tabla__container .anima-tabla__middle {
      flex: 0 0 auto !important;
      display: flex !important;
      flex-direction: column !important;
      gap: 0 !important;
      margin: 0 !important;
      padding: 0 !important;
    }
    .anima-tabla__middle-spacer {
      flex: 0 0 auto !important;
      order: 1 !important;
      min-height: 0 !important;
      height: 0 !important;
      max-height: 0 !important;
      overflow: hidden !important;
    }
    .anima-tabla__red-bar {
      order: 2 !important;
      display: grid !important;
      grid-template-columns: 1fr auto !important;
      grid-template-rows: auto auto !important;
      align-items: center !important;
      gap: 1rem 1rem !important;
      height: auto !important;
      min-height: 21px !important;
      padding-top: 1rem !important;
      padding-bottom: 0 !important;
      margin: 0 !important;
    }
    /* SM/MD: fila “n seleccionadas” + select; entre paginado y tabla */
    .anima-tabla__narrow-bulk-row {
      order: 3 !important;
      flex-shrink: 0 !important;
      width: 100% !important;
      box-sizing: border-box !important;
    }
    .anima-tabla__middle-content-wrap {
      flex: 0 0 auto !important;
      order: 6 !important;
      min-height: 0 !important;
      overflow: hidden !important;
    }
    .anima-tabla__middle-table-wrap {
      order: 4 !important;
      flex-shrink: 0 !important;
      margin: 0 !important;
      padding: 0 !important;
      margin-top: 0 !important;
    }
    .anima-tabla__middle-table-wrap--no-progress {
      margin-top: 0 !important;
    }
    /* Fila “n seleccionadas” + select: el margen negativo de la tabla tapaba esa fila */
    .anima-tabla__middle-table-wrap.anima-tabla__middle-table-wrap--after-narrow-bulk {
      margin-top: 0 !important;
    }
    .anima-tabla__table-progress-wrap {
      order: 5 !important;
      flex-shrink: 0 !important;
    }
    .anima-tabla__container .anima-tabla__content {
      padding-top: 0 !important;
      padding-bottom: 0 !important;
      min-height: 0 !important;
    }
    .anima-tabla__bottom-area {
      margin: 0 !important;
      padding: 0 !important;
      margin-top: 0 !important;
    }
    .anima-tabla__red-bar-registros {
      grid-column: 1 !important;
      grid-row: 1 !important;
      flex: 0 0 auto !important;
      padding-left: 8px !important;
    }
    .anima-tabla__red-bar-pagination {
      display: contents !important;
    }
    .anima-tabla__red-bar-pagina-text {
      grid-column: 1 !important;
      grid-row: 2 !important;
      padding-left: 8px !important;
    }
    .anima-tabla__red-bar-pagination-buttons {
      grid-column: 2 !important;
      grid-row: 1 / -1 !important;
      align-self: center !important;
      display: flex !important;
      align-items: center !important;
      gap: 1rem !important;
      padding-right: 0 !important;
    }
    .anima-tabla__red-bar-pagination button {
      width: 48px !important;
      height: 48px !important;
      min-width: 48px !important;
      min-height: 48px !important;
      display: flex !important;
      align-items: center !important;
      justify-content: center !important;
      flex-shrink: 0 !important;
      border: 1px solid var(--color-main-700, #38656D) !important;
      border-radius: 12px !important;
    }
  }
  /* SM/MD: la cabecera sticky del DataGrid no debe dibujarse encima de la fila de acciones en masa */
  @media (max-width: 1023px) {
    .anima-tabla__narrow-bulk-row {
      position: relative;
      z-index: 10;
    }
  }
  /* Rango intermedio problemático: mantener layout igual a ≥1150 */
  @media (min-width: 1069px) and (max-width: 1149px) {
    .anima-tabla__middle {
      display: flex !important;
      flex-direction: column !important;
      gap: 0 !important;
    }
    .anima-tabla__middle-spacer {
      display: block !important;
      order: 1 !important;
      flex: 0 0 24px !important;
      min-height: 24px !important;
      height: 24px !important;
      max-height: 24px !important;
      overflow: hidden !important;
    }
    .anima-tabla__red-bar {
      order: 2 !important;
      display: flex !important;
      flex-direction: row !important;
      flex-wrap: nowrap !important;
      align-items: stretch !important;
      height: 21px !important;
      min-height: 21px !important;
      margin: 0 !important;
      padding-top: 0 !important;
      padding-bottom: 0 !important;
      gap: 0 !important;
    }
    .anima-tabla__red-bar-registros {
      flex: 1 1 auto !important;
      min-width: 0 !important;
      padding-left: 8px !important;
      display: flex !important;
      align-items: center !important;
      overflow: hidden !important;
    }
    .anima-tabla__red-bar-pagination {
      width: auto !important;
      flex: 0 0 auto !important;
      display: flex !important;
      align-items: center !important;
      justify-content: flex-end !important;
      padding-right: 8px !important;
      gap: 8px !important;
    }
    .anima-tabla__middle-table-wrap {
      order: 3 !important;
      margin-top: 12px !important;
      padding-top: 0 !important;
    }
    .anima-tabla__table-progress-wrap {
      order: 4 !important;
      margin-top: 1rem !important;
    }
  }
  .anima-tabla__toolbar-btn--with-border {
    border: 1px solid var(--color-main-700, #38656D) !important;
  }
  .anima-tabla__toolbar-btn--with-border:active {
    background: var(--color-main-700, #38656D) !important;
  }
  .anima-tabla__toolbar-btn--with-border:active .anima-tabla__toolbar-btn-icon {
    color: var(--color-neutrals-white, #FFFFFF) !important;
  }
  .anima-tabla__toolbar-btn--selected,
  .anima-tabla__toolbar-btn--with-border.anima-tabla__toolbar-btn--selected {
    background: var(--color-main-700, #38656D) !important;
    border: 1px solid var(--color-main-700, #38656D) !important;
  }
  .anima-tabla__toolbar-btn--selected .anima-tabla__toolbar-btn-icon {
    color: var(--color-neutrals-white, #FFFFFF) !important;
  }
`;
