@import url("propostas.css");

/* ===================================================
   RESET & CONTAINER PRINCIPAL - USUÁRIOS CONSULTA
=================================================== */
.page {
    min-height: 100vh;
    padding: 20px 16px 40px !important;
    background-color: #f4f6f8;
    display: flex;
    justify-content: center;
}

.container-central {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding-top: 4vh;
}

.page-title {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===================================================
   FORMULÁRIO DE FILTROS / BUSCA
=================================================== */
.card-clean {
    background: #ffffff;
    border-radius: 4px;
    padding: 3px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

.form-busca form {
    display: flex;
    flex-direction: column;
}

.search-columns-container {
    display: grid;
    grid-template-columns: 1.15fr 1fr auto;
    gap: 0px 15px !important;
    width: 100%;
    align-items: start;
}

.col-search {
    display: flex;
    flex-direction: column;
    gap: 0px;
}

.col-search.col-lookup {
    min-width: 0;
}

.col-search.col-other {
    min-width: 0;
}

/* Linha de campo horizontal */
.form-row {
    display: flex;
    align-items: center;
    min-height: 22px;
    margin-bottom: 0px;
}

/* Labels Padronizados */
.field-label {
    width: 135px;
    font-size: 12px;
    font-weight: bold;
    color: #000080;
    text-align: right;
    margin-right: 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Inputs e Selects do formulário de busca */
.form-busca .form-row input[type="text"],
.form-busca .form-row select {
    height: 21px !important;
    padding: 0 4px !important;
    font-size: 12px !important;
    border: 1px solid #cbd5e1;
    border-radius: 2px;
    background-color: #fff;
    color: #334155;
    box-sizing: border-box;
    width: 100%;
    outline: none;
}

.form-busca .form-row input[type="text"]:focus,
.form-busca .form-row select:focus {
    border-color: #3b82f6;
}

/* Grupos de Busca Lookup */
.form-busca .input-group-search {
    display: flex !important;
    align-items: center;
    height: 21px !important;
    border: 1px solid #cbd5e1;
    border-radius: 2px;
    background-color: #fff;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.form-busca .input-group-search input.lookup-code {
    width: 50px !important;
    min-width: 50px !important;
    max-width: 50px !important;
    height: 19px !important;
    padding: 0 2px !important;
    font-size: 12px !important;
    border: none !important;
    border-right: 1px solid #cbd5e1 !important;
    border-radius: 0 !important;
    text-align: center;
    background-color: #fff !important;
    box-shadow: none !important;
    outline: none;
    flex-shrink: 0;
}

.form-busca .input-group-search .btn-search-field {
    width: 22px !important;
    min-width: 22px !important;
    height: 19px !important;
    padding: 0 !important;
    background-color: #f1f5f9;
    border: none !important;
    border-right: 1px solid #cbd5e1 !important;
    border-radius: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #475569;
    font-size: 11px;
    flex-shrink: 0;
}

.form-busca .input-group-search .btn-search-field:hover {
    background-color: #e2e8f0;
    color: #1e293b;
}

.form-busca .input-group-search input.lookup-desc {
    flex-grow: 1;
    height: 19px !important;
    padding: 0 4px !important;
    font-size: 12px !important;
    border: none !important;
    background-color: #f8fafc !important;
    color: #475569;
    box-shadow: none !important;
    outline: none;
    cursor: default;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===================================================
   COLUNA DE BOTÕES DE BUSCA (SUPERIOR DIREITA)
=================================================== */
.col-buttons {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 0px;
    width: 90px;
    justify-content: flex-start;
    align-items: center;
}

.col-buttons .buttons-stack-column {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    width: 100%;
}

.col-buttons .buttons-stack-column .btn-novo,
.col-buttons .buttons-stack-column .btn-fechar,
.col-buttons .buttons-stack-column .btn-exibir {
    height: 28px !important;
    font-size: 13px !important;
    padding: 0 10px !important;
    width: 100% !important;
    min-width: 0 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    box-sizing: border-box;
}

.btn-novo {
    background: #3b82f6;
    color: #fff;
}
.btn-novo:hover:not(:disabled) {
    background: #2563eb;
}

.btn-fechar {
    background: #334155;
    color: #fff;
}
.btn-fechar:hover {
    opacity: 0.9;
    color: #fff;
}

.btn-exibir {
    background: #0db523;
    color: #fff;
}
.btn-exibir:hover:not(:disabled) {
    background: #3bbd4c;
}

.btn-fechar.disabled {
    opacity: 0.5 !important;
    pointer-events: none !important;
    cursor: not-allowed !important;
}

/* ===================================================
   RESULTADOS: HEADER, ORDENAÇÃO E PAGINAÇÃO
=================================================== */
.resultado-card {
    background: #ffffff;
    border-radius: 4px;
    padding: 3px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    color: #000;
    margin-top: 3px;
}

.resultado-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 2px 4px;
    gap: 15px;
    background-color: #f8fafc;
    border: 1px solid #cbd5e1;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    min-height: 28px;
    box-sizing: border-box;
}

.pag-info {
    font-size: 13px;
    color: #800000;
    font-weight: bold;
    margin-right: auto;
    padding-left: 4px;
}

/* ===================================================
   TABELA, SELEÇÃO DE LINHA E CÉLULA FOCADA
=================================================== */
.tabela-com-acoes {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    width: 100%;
}

.tabela-wrapper {
    flex-grow: 1;
    overflow: auto;
    max-height: 68vh;
    min-width: 0;
}

.tabela-clean {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.tabela-clean th,
.tabela-clean td {
    border: 1px solid #cbd5e1;
}

.tabela-clean thead th {
    position: sticky;
    top: 0;
    z-index: 9;
    background: #f0f0f0;
    color: #475569;
    padding: 12px 8px;
    font-size: 13px;
    font-weight: 600;
    border-bottom: 2px solid #cbd5e1;
    text-align: left;
    white-space: nowrap;
}

.tabela-clean tbody tr {
    border-bottom: 1px solid #cbd5e1;
    cursor: pointer;
    transition: background 0.2s;
}

/* Hover da Linha */
.tabela-clean tbody tr:not(.structural-empty-row):hover td {
    background-color: #f1f5f9 !important;
}

/* Linha Selecionada (Fundo Cinza-Azulado) */
.tabela-clean tbody tr:not(.structural-empty-row).selected td {
    background-color: #cbd5e1 !important;
}

/* Células Padrão (Fundo Amarelo Claro Legado) */
.tabela-clean tbody td {
    padding: 10px 8px;
    font-size: 13px;
    color: #334155;
    white-space: nowrap;
    background-color: #ffffe1;
}

/* Célula Focada por Teclado/Mouse (Destaque Azul sem perder a linha selecionada) */
.tabela-clean tbody td.celula-focada {
    outline: 2px solid #2563eb !important;
    outline-offset: -2px !important;
    background-color: #93c5fd !important;
    color: #000000 !important;
}

/* Linhas Estruturais Vazias */
.structural-empty-row {
    height: 28px;
}

.structural-empty-row td {
    padding: 0 8px !important;
    background-color: #ffffe1;
    cursor: default;
}

/* ===================================================
   BARRA DE AÇÕES LATERAL (COLUNA ÚNICA)
=================================================== */
.acoes-lateral {
    flex-shrink: 0;
    padding-top: 10px;
    width: 160px;
}

.acoes-lateral .buttons-stack-column {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    justify-content: flex-start !important;
    width: 100% !important;
}

.acoes-lateral .buttons-stack-column .btn-pag {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #475569;
    padding: 0 !important;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    text-align: left;
    white-space: nowrap;
    width: 100% !important;
    min-width: 0 !important;
    height: 24px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: flex-start !important;
    gap: 6px;
    text-decoration: none;
    box-sizing: border-box;
}

.acoes-lateral .buttons-stack-column .btn-pag i {
    width: 14px;
    text-align: center;
    flex-shrink: 0;
}

.acoes-lateral .buttons-stack-column .btn-pag:hover:not(:disabled) {
    background: #e2e8f0;
    color: #1e293b;
}

.acoes-lateral .buttons-stack-column .btn-pag:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===================================================
   MODAL DE LOOKUP
=================================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 25px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.modal-header h2 {
    font-size: 16px;
    color: #1e293b;
    font-weight: 700;
}

.lookup-header-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-lookup-action {
    height: 32px !important;
    width: 32px !important;
    padding: 0 !important;
    font-size: 12px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    border: none;
}

.btn-lookup-action i {
    font-size: 12px;
}

.close-modal {
    font-size: 24px;
    font-weight: bold;
    color: #64748b;
    line-height: 1;
    cursor: pointer;
    margin-left: 10px;
}

.close-modal:hover {
    color: #1e293b;
}

.lookup-results-container {
    max-height: 300px;
    overflow-y: auto;
}

.tabela-lookup {
    width: 100%;
    border-collapse: collapse;
}

.tabela-lookup th,
.tabela-lookup td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    font-size: 13px;
}

.tabela-lookup tr {
    cursor: pointer;
}

.tabela-lookup tr:hover {
    background-color: #f1f5f9;
}

.tabela-lookup tr.selected {
    background-color: #cbd5e1;
    color: #1e293b;
}

.lookup-status-message {
    text-align: center;
    padding: 10px;
    color: #64748b;
}

.lookup-status-error {
    color: #dc2626 !important;
}

.lookup-search-container {
    margin-bottom: 15px;
    width: 100%;
    display: flex;
    gap: 8px;
    align-items: center;
}

.lookup-search-input {
    flex-grow: 1;
    box-sizing: border-box;
    padding: 10px 12px;
    border-radius: 4px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #334155;
    font-size: 14px;
    outline: none;
    height: 40px;
}

.lookup-search-input:focus {
    border-color: #3b82f6;
    background: #fff;
}

.btn-exibir-lookup {
    height: 40px;
    background: #0db523;
    color: #fff;
    font-weight: 600;
    padding: 0 15px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}

.btn-exibir-lookup:hover {
    background: #3bbd4c;
}

/* ===================================================
   CADASTRO PÚBLICO / ATIVAÇÃO DE USUÁRIOS (/cadastrar)
=================================================== */
.container-cadastro {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.card-cadastro {
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.card-cadastro input {
    width: 100%;
    padding: 10px;
    margin: 8px 0;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.card-cadastro button {
    width: 60%;
    display: block;
    margin: 10px auto 0;
    height: 40px;
    border-radius: 4px;
    border: none;
    background: #0f172a;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    text-transform: uppercase;
}

.card-cadastro button:hover{
    background: #334155;
}

.btn-voltar{
    transition: background 0.2s;
}

.btn-voltar:hover{
    opacity: 0.8;
}

.btn-sucesso {
    background-color: #28a745 !important;
}

.btn-sucesso:hover{
    opacity: 0.9;
}

.msg-error {
    color: #d9534f;
    font-weight: bold;
    text-align: center;
    margin: 2vh 0;
}

.conferencia-dados {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    padding: 15px;
    border-radius: 6px;
    margin: 15px 0;
    text-align: left;
}

.conferencia-dados ul {
    list-style: none;
    padding: 0;
    text-align: left;
}

.conferencia-dados li {
    margin-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 4px;
}

.conferencia-dados li:last-child {
    border-bottom: none;
}

.btn-cancelar {
    display: block;
    text-align: center;
    margin-top: 10px;
    font-size: 0.8rem;
    color: #d9534f;
    text-decoration: none;
}

.btn-voltar-tentar {
    display: block;
    width: 100%;
    padding: 12px;
    background-color: #6c757d;
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 4px;
    margin-top: 20px;
    font-weight: bold;
    transition: background 0.3s;
}

.btn-voltar-tentar:hover {
    background-color: #5a6268;
}

.alerta-juridico{
    background-color: #f8d7da;
    border-left: 4px solid #dc3545;
    text-align: center;
    margin-bottom: 2vh;
    padding: 1.5vh 0;
}

.alerta-juridico p {
    color: #721c24;
}

.input-tkn{
    font-weight: bold;
    text-align: center;
    background-color: gray;
    width: 60%;
}

.token-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 3vh 0;
}

.token-label {
    font-weight: 600;
    color: #334155;
    margin: 0;
}

.input-tkn-styled{
    background-color: #d1d1d1 !important;
    width: 120px;
    text-align: center;
    font-weight: bold;
    letter-spacing: 2px;
    border: 1px solid #94a3b8;
    text-transform: uppercase;
}

/* ===================================================
   RESPONSIVIDADE
=================================================== */
@media (max-width: 1024px) {
    .search-columns-container {
        grid-template-columns: 1fr 1fr;
    }
    .col-buttons {
        grid-column: span 2;
        flex-direction: row;
        width: 100%;
        justify-content: flex-end;
        align-items: center;
        gap: 15px;
        padding-top: 10px;
        border-top: 1px dashed #cbd5e1;
    }
    .tabela-com-acoes {
        flex-direction: column;
    }
    .acoes-lateral {
        width: 100%;
    }
    .acoes-lateral .buttons-stack-column {
        flex-direction: row !important;
        flex-wrap: wrap !important;
    }
    .acoes-lateral .buttons-stack-column .btn-pag {
        width: auto !important;
        padding: 0 10px !important;
    }
}
