:root {
  --blue-navy: #1f2a44;
  --blue-accent: #2f5fa7;
  --beige-light: #f4f1ec;
  --beige-medium: #e8e3da;
  --header-h: 80px; /* Valor inicial fallback */
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background: #f4f1ec;
  color: #333;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ================= HEADER ================= */
header {
  padding: 16px 28px;
  border-bottom: 3px solid var(--blue-navy);
  background: var(--blue-navy);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.header-left {
  min-width: 220px;
}

.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

header h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 600;
  color: var(--beige-medium);
}

.subtitle {
  margin: 4px 0 0 0;
  font-size: 14px;
  color: var(--beige-medium);
  font-style: italic;
  opacity: 0.85;
}

/* Language switcher */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lang-btn {
  padding: 6px 8px;
  border: 1px solid rgba(255,255,255,0.35);
  background: transparent;
  color: #fff;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
}

.lang-btn.active {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.65);
}

/* Botão do Menu Hambúrguer (Escondido no Desktop) */
#menuToggle {
  display: none; /* Padrão desktop */
  padding: 6px 12px;
  font-size: 18px;
  border: 1px solid #c8c1b5;
  background: #ffffff;
  color: #1f2a44;
  cursor: pointer;
  border-radius: 4px;
  line-height: 1;
}

#menuToggle:hover {
  background: #e8e3da;
}

/* ================= MAIN LAYOUT ================= */
.container {
  display: flex;
  flex-direction: column;
  flex: 1;
  position: relative; /* Necessário para posicionar sidebar mobile */
}

/* Sidebar (Menu de Navegação) - Estilo Desktop Padrão */
.sidebar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background: #f4f1ec;
  padding: 0 24px;
  border-bottom: 1px solid #d8d2c7;
  box-sizing: border-box;
  z-index: 100;
}

.sidebar button {
  flex: 1;
  text-align: center;
  padding: 14px 16px;
  margin-bottom: 6px; /* Para o border bottom effect */
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 15px;
  color: #1f2a44;
  position: relative;
  transition: all 0.2s ease;
}

.sidebar button:hover {
  background: var(--beige-medium);
  color: var(--blue-accent);
}

.sidebar button.active {
  font-weight: 600;
  color: var(--blue-navy);
}

.sidebar button.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 20%;
  width: 60%;
  height: 3px;
  background: var(--blue-navy);
  border-radius: 2px;
}

/* Conteúdo Principal */
.content {
  flex: 1;
  position: relative;
  background: #f4f1ec;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#textContent {
  max-width: 900px;
  margin: 40px auto;
  padding: 0 24px;
  font-size: 16px;
  line-height: 1.6;
  color: #333;
}

#textContent h2 {
  font-size: 24px;
  color: #1f2a44;
  margin-bottom: 16px;
}

/* Map Loader & Iframe */
.map-loading {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-style: italic;
  color: #666;
  background: rgba(244, 241, 236, 0.85);
  z-index: 10;
}

iframe {
  width: 100%;
  flex: 1;
  min-height: 520px;
  height: auto;
  border: none;
  display: none;
  background: #ffffff;
}

/* Figures */
.figure {
  margin: 24px auto;
  padding: 14px;
  max-width: 900px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  text-align: center;
}

.figure img {
  width: 100%;
  max-width: 800px;
  height: auto;
  border-radius: 10px;
}

.figure-caption {
  margin-top: 8px;
  font-size: 13px;
  color: #374151;
  font-style: italic;
}

/* ================= FOOTER ================= */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 28px;
  background: var(--beige-light);
  border-top: 3px solid var(--blue-navy);
  font-size: 14px;
  color: var(--blue-navy);
  flex-shrink: 0;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-left .logo-box {
  width: 90px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer-left .logo-box img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
}

.footer-right {
  text-align: right;
  line-height: 1.4;
}


/* ================= RESPONSIVE (MOBILE) ================= */
@media (max-width: 768px) {
  
  /* Header adjustments */
  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .header-top {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }

  .header-right {
    width: 100%;
    justify-content: space-between;
  }

  /* Exibir botão hambúrguer */
  #menuToggle {
    display: inline-block;
  }

  /* Sidebar vira menu lateral (drawer) */
  .sidebar {
    position: fixed;
    top: var(--header-h, 110px); /* Usa a variável calculada pelo JS */
    left: 0;
    width: 100%;
    max-width: 300px; /* Opcional: limitar largura */
    height: calc(100vh - var(--header-h, 110px));
    flex-direction: column;
    justify-content: flex-start;
    background: #ffffff;
    box-shadow: 2px 0 12px rgba(0,0,0,0.2);
    border-right: 1px solid #d8d2c7;
    border-bottom: none;
    padding: 0;
    
    /* Animação de entrada */
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  /* Classe .open adicionada via JS ao clicar no hambúrguer */
  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar button {
    width: 100%;
    text-align: left;
    padding: 16px 24px;
    margin: 0;
    border-bottom: 1px solid #eee;
    font-size: 16px;
  }
  
  .sidebar button.active::after {
    left: 0;
    width: 4px;
    height: 100%;
    top: 0;
  }

  /* Footer adjustments */
  .footer {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }

  .footer-left {
    flex-wrap: wrap;
    justify-content: center;
  }

  .footer-right {
    text-align: center;
  }

  /* Figures adjustments */
  .figure {
    padding: 12px;
    margin: 18px auto;
  }
}