/* Paleta Advena - override Bootstrap primary */
:root {
    --bs-primary: #b51537;
    --bs-primary-rgb: 181, 21, 55;
    --bs-primary-dark: #9a1230;
    --bs-primary-light: #fde8e9;
}

/* Garantir que botões e elementos primários usem a cor Advena */
.btn-primary,
.bg-primary {
    background-color: #b51537 !important;
    border-color: #b51537 !important;
}
.btn-primary:hover {
    background-color: #9a1230 !important;
    border-color: #9a1230 !important;
}
.text-primary {
    color: #b51537 !important;
}
.border-primary {
    border-color: #b51537 !important;
}
.form-control:focus,
.form-select:focus {
    border-color: rgba(181, 21, 55, 0.5);
    box-shadow: 0 0 0 0.2rem rgba(181, 21, 55, 0.25);
}

/* Reset básico */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.5;
}

/* Estilos do Header */
header {
    background-color: #333;
    padding: 1rem;
}

nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 2rem;
}

nav a {
    color: white;
    text-decoration: none;
}

/* Estilos do Main */
main {
    padding: 2rem;
}

/* Estilos do Footer */
footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 1rem;
    position: fixed;
    bottom: 0;
    width: 100%;
} 

.form-label {
    font-weight: bold;
    font-size: 0.6rem;
}

.form-check-label {
    font-weight: bold;
    font-size: 0.6rem;
}
.card {
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.card-header {
    background-color: #f8f9fa;
    font-weight: bold;
    text-transform: uppercase;
}

input[readonly] {
    background-color: #e9ecef;
}

/* Ajustes para layout compacto */
.container-fluid {
    /* padding: 0.5rem; */
}

.card {
    margin-bottom: 0.5rem;
}

.card-header {
    padding: 0.5rem;
    font-size: 0.7rem;
    text-transform: uppercase;
}

.card-body {
    padding: 1.5rem;
}

/* Alinha o bloco Verbas Seguráveis com o bloco Dados do Embarque (coluna esquerda) */
[data-block="dados-verbas"] {
    margin-top: 1.1rem;
}

.form-control-sm, .form-select-sm .form-control {
    padding: 0.25rem 0.5rem;
    height: calc(1.5em + 0.5rem + 2px);
    font-size: 0.8rem;
}

.form-label {
    margin-bottom: 0.1rem;
    font-size: 0.8rem;
}
.form-control {
    font-size: 0.8rem;
}

.input-maiuscula {
    text-transform: uppercase;
}
.form-control, form-select, .form-control-sm :focus{
    background-color: #f8f9fa;
}

.form-select {
    font-size: 0.8rem;
}

.row.g-1 {
    --bs-gutter-x: 0.5rem;
    --bs-gutter-y: 0.5rem;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Alinhamento à direita para campos de valor */
.valor {
    text-align: right !important;
}
.mb-1 {
    font-size: 0.8rem !important;
}
.mb-2 {
    font-size: 0.6rem !important;
}
.mb-3 {
    font-size: 0.6rem !important;
}

/* Estilos para o autocomplete */
.autocomplete-items {
    position: absolute;
    border: 1px solid #d4d4d4;
    border-top: none;
    z-index: 99;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 150px;
    overflow-y: auto;
    background-color: #fff;
}

.autocomplete-items div {
    padding: 8px 10px;
    cursor: pointer;
    background-color: #fff;
    border-bottom: 1px solid #d4d4d4;
    font-size: 0.6rem;
}

.autocomplete-items div:hover {
    background-color: #e9e9e9;
}

.autocomplete-active {
    background-color: #e9e9e9 !important;
}

.disabled-block {
    position: relative;
}

.disabled-block fieldset {
    opacity: 0.7;
}

.disabled-block::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(248, 249, 250, 0.5);
    z-index: 1;
    pointer-events: none;
}

/* Remove a borda padrão do fieldset */
fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

.is-invalid {
    border-color: #dc3545 !important;
}

/* Estilos para a tabela */
.table-responsive {
    max-height: 60vh; /* Ajuste conforme necessário */
    overflow-y: auto; /* Permite rolagem apenas na tabela */
}

.table thead {
    position: sticky; /* Faz o cabeçalho ficar fixo */
    top: -30px; /* Fixa o cabeçalho no topo */
    background-color: white; /* Define a cor de fundo do cabeçalho */
    z-index: 10; /* Garante que o cabeçalho fique acima do conteúdo */
}

.required:after {
    content: " *";
    color: red;
}

/* Estilos para o alerta de valor excedido */
.alerta-valor-excedido {
    color: #fff;
    background-color: #dc3545;
    border: 1px solid #c82333;
    padding: 0.75rem 1.25rem;
    margin: 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    font-size: 1rem;
    font-weight: bold;
    text-align: center;
    display: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    animation: piscar 1.5s infinite alternate;
}

@keyframes piscar {
    from { background-color: #dc3545; }
    to { background-color: #bd2130; }
}

.fechar-alerta {
    color: #fff;
    float: right;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    text-shadow: 0 1px 0 #000;
    opacity: 0.8;
    cursor: pointer;
    margin-left: 15px;
}

.fechar-alerta:hover {
    color: #fff;
    opacity: 1;
}

/* Estilos para o badge de administrador */
#userAdmin {
    font-size: 0.7rem;
    vertical-align: text-top;
    padding: 0.25em 0.4em;
    border-radius: 4px;
}

#userAdmin i {
    font-size: 0.65rem;
}

/* Tooltip personalizado - cursor pointer para links/botões com title */
[title]:hover {
    position: relative;
    cursor: pointer;
}

[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%);
    padding: 5px 10px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
}

/* Estilos para as informações do usuário no menu */
#userInfo {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

#userName, #userCorretora {
    font-weight: 500;
}

@media (max-width: 992px) {
    #userInfo {
        margin-bottom: 10px;
        max-width: 100%;
    }
    
    .navbar .ms-auto {
        margin-top: 10px;
        flex-direction: column;
        align-items: flex-start !important;
    }
    
    #btnLogout {
        align-self: flex-start;
    }
}

/* Identificação do veículo (averbação): lista do autocomplete abaixo do input, colada ao campo (sem input-group). */
.veic-transp-wrap .veic-transp-anchor {
    min-width: 0;
}
.veic-transp-wrap .veic-transp-input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
.veic-transp-wrap .veic-transp-btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    margin-left: -1px;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    z-index: 2;
}
/* Garante dropdown logo abaixo do input (âncora é só o wrapper do campo, não a linha inteira com o botão). */
.veic-transp-wrap .veic-transp-anchor .autocomplete-menu.show {
    top: 100% !important;
    left: 0 !important;
    margin-top: 2px;
}

/* Bootstrap5-autocomplete: largura igual ao input e fonte menor na lista */
.autocomplete-menu {
    width: 100% !important;
    min-width: unset !important;
    max-width: none !important;
    font-size: 0.75rem !important;
}
.autocomplete-menu .dropdown-item {
    font-size: 0.75rem !important;
    padding: 0.25rem 0.5rem !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Estilos para os autocomplete (legado - mantido para compatibilidade) */
.autocomplete-items {
    position: absolute;
    border: 1px solid #ddd;
    border-top: none;
    z-index: 99;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background-color: #fff;
    display: none;
}

.autocomplete-item {
    padding: 10px;
    cursor: pointer;
    background-color: #fff;
    border-bottom: 1px solid #ddd;
}

.autocomplete-item:hover {
    background-color: #e9e9e9;
}

.autocomplete-active {
    background-color: #007bff !important;
    color: #fff;
}

/* Estilos gerais */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100px;
}

/* Alerta para valor excedido */
.alert-valor-excedido {
    background-color: #fff3cd;
    border: 1px solid #ffecb5;
    border-left: 4px solid #ffc107;
    padding: 10px 15px;
    margin-top: 10px;
    border-radius: 4px;
    font-size: 14px;
    color: #856404;
}

.alert-valor-excedido i {
    margin-right: 8px;
    color: #856404;
}

.alert-valor-excedido strong {
    font-weight: 600;
}

/* Estilo para os diferentes tipos de perfil na lista de usuários */
.perfil-admin {
    color: #fff;
    background-color: #dc3545;
    padding: 0.2em 0.6em;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.perfil-padrao {
    color: #fff;
    background-color: #6c757d;
    padding: 0.2em 0.6em;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.perfil-outro {
    color: #fff;
    background-color: #17a2b8;
    padding: 0.2em 0.6em;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Relatório de averbações: scroll horizontal + cabeçalho e 1ª coluna fixos (fundos opacos — sem “vazamento”) */
.table-responsive-relatorio-averbacoes {
    max-height: min(78vh, 800px);
    overflow: auto;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    isolation: isolate;
}

.table-relatorio-averbacoes {
    table-layout: auto;
    min-width: 3000px;
    font-size: 0.875rem;
    margin-bottom: 0;
    --relatorio-grid: #d9dde2;
    border-collapse: collapse;
}

/*
 * Larguras por coluna (<colgroup>): em table-layout:auto funcionam como largura alvo / mínimo,
 * evitando colunas espremidas (ex.: Moeda) e bloco de valores com proporção estável.
 */
.table-relatorio-averbacoes col.relatorio-col-apolice { width: 6.5rem; min-width: 6.5rem; }
.table-relatorio-averbacoes col.relatorio-col-tipo-apolice { width: 9rem; min-width: 9rem; }
.table-relatorio-averbacoes col.relatorio-col-segurado { width: 16rem; min-width: 14rem; }
.table-relatorio-averbacoes col.relatorio-col-beneficiario { width: 16rem; min-width: 14rem; }
.table-relatorio-averbacoes col.relatorio-col-cnpj { width: 11rem; min-width: 11rem; }
.table-relatorio-averbacoes col.relatorio-col-origem { width: 9rem; min-width: 9rem; }
.table-relatorio-averbacoes col.relatorio-col-porto-origem { width: 8rem; min-width: 8rem; }
.table-relatorio-averbacoes col.relatorio-col-porto-destino { width: 14rem; min-width: 14rem; }
.table-relatorio-averbacoes col.relatorio-col-uf { width: 2.75rem; min-width: 2.75rem; }
.table-relatorio-averbacoes col.relatorio-col-data-cadastro { width: 5.5rem; min-width: 5.5rem; }
.table-relatorio-averbacoes col.relatorio-col-veic { width: 17rem; min-width: 17rem; }
.table-relatorio-averbacoes col.relatorio-col-meio { width: 8rem; min-width: 8rem; }
.table-relatorio-averbacoes col.relatorio-col-obs { width: 16rem; min-width: 16rem; }
.table-relatorio-averbacoes col.relatorio-col-moeda { width: 6rem; min-width: 6rem; }
.table-relatorio-averbacoes col.relatorio-col-taxa { width: 5.75rem; min-width: 5.75rem; }
.table-relatorio-averbacoes col.relatorio-col-valor { width: 6.75rem; min-width: 6.75rem; }
.table-relatorio-averbacoes col.relatorio-col-acima-limite { width: 6.5rem; min-width: 6.5rem; }

.table-relatorio-averbacoes > thead > tr > th,
.table-relatorio-averbacoes > tbody > tr > td,
.table-relatorio-averbacoes > tfoot > tr > td {
    border: 1px solid var(--relatorio-grid);
}

.table-relatorio-averbacoes thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
    vertical-align: middle;
    white-space: nowrap;
    background-color: #e9ecef;
    background-clip: padding-box;
}

.table-relatorio-averbacoes thead th:first-child,
.table-relatorio-averbacoes tbody td:first-child {
    position: sticky;
    left: 0;
    z-index: 3;
    box-shadow: 2px 0 6px rgba(0, 0, 0, 0.06);
}

.table-relatorio-averbacoes thead th:first-child {
    z-index: 6;
    background-color: #dee2e6;
    background-clip: padding-box;
}

.table-relatorio-averbacoes tbody td:first-child {
    background-color: #ffffff;
    background-clip: padding-box;
}

.table-relatorio-averbacoes tbody td {
    font-size: 0.75rem;
    background-color: #ffffff;
}

.table-relatorio-averbacoes th,
.table-relatorio-averbacoes td {
    vertical-align: top;
}

.relatorio-cell-text {
    word-break: normal;
    overflow-wrap: break-word;
}

.table-relatorio-averbacoes th:nth-child(2),
.table-relatorio-averbacoes td:nth-child(2),
.table-relatorio-averbacoes th:nth-child(3),
.table-relatorio-averbacoes td:nth-child(3),
.table-relatorio-averbacoes th:nth-child(4),
.table-relatorio-averbacoes td:nth-child(4) {
    white-space: nowrap;
}

.table-relatorio-averbacoes th:nth-child(5),
.table-relatorio-averbacoes td:nth-child(5) {
    white-space: nowrap;
}

/* Moeda: largura garantida pelo <col> + alinhamento compacto para código (BRL, USD…) */
.table-relatorio-averbacoes th:nth-child(14),
.table-relatorio-averbacoes td:nth-child(14) {
    white-space: nowrap;
    text-align: center;
    vertical-align: middle;
}

.relatorio-cell-obs {
    max-width: 18rem;
    overflow-wrap: break-word;
    word-break: break-word;
}

.table-relatorio-averbacoes thead th:nth-child(n + 15):nth-child(-n + 22),
.table-relatorio-averbacoes thead th:nth-child(23) {
    white-space: nowrap;
}

/* Valores numéricos: coluna com largura fixa + fonte tabular alinha dígitos entre linhas */
.table-relatorio-averbacoes td.relatorio-cell-num,
.table-relatorio-averbacoes td.relatorio-cell-taxa,
.table-relatorio-averbacoes tfoot td.text-end {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
    padding-left: 0.35rem;
    padding-right: 0.35rem;
}

.table-relatorio-averbacoes td.relatorio-cell-taxa,
.table-relatorio-averbacoes td.relatorio-cell-num {
    font-size: 0.8125rem;
}

.table-relatorio-averbacoes td.relatorio-cell-acima-limite {
    min-width: 5.5rem;
    font-weight: 600;
    color: var(--bs-danger);
}

.relatorio-resultado-wrapper {
    min-height: 10rem;
}

.relatorio-loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 12;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(2px);
    pointer-events: all;
}

.relatorio-loading-overlay.d-flex {
    display: flex !important;
}