/* Estilos aprimorados para o modal de logs */
.logs-modal {
    max-width: 90%;
    max-height: 90vh;
    width: 1100px;
    overflow-y: auto;
}

/* Controles para a tabela de logs */
.logs-controls {
    display: flex;
    justify-content: space-between;
    margin: 16px 0;
    flex-wrap: wrap;
    gap: 12px;
}

.logs-filter {
    display: flex;
    flex: 1;
    min-width: 250px;
    gap: 10px;
}

.logs-filter-input {
    flex: 1;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.logs-filter-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.25);
}

.logs-export {
    display: flex;
    justify-content: flex-end;
}

.logs-table-container {
    margin-top: 16px;
    border-radius: var(--radius-lg);
    overflow-x: auto; /* Permite rolagem horizontal */
    overflow-y: auto; /* Permite rolagem vertical se necessário */
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    box-shadow: var(--shadow-md);
    max-height: 60vh; /* Limita a altura para garantir que caiba na tela */
}

#logsTableBody tr {
    transition: all var(--transition-fast);
}

#logsTableBody tr:nth-child(odd) {
    background: rgba(255, 255, 255, 0.03);
}

#logsTableBody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.historico-table {
    width: 100%;
    min-width: 850px; /* Garante largura mínima para todas as colunas */
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed; /* Ajuda a controlar a largura das colunas */
}

.historico-table thead th {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    font-weight: 600;
    text-align: left;
    padding: 16px;
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap; /* Evita quebra de texto em cabeçalhos */
}

/* Definindo larguras específicas para cada coluna */
.historico-table th:nth-child(1) {
    width: 180px; /* Data/Hora */
}
.historico-table th:nth-child(2) {
    width: 100px; /* Placa */
}
.historico-table th:nth-child(3) {
    width: 150px; /* Motorista */
}
.historico-table th:nth-child(4) {
    width: 120px; /* Nota Fiscal */
}
.historico-table th:nth-child(5) {
    width: 180px; /* Tipo de Chamada */
}
.historico-table th:nth-child(6) {
    width: 220px; /* Usuário */
}

.historico-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis; /* Adiciona reticências caso o texto seja muito longo */
    white-space: nowrap; /* Evita quebra de linha */
}

/* Formatação específica para colunas */
.historico-table td:nth-child(1) { /* Data/Hora */
    font-weight: 500;
    color: var(--text-primary);
}

.historico-table td:nth-child(6) { /* Usuário */
    white-space: normal; /* Permite quebra de linha para informações do usuário */
    line-height: 1.4;
}

.historico-table td:nth-child(6) .user-email {
    font-style: italic;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.historico-table th:first-child,
.historico-table td:first-child {
    border-left: none;
}

/* Estilo para mensagem de status nos logs */
#logsStatus {
    padding: 10px 14px;
    margin: 12px 0;
    border-radius: var(--radius-md);
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    display: none;
}

#logsStatus:not(:empty) {
    display: block;
}

/* Estilização para botões no painel de logs */
#btnLogsAdmin {
    margin-left: 15px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

#btnLogsAdmin:hover {
    background: var(--bg-secondary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

#btnLogsAdmin i {
    font-size: 0.9rem;
    color: var(--primary-color);
}

/* Estilos para paginação dos logs */
.logs-paginacao {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 12px 16px;
    background: var(--bg-glass);
    backdrop-filter: blur(15px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
    gap: 12px;
}

.logs-paginacao-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    background: var(--bg-tertiary);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.logs-paginacao-botoes {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-logs-pagina {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    min-width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    backdrop-filter: blur(10px);
    padding: 0 12px;
}

.btn-logs-pagina:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-logs-pagina:hover:not(:disabled) {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-logs-pagina.ativo {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-color: transparent;
    box-shadow: var(--shadow-md);
}

/* Estilos para controle de tamanho da paginação */
.logs-paginacao-tamanho {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-tertiary);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.logs-paginacao-tamanho label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.logs-paginacao-tamanho select {
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
}

.logs-paginacao-tamanho select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.2);
}

/* Melhorias responsivas para logs */
@media (max-width: 768px) {
    .logs-modal {
        width: 95%;
        max-height: 80vh;
    }
    
    .historico-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .historico-table td, 
    .historico-table th {
        padding: 12px;
        font-size: 0.8rem;
    }
    
    .logs-paginacao {
        flex-direction: column;
    }
    
    .logs-paginacao-botoes {
        justify-content: center;
    }
}
