@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary-blue: #0c82fb;
  --primary-dark: #0659b1;
  --text-dark: #333;
  --text-black: #1a1a1a;
  --bg-light: transparent;
  --bg-gradient: linear-gradient(135deg, #eef4f9 0%, #e1e9f0 100%);
  --radius-standard: 8px;
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

body {
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-dark);
  scroll-behavior: smooth;
  line-height: 1.6;
}

/* Scroll offset for fixed header: anchor (#topic) navigation */
[id^="topic"] {
  scroll-margin-top: 150px;
}

/* TOP BAR */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 36px;
  background: #000;
  color: #ccc;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10%;
  z-index: 1100;
  transition: transform 0.35s ease, opacity 0.35s ease;
}
.top-bar a {
  color: #ccc;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: color 0.2s;
}
.top-bar a:hover { color: #fff; }
.top-bar .top-bar-left { display: flex; align-items: center; gap: 20px; }
.top-bar .top-bar-right { display: flex; align-items: center; gap: 14px; }
.top-bar i { font-size: 11px; color: #0c82fb; }
.top-bar.hidden {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

/* HEADER - BRANCO */
header {
  position: fixed;
  top: 36px;
  left: 0;
  width: 100%;
  padding: 10px 10%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1000;
  background: transparent;
  transition: top 0.35s ease, padding 0.3s ease, box-shadow 0.3s ease;
}

header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: #ffffff;
  border-bottom: 1px solid #e8e8e8;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  z-index: 1;
  pointer-events: none;
}

header.top-bar-gone {
  top: 0;
}

header .logo {
  height: 80px;
  width: auto;
  transition: all 0.3s ease;
  position: relative;
  z-index: 2;
}

#logoLink {
  position: relative;
  z-index: 2;
}

header nav {
  display: flex;
  gap: 12px;
  margin-left: auto;
  position: relative;
  z-index: 2;
}

header nav a {
  color: #222;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 22px;
  border-radius: var(--radius-standard);
  transition: all 0.3s ease;
  background: transparent;
  border: 1px solid #ddd;
}

header nav a:hover {
  background: rgba(12, 130, 251, 0.08);
  color: var(--primary-blue);
  border-color: var(--primary-blue);
}

header nav a.active {
  background: rgba(12, 130, 251, 0.12);
  color: var(--primary-blue);
  border-color: var(--primary-blue);
  box-shadow: 0 0 10px rgba(12, 130, 251, 0.15);
}

/* DROPDOWN NAVIGATION SYSTEM */
.dropdown-container {
  position: relative;
  display: inline-block;
}

header nav .dropdown-container .dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dropdown-arrow {
  font-size: 10px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-block;
}

.dropdown-container:hover .dropdown-trigger .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(15px);
  width: 290px;
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid var(--primary-blue);
  padding: 8px 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              visibility 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  margin-top: 12px;
}

/* Rotated square indicator to allow matching border */
.dropdown-menu::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: #ffffff;
  border-left: 1px solid var(--primary-blue);
  border-top: 1px solid var(--primary-blue);
}

.dropdown-container:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Override default button styling for sublinks */
header nav .dropdown-container .dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: #333;
  font-size: 14px;
  font-weight: 500;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  text-align: left;
  transition: background 0.25s ease, color 0.25s ease;
}

header nav .dropdown-container .dropdown-menu a i {
  color: var(--primary-blue);
  font-size: 15px;
  width: 20px;
  text-align: center;
  transition: transform 0.25s ease;
}

header nav .dropdown-container .dropdown-menu a:hover {
  background: rgba(12, 130, 251, 0.06);
  color: var(--primary-blue);
}

header nav .dropdown-container .dropdown-menu a:hover i {
  transform: scale(1.15) translateX(2px);
}

header nav .dropdown-container .dropdown-menu a.active {
  background: rgba(12, 130, 251, 0.08);
  color: var(--primary-blue);
  border: none;
  box-shadow: none;
}

header nav .dropdown-container .dropdown-menu a:first-of-type {
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}

header nav .dropdown-container .dropdown-menu a:last-of-type {
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
}

.logo {
  transform-origin: left center;
}

.logo:hover {
  filter: brightness(1.2) drop-shadow(0 0 10px rgba(12, 130, 251, 0.6)) !important;
  transform: scale(1.05) !important;
}



/* HAMBURGER MENU */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 28px;
  height: 20px;
  cursor: pointer;
  position: relative;
  z-index: 1001;
  margin-top: auto;
  margin-bottom: auto;
  flex-shrink: 0;
}

.hamburger span {
  display: block;
  height: 2.5px;
  width: 100%;
  background-color: #0c82fb;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.hamburger.open span:nth-child(1) { transform: translateY(8.75px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-8.75px) rotate(-45deg); }

/* PORTAL TRIGGER BUTTON */
.portal-trigger {
  margin-left: 12px;
  background: #0c82fb;
  color: white;
  border: none;
  border-radius: var(--radius-standard);
  width: 42px;
  height: 42px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background 0.25s, transform 0.2s;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}
.portal-trigger:hover { background: #0066d6; transform: scale(1.08); }

/* PORTAL OVERLAY */
.portal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 3000;
  backdrop-filter: blur(3px);
}
.portal-overlay.open { display: block; }

/* PORTAL SIDEBAR */
.portal-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  height: 100vh;
  background: #fff;
  z-index: 3100;
  box-shadow: -8px 0 40px rgba(0,0,0,0.18);
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  border-left: 3px solid #0c82fb;
}
.portal-sidebar.open { transform: translateX(0); }
.portal-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: #0c82fb;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}
.portal-sidebar-header i { margin-right: 8px; }
.portal-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  opacity: 0.85;
  transition: opacity 0.2s;
}
.portal-close:hover { opacity: 1; }
.portal-sidebar-body {
  padding: 24px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.portal-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 18px;
  border-radius: var(--radius-standard);
  background: #f4f6fb;
  border: 1.5px solid #e0e8fa;
  text-decoration: none;
  color: #222;
  transition: all 0.25s;
}
.portal-btn:hover {
  background: #e8f0fe;
  border-color: #0c82fb;
  transform: translateX(-4px);
  box-shadow: 4px 0 20px rgba(12,130,251,0.12);
}
.portal-btn > i:first-child {
  font-size: 22px;
  color: #0c82fb;
  flex-shrink: 0;
}
.portal-btn div { flex: 1; }
.portal-btn strong { display: block; font-size: 14px; font-weight: 600; }
.portal-btn span { font-size: 11px; color: #888; }
.portal-arrow { font-size: 12px; color: #aaa; flex-shrink: 0; }
.portal-footer {
  padding: 16px 24px;
  font-size: 11px;
  color: #aaa;
  text-align: center;
  border-top: 1px solid #f0f0f0;
}

/* FOOTER PREMIUM - DARK MODE */
footer {
  background: linear-gradient(180deg, #1a2533 0%, #0f172a 100%) !important; /* Gradiente profundo e luxuoso */
  color: #fff;
  padding: 30px 2rem 15px !important; /* Reduzido de 40px para 30px */
  border-top: none;
  font-family: 'Inter', sans-serif;
  height: auto !important;
  display: block !important;
  line-height: 1.5;
  position: relative;
  z-index: 10; /* Força o footer a sobrepor o canvas de marcas de água fixo de fundo */
}

.footer__layout {
  display: grid; /* Mudado para Grid para controlo total de 3 colunas */
  grid-template-columns: 1fr auto 1fr; /* Esquerda, Meio (Auto), Direita */
  align-items: flex-start;
  width: 100%;
  max-width: 100% !important;
  margin-bottom: 30px;
}

/* Coluna Logo */
.footer__brand-col {
  flex: 1;
}

.footer__logo {
  max-height: clamp(45px, 6vw, 70px);
  width: auto;
  margin-top: 8px; /* Ligeiro ajuste para descer o logo */
  margin-bottom: 20px; /* Aumentado para dar espaço às redes sociais */
  filter: brightness(0) invert(1); /* Logo branco para fundo escuro */
}

.footer__social {
  display: flex;
  gap: 20px;
  margin-top: 10px;
}

.footer__social a {
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer__social img {
  height: 24px;
  width: auto;
  filter: brightness(0) invert(1); 
  opacity: 0.8; /* Um pouco discretos por padrão */
  transition: all 0.3s ease;
}

.footer__social a:hover img {
  opacity: 1; 
  filter: brightness(0) saturate(100%) invert(41%) sepia(74%) saturate(4176%) hue-rotate(195deg) brightness(101%) contrast(98%);
  transform: translateY(-3px);
}

/* Coluna Contactos - Estilo Página Contactos */
.footer__contact-col {
  flex: 1.5;
  display: flex;
  flex-direction: column;
  align-items: flex-start; /* Alinhado à esquerda internamente */
  padding-left: 10%; /* Pequeno ajuste para manter no centro visual */
}

.footer__contact-col h4 {
  color: var(--primary-blue);
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 20px;
  font-weight: 700;
  width: 100%;
  text-align: left;
}

.footer__contact-grid {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 20px 60px; /* Um pouco mais de espaço lateral para a letra maior */
  width: max-content;
}

.footer__contact-item {
  display: flex;
  gap: 12px;
  align-items: flex-start; /* Alinhado pelo topo do ícone */
  text-align: left;
}

.footer__contact-icon {
  width: clamp(36px, 4vw, 42px); /* Ícone dinâmico */
  height: clamp(36px, 4vw, 42px);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid rgba(255,255,255,0.2); /* Borda suave branca */
  border-radius: 50%;
  flex-shrink: 0;
  transition: all 0.3s ease;
  background: transparent;
  color: var(--primary-blue);
}

.footer__contact-icon svg {
  width: 20px; /* Reduzido de 22px para 20px */
  height: 20px; /* Reduzido de 22px para 20px */
  transition: all 0.3s ease;
}

/* Efeito Hover no Ícone */
.footer__contact-item:hover .footer__contact-icon {
  background: var(--primary-blue);
  color: #fff;
}

.footer__contact-details {
  display: flex;
  flex-direction: column;
  padding-top: 5px; /* Alinha o texto com o topo do círculo */
}

.footer__contact-details a, 
.footer__contact-details span {
  color: #fff !important; /* Branco para fundo escuro */
  text-decoration: none;
  font-size: clamp(15px, 1.1vw, 17px); /* Letra fluída */
  font-weight: 500; /* Removido o negrito para maior leveza */
  transition: opacity 0.3s ease;
}

.footer__contact-details a:hover {
  opacity: 0.8; /* Apenas uma leve transparência no hover em vez de mudar de cor */
}

.footer__contact-details small {
  color: #cbd5e1; /* Cinza-azulado claro */
  font-size: 14px;
}

.footer__contact-details .directions {
  color: var(--primary-blue) !important;
  font-size: 13px;
  text-decoration: none;
  margin-top: 8px;
  font-weight: 700;
}

/* Coluna Links */
.footer__links-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end; /* Encosta o conteúdo à direita da sua coluna */
  text-align: right;
}

.footer__links-col h4 {
  color: var(--primary-blue);
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 20px;
  font-weight: 700;
}

.footer__links-col ul {
  list-style: none;
}

.footer__links-col ul li {
  margin-bottom: 8px;
}

@media (max-width: 768px) {
  .footer__links-col ul {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
  }
  
  .footer__links-col ul li {
    margin-bottom: 0;
  }
}

.footer__links-col ul li a {
  color: #cbd5e1;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500; /* Igual aos contactos */
  transition: all 0.3s;
}

.footer__links-col ul li a:hover {
  color: #fff;
}

.footer__links-col ul li a:hover {
  color: var(--primary-blue);
}

/* Bottom Bar */
.footer__bottom {
  border-top: 1px solid rgba(255,255,255,0.05);
  padding-top: 10px; /* Reduzido de 30px para 10px */
  width: 100%;
}

.footer__bottom-layout {
  display: flex;
  justify-content: center;
  align-items: center; /* Alinha tudo ao centro verticalmente */
  gap: 70px; /* Afastado um pouco mais para melhor equilíbrio */
  width: 100%;
}

.footer__bottom-info {
  font-size: 14px;
  color: #94a3b8;
  font-weight: 500;
}

.footer__legal-links {
  display: flex;
  align-items: center; /* Centra texto com o logo */
  gap: 40px; /* Muito mais afastado conforme pedido */
  font-size: 14px;
  color: #94a3b8;
}

.footer__legal-links a,
.footer__legal-links span {
  color: #94a3b8;
  text-decoration: none;
  font-weight: 500;
}

.footer__lre {
  display: inline-flex;
  align-items: center;
  transition: opacity 0.3s;
}

.footer__lre img {
  max-height: 55px; /* Tamanho XL para máximo destaque */
  width: auto;
  filter: brightness(1); /* Logo bem nítido no escuro */
}

.footer__lre:hover {
  opacity: 0.8;
}

.footer__copy {
  font-size: 14px;
  color: #64748b;
  font-weight: 500;
}

/* Responsividade Inteligente e Fluída */
@media (max-width: 1200px) {
  .footer__contact-grid {
    gap: 20px 30px; /* Reduz espaço entre contactos para caber melhor */
  }
}

@media (max-width: 1000px) {
  .footer__layout {
    grid-template-columns: 1fr 1fr; /* Logo em cima, mas Contactos e Links lado a lado */
    grid-template-areas: 
      "logo logo"
      "contacts links";
    gap: 30px;
  }
  .footer__brand-col {
    grid-area: logo;
    justify-content: flex-start; /* Logo à esquerda no topo */
  }
}

@media (max-width: 700px) {
  .footer__layout {
    display: flex;
    flex-direction: column;
    gap: 40px;
    text-align: left;
  }
  .footer__contact-grid {
    grid-template-columns: 1fr;
  }
  .footer__links-col {
    align-items: flex-start;
    text-align: left;
  }
  .footer__bottom-layout {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }
}

@media (max-width: 600px) {
  .footer__contact-grid {
    grid-template-columns: 1fr;
  }
}

/* PRELOADER V2 */
#preloader-v2 {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background: transparent;
}

.preloader-panel {
  position: absolute;
  left: 0;
  width: 100%;
  height: 50.5%;
  background: #111;
  transition: transform 1.2s cubic-bezier(0.85, 0, 0.15, 1);
  z-index: 1;
}

.panel-top { top: 0; }
.panel-bottom { bottom: 0; }

#preloader-v2.ready .panel-top { transform: translateY(-100%); }
#preloader-v2.ready .panel-bottom { transform: translateY(100%); }

.preloader-content {
  position: relative;
  z-index: 2;
  text-align: center;
  transition: opacity 0.6s ease, transform 0.8s ease;
  width: 220px;
}

#preloader-v2.ready .preloader-content {
  opacity: 0;
  transform: scale(1.1);
  pointer-events: none;
}

.logo-container {
  position: relative;
  width: 100%;
  height: auto;
}

.logo-base {
  width: 100%;
  height: auto;
  opacity: 0.1;
  filter: grayscale(1);
  display: block;
}

.logo-reveal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  clip-path: inset(0 100% 0 0);
  filter: drop-shadow(0 0 15px rgba(12, 130, 251, 0.6));
  z-index: 2;
  transition: clip-path 0.3s ease;
}

.logo-reveal img {
  width: 100%;
  height: auto;
  display: block;
}

.scan-line {
  position: absolute;
  top: 0;
  left: 0;
  width: 2px;
  height: 100%;
  background: #0c82fb;
  box-shadow: 0 0 15px #0c82fb, 0 0 30px #0c82fb;
  z-index: 3;
  transition: left 0.3s ease, opacity 0.3s ease;
}

body.preloader-active {
  overflow: hidden;
}

.no-preloader #preloader-v2 {
  display: none !important;
}

/* Preloader Progress Bar */
.progress-container {
  margin-top: 30px;
  width: 100%;
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #0c82fb, #00d4ff);
  width: 0%;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px rgba(12, 130, 251, 0.5);
}

.progress-text {
  margin-top: 10px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
  letter-spacing: 1px;
}

@media (max-width: 1024px) {
  header { flex-direction: row !important; justify-content: space-between; padding: 8px 5% !important; align-items: center; }
  header .logo { height: 52px !important; transform: none !important; filter: none !important; }
  .hamburger { display: flex; margin-left: auto; margin-right: 20px; }
  header nav {
    display: flex; flex-direction: column; position: absolute; top: 100%; right: 0; left: auto; width: 260px;
    background: #fff; padding: 12px; gap: 4px; box-shadow: -5px 10px 30px rgba(0,0,0,0.15); border-radius: 0 0 0 12px; z-index: -1;
    border: 1px solid var(--primary-blue); border-top: none; border-right: none; margin-left: 0 !important; opacity: 0; visibility: hidden; transform: translateY(-100%);
    transition: all 0.45s cubic-bezier(0.165, 0.84, 0.44, 1); pointer-events: none;
  }
  header nav.open { opacity: 1; visibility: visible; transform: translateY(0); pointer-events: auto; }
  header nav a { padding: 12px 16px !important; font-size: 15px !important; border-radius: 8px; width: 100%; }

  /* Mobile Dropdown Overrides */
  .dropdown-container {
    width: 100%;
  }
  header nav .dropdown-container .dropdown-trigger {
    width: 100%;
    justify-content: space-between;
  }
  .dropdown-menu {
    position: static;
    transform: none !important;
    opacity: 0;
    visibility: hidden;
    height: 0;
    overflow: hidden;
    width: 100%;
    box-shadow: none;
    border: 1px solid transparent;
    padding: 0;
    margin-top: 0;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    background: transparent;
    border-radius: 8px;
  }
  .dropdown-menu::before {
    display: none;
  }
  .dropdown-container.mobile-open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    height: auto;
    padding: 6px 0;
    margin-top: 6px;
    border-color: var(--primary-blue);
  }
  .dropdown-container.mobile-open .dropdown-arrow {
    transform: rotate(180deg);
  }
  header nav .dropdown-container .dropdown-menu a {
    padding: 10px 16px !important;
    font-size: 14px !important;
    border-radius: 0 !important;
  }
}

/* -------------------------------------- */
/* ESTILOS GLOBAIS DE TÍTULOS DE SECÇÃO   */
/* -------------------------------------- */
.reveal-title {
  font-size: 38px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-black); /* PRETO por defeito, conforme pedido */
  position: relative;
  display: inline-block !important; /* CRUCIAL: impede que a linha ocupe a largura do ecrã */
  margin-bottom: 25px;
  cursor: default;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s ease-out, transform 0.7s ease-out, color 0.3s ease;
}

.reveal-title.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-title.visible:hover {
  color: #0c82fb; /* AZUL APENAS AO PASSAR O RATO */
}

/* O Efeito Mola Global */
.reveal-title::after {
  content: "";
  position: absolute;
  bottom: -15px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 4px;
  background: #0c82fb; /* A linha é sempre azul */
  border-radius: 2px;
  transition: width 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.reveal-title.visible::after {
  width: 120px; /* Linha inicial mais visível */
}

/* Estica a 100% do texto com mola */
.reveal-title.visible:hover::after {
  width: 100%;
}
