/* ======================================================== */
/* --- NOVO DESIGN PROFISSIONAL v3.0 --- */
/* ======================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap');

:root {
    --cor-primaria: #be2d30;
    --cor-primaria-hover: #a12123;
    --cor-fundo: #f8f9fa;
    --cor-cabecalho-fundo: #212529;
    --cor-card-fundo: #ffffff;
    --cor-texto-principal: #212529;
    --cor-texto-secundario: #6c757d;
    --cor-borda: #dee2e6;
    --sombra-card: 0 10px 30px rgba(0, 0, 0, 0.07);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--cor-fundo);
    color: var(--cor-texto-principal);
}

.page-container {
    width: 100%;
}

.hero-header {
    background-color: var(--cor-cabecalho-fundo);
    padding: 30px 20px;
    text-align: center;
}

.hero-header img {
    max-width: 220px;
    height: auto;
}

.main-content {
    padding: 40px 20px;
}

.card-wrapper {
    max-width: 680px;
    width: 100%;
    margin: 0 auto;
    background-color: var(--cor-card-fundo);
    border-radius: 12px;
    box-shadow: var(--sombra-card);
    overflow: hidden;
}

.card-header {
    padding: 30px;
}

.card-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 15px 0;
}

.card-form {
    display: flex;
    gap: 10px;
}

.card-form input[type="text"],
.card-form input[type="password"] {
    flex-grow: 1;
    padding: 12px 15px;
    font-size: 1rem;
    border: 1px solid var(--cor-borda);
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.card-form input[type="text"]:focus,
.card-form input[type="password"]:focus {
    outline: none;
    border-color: var(--cor-primaria);
    box-shadow: 0 0 0 3px rgba(190, 45, 48, 0.2);
}

.card-form button {
    background-color: var(--cor-primaria);
    color: #ffffff;
    border: none;
    padding: 12px 25px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.card-form button:hover {
    background-color: var(--cor-primaria-hover);
}

.resultado-wrapper {
    padding: 0 30px 30px 30px;
}

.resultado-box {
    background-color: var(--cor-fundo);
    border: 1px solid var(--cor-borda);
    border-radius: 8px;
    padding: 25px;
}

.resultado-box h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--cor-primaria);
    margin: 0 0 15px 0;
}

.consulta-log-style {
    font-size: 0.85rem;
    color: var(--cor-texto-secundario);
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--cor-borda);
}

.registro-info p {
    margin: 0 0 12px 0;
    color: #495057;
    font-size: 1rem;
    line-height: 1.6;
    display: flex;
}

.registro-info p strong {
    color: var(--cor-texto-principal);
    display: inline-block;
    min-width: 200px; /* Alinha os valores */
    font-weight: 500;
}

.registro-info p:last-child {
    margin-bottom: 0;
}

.cd-mensagem {
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}
.cd-mensagem.erro {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
.cd-mensagem.sucesso {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
/* Estilos para a nova seção de histórico */
.card-box {
    background-color: var(--cor-fundo);
    border: 1px solid var(--cor-borda);
    border-radius: 8px;
    padding: 25px;
    margin-top: 20px;
}
.card-box h3 {
    margin-top: 0;
    font-weight: 700;
    color: var(--cor-texto-principal);
}
.tabela-historico {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}
.tabela-historico th,
.tabela-historico td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--cor-borda);
}
.tabela-historico th {
    font-weight: 700;
    color: var(--cor-texto-secundario);
    font-size: 0.9rem;
}
.tabela-historico td {
    color: var(--cor-texto-principal);
}
.tabela-historico tbody tr:last-child td {
    border-bottom: none;
}
/* ======================================================== */
/* --- NOVOS ESTILOS PARA O PAINEL DE ADMIN --- */
/* ======================================================== */

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto 20px auto;
}

.admin-header h2 {
    margin: 0;
    color: var(--cor-texto-principal);
}

.logout-button {
    text-decoration: none;
    color: var(--cor-primaria);
    font-weight: 500;
    padding: 8px 16px;
    border: 1px solid var(--cor-borda);
    border-radius: 8px;
    transition: all 0.2s ease-in-out;
}

.logout-button:hover {
    background-color: var(--cor-primaria);
    color: #fff;
    border-color: var(--cor-primaria);
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.admin-card {
    background-color: var(--cor-card-fundo);
    border-radius: 12px;
    box-shadow: var(--sombra-card);
    padding: 30px;
}

.admin-card h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 20px 0;
    font-size: 1.25rem;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--cor-borda);
    color: var(--cor-texto-principal);
}

.admin-card p {
    margin: 0 0 20px 0;
    color: var(--cor-texto-secundario);
    line-height: 1.6;
}

/* Estilo do campo de upload personalizado */
input[type="file"] {
    display: none;
}
.custom-file-upload {
    border: 2px dashed var(--cor-borda);
    border-radius: 8px;
    display: block;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    color: var(--cor-texto-secundario);
    margin-bottom: 20px;
}
.custom-file-upload:hover {
    background-color: #f8f9fa;
    border-color: var(--cor-primaria);
}

.checkbox-container {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}
.checkbox-container input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-right: 10px;
}
.checkbox-container label {
    font-weight: normal;
    font-size: 1rem;
    margin: 0;
}

/* Estilo da tabela de histórico */
.table-container {
    max-height: 600px;
    overflow-y: auto;
}
.tabela-historico {
    width: 100%;
    border-collapse: collapse;
}
.tabela-historico th,
.tabela-historico td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--cor-borda);
}
.tabela-historico th {
    font-weight: 500;
    color: var(--cor-texto-secundario);
    font-size: 0.9rem;
    text-transform: uppercase;
}
.tabela-historico tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}
.tabela-historico tbody tr:last-child td {
    border-bottom: none;
}
.tabela-historico td {
    font-size: 0.95rem;
}
/* Estilos do Novo Dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 20px auto;
}
.dashboard-card {
    background-color: var(--cor-card-fundo);
    border-radius: 12px;
    box-shadow: var(--sombra-card);
    padding: 25px;
    text-decoration: none;
    color: var(--cor-texto-principal);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}
.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
}
.dashboard-card h3 {
    margin: 0 0 10px 0;
    color: var(--cor-primaria);
}
.dashboard-card p {
    margin: 0;
    color: var(--cor-texto-secundario);
    font-size: 0.95rem;
    line-height: 1.6;
}
.dashboard-card.disabled {
    opacity: 0.5;
    background-color: #f1f1f1;
    cursor: not-allowed;
}
.dashboard-card.disabled:hover {
    transform: none;
    box-shadow: var(--sombra-card);
}
/* ======================================================== */
/* --- CORREÇÃO PARA O TAMANHO DO BOTÃO NO FORMULÁRIO --- */
/* ======================================================== */
.card-form {
    flex-direction: column; /* Garante que o form seja uma coluna */
}

/* Aplica-se a todos os botões dentro de um .card-form */
.card-form button {
    align-self: flex-start; /* Impede o botão de esticar na largura */
    width: auto;            /* Faz a largura do botão se ajustar ao texto */
}
/* ======================================================== */
/* --- ESTILOS PARA A PÁGINA DE GERENCIAMENTO (CRUD) --- */
/* ======================================================== */

.full-width-card {
    max-width: 1200px;
    margin: 0 auto;
}

.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.search-form {
    display: flex;
    gap: 10px;
}

.search-form input {
    min-width: 300px;
    padding: 10px 15px;
    font-size: 1rem;
    border: 1px solid var(--cor-borda);
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
}

.table-controls .button {
    padding-top: 10px;
    padding-bottom: 10px;
}

.tabela-historico .acoes a {
    text-decoration: none;
    font-weight: 500;
    color: var(--cor-primaria);
    margin-right: 15px;
}

.tabela-historico .acoes a:last-child {
    margin-right: 0;
}

.tabela-historico .acoes a.disabled {
    color: var(--cor-texto-secundario);
    cursor: not-allowed;
    opacity: 0.6;
}

.pagination {
    margin-top: 20px;
    text-align: center;
}

.pagination a {
    display: inline-block;
    padding: 8px 14px;
    margin: 0 4px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--cor-primaria);
    border: 1px solid var(--cor-borda);
    transition: all 0.2s;
}

.pagination a:hover {
    background-color: #fde5e6;
    border-color: #f7c7cb;
}

.pagination a.active {
    background-color: var(--cor-primaria);
    border-color: var(--cor-primaria);
    color: #fff;
    cursor: default;
}
/* ======================================================== */
/* --- ESTILOS PARA FORMULÁRIOS DE EDIÇÃO/CRIAÇÃO --- */
/* ======================================================== */

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.form-group input {
    padding: 10px 12px;
    font-size: 1rem;
    border: 1px solid var(--cor-borda);
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
}
/* ======================================================== */
/* --- ESTILOS PARA O SELETOR DE REGISTROS POR PÁGINA --- */
/* ======================================================== */
.search-form-wrapper {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}
.view-options-form {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--cor-texto-secundario);
}
.view-options-form select {
    padding: 8px;
    border-radius: 8px;
    border: 1px solid var(--cor-borda);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
}
/* ======================================================== */
/* --- ESTILOS CORRIGIDOS PARA CONTROLES DA TABELA --- */
/* ======================================================== */
.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 20px;
}
.view-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}
.search-form {
    display: flex;
    gap: 10px;
}
.search-form input {
    min-width: 250px;
}
.view-options-form {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--cor-texto-secundario);
}
.view-options-form select {
    padding: 8px;
    border-radius: 8px;
    border: 1px solid var(--cor-borda);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    background-color: #fff;
}
/* Ajuste para botões não ficarem tão grandes na barra */
.table-controls .button {
    padding-top: 10px;
    padding-bottom: 10px;
}
/* ======================================================== */
/* --- ESTILOS PARA O LAYOUT DA PÁGINA DE GERENCIAMENTO --- */
/* ======================================================== */

.content-layout {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 30px; /* Cria um espaço vertical entre os cards */
}

/* Remove a margem inferior padrão dos controles quando estão no novo layout */
.content-layout .table-controls {
    margin-bottom: 0;
}
/* ======================================================== */
/* --- ESTILOS PARA OS BOTÕES DE AÇÃO NA TABELA --- */
/* ======================================================== */

/* Faz os botões ficarem lado a lado com um espaço */
.tabela-historico .acoes {
    display: flex;
    gap: 8px;
}
/* ======================================================== */
/* --- ESTILOS PARA O BOTÃO DE DOWNLOAD PDF --- */
/* ======================================================== */

.resultado-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.resultado-header h3 {
    margin: 0;
}

.button-pdf {
    text-decoration: none;
    background-color: #f8f9fa;
    color: var(--cor-texto-principal);
    font-weight: 500;
    padding: 8px 16px;
    border: 1px solid var(--cor-borda);
    border-radius: 8px;
    transition: all 0.2s ease-in-out;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9rem;
}

.button-pdf:hover {
    background-color: #e9ecef;
    border-color: #ced4da;
}