/* ==========================================================================
   1. Variáveis Globais e Reset
   ========================================================================== */
:root {
    --bg-color: #0D1117;
    --text-color: #E6EDF3;
    --primary-neon: #58A6FF;
    --secondary-neon: #1F6FEB;
    --font-family: 'Poppins', sans-serif;
    --container-bg: rgba(22, 27, 34, 0.7);
    --border-color: rgba(88, 166, 255, 0.2);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scrollbar-width: thin; scrollbar-color: var(--primary-neon) var(--bg-color); }
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-color); }
::-webkit-scrollbar-thumb { background-color: var(--primary-neon); border-radius: 10px; border: 2px solid var(--bg-color); }

/* ==========================================================================
   2. Estilos Gerais do Corpo e Layout Principal
   ========================================================================== */
body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-family);
    background-image: url('../imagens/background.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    line-height: 1.6;
    overflow-x: hidden;
}
#particles-js { position: fixed; width: 100%; height: 100%; top: 0; left: 0; z-index: -2; }
main { padding-top: 80px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0; }

/**
 * .content-section é o nosso container principal para as secções.
 * Ele centra o conteúdo e define um padding padrão.
 * A largura máxima agora é maior para acomodar a grelha.
 */
.content-section {
    max-width: 1200px; /* Aumentado para dar espaço à grelha */
    margin: 6rem auto;
    padding: 3rem 5%; /* Padding lateral responsivo */
    background: var(--container-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    backdrop-filter: blur(5px);
}

.content-section h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-align: center;
    color: var(--primary-neon);
    text-shadow: 0 0 5px var(--primary-neon);
}

.content-section h3 {
    font-size: 1.2rem;
    text-align: center;
    opacity: 0.8;
    margin-bottom: 2.5rem;
    font-weight: 400;
}

/* ==========================================================================
   3. Cabeçalho e Navegação
   ========================================================================== */
header { position: fixed; top: 0; left: 0; width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 1rem 5%; z-index: 1000; background: rgba(13, 17, 23, 0.6); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border-color); }
.logo-container { display: flex; align-items: center; gap: 15px; flex-shrink: 0; }
.logo { height: 50px; width: auto; }
nav { flex-grow: 1; text-align: center; }
.nav-link { color: var(--text-color); text-decoration: none; margin: 0 1.5rem; font-size: 1.1rem; padding: 5px 0; border-bottom: 2px solid transparent; transition: color 0.3s, text-shadow 0.3s, border-bottom-color 0.3s; }
.nav-link:hover, .nav-link.active { color: var(--primary-neon); text-shadow: 0 0 3px var(--primary-neon); border-bottom-color: var(--primary-neon); }
.lang-switcher { flex-shrink: 0; }
.lang-switcher a { color: var(--text-color); text-decoration: none; font-weight: 700; opacity: 0.7; transition: opacity 0.3s, color 0.3s; }
.lang-switcher a:hover { opacity: 1; color: var(--primary-neon); }
.lang-switcher a.active { opacity: 1; color: var(--secondary-neon); cursor: default; }
#menu-btn, #mobile-menu { display: none; }

/* ==========================================================================
   4. Secção Hero
   ========================================================================== */
#hero { height: 100vh; display: flex; align-items: center; justify-content: center; text-align: center; padding: 0 5%; position: relative; overflow: hidden; }
#hero-video { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); min-width: 100%; min-height: 100%; filter: brightness(0.4); z-index: 0; }
.hero-content { position: relative; z-index: 1; }
.logo-video-container { width: 250px; height: 250px; margin: 0 auto 2.5rem auto; display: flex; justify-content: center; align-items: center; border-radius: 50%; position: relative; -webkit-mask-image: radial-gradient(circle, black 50%, transparent 100%); mask-image: radial-gradient(circle, black 50%, transparent 100%); }
.logo-video-container::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(13, 17, 23, 0.3); border-radius: 50%; z-index: 1; }
.logo-video-container video { width: 100%; height: 100%; object-fit: cover; position: relative; z-index: 0; }
.hero-content h2 { font-size: clamp(2.5rem, 5vw, 3.5rem); font-weight: 700; margin-bottom: 1rem; line-height: 1.2; text-shadow: 0 0 8px rgba(88, 166, 255, 0.4), 0 0 15px rgba(88, 166, 255, 0.3); }
.hero-content p { font-size: 1.2rem; max-width: 600px; margin: 0 auto 2rem auto; }
.cta-button { display: inline-block; padding: 1rem 2rem; background: var(--primary-neon); color: var(--text-color); text-decoration: none; font-weight: 700; border-radius: 5px; box-shadow: 0 0 15px var(--primary-neon); transition: transform 0.3s, box-shadow 0.3s; }
.cta-button:hover { transform: scale(1.05) translateY(-2px); box-shadow: 0 0 25px var(--primary-neon); }

/* ==========================================================================
   5. Secção de Serviços (LAYOUT DE GRELHA INTERATIVA)
   ========================================================================== */

.services-grid {
    display: grid;
    /* Grelha responsiva: cria colunas de no mínimo 200px */
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    position: relative; /* Necessário para o posicionamento do card expandido */
}

.service-card {
    background: var(--container-bg);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    
    /* A "magia" para criar o quadrado perfeito */
    aspect-ratio: 1 / 1; 
    
    /* Usamos flexbox para alinhar o conteúdo dentro do quadrado */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    
    /* Transições suaves para todas as propriedades */
    transition: transform 0.4s ease, box-shadow 0.4s ease, border-color 0.4s ease;
}

.service-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-neon);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.service-card h4 {
    font-size: 1.2rem;
    color: var(--primary-neon);
    margin: 0;
    transition: font-size 0.4s ease;
}

/* O parágrafo (resumo) fica escondido por defeito */
.service-card p {
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0;
    max-height: 0;
    margin-top: 0;
    overflow: hidden;
    transition: opacity 0.4s ease, max-height 0.4s ease, margin-top 0.4s ease;
}


/* --- ESTADO EXPANDIDO --- */

.service-card.expanded {
    /* Quando expandido, o card usa posicionamento absoluto para flutuar por cima dos outros */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1.1); /* Centra e aumenta o card */
    
    width: 90%;  /* Ocupa 90% da largura do container .services-grid */
    height: auto; /* A altura será automática com base no conteúdo */
    max-width: 500px; /* Limite máximo de largura */
    aspect-ratio: initial; /* Remove a restrição de ser um quadrado */
    
    z-index: 10; /* Garante que fica por cima dos outros cards */
    
    border-width: 2px;
    border-color: var(--primary-neon);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

/* Mostra o parágrafo quando o card está expandido */
.service-card.expanded p {
    opacity: 0.8;
    max-height: 200px; /* Altura suficiente para o texto */
    margin-top: 1rem;
}

.service-card.expanded h4 {
    font-size: 1.8rem;
}

/**
 * Overlay para o fundo.
 * Adicionamos este elemento via JS quando um card é expandido
 * para escurecer o resto da página.
 */
.service-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 5; /* Fica abaixo do card expandido, mas acima do resto */
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none; /* Não pode ser clicado por defeito */
}

.service-overlay.active {
    opacity: 1;
    pointer-events: all; /* Permite clicar para fechar */
}

/* ==========================================================================
   5.1 Secção de Processo (LAYOUT DE LINHA DO TEMPO)
   ========================================================================== */

/* Removemos a formatação de lista padrão */
.process-steps {
    list-style: none;
    padding-left: 0;
    margin-top: 3rem;
    position: relative;
}

/* A linha vertical da "linha do tempo" */
.process-steps::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 20px;
    bottom: 10px;
    width: 3px;
    background-color: var(--border-color);
    border-radius: 3px;
}

.process-steps li {
    position: relative;
    padding-left: 60px; /* Espaço para o número e a linha */
    margin-bottom: 2.5rem; /* Espaço entre os passos */
    font-size: 1.1rem;
}

/* Garante que o último item não tem margem extra no fundo */
.process-steps li:last-child {
    margin-bottom: 0;
}

/* O círculo numerado */
.process-steps li span {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    
    display: flex;
    align-items: center;
    justify-content: center;
    
    width: 40px;
    height: 40px;
    border-radius: 50%;
    
    background-color: var(--bg-color);
    border: 2px solid var(--primary-neon);
    
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-neon);
    
    text-shadow: 0 0 5px var(--secondary-neon);
}

/* ==========================================================================
   6. Widget do Assistente de IA
   ========================================================================== */
#chat-widget { position: fixed; bottom: 2rem; right: 2rem; z-index: 1001; }
#chat-toggle-btn { width: 60px; height: 60px; background: var(--primary-neon); border: none; border-radius: 50%; cursor: pointer; display: flex; justify-content: center; align-items: center; box-shadow: 0 0 15px var(--primary-neon); transition: transform 0.3s, box-shadow 0.3s; }
#chat-toggle-btn:hover { transform: scale(1.1); box-shadow: 0 0 25px var(--primary-neon); }
#chat-toggle-btn img { width: 40px; height: 40px; border-radius: 50%; }
#chat-container { width: 350px; height: 500px; background: var(--container-bg); border: 1px solid var(--border-color); border-radius: 10px; display: flex; flex-direction: column; overflow: hidden; transition: transform 0.3s ease-out, opacity 0.3s ease-out; transform-origin: bottom right; }
#chat-container.hidden, #chat-toggle-btn.hidden { transform: scale(0); opacity: 0; pointer-events: none; }
#chat-header { padding: 1rem; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
#chat-header h2 { font-size: 1.1rem; margin: 0; }
#close-chat-btn { background: none; border: none; color: var(--text-color); font-size: 1.8rem; cursor: pointer; line-height: 1; transition: color 0.2s; }
#close-chat-btn:hover { color: var(--primary-neon); }
#chat-box { flex-grow: 1; padding: 1rem; overflow-y: auto; display: flex; flex-direction: column; gap: 1rem; }
.chat-message { padding: 0.75rem 1rem; border-radius: 10px; max-width: 80%; line-height: 1.4; word-wrap: break-word; }
.user-message { background: var(--primary-neon); color: var(--bg-color); align-self: flex-end; border-bottom-right-radius: 0; }
.ai-message { background: #22272E; align-self: flex-start; border: 1px solid var(--border-color); border-bottom-left-radius: 0; }
#chat-input-container { display: flex; padding: 1rem; border-top: 1px solid var(--border-color); flex-shrink: 0; }
#user-input { flex-grow: 1; background: #1a1a1a; border: 1px solid var(--border-color); border-radius: 5px; padding: 0.75rem; color: var(--text-color); font-family: var(--font-family); font-size: 1rem; transition: border-color 0.3s, box-shadow 0.3s; }
#user-input:focus { outline: none; border-color: var(--primary-neon); box-shadow: 0 0 5px var(--primary-neon); }
#send-btn { background: var(--primary-neon); border: none; padding: 0 1rem; margin-left: 1rem; border-radius: 5px; cursor: pointer; color: var(--bg-color); display: flex; align-items: center; justify-content: center; }

/* --- ESTADO MAXIMIZADO DO CHAT --- */

/* O ícone para o novo botão de maximizar/minimizar */
#maximize-chat-btn {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 0 0.5rem;
    transition: color 0.2s;
}
#maximize-chat-btn:hover {
    color: var(--primary-neon);
}

/* Quando o chat-container tem a classe .maximized */
#chat-container.maximized {
    /* Ocupa quase todo o ecrã */
    width: 80vw;
    height: 80vh;
    
    /* Remove o posicionamento fixo no canto para o centrar */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    
    /* Remove a origem da transformação para uma animação de centro */
    transform-origin: center center;
    
    z-index: 1002; /* Garante que fica acima do overlay, se houver */
}

/* ==========================================================================
   7. Rodapé e Animações
   ========================================================================== */
footer { text-align: center; padding: 2.5rem 1rem; border-top: 1px solid var(--border-color); background: #0A0A0A; }
footer p { margin-bottom: 0.5rem; color: rgba(230, 237, 243, 0.6); font-size: 0.9rem; }
footer p:last-child { margin-bottom: 0; }
.view-switcher-link { color: var(--secondary-neon); text-decoration: none; opacity: 0.7; transition: opacity 0.3s; }
.view-switcher-link:hover { opacity: 1; text-decoration: underline; }
.typing-indicator span { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background-color: #888; margin: 0 2px; animation: typing 1.2s infinite ease-in-out; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%, 100% { transform: translateY(0); opacity: 0.5; } 50% { transform: translateY(-6px); opacity: 1; } }