import { SxProps, Theme } from '@mui/material/styles';

/**
 * Estilos compartilhados para DataGridPremium utilizado em tabelas de pedidos.
 * Garante consistência visual entre OrderItemsTable, InformationPanel, etc.
 */
export const dataGridStyles: SxProps<Theme> = {
  border: '1px solid',
  borderColor: 'divider',
  fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif',
  backgroundColor: 'background.paper',

  '& .MuiDataGrid-root': {
    fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif',
    border: 'none',
  },

  '& .MuiDataGrid-columnHeaders': {
    backgroundColor: 'grey.50',
    fontWeight: 600,
    fontSize: '0.75rem',
    borderBottom: '2px solid',
    borderColor: 'divider',
    fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif',
    minHeight: '40px !important',
    maxHeight: '40px !important',
  },

  '& .MuiDataGrid-columnHeader': {
    borderRight: '1px solid',
    borderColor: 'divider',
    paddingLeft: '12px',
    paddingRight: '12px',
    '&:focus': { outline: 'none' },
    '&:focus-within': { outline: 'none' },
    '&:last-of-type': { borderRight: 'none' },
  },

  '& .MuiDataGrid-row': {
    borderBottom: '1px solid',
    borderColor: 'divider',
    backgroundColor: 'background.paper',
    minHeight: '36px !important',
    maxHeight: '36px !important',
    '&:hover': { backgroundColor: 'action.hover' },
    '&:last-child': { borderBottom: 'none' },
  },

  '& .MuiDataGrid-row:nth-of-type(even)': {
    backgroundColor: 'grey.50',
    '&:hover': { backgroundColor: 'action.hover' },
  },

  '& .MuiDataGrid-cell': {
    borderRight: '1px solid',
    borderColor: 'divider',
    borderBottom: 'none',
    paddingLeft: '12px',
    paddingRight: '12px',
    fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif',
    fontSize: '0.75rem',
    lineHeight: 1.2,
    '&:focus': { outline: 'none' },
    '&:focus-within': { outline: 'none' },
    '&:last-of-type': { borderRight: 'none' },
  },

  '& .MuiDataGrid-footerContainer': {
    borderTop: '2px solid',
    borderColor: 'divider',
    fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif',
    minHeight: '48px !important',
    fontSize: '0.75rem',
    backgroundColor: 'grey.50',
  },
};

/**
 * Versão simplificada sem zebra-striping (para tabelas de linha única).
 */
export const dataGridStylesSimple: SxProps<Theme> = {
  ...dataGridStyles,
  '& .MuiDataGrid-row': {
    borderBottom: 'none',
    backgroundColor: 'background.paper',
    minHeight: '36px !important',
    maxHeight: '36px !important',
    '&:hover': { backgroundColor: 'action.hover' },
  },
  '& .MuiDataGrid-row:nth-of-type(even)': {
    backgroundColor: 'background.paper',
  },
};
