/* style.css */
:root {
    --primary-color: #0047ba;
    --secondary-color: #FF6600;
    --bg-light: #ffffff; /* Fundo agora é todo branco */
    --text-main: #333333;
    --text-muted: #666666; /* Nova variável para textos secundários */
    --sidebar-width: 320px; /* Um pouco mais largo para acomodar bem o menu */
    --border-color: #e1e4e8;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Poppins", sans-serif;
    color: var(--text-main);
    background-color: var(--bg-light);
    line-height: 1.6;
}


/* --- Tela Inicial (Home) --- */
.home-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: var(--bg-light);
    padding: 10px;
    text-align: center;
}

.home-logo {
    min-width: 310px; /* Aumentado em ~20% (antes era 420px) */
    margin-bottom: 10px;
}

/* Deixa o logo da sidebar com cara de botão clicável */
.sidebar-header .cms-logo {
    cursor: pointer;
    transition: transform 0.2s ease;
}

/* Dá um efeitinho super sutil de "pulo" quando passa o mouse */
.sidebar-header .cms-logo:hover {
    transform: scale(1.03); 
}

.home-title {
    color: var(--primary-color);
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 15px;
}

.home-subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 800px;
    margin-bottom: 40px;
    line-height: 1.7;
}

.home-search {
    width: 100%;
    max-width: 650px;
    margin-bottom: 30px;
    position: relative; /* Garante que o botão fique atrelado à barra */
}

/* Deixa o input da home mais gordinho e destacado */
.home-search input {
    font-size: 1.1rem;
    border-radius: 50px; 
    box-shadow: 0 5px 20px rgba(0,0,0,0.06);
    padding-left: 50px; /* Espaço para a lupa original à esquerda */
    padding-right: 60px; /* Espaço reservado para o botão da seta à direita */
}

.home-search i {
    left: 20px;
    font-size: 1.3rem;
}

.btn-search-submit {
    position: absolute;
    right: 20px; /* Cola o botão no canto direito */
    top: 50%;
    transform: translateY(-50%); /* Centraliza verticalmente */
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s ease;
    padding: 10px;
    opacity: 0.6; /* Começa sutil */
    z-index: 5; /* Fica acima do input, mas abaixo das sugestões */
}

.btn-search-submit:hover {
    opacity: 1; /* Fica totalmente visível no hover */
    color: var(--secondary-color);
}

/* --- Animação da Home e Sugestões da Busca --- */
.home-view {
    /* Prepara a tela inteira para deslizar suavemente */
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1); 
}

/* Quando o usuário digita, essa classe é ativada e a tela sobe */
.home-view.search-active {
    transform: translateY(-15vh); 
}

/* O dropdown de sugestões */
.home-search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #fff;
    border-radius: 0 0 20px 20px; /* Arredondado só embaixo */
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
    max-height: 280px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 10;
    text-align: left;
    margin-top: -10px; /* Começa escondido mais pra cima */
}

/* Revela o dropdown com efeito de deslizar */
.home-view.search-active .home-search-suggestions {
    opacity: 1;
    visibility: visible;
    margin-top: 0; 
}

/* Truque de mestre: deixa a barra reta embaixo quando abre as sugestões */
.home-view.search-active .home-search input {
    border-radius: 25px 25px 0 0;
    border-bottom: 1px solid var(--border-color);
}

/* Estilo de cada item sugerido */
.suggestion-item {
    padding: 15px 25px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    color: var(--text-main);
    font-size: 0.95rem;
    transition: 0.2s;
}

.suggestion-item:last-child { border-bottom: none; }

.suggestion-item:hover {
    background: #f8f9fa;
    color: var(--primary-color);
    padding-left: 30px; /* Dá um leve pulinho pro lado no hover */
}

.btn-open-manual {
    background: var(--secondary-color);
    color: #fff;
    border: none;
    padding: 14px 35px;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.3s;
    box-shadow: 0 4px 15px rgba(255, 102, 0, 0.2);
}

.btn-open-manual:hover {
    background: #e55c00;
    transform: translateY(-2px);
}


/* Botão de Voltar para a Home */
.btn-voltar {
    width: 100%;
    background: #f8f9fa;
    color: var(--primary-color);
    border: 1px solid var(--border-color);
    padding: 10px 15px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 20px; /* Dá um respiro antes da barra de busca */
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
}

.btn-voltar:hover {
    background: #eaf1fa;
    border-color: var(--primary-color);
}

/* Layout Estrutural */
.main-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: #fff;
    border-right: 1px solid var(--border-color);
    padding: 20px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.content-area {
    flex: 1;
    padding: 30px 20px; /* Mais respiro no topo */
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Garante que o conteúdo cole no topo */
}

.manual-container {
    width: 100%;
    max-width: 1400px; /* Limita a largura do texto para leitura confortável */
    background: #fff;
}

/* Menu Lateral */
.menu-nav ul { list-style: none; }

.menu-item { margin-bottom: 10px; }

.page-title { 
    font-size: 1rem; 
    font-weight: 600; 
    color: var(--primary-color); 
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.submenu { 
    margin: 10px 0 0 5px;
    margin-left: 10;  /* Recuo menor */
    border-left: 2px solid #f0f0f0; /* Linha guia para os subitens */
    padding-left: 10px;
    margin-bottom: 20px; 
}

.submenu-item { 
    padding: 10px 15px; 
    cursor: pointer; 
    border-radius: 6px; 
    font-size: 0.95rem;
    color: var(--text-muted);
    transition: all 0.2s ease;
    margin-bottom: 2px;
}

.submenu-item:hover { 
    background: #f8f9fa; 
    color: var(--primary-color); 
}

.submenu-item.active { 
    background: #eaf1fa; /* Fundo azul bem claro */
    color: var(--primary-color); 
    font-weight: 500;
}

/* Estilização dos Blocos (Vindo da Planilha) */
.block-titulo-principal { 
    margin-bottom: 25px; 
    background: #0F6EFC;
    padding: 20px;
    border-radius: 10px;
}

.block-titulo-principal h1 { 
    font-size: 2.2rem; 
    font-weight: 800;
    color: #fff;
}

.block-titulo-principal p{
    font-size: 1.5rem; 
    font-weight: 300;
    color: #fff;
}

.block-subtitulo { 
    font-size: 1.1rem; 
    color: var(--text-muted); 
    margin-bottom: 40px; 
}

.block-titulo { 
    font-size: 1.5rem; 
    font-weight: 600;
    color: var(--text-main);
    margin: 50px 0 20px; /* Muito respiro antes de um novo tópico */
    padding-bottom: 10px; 
    border-bottom: 1px solid var(--border-color); /* Linha divisória mais sutil */
}

.block-paragrafo { 
    margin-bottom: 20px; 
    font-size: 1rem; 
    color: var(--text-muted); /* Parágrafos mais suaves */
    line-height: 1.8; /* Aumenta o espaçamento entre linhas (leading) para leitura */
}

.block-lista { margin: 20px 0 20px 25px; }
.block-lista li { margin-bottom: 10px; color: var(--text-muted); }

.block-alerta-dica, .block-alerta-aviso {
    padding: 20px;
    border-radius: 8px;
    display: flex;
    gap: 15px;
    align-items: flex-start;
    margin: 25px 0;
}

.block-alerta-dica { background: #e7f3ff; border-left: 5px solid #2196F3; color: #0d47a1; }
.block-alerta-aviso { background: #fff3e0; border-left: 5px solid #ff9800; color: #e65100; }

/* Estilos da Tabela (Gerada dinamicamente) */
.table-wrapper {
    overflow-x: auto;
    margin: 30px 0;
    border: 1px solid var(--border-color); /* Borda em volta de toda a tabela */
    border-radius: 6px;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    text-align: left;
    font-size: 0.95rem;
}

/* Estilo apenas para a PRIMEIRA linha (o cabeçalho) */
.custom-table tr:first-child td {
    background-color: #f8f9fa;
    font-weight: 600;
    color: var(--text-main);
    border-bottom: 2px solid var(--border-color); /* Destaca o cabeçalho */
}

.custom-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-muted);
}

.custom-table tr:last-child td {
    border-bottom: none;
}

/* Barra de Pesquisa */
.search-container {
    position: relative;
    margin-bottom: 20px;
}

.search-container input {
    width: 100%;
    padding: 12px 15px 12px 35px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: 0.2s;
}

.search-container input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 71, 186, 0.1);
}

.search-container i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

/* Cards de Resultado da Busca */
.search-result-card {
    background: #fff;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: 0.2s;
}

.search-result-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.search-result-card h3 {
    color: var(--primary-color);
    margin-bottom: 5px;
}

/* Botão de fechar (escondido no desktop por padrão) */
.close-mobile-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-main);
    cursor: pointer;
}

/* Estilos para Imagens Dinâmicas */
.block-imagem {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 20px 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    display: block; 
}

/* Estilos para Links Dinâmicos */
.text-link {
    color: var(--primary-color);
    text-decoration: underline;
    font-weight: 500;
    transition: 0.2s;
}

.text-link:hover {
    color: var(--secondary-color);
}


/* --- Transições de Esmaecimento (Fade In / Fade Out) --- */
#home-view, 
#app-main-layout, 
#app-mobile-header {
    transition: opacity 0.2s ease;
}

/* --- Layout dos Botões lado a lado --- */
.botoes-home.flex {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px; /* Espaçamento horizontal entre os dois botões */
    margin-bottom: 30px; /* Respiro antes da barra de pesquisa */
    flex-wrap: wrap; /* Se for acedido por telemóvel, eles ajustam-se automaticamente */
    width: 100%;
}

/* --- Estilo Diferenciado dos Botões (Menores, Outline e Arredondados) --- */
#home-view .button-home {
    background: #0F6EFC; /* Fundo transparente (estilo Ghost) */
    padding: 9px 30px; /* Exatamente -5px em relação aos 14px 35px do botão principal */
    font-size: 0.95rem; /* Letra ligeiramente mais pequena */
    font-weight: 500; /* Menos espesso para diferenciar do botão principal */
    border-radius: 50px; /* Formato de pílula (arredondado) para ser totalmente diferente */
    cursor: pointer;
    transition: all 0.3s ease;
}

#home-view .button-home a {
    text-decoration: none;
    color: #fff; /* Texto a azul a combinar com a borda */
    display: flex;
    align-items: center;
    gap: 8px; /* Espaço perfeito entre o ícone e o texto */
}

/* --- Efeito ao passar o rato (Hover) --- */
#home-view .button-home:hover {
    background: #FF6600; /* Preenche de azul ao passar o rato */
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(15, 110, 252, 0.3); /* Sombra corrigida para tons de azul */
}

#home-view .button-home:hover a {
    color: #ffffff; /* O texto fica branco no hover */
}

/* Controlo do tamanho do ícone para não deformar o botão */
#home-view .button-home img {
    width: 18px; 
    height: auto;
    display: block;
}

/* Mobile */
.mobile-header { display: none; background: var(--primary-color); color: #fff; padding: 15px; }

@media (max-width: 768px) {
    .sidebar { 
        display: none; 
        position: fixed;
        top: 0;
        left: 0;
        width: 80%;
        z-index: 1000;
        box-shadow: 5px 0 15px rgba(0,0,0,0.1);
    }
    
    .sidebar.active { display: block; }
    
    .mobile-header { display: flex; align-items: center; gap: 15px; }
    .content-area { padding: 20px; }

    .sidebar-header {
        display: flex;
        justify-content: space-between; 
        align-items: center;
        flex-wrap: wrap;
         
    }
    
    .close-mobile-btn {
        display: block; 
    }
}