/* =========================================
   1. RESET E LAYOUT BÁSICO (TRAVADO NA TELA)
   ========================================= */
#qcore-app-wrapper {
    display: flex;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f7f6;
    width: 100%;
    height: 100vh; /* Força a altura exata da tela */
    overflow: hidden; /* Impede que a página inteira role (app feel) */
    position: fixed;
    top: 0;
    left: 0;
    z-index: 99999; /* Garante que fique acima de tudo */
    color: #333;
}

/* =========================================
   2. SIDEBAR (MENU LATERAL) - SCROLL INDEPENDENTE
   ========================================= */
.qcore-sidebar {
    width: 260px;
    background-color: #1e293b;
    color: #e2e8f0;
    display: flex;
    flex-direction: column; /* Organiza: Topo - Menu - Rodapé */
    border-right: 1px solid #334155;
    flex-shrink: 0;
    height: 100%; /* Ocupa toda altura disponível */
}

/* Cabeçalho Fixo */
.sidebar-header {
    padding: 20px;
    background-color: #0f172a;
    border-bottom: 1px solid #334155;
    flex-shrink: 0; /* Não encolhe */
}

/* Container do Menu (ESTE É O SEGREDO DO SCROLL) */
.sidebar-menu-container {
    flex-grow: 1; /* Ocupa todo o espaço vazio */
    overflow-y: auto; /* Cria barra de rolagem se precisar */
    padding: 10px 0;
}

/* Rodapé Fixo */
.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid #334155;
    background-color: #1e293b;
    flex-shrink: 0; /* Não encolhe */
}

/* Estilos dos Itens (Mantidos) */
.lab-logo { font-size: 20px; font-weight: bold; color: white; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.lab-info { display: flex; flex-direction: column; font-size: 13px; color: #94a3b8; margin-bottom: 10px; }
.unit-badge { background: #3b82f6; color: white; padding: 2px 6px; border-radius: 4px; font-size: 10px; align-self: flex-start; margin-top: 3px; }
.user-info { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #cbd5e1; padding-top: 10px; border-top: 1px solid #334155; }
.qcore-menu { list-style: none; padding: 0; margin: 0; }
.menu-header { font-size: 11px; text-transform: uppercase; color: #64748b; padding: 15px 20px 5px; font-weight: 700; letter-spacing: 0.5px; }
.menu-item { padding: 12px 20px; cursor: pointer; display: flex; align-items: center; gap: 12px; color: #cbd5e1; transition: all 0.2s; border-left: 3px solid transparent; text-decoration: none; }
.menu-item i { width: 20px; text-align: center; }
.menu-item:hover { background-color: #334155; color: white; }
.menu-item.active { background-color: #334155; color: #60a5fa; border-left-color: #60a5fa; font-weight: 600; }
.menu-item.disabled { opacity: 0.5; cursor: not-allowed; }
.submenu { list-style: none; padding: 0; margin: 0; background-color: #0f172a; display: none; }
.has-submenu.open .submenu { display: block; }
.has-submenu.open .submenu-toggle .arrow { transform: rotate(180deg); }
.submenu-toggle { display: flex; align-items: center; gap: 12px; width: 100%; }
.submenu-toggle .arrow { margin-left: auto; font-size: 12px; transition: transform 0.3s; }
.submenu-item { padding: 10px 20px 10px 52px; font-size: 13px; color: #94a3b8; cursor: pointer; transition: color 0.2s; }
.submenu-item:hover { color: white; }
.submenu-item.active { color: #60a5fa; font-weight: bold; }
.logout-btn { color: #ef4444; text-decoration: none; display: flex; align-items: center; gap: 10px; font-size: 14px; transition: color 0.2s; }
.logout-btn:hover { color: #fca5a5; }

/* =========================================
   3. CONTEÚDO PRINCIPAL (MAIN) - SCROLL INDEPENDENTE
   ========================================= */
.qcore-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%; /* Altura total */
    overflow-y: auto; /* SCROLL AQUI: Permite rolar o conteúdo */
    background: #f1f5f9;
    position: relative;
}

/* Barra Superior Fixa no topo do Main? Não, deixamos rolar junto */
.qcore-topbar {
    background: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    flex-shrink: 0; /* Não encolhe */
}

/* Conteúdo */
#qcore-content {
    padding: 30px;
    flex-grow: 1;
    /* Se o conteúdo for pequeno, ele estica. Se for grande, o .qcore-main rola. */
}

.page-title h3 { margin: 0; color: #1e293b; font-size: 18px; font-weight: 600; }
.topbar-actions { display: flex; gap: 15px; align-items: center; }
.date-badge { background: #f1f5f9; padding: 6px 12px; border-radius: 20px; font-size: 13px; color: #475569; display: flex; align-items: center; gap: 5px; }
.notif-btn { border: none; background: none; font-size: 18px; color: #64748b; cursor: pointer; }
.qcore-card { background: white; padding: 25px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.03); margin-bottom: 20px; }
.qcore-alert { padding: 20px; background: #fee; color: #c00; border: 1px solid #fcc; border-radius: 5px; }
.button-small { padding: 4px 8px; font-size: 12px; }

/* =========================================
   4. SCROLLBAR BONITA (Webkit - Chrome/Edge/Safari)
   ========================================= */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
/* Sidebar Scrollbar (Mais escura) */
.sidebar-menu-container::-webkit-scrollbar-thumb { background: #334155; }
.sidebar-menu-container::-webkit-scrollbar-thumb:hover { background: #475569; }

/* =========================================
   5. TELA DE LOGIN & OUTROS (Mantidos)
   ========================================= */
.qcore-login-wrapper { display: flex; justify-content: center; align-items: center; min-height: 100vh; background-color: #f4f7f6; width: 100%; position: fixed; top:0; left:0; z-index:10000; }
.qcore-login-box { background: white; padding: 40px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); width: 100%; max-width: 400px; }
.qcore-login-box .login-username, .qcore-login-box .login-password { margin-bottom: 15px; }
.qcore-login-box label { display: block; margin-bottom: 5px; font-weight: 600; color: #444; }
.qcore-login-box input[type="text"], .qcore-login-box input[type="password"] { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 4px; font-size: 16px; }
.qcore-login-box .login-submit { margin-top: 20px; }
.qcore-login-box input[type="submit"] { background-color: #3498db; color: white; border: none; padding: 12px 20px; width: 100%; border-radius: 4px; cursor: pointer; font-size: 16px; font-weight: bold; transition: background 0.2s; }
.qcore-login-box input[type="submit"]:hover { background-color: #2980b9; }

/* Relatórios */
.qcore-report-paper { background: white; padding: 40px; border: 1px solid #ddd; box-shadow: 0 0 15px rgba(0,0,0,0.1); max-width: 210mm; margin: 20px auto; min-height: 297mm; position: relative; }
.report-header { border-bottom: 2px solid #333; padding-bottom: 20px; margin-bottom: 30px; display: flex; justify-content: space-between; align-items: center; }
.report-title h2 { margin: 0; font-size: 24px; text-transform: uppercase; }
.report-title p { margin: 5px 0 0; color: #666; }
.report-signature { margin-top: 50px; border-top: 1px solid #000; width: 250px; padding-top: 10px; text-align: center; font-size: 12px; }

/* Modal */
.qcore-modal { position: fixed; z-index: 10000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; }
.qcore-modal-content { background-color: #fefefe; margin: auto; padding: 25px; border: 1px solid #888; width: 90%; max-width: 500px; border-radius: 8px; position: relative; box-shadow: 0 4px 20px rgba(0,0,0,0.2); }
.close-modal { color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer; }
.close-modal:hover { color: black; }

/* =========================================
   8. DASHBOARD WIDGETS (CARDS)
   ========================================= */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.dash-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    border-left: 4px solid #3498db; /* Cor padrão */
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.2s;
}

.dash-card:hover { transform: translateY(-3px); }

.dash-info h4 { margin: 0 0 5px 0; color: #64748b; font-size: 13px; text-transform: uppercase; font-weight: 700; }
.dash-info span { font-size: 28px; font-weight: 700; color: #1e293b; }

.dash-icon {
    width: 50px; height: 50px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
    background-color: #f1f5f9;
    color: #64748b;
}

/* Variações de Cores */
.card-blue { border-left-color: #3498db; }
.card-blue .dash-icon { background-color: #eaf6fd; color: #3498db; }

.card-green { border-left-color: #2ecc71; }
.card-green .dash-icon { background-color: #eafaf1; color: #2ecc71; }

.card-red { border-left-color: #e74c3c; }
.card-red .dash-icon { background-color: #fdedeb; color: #e74c3c; }

.card-orange { border-left-color: #f39c12; }
.card-orange .dash-icon { background-color: #fef5e7; color: #f39c12; }

/* IMPRESSÃO */
@media print {
    @page { margin: 0; size: A4; }
    .qcore-sidebar, .qcore-topbar, .no-print, .qcore-card, #wpadminbar { display: none !important; }
    #qcore-app-wrapper { position: static; height: auto; overflow: visible; background: white; }
    .qcore-main { overflow: visible; height: auto; padding: 0; background: white; display: block; }
    .qcore-report-paper { visibility: visible; position: absolute; left: 0; top: 0; width: 100%; margin: 0; padding: 10mm; border: none; box-shadow: none; }
}

