/* Estilos globais para DataGrid com suporte a temas */

/* Container para grids com tema */
.custom-datagrid-container {
    width: 100%;
}

/* Estilos personalizados para o DataGrid */
.custom-datagrid {
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    border-radius: 8px;
    overflow: visible; /* Changed from hidden to visible to allow ChildRowContent */
}

.custom-datagrid .mud-table-container {
    border-radius: 8px;
}

.custom-datagrid .mud-table-head-row {
    font-weight: 600;
    border-top: 3px solid transparent; /* Borda superior invisível por padrão */
    transition: border-color 0.2s ease; /* Transição suave */
}

/* Estilo para cabeçalho no tema claro */
.custom-datagrid .mud-table-head-row {
    background-color: #e9ecef;
}

/* Estilo para cabeçalho no tema escuro */
.custom-datagrid[data-theme="dark"] .mud-table-head-row {
    background-color: #1f2937;
}

/* Efeito hover no cabeçalho - borda superior amarela */
.custom-datagrid .mud-table-head-row:hover {
    border-top-color: #ffc107; /* Amarelo */
}

/* Texto do cabeçalho no tema claro */
.custom-datagrid .mud-table-head-cell {
    color: rgba(0,0,0, 0.87); /* Texto escuro no tema claro */
}

/* Texto do cabeçalho no tema escuro */
.custom-datagrid[data-theme="dark"] .mud-table-head-cell {
    color: rgba(255,255,255, 0.87); /* Texto claro no tema escuro */
}

/* Hover no texto do cabeçalho - amarelo no tema claro, azul no tema escuro */
.custom-datagrid .mud-table-head-row:hover .mud-table-head-cell {
    color: #ffc107 !important; /* Amarelo no tema claro */
}

.custom-datagrid[data-theme="dark"] .mud-table-head-row:hover .mud-table-head-cell {
    color: #1976d2 !important; /* Azul escuro no tema escuro */
}

/* Reduzir a altura das células */
.custom-datagrid .mud-table-cell {
    padding: 4px 8px !important;
    height: 36px !important;
    font-size: 0.875rem !important;
}

/* EXCEPTION: Allow ChildRowContent cells (colspan in tbody only) to have auto height */
.custom-datagrid .mud-table-body .mud-table-cell[colspan],
.custom-datagrid .mud-table-body td[colspan],
.custom-datagrid tbody td[colspan] {
    height: auto !important;
    min-height: 50px !important;
    padding: 8px !important;
    overflow: visible !important;
}

.custom-datagrid .mud-table-head-cell {
    padding: 8px 8px !important;
    height: 40px !important;
    font-size: 0.875rem !important;
}

/* Estilo para células que não quebram linha */
.custom-datagrid .no-wrap-cell {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* Linhas com efeito hover mais suave - tema claro */
.custom-datagrid .mud-table-row:hover {
    background-color: #e3f2fd !important;
}

/* Linhas com efeito hover mais suave - tema escuro */
.custom-datagrid[data-theme="dark"] .mud-table-row:hover {
    background-color: #1e3a8a !important; /* Azul escuro para tema escuro */
}

.custom-datagrid tbody .mud-table-row:hover .mud-table-cell {
    color: #000 !important; /* Texto preto no hover para melhor contraste */
}

.custom-datagrid[data-theme="dark"] tbody .mud-table-row:hover .mud-table-cell {
    color: #ffffff !important; /* Texto branco no hover para tema escuro */
}

/* Linhas alternadas com cor mais suave - tema claro */
.custom-datagrid .mud-table-row:nth-child(even) {
    background-color: #f1f3f4;
}

/* Linhas alternadas com cor mais suave - tema escuro */
.custom-datagrid[data-theme="dark"] .mud-table-row:nth-child(even) {
    background-color: #1f2937;
}

/* Borda inferior mais sutil - tema claro */
.custom-datagrid .mud-table-cell {
    border-bottom: 1px solid #f0f0f0;
}

/* Borda inferior mais sutil - tema escuro */
.custom-datagrid[data-theme="dark"] .mud-table-cell {
    border-bottom: 1px solid #374151;
}

/* Estilo para o modo compacto */
.compact-grid .mud-table-cell {
    padding: 2px 6px !important;
    height: 30px !important;
    font-size: 0.8125rem !important;
}

.compact-grid .mud-table-head-cell {
    padding: 6px 6px !important;
    height: 32px !important;
    font-size: 0.8125rem !important;
}

/* Ajuste para o pager */
.custom-datagrid .mud-table-pagination {
    padding: 8px 16px !important;
}

/* Pager no tema escuro */
.custom-datagrid[data-theme="dark"] .mud-table-pagination {
    background-color: #1f2937;
}

/* Classes utilitárias para alinhamento */
.text-end {
    text-align: end;
}

.text-center {
    text-align: center;
}

/* Estilos adicionais para a view de consulta */

/* Cor da fonte da linha selecionada */
.mud-table-row.selected > .mud-table-cell {
    color: white !important;
}

/* Altura compacta para todas as linhas do grid */
.compact-datagrid .mud-table-cell {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    height: 20px !important; 
}

/* Estilos para campos de filtro compactos */
.compact-form {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

.compact-form .mud-input-control {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
    min-height: 36px !important;
}

.compact-form .mud-input-label {
    transform: scale(0.85) translateY(-1px) !important;
    font-size: 0.75rem !important;
}

.compact-form .mud-input-label-shrink {
    transform: scale(0.85) translateY(-8px) !important;
}

.compact-form .mud-input {
    min-height: 32px !important;
    font-size: 0.8rem !important;
    padding-top: 2px !important;
    padding-bottom: 2px !important;
}

.compact-form .mud-input-outlined {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.compact-button {
    min-height: 32px !important;
    padding: 0 6px !important;
    font-size: 0.8rem !important;
}

.compact-button .mud-button-label {
    padding: 0 4px !important;
}

.compact-button .mud-icon-button {
    padding: 4px !important;
    width: 32px !important;
    height: 32px !important;
}

/* Efeito de hover para as linhas do grid - Tema claro */
.custom-datagrid .mud-table-row:hover:not(.selected) {
    background-color: rgba(0, 0, 0, 0.04) !important;
    transition: background-color 0.2s ease;
}

/* Efeito de hover para as linhas do grid - Tema escuro */
.mud-theme-dark .custom-datagrid .mud-table-row:hover:not(.selected) {
    background-color: rgba(255, 255, 255, 0.04) !important;
    transition: background-color 0.2s ease;
}

/* Efeito de hover para a linha selecionada - Tema claro */
.custom-datagrid .mud-table-row.selected:hover {
    background-color: rgba(33, 150, 243, 0.8) !important; /* Azul primário com opacidade */
    transition: background-color 0.2s ease;
}

/* Efeito de hover para a linha selecionada - Tema escuro */
.mud-theme-dark .custom-datagrid .mud-table-row.selected:hover {
    background-color: rgba(33, 150, 243, 0.8) !important; /* Azul primário com opacidade */
    transition: background-color 0.2s ease;
}

/* Estilos para o ícone de status */
.status-icon {
    font-size: 1.2rem !important;
}

/* Estilos para células que não quebram linha */
.no-wrap-cell {
    white-space: nowrap !important;
}

/* Estilos para o cursor pointer nas linhas */
.cursor-pointer {
    cursor: pointer !important;
}

/* ===== HIERARCHY COLUMN - EXPAND BUTTON STYLING ===== */
/* Make the hierarchy expand button more visible */
.custom-datagrid .mud-table-body .mud-table-cell:first-child .mud-icon-button {
    color: #537699 !important;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%) !important;
    border: 1px solid #86a2b9 !important;
    border-radius: 4px !important;
    width: 20px !important;
    height: 20px !important;
    margin: 0 2px !important;
    transition: all 0.2s ease !important;
}

.custom-datagrid .mud-table-body .mud-table-cell:first-child .mud-icon-button:hover {
    background: linear-gradient(135deg, #a5bdd0 0%, #87a5bd 100%) !important;
    color: #394557 !important;
    transform: scale(1.1) !important;
    box-shadow: 0 2px 4px rgba(80, 117, 153, 0.3) !important;
}

.custom-datagrid .mud-table-body .mud-table-cell:first-child .mud-icon-button .mud-icon-root {
    font-size: 16px !important;
}

/* Dark theme hierarchy button - Subtle colors that blend with background */
[data-theme="dark"] .custom-datagrid .mud-table-body .mud-table-cell:first-child .mud-icon-button {
    color: #8899aa !important;
    background: linear-gradient(135deg, #2a3441 0%, #1f2832 100%) !important;
    border: 1px solid #3d4a57 !important;
}

[data-theme="dark"] .custom-datagrid .mud-table-body .mud-table-cell:first-child .mud-icon-button:hover {
    background: linear-gradient(135deg, #374553 0%, #2a3744 100%) !important;
    color: #b0c4d8 !important;
    border-color: #4d5a67 !important;
}