/* --- ESTILOS GLOBAIS E RESET BÁSICO --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    color: #333;
    display: flex; /* Define o layout principal com sidebar */
    background-color: #f4f7f6; /* Cor de fundo para as páginas internas */
}

a {
    color: #007bff;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* --- LAYOUT PRINCIPAL COM SIDEBAR --- */
.sidebar {
    width: 260px;
    background-color: #2c3e50;
    color: #ecf0f1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
}

.main-content {
    margin-left: 260px;
    flex: 1;
    padding: 30px;
    width: calc(100% - 260px);
}

/* --- ESTILOS DA SIDEBAR --- */
.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid #34495e;
}

.sidebar-logo {
    color: #ffffff;
    font-size: 24px;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
    flex-grow: 1;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    color: #ecf0f1;
    text-decoration: none;
    padding: 15px 25px;
    gap: 15px;
    transition: background-color 0.3s, color 0.3s;
}

.sidebar-menu li a:hover, .sidebar-menu li a.active {
    background-color: #3498db;
    color: #ffffff;
}

.sidebar-menu li a i {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #34495e;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-footer .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-footer .user-info i {
    font-size: 36px;
}

.sidebar-footer .user-details {
    display: flex;
    flex-direction: column;
}

.sidebar-footer .user-details strong {
    font-size: 14px;
}

.sidebar-footer .user-details span {
    font-size: 12px;
    color: #bdc3c7;
}

.sidebar-footer .logout-button {
    color: #ecf0f1;
    font-size: 20px;
    padding: 5px;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.sidebar-footer .logout-button:hover {
    background-color: #e74c3c;
}


/* --- COMPONENTES GERAIS (CARDS, BOTÕES, ETC) --- */
.container, .form-container {
    max-width: 1200px;
    margin: 0 auto;
}

.card {
    background-color: #ffffff;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e9ecef;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 15px;
}

.card h1, .card h2 {
    margin-bottom: 10px;
    font-size: 22px;
}

.btn {
    padding: 10px 18px;
    border-radius: 6px;
    text-decoration: none;
    color: white;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    cursor: pointer;
}
.btn:hover {
    opacity: 0.9;
    color: white;
    text-decoration: none;
}
.btn-primary { background-color: #007bff; }
.btn-secondary { background-color: #6c757d; }


/* --- ESTILOS PARA FORMULÁRIOS PROFISSIONAIS --- */
fieldset {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 25px;
}

legend {
    font-size: 18px;
    font-weight: 500;
    padding: 0 10px;
    color: #495057;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: #495057;
    margin-bottom: 8px;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="time"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
    display: block;
    width: 100%;
    padding: 10px 12px;
    font-size: 15px;
    font-family: 'Roboto', sans-serif;
    line-height: 1.5;
    min-height: 42px;
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 6px;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: 0;
    border-color: #80bdff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 10px;
}

.radio-group, .checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding-top: 5px;
}
.radio-group label, .checkbox-group label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: normal;
}


/* --- ESTILOS PARA LISTAGEM E DATATABLES --- */
.table-responsive {
    overflow-x: auto;
}
th.actions-header, td.actions-cell {
    text-align: center;
    min-width: 160px;
}
.btn-action {
    display: inline-block;
    padding: 6px 10px;
    margin: 0 2px;
    border-radius: 5px;
    color: #fff;
    text-decoration: none;
    transition: opacity 0.3s;
}
.btn-action:hover {
    opacity: 0.8;
    color: #fff;
    text-decoration: none;
}
.btn-action.view   { background-color: #007bff; }
.btn-action.edit   { background-color: #ffc107; }
.btn-action.print  { background-color: #17a2b8; }
.btn-action.delete { background-color: #dc3545; }

.dataTables_wrapper {
    margin-top: 20px;
}
.dt-buttons {
    margin-bottom: 15px;
}
.btn-action i {
    pointer-events: none;
}


/* --- ESTILOS PARA TELA DE VISUALIZAÇÃO (VIEW) --- */
.view-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px 30px;
}

.view-item {
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.view-item.full-width {
    grid-column: 1 / -1;
}

.view-label {
    display: block;
    font-size: 13px;
    color: #6c757d;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.view-value {
    font-size: 16px;
    color: #343a40;
}


/* --- ESTILOS PARA CÉLULA DE RETORNO --- */
td.retorno-ativo {
    background-color: #d4edda !important; /* Verde */
    color: #155724 !important;
    font-weight: 500;
}

td.retorno-vencido {
    background-color: #f8d7da !important; /* Vermelho */
    color: #721c24 !important;
    font-weight: 500;
}

td.retorno-superado {
    color: #6c757d !important;
    font-style: italic;
    text-decoration: line-through;
}

/* Em assets/css/style.css */

/* --- UTILITÁRIOS PARA FORMULÁRIOS --- */

.inline-fields {
    display: flex;
    gap: 20px; /* Espaçamento entre os campos */
    align-items: flex-end; /* Alinha os campos pela base */
}

.inline-fields .form-group {
    flex-grow: 1; /* Permite que os campos cresçam */
    margin-bottom: 0; /* Remove a margem inferior padrão */
}

/* --- PÁGINA DE LOGIN (LAYOUT DE 2 COLUNAS) --- */

/* Este body só será aplicado na página de login, graças a uma classe que adicionaremos */
body.login-page {
    display: block; /* Sobrescreve o 'display: flex' do body principal */
}

.login-wrapper {
    display: flex;
    min-height: 100vh;
}

.login-aside {
    flex: 1;
    background: linear-gradient(rgba(20, 30, 48, 0.8), rgba(36, 59, 85, 0.9)), url('https://images.unsplash.com/photo-1579684385127-6ab18a5d7814?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3w0NTYyMDF8MHwxfHNlYXJjaHwxfHxjbGluaWNhfGVufDB8fHx8MTY4OTU0NjYxM3ww&ixlib=rb-4.0.3&q=80&w=1080') no-repeat center center;
    background-size: cover;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #ffffff;
    padding: 40px;
    text-align: center;
}
.login-aside h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 15px;
}
.login-aside p {
    font-size: 18px;
    font-weight: 400;
    max-width: 400px;
}

.login-main {
    flex: 1;
    background-color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}
.login-content {
    width: 100%;
    max-width: 400px;
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}
.login-logo img {
    max-width: 300px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}
.login-header h2 {
    font-size: 28px;
    font-weight: 600;
    color: #1e293b;
}
.login-header p {
    color: #64748b;
    margin-top: 5px;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 14px;
}

.input-group {
    position: relative;
    margin-bottom: 20px;
}
.input-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}
.input-group input {
    width: 100%;
    padding: 14px 15px 14px 45px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    font-family: 'Poppins', sans-serif;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.input-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.options-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    font-size: 14px;
}
.options-row a {
    color: #3b82f6;
    font-weight: 500;
}
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #475569;
}
    
.btn-acessar {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 8px;
    background-color: #f97316;
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.3s;
}
.btn-acessar:hover {
    background-color: #ea580c;
}

.login-footer {
    text-align: center;
    margin-top: 30px;
    font-size: 14px;
    color: #94a3b8;
}
    
@media (max-width: 900px) {
    .login-aside {
        display: none;
    }
    .login-main {
        flex: 1 1 100%;
    }
}

/* --- ESTILOS PARA SLIDERS DE AVALIAÇÃO --- */

.slider-container {
    padding-top: 10px;
}

.slider-container input[type="range"] {
    width: 100%;
    margin: 10px 0;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #6c757d;
}

.slider-output {
    display: inline-block;
    font-weight: 500;
    color: #007bff;
    font-size: 16px;
    min-width: 25px; /* Garante espaço para os números */
    text-align: center;
}

/* --- ESTILOS PARA TABELA DE TESTES (CHECKBOX) --- */

.test-table {
    width: 100%;
    border-collapse: separate; /* Importante para o espaçamento */
    border-spacing: 0;
    margin-top: 15px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden; /* Garante que as bordas arredondadas funcionem */
}

.test-table th,
.test-table td {
    padding: 12px;
    text-align: center;
    vertical-align: middle;
    border-bottom: 1px solid #e9ecef;
}

.test-table td {
    border-left: 1px solid #e9ecef;
}

.test-table th:first-child,
.test-table td:first-child {
    text-align: left;
    font-weight: 500;
    border-left: none;
}

.test-table thead th {
    background-color: #f8f9fa;
    color: #495057;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 13px;
    border-top: none;
}

.test-table tbody tr:last-child td {
    border-bottom: none;
}

/* Estilos para os checkboxes customizados */
.checkbox-cell {
    position: relative;
}

.checkbox-custom {
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    height: 100%;
}

.checkbox-custom input[type="checkbox"] {
    opacity: 0; /* Esconde o checkbox padrão */
    position: absolute;
}

.checkbox-custom .checkmark {
    display: inline-block;
    width: 20px;
    height: 20px;
    background-color: #fff;
    border: 2px solid #ced4da;
    border-radius: 4px;
    transition: all 0.2s;
    position: relative;
}

/* Efeito ao passar o mouse */
.checkbox-custom:hover .checkmark {
    border-color: #007bff;
}

/* Estilo do checkmark quando selecionado */
.checkbox-custom input[type="checkbox"]:checked + .checkmark {
    background-color: #007bff;
    border-color: #007bff;
}

/* O "v" de verificado, criado com CSS */
.checkbox-custom .checkmark::after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

.checkbox-custom input[type="checkbox"]:checked + .checkmark::after {
    display: block; /* Mostra o "v" quando marcado */
}

/* --- LAYOUTS CUSTOMIZADOS PARA FORMULÁRIOS --- */

.three-column-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* Cria 3 colunas de largura igual */
    gap: 25px; /* Espaçamento entre as colunas */
}

/* Um novo grupo de checkbox para alinhamento vertical */
.checkbox-group-vertical {
    display: flex;
    flex-direction: column; /* Alinha os itens verticalmente */
    gap: 12px; /* Espaçamento entre cada checkbox */
    padding-top: 10px;
}

/* --- Tabela de Visualização (ver.php) --- */
.view-table {
    width: 100%;
    margin-top: 10px;
    border-collapse: collapse;
}
.view-table th, .view-table td {
    border: 1px solid #e9ecef;
    padding: 10px;
    text-align: left;
}
.view-table thead {
    background-color: #f8f9fa;
}

/* --- ESTILOS PARA TABELAS DE DADOS SIMPLES (EX: HISTÓRICO) --- */

.view-data-table {
    width: 100%;
    border-collapse: collapse; /* Remove o espaçamento entre as células */
    margin-top: 15px;
}

.view-data-table thead th {
    background-color: #f8f9fa;
    color: #495057;
    font-weight: 500;
    text-align: left;
    border-bottom: 2px solid #dee2e6; /* Borda mais grossa no cabeçalho */
    padding: 12px 15px; /* Mais espaçamento interno */
}

.view-data-table tbody td {
    padding: 12px 15px; /* Mais espaçamento interno */
    border-bottom: 1px solid #e9ecef; /* Linha fina separando as linhas */
    vertical-align: middle;
}

/* Remove a borda da última linha para um acabamento limpo */
.view-data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Efeito suave ao passar o mouse sobre uma linha */
.view-data-table tbody tr:hover {
    background-color: #f7f9fc;
}

/* Alinha os botões de ação à direita */
.view-data-table .actions-cell {
    text-align: right;
    width: 1%; /* Faz com que a célula ocupe o menor espaço possível */
    white-space: nowrap;
}

/* --- ESTILOS PARA O MODAL (SWEETALERT2) --- */
.swal-info-container {
    text-align: left;
    margin: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}
.swal-info-container p {
    margin: 10px 0;
    font-size: 16px;
}
.swal-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}
/* Estilo para o botão de excluir no modal */
.btn-danger {
    background-color: #dc3545;
}

/* Ajuste de tamanho para botões dentro do Modal da Agenda */
.swal-actions .btn {
    font-size: 14px; /* Diminui o tamanho da fonte */
    padding: 8px 15px; /* Ajusta o espaçamento interno para o novo tamanho */
}

/* --- ESTRUTURA RESPONSIVA --- */

/* O 'main-content' agora está dentro de um wrapper */
.main-content-wrapper {
    margin-left: 260px;
    width: calc(100% - 260px);
    transition: margin-left 0.3s ease-in-out;
}

/* Barra superior e botão do menu mobile (escondidos em telas grandes) */
.main-header-mobile {
    display: none;
}
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

/* Adiciona a transição de slide na sidebar */
.sidebar {
    transition: left 0.3s ease-in-out;
    z-index: 100;
}


/* ====================================================== */
/* MEDIA QUERY: ESTILOS PARA TELAS PEQUENAS (ATÉ 992px) */
/* ====================================================== */
@media (max-width: 1200px) {
    /* 1. Esconde a sidebar para a esquerda */
    .sidebar {
        left: -260px;
    }
    
    /* 2. Expande o conteúdo principal para ocupar 100% da tela */
    .main-content-wrapper {
        margin-left: 0;
        width: 100%;
    }

    /* 3. Mostra a barra de topo e o botão hambúrguer */
    .main-header-mobile {
        display: flex;
        align-items: center;
        gap: 15px;
        background-color: #ffffff;
        padding: 10px 15px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    .sidebar-toggle {
        background: none;
        border: none;
        font-size: 20px;
        cursor: pointer;
        color: #333;
    }
    .mobile-logo a {
        font-size: 18px;
        font-weight: 700;
        color: #007bff;
        text-decoration: none;
    }

    /* 4. Classe que o JavaScript adiciona para ABRIR o menu */
    body.sidebar-open .sidebar {
        left: 0; /* Traz a sidebar de volta para a tela */
        box-shadow: 3px 0 15px rgba(0,0,0,0.2);
    }

    /* 5. Mostra o overlay quando o menu está aberto */
    body.sidebar-open .sidebar-overlay {
        display: block;
    }
}

/* Estilos básicos para o canvas */
    #canvas-container {
        border: 1px solid #ccc;
        margin: 10px 0;
        background-color: #fff;
        display: flex; /* Para centralizar o canvas */
        justify-content: center;
        align-items: center;
    }
    .color-palette button {
        width: 30px;
        height: 30px;
        border: 1px solid #ccc;
        cursor: pointer;
        margin: 5px;
        border-radius: 50%;
        transition: transform 0.2s;
    }
    .color-palette button.active {
        border: 2px solid #000;
        transform: scale(1.2);
    }
    .color-palette button:hover {
        transform: scale(1.1);
    }
    /* Cores */
    .color-red { background-color: #f44336; } /* Vermelho: dor muito intensa */
    .color-yellow { background-color: #ffeb3b; } /* Amarelo: dor média */
    .color-green { background-color: #4CAF50; } /* Verde: pouca dor */
    .btn-tool {
        padding: 8px 12px;
        margin: 5px;
        border: 1px solid #ccc;
        border-radius: 4px;
        background-color: #f0f0f0;
        cursor: pointer;
    }
    .btn-tool.active {
        background-color: #007bff;
        color: white;
        border-color: #007bff;
    }
    .swal2-actions {
        flex-wrap: wrap; /* Para os botões ficarem responsivos */
    }

.btn-mapa-dor {
    background-color: #4da6ff; /* Azul claro */
    color: #fff;
    border: none;
    padding: 10px 18px;
    font-size: 15px;
    border-radius: 6px;
    transition: background-color 0.3s ease;
}

.btn-mapa-dor:hover {
    background-color: #3399ff; /* Azul um pouco mais forte no hover */
    color: #fff;
}

/* --- ESTILOS DO PAINEL (DASHBOARD) --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 25px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 20px;
    background-color: #ffffff;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e9ecef;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-icon i {
    font-size: 24px;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1.1;
}

.stat-label {
    font-size: 15px;
    color: #6c757d;
}

/* --- BADGES DE STATUS (Usado no Painel e em Consultas) --- */
.status-badge {
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    text-transform: capitalize;
}
.status-agendada { background-color: #cfe2ff; color: #0a58ca; }
.status-confirmada { background-color: #cff4fc; color: #087990; }
.status-realizada { background-color: #d1e7dd; color: #146c43; }
.status-cancelada { background-color: #f8d7da; color: #a52834; }
.status-não-compareceu { background-color: #e9ecef; color: #495057; }
.status-em-andamento { background-color: #fff3cd; color: #856404; }