*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ============================================ */
/* TELA DE CARREGAMENTO (INDEX) */
/* ============================================ */

.loading-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    flex-direction: column;
    background-color: #f4f6f9;
    font-family: Arial, sans-serif;
}

.loading-title {
    color: #0d6efd;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.loading-text {
    color: #666;
    font-size: 1.2rem;
    margin: 0.3rem 0;
}

.loading-subtext {
    color: #999;
    font-size: 12px;
    margin-top: 0.5rem;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    display: flex;
    flex-direction: column;
    background-color: #f4f6f9;
    font-family: Arial, Helvetica, sans-serif;
    min-height: 100vh;
}

body > div {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
}

.cabecalho {
    background-color: #0d6efd;
    color: white;
    text-align: center;
    padding: 25px;
    position: relative;
}

.cabecalho h1 {
    margin-bottom: 8px;
}

main {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    width: 100%;
}

main > div,
main > section {
    width: 100%;
    max-width: 1200px;
}

.container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.container form {
    width: 420px;
    max-width: 100%;
    background: white;
    padding: 35px;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    margin: 0 auto;
}

.container h2 {
    text-align: center;
    margin-bottom: 25px;
    color: #0d6efd;
}

.campo {
    margin-bottom: 20px;
}

.campo label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
}

.campo input,
.campo select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
}

.opcoes {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 14px;
}

.opcoes a {
    color: #0d6efd;
    text-decoration: none;
}

button {
    width: 100%;
    padding: 12px;
    background: #0d6efd;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    margin-top: 10px;
}

button:hover {
    background: #0b5ed7;
}

.cadastrar {
    text-align: center;
    margin-top: 15px;
}

footer {
    background: #212529;
    color: white;
    text-align: center;
    padding: 15px;
    width: 100%;
    margin-top: auto;
    flex-shrink: 0;
}

.modulo-card {
    background: white;
    border-radius: 12px;
    padding: 40px 30px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.3s;
}

.modulo-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15) !important;
}

.card-admin {
    border: 2px solid #0d6efd;
}

.card-central {
    border: 2px solid #28a745;
}

.icone {
    font-size: 48px;
    margin-bottom: 15px;
}

.tag-acesso {
    display: inline-block;
    margin-top: 10px;
    background: #f8f9fa;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    color: #555;
}

.conteudo {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    width: 100%;
    margin-bottom: 20px;
}

.conteudo h2 {
    color: #0d6efd;
    margin-bottom: 20px;
}

.conteudo ul {
    list-style: none;
    padding: 0;
}

.conteudo ul li {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.conteudo ul li:hover {
    background: #f8f9fa;
}

.mensagem {
    margin-top: 15px;
    padding: 12px;
    border-radius: 8px;
    display: none;
}

.mensagem.sucesso {
    display: block;
    background: #d4edda;
    border: 1px solid #28a745;
    color: #155724;
}

.mensagem.erro {
    display: block;
    background: #f8d7da;
    border: 1px solid #dc3545;
    color: #721c24;
}

.btn-tema {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 15px;
    right: 15px;
}

/* Tela login 
.cabecalho-relativo {
    padding: 50px;
}
*/

/* TEMA ESCURO */

body.dark-mode .card-admin {
    background-color: #1a1a1a !important; /* Um tom bem escuro, quase preto */
    border-color: #333333 !important;   /* Borda sutil e escura */
    color: #e0e0e0 !important;
}

body.dark-mode {
    background-color: #1a1a2e;
    color: #e0e0e0;
}

body.dark-mode .cabecalho {
    background-color: #16213e;
}

body.dark-mode .modulo-card {
    background-color: #16213e !important;
    border-color: #0d6efd !important;
    color: #e0e0e0 !important;
}

body.dark-mode .modulo-card h3 {
    color: #4a9eff !important;
}

body.dark-mode .modulo-card p {
    color: #b0b0b0 !important;
}

body.dark-mode .modulo-card .tag-acesso {
    background-color: #0d1b3e !important;
    color: #8ab4f8 !important;
}

body.dark-mode .container form {
    background-color: #16213e;
    color: #e0e0e0;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
}

body.dark-mode .container h2 {
    color: #4a9eff;
}

body.dark-mode .campo label {
    color: #b0b0b0;
}

body.dark-mode .campo input,
body.dark-mode .campo select {
    background-color: #0d1b3e;
    border-color: #2a3a5e;
    color: #e0e0e0;
}

body.dark-mode .campo input:focus,
body.dark-mode .campo select:focus {
    border-color: #4a9eff;
    background-color: #1a2a4e;
}

body.dark-mode .conteudo {
    background-color: #16213e;
    color: #e0e0e0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

body.dark-mode .conteudo h2 {
    color: #4a9eff;
}

body.dark-mode .conteudo ul li {
    border-bottom: 1px solid #2a3a5e;
    color: #e0e0e0;
}

body.dark-mode .conteudo ul li:hover {
    background-color: #1a2a4e;
}

body.dark-mode nav {
    background-color: #16213e !important;
}

body.dark-mode footer {
    background-color: #0d1b3e;
    color: #8ab4f8;
}

body.dark-mode .mensagem.sucesso {
    background-color: #1a3a2a;
    border-color: #28a745;
    color: #8bdfa0;
}

body.dark-mode .mensagem.erro {
    background-color: #3a1a1a;
    border-color: #dc3545;
    color: #f8a0a0;
}

body.dark-mode #listaAgendaCentral span[style*="color"] {
    color: #cccccc !important;
}

@media (max-width: 600px) {
    .container form {
        width: 95%;
        padding: 20px;
    }
    .conteudo {
        padding: 15px;
    }
    .conteudo ul li {
        flex-direction: column;
        text-align: center;
    }
    main {
        padding: 10px;
    }
    #telaInicial main > div {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 600px) {
    #telaLogin main .container {
        padding: 0 15px;
    }
}

/* ============================================ */
/* CLASSES PARA CABEÇALHO E BOTÃO TEMA */
/* ============================================ */

.cabecalho-relativo {
    position: relative;
}

.btn-tema-header {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================ */
/* HEADER - USUÁRIO E SAIR CENTRALIZADOS */
/* ============================================ */

.header-usuario {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: nowrap;
    margin-top: 10px;
}

/* ============================================ */
/* BOTÃO IMPRIMIR NO HISTÓRICO */
/* ============================================ */

.btn-imprimir-historico {
    width: auto;
    padding: 5px 12px;
    background: #17a2b8;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
}
.btn-imprimir-historico:hover {
    background: #138496;
}

/* Correção global para blocos e tabelas no Modo Escuro */
body.dark-mode .mt-30,
body.dark-mode form,
body.dark-mode .conteudo {
    background-color: #4d4a4a !important;
    color: #e0e0e0 !important;
    border-color: #333 !important;
}

body.dark-mode table {
    background-color: #1e1e1e !important;
    color: #e0e0e0 !important;
}

body.dark-mode th {
    background-color: #252525 !important;
    color: #ffffff !important;
    border-bottom: 2px solid #444 !important;
}

body.dark-mode td {
    border-bottom: 1px solid #333 !important;
    color: #e0e0e0 !important;
}

body.dark-mode input, 
body.dark-mode select, 
body.dark-mode textarea {
    background-color: #2D2D75 !important;
    color: #ffffff !important;
    border: 1px solid #444 !important;
}

body.dark-mode div[style*="background: #f8f9fa"],
body.dark-mode div[style*="background:#f8f9fa"] {
    background-color: #1e1e1e !important;
    border-color: #333 !important;
    color: #e0e0e0 !important;
}

#cadNacionalidadeSelect {
    max-width: 300px !important;
    width: 100% !important;
}

body.dark-mode span[style*="background: #f8f9fa"],
body.dark-mode span[style*="background:#f8f9fa"] {
    background-color: #4d4a4a !important;
    color: #e0e0e0 !important;
}

#conteudoAgendaMensal div[style*="align-items: flex-end"] {
    align-items: center !important;
}

/* Restaura o tamanho normal e elegante dos botões da fila */
#listaFilaCentral button {
    height: auto !important;
    padding: 6px 14px !important;
    font-size: 13px !important;
    white-space: nowrap !important;
}

/* Permite rolagem lateral limpa caso o conteúdo ultrapasse a largura */
#listaFilaCentral {
    overflow-x: auto !important;
    width: 100% !important;
}

/* Alarga a seção da Fila de Espera */
#conteudoFilaCentral {
    max-width: 100% !important;
    width: 100% !important;
}

/* Mantém o grid estruturado com respiro entre o nome e a especialidade */
#listaFilaCentral li {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 15px !important;
    padding: 12px 15px !important;
    white-space: nowrap !important;
}

/* Garante o espaço ideal para o nome não colar na especialidade */
#listaFilaCentral li > div:first-child,
#listaFilaCentral li span:first-of-type {
    min-width: 280px !important;
    flex-shrink: 0 !important;
}

/* Agrupa a especialidade e o selo para ficarem naturais */
#listaFilaCentral li .info-central,
#listaFilaCentral li span:nth-of-type(2) {
    flex-grow: 1 !important;
    margin-right: 15px !important;
}

/* Mantém os botões "Agendar" e "Remover" firmes e lado a lado na mesma linha */
#listaFilaCentral li .botoes-acao,
#listaFilaCentral li button {
    flex-shrink: 0 !important;
}

#buscarEditar, #buscarHistorico {
    flex: 1 !important;
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 6px !important;
    border: 1px solid #ced4da !important;
    padding: 8px 12px !important;
}

/* Efeito de brilho pulsante ao redor do modal (apenas no modo escuro) */
@keyframes brilhoModal {
    0%   { box-shadow: 0 0 15px 2px rgba(255,255,255,0.25); }
    50%  { box-shadow: 0 0 35px 10px rgba(255,255,255,0.65); }
    100% { box-shadow: 0 0 15px 2px rgba(255,255,255,0.25); }
}

body.dark-mode #modalEscolherVaga > div {
    animation: brilhoModal 2.5s ease-in-out infinite;
}

/* Efeito de brilho pulsante — Modo Escuro (branco) */
@keyframes brilhoModalDark {
    0%   { box-shadow: 0 0 15px 2px rgba(255,255,255,0.25); }
    50%  { box-shadow: 0 0 35px 10px rgba(255,255,255,0.65); }
    100% { box-shadow: 0 0 15px 2px rgba(255,255,255,0.25); }
}

/*//////////////////////*/

/* Efeito de brilho pulsante — Modo Claro (escuro) */
@keyframes brilhoModalLight {
    0%   { box-shadow: 0 0 15px 2px rgba(0,0,0,0.15); }
    50%  { box-shadow: 0 0 30px 8px rgba(0,0,0,0.35); }
    100% { box-shadow: 0 0 15px 2px rgba(0,0,0,0.15); }
}

/* Aplica cada animação conforme o tema ativo */
body.dark-mode #modalEscolherVaga > div {
    animation: brilhoModalDark 2.5s ease-in-out infinite;
}

body:not(.dark-mode) #modalEscolherVaga > div {
    animation: brilhoModalLight 2.5s ease-in-out infinite;
}