/* style.css (Atualizado com Novas Variáveis de Cor) */
:root {
    --sidebar-bg: #2c3e50;
    --header-bg: #ffffff;
    --main-bg: #f4f7fa;
    --card-bg: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --border-color: #dfe6e9;
    
    /* Cores Primárias (do config) */
    --primary-color: #3498db;
    --success-color: #2ecc71;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    
    /* --- ATUALIZADO V8 --- */
    /* Novas cores do Menu (do config) */
    --sidebar-text: #ecf0f1;
    --sidebar-active-bg: #34495e;
    --logout-btn-bg: #e74c3c; /* Usa dangerColor como padrão */
    /* --- FIM DA ATUALIZAÇÃO --- */

    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}
body, html {
    margin: 0; padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    height: 100%;
    background-color: var(--main-bg);
    color: var(--text-primary);
}
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #f4f7fa;
    flex-direction: column;
}
.login-card {
    background-color: var(--card-bg);
    padding: 30px 40px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
}
.login-card h1 {
    text-align: center;
    color: var(--text-primary);
    margin-top: 0;
    margin-bottom: 25px;
}
.login-card .form-group { margin-bottom: 20px; }
.login-card .btn { width: 100%; padding: 12px; margin-bottom: 10px; }
.login-card .btn-secondary { background-color: #bdc3c7; color: var(--text-primary); }
#login-message {
    text-align: center;
    color: var(--danger-color);
    min-height: 1.2em;
}
.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-top: 20px;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.app-container { display: flex; height: 100vh; }
.sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    transition: width 0.3s;
    flex-shrink: 0; /* Adicionado para garantir que não encolha */
    transition: transform 0.3s ease-in-out; /* Adicionado para animação mobile */
}
.sidebar-header {
    padding: 20px;
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    min-height: 60px;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}
.sidebar-header h2 { 
    margin: 0; 
    word-break: break-word;
    line-height: 1.2; 
}
.sidebar-header h2 img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    max-height: 60px;
}
.sidebar-nav { flex-grow: 1; overflow-y: auto; }
.sidebar-nav ul { list-style: none; padding: 0; margin: 20px 0; }
.sidebar-nav li a {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    text-decoration: none;
    transition: background-color 0.3s;
    border-left: 3px solid transparent;
    
    /* --- ATUALIZADO V8 --- */
    color: var(--sidebar-text); /* Usa a variável */
}
.sidebar-nav li a:hover { 
    background-color: var(--sidebar-active-bg); /* Usa a variável */
}
.sidebar-nav li a.active {
    background-color: var(--sidebar-active-bg); /* Usa a variável */
    border-left-color: var(--primary-color);
}
/* --- FIM DA ATUALIZAÇÃO --- */

.sidebar-nav .nav-link i {
    margin-right: 15px;
    width: 20px;
    text-align: center;
    font-size: 1.1em;
}
#nav-configuracoes, #nav-usuarios {
    display: none;
}

/* --- ATUALIZADO V8 --- */
#logout-btn {
    background-color: var(--logout-btn-bg); /* Usa a nova variável */
    opacity: 0.8;
}
#logout-btn:hover {
    opacity: 1;
}
/* --- FIM DA ATUALIZAÇÃO --- */

.sidebar-footer { 
    padding: 20px; 
    text-align: center; 
    font-size: 0.8em; 
    border-top: 1px solid var(--sidebar-active-bg);
    /* --- ATUALIZADO V8 --- */
    color: var(--sidebar-text); /* Também usa a cor da fonte */
    opacity: 0.7;
}
.sidebar-footer a {
    color: var(--sidebar-text); /* Garante que o link use a cor */
    text-decoration: none;
}
.sidebar-footer a:hover {
    text-decoration: underline;
}
/* --- FIM DA ATUALIZAÇÃO --- */

.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    /* --- CORREÇÃO APLICADA AQUI --- */
    /* 'hidden' impedia o scroll. 'auto' permite quando necessário. */
    overflow-x: auto; 
}
.main-header {
    background-color: var(--header-bg);
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    z-index: 10;
    display: flex; /* Adicionado para alinhar o botão hambúrguer */
    align-items: center; /* Adicionado para alinhar o botão hambúrguer */
}
#page-title { margin: 0; font-size: 28px; flex-grow: 1; } /* Adicionado flex-grow */
.content-area { padding: 20px; flex-grow: 1; }
.card {
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}
.grid-container {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}
.kpi-card { padding: 20px; }
.kpi-card .icon { font-size: 2em; color: var(--primary-color); margin-bottom: 10px; }
.kpi-card h3 { margin: 0; font-size: 1em; color: var(--text-secondary); }
.kpi-card p { margin: 5px 0 0; font-size: 1.5em; font-weight: bold; }
.btn {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    transition: opacity 0.3s;
    margin-right: 5px;
    text-decoration: none;
    display: inline-block;
}
.btn:hover { opacity: 0.85; }
.btn-primary { background-color: var(--primary-color); color: white; }
.btn-danger { background-color: var(--danger-color); color: white; }
.btn-success { background-color: var(--success-color); color: white; }
.btn-warning { background-color: var(--warning-color); color: white; }
.btn-info { background-color: #1abc9c; color: white; }
.btn-sm { padding: 5px 10px; font-size: 0.9em; }
table { width: 100%; border-collapse: collapse; margin-top: 20px; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid var(--border-color); }
th { background-color: #ecf0f1; }
.table-wrapper { overflow-x: auto; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: bold; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box;
    font-family: inherit; 
    font-size: 1em;
}
.form-group textarea { min-height: 80px; resize: vertical; }
.hidden { display: none !important; }
.modal {
    display: none; position: fixed; z-index: 1000; left: 0; top: 0;
    width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.5);
    justify-content: center; align-items: flex-start; padding-top: 5vh;
}
.modal-content {
    background-color: #fefefe; margin: auto; padding: 30px; border: 1px solid #888;
    width: 90%; max-width: 600px; border-radius: 8px; position: relative;
    animation: fadeIn 0.3s; max-height: 85vh; overflow-y: auto;
}
@keyframes fadeIn { from {opacity: 0; transform: scale(0.95);} to {opacity: 1; transform: scale(1);}}
.close-button {
    color: #aaa; position: absolute; top: 10px; right: 15px;
    font-size: 28px; font-weight: bold; cursor: pointer;
}
.page-header {
    display: flex; flex-wrap: wrap; justify-content: space-between;
    align-items: center; gap: 15px; margin-bottom: 20px;
}
.page-header h2 a { text-decoration: none; color: var(--primary-color); margin-right: 15px; }
.tabs {
    display: flex; border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px; flex-wrap: wrap;
}
.tab-link {
    padding: 10px 20px; cursor: pointer; border: none; background: none;
    font-size: 1em; border-bottom: 3px solid transparent;
}
.tab-link.active { border-bottom-color: var(--primary-color); font-weight: bold; }
.tab-content { display: none; }
.tab-content.active { display: block; }
.filters-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: end;
}
.status-badge {
    padding: 5px 12px; border-radius: 15px; color: white;
    font-size: 0.8em; font-weight: bold; text-align: center; display: inline-block;
}
.status-em-andamento, .status-primary { background-color: var(--primary-color); }
.status-concluida { background-color: var(--success-color); }
.status-pausada { background-color: var(--warning-color); }
.status-danger { background-color: var(--danger-color); }
.text-credito { color: var(--success-color); font-weight: bold; }
.text-debito { color: var(--danger-color); font-weight: bold; }
.search-container { position: relative; max-width: 400px; }
.search-container input { width: 100%; padding-left: 40px; box-sizing: border-box; }
.search-container .fa-search {
    position: absolute; left: 15px; top: 50%;
    transform: translateY(-50%); color: var(--text-secondary);
}


/*
=================================================================
--- ADICIONADO: MÁGICA DA RESPONSIVIDADE (Telas pequenas < 768px) ---
=================================================================
*/

/* --- BOTÃO HAMBÚRGUER (Escondido no Desktop) --- */
#menu-toggle-btn {
    display: none; /* Escondido por padrão */
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
    margin-right: 15px;
}

/* --- OVERLAY (Escondido no Desktop) --- */
#sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#sidebar-overlay.open {
    display: block;
    opacity: 1;
    visibility: visible;
}


@media (max-width: 768px) {

    /* --- AJUSTES GERAIS --- */
    body {
        font-size: 16px; /* Aumenta a fonte base para legibilidade */
    }

    .content-area, .main-header {
        padding: 15px; /* Menos padding em telas pequenas */
    }

    /* --- O CÉREBRO DO MENU MOBILE --- */

    /* 1. O Menu (Sidebar) fica escondido e flutuando */
    .sidebar {
        position: fixed; /* Flutua acima de tudo */
        left: 0;
        top: 0;
        bottom: 0;
        height: 100vh;
        z-index: 1000;
        transform: translateX(-100%); /* Começa escondido à esquerda */
        box-shadow: 4px 0 10px rgba(0,0,0,0.1);
    }

    /* 2. A classe '.open' faz o menu aparecer */
    .sidebar.open {
        transform: translateX(0);
    }

    /* 3. O conteúdo principal agora ocupa 100% */
    .main-content {
        width: 100%;
    }

    /* 4. O botão hambúrguer aparece */
    #menu-toggle-btn {
        display: block; /* Mostra o botão */
    }

    /* 5. O Overlay (fundo escuro) */
    #sidebar-overlay {
        display: block; /* Permite que seja ativado */
    }

    /* --- AJUSTES DE LAYOUT DO CONTEÚDO --- */

    /* Faz os grids de 2+ colunas virarem de 1 coluna */
    .grid-container,
    .filters-container {
        grid-template-columns: 1fr !important; /* Força 1 coluna */
    }

    /* Ajusta o cabeçalho das páginas */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    /* Ajusta tamanho da fonte do título da página */
    #page-title {
        font-size: 1.75rem;
    }
}

/* =====================================================
  ESTILOS PARA TAREFAS CONCLUÍDAS (V15)
=====================================================
*/

/* Define a altura máxima da lista de concluídas e adiciona scroll */
#tarefas-finalizadas-wrapper {
    max-height: 300px; /* Define a altura máxima para consulta */
    overflow-y: auto;  /* Adiciona scroll se a lista for maior */
    border-top: 1px solid var(--border-color);
    margin-top: 10px;
    padding-top: 10px;
}

/* Deixa a linha inteira da tarefa concluída "opaca" */
.tarefa-concluida {
    opacity: 0.6;
}

/* Garante que o texto de todas as células fique riscado */
.tarefa-concluida td {
    text-decoration: line-through;
}