/* style.css */

* {
  box-sizing: border-box;
}

body {
  background-color: white;
  color: #222;
  margin: 0;
  font-family: Arial, sans-serif;
}

.top-bar {
  background-color: #003366;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 30px;
  position: fixed;
  width: 100%;
  top: 0;
  left: 0;
  z-index: 1000;
  transition: background-color 0.3s ease;
}

.top-bar.scrolled {
  background-color: rgba(0, 51, 102, 0.85);
  backdrop-filter: blur(6px);
}

.top-bar img {
  height: 50px;
}

.top-bar nav ul {
  display: flex;
  gap: 20px;
  list-style: none;
  padding: 0;
  margin: 0;
  align-items: center;
}

.top-bar nav ul li a {
  color: white;
  text-decoration: none;
  font-weight: bold;
}

.top-bar .btn-submeter {
  background-color: white;
  color: #003366;
  border: none;
  padding: 8px 16px;
  border-radius: 5px;
  text-decoration: none;
  font-weight: bold;
  cursor: pointer;
  white-space: nowrap;
  margin-left: 20px;
}

section {
  max-width: 960px;
  margin: 30px auto;
  padding: 25px 40px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

section h1,
section h2 {
  color: #003366;
  margin-top: 0;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
  margin-bottom: 20px;
}

.logos {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 30px;
}

.logos img {
  width: 120px;
  height: 80px;
  object-fit: contain;
  padding: 10px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
}

footer {
  max-width: 960px;
  margin: 40px auto;
  padding: 30px 40px;
  color: #222;
  border-top: 2px solid #003366;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  flex-wrap: wrap;
}

footer img {
  max-height: 90px;
}

footer .info {
  text-align: left;
}

.mapa {
  text-align: center;
  margin-top: 30px;
}

.mapa iframe {
  width: 100%;
  max-width: 800px;
  height: 350px;
  border: 0;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

#back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: transparent;
  border: none;
  cursor: pointer;
  display: none;
  z-index: 1000;
}

#back-to-top img {
  height: 40px;
}

/* MODAL CORRECTION START */
.modal {
  display: none; /* Initially hidden */
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  /* These properties will ensure centering when display becomes 'flex' */
  justify-content: center; /* Center horizontally */
  align-items: center;   /* Center vertically */
  overflow: auto; /* Allows scrolling if content overflows */
}

/* This is the class your JavaScript should add to show the modal */
/* Example: modalElement.style.display = 'flex'; OR modalElement.classList.add('show-modal'); */
/* If your JS sets display to 'block', change 'display: flex' below to 'display: block' */
/* and use 'text-align: center' on .modal, with 'margin: auto' on .modal-content */
/* But 'display: flex' on .modal is generally preferred for centering */


.modal-content {
  background: white;
  padding: 20px 30px;
  border-radius: 10px;
  max-width: 500px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  box-sizing: border-box;
  position: relative; /* CRUCIAL: Establishes a positioning context for the absolute 'X' button */
}

.modal-content::-webkit-scrollbar {
  width: 8px;
}

.modal-content::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}

.modal-content h2 {
  margin-top: 0;
  color: #003366;
}

/* ----------------------------------------------------- */
/* AJUSTES PARA ESPAÇAMENTO DOS CAMPOS E BOTÕES NO MODAL */
/* ----------------------------------------------------- */

/* Ajusta o padding interno para dar mais altura aos campos */
.modal-content input[type="text"],
.modal-content input[type="email"],
.modal-content input[type="password"],
.modal-content input[type="tel"],
.modal-content textarea,
.modal-content select {
  display: block;
  width: 100%;
  padding: 10px; /* Mantém o padding para a altura */
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 1em;
  margin-top: 5px; /* Um pequeno margin-top para separar do label */
  margin-bottom: 15px; /* Aumenta a margem inferior para separar do próximo label/botão */
}

/* Aproxima as labels dos campos de texto que se referem */
.modal-content label {
  display: block;
  width: 100%;
  margin-top: 15px; /* Espaçamento entre labels (se houver) ou do elemento anterior */
  margin-bottom: 5px; /* Mais perto do campo abaixo */
  font-weight: bold;
  color: #333;
}

/* Afasta o botão dos campos de texto acima */
.modal-content button {
  background: #003366;
  color: white;
  border: none;
  padding: 10px;
  border-radius: 5px;
  cursor: pointer;
  margin-top: 25px; /* Aumenta a margem superior do botão para afastá-lo do campo acima */
}

/* ----------------------------------------------------- */
/* FIM DOS AJUSTES PARA ESPAÇAMENTO DOS CAMPOS E BOTÕES */
/* ----------------------------------------------------- */

/* Adjustment for the close button (X) */
.modal-close {
  /* float: right; REMOVED: This was a major cause of positioning issues */
  position: absolute; /* Allows positioning relative to its nearest positioned ancestor (.modal-content) */
  right: 15px;       /* Distance from the right edge of .modal-content */
  top: 10px;         /* Distance from the top edge of .modal-content */
  font-weight: bold;
  cursor: pointer;
  color: red;
  font-size: 1.5em;
  line-height: 1; /* Ensures the 'X' is vertically centered within its line-height */
  z-index: 2001; /* Ensures the 'X' is above any content within the modal */
}
/* MODAL CORRECTION END */

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-container {
  display: flex;
  align-items: center;
  gap: 20px;
}

.hamburger-menu {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  width: 30px;
  height: 30px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-left: 20px;
}

.hamburger-menu span {
  width: 100%;
  height: 3px;
  background-color: white;
  border-radius: 2px;
}

.user-info-container {
  display: none; /* Escondido por padrão */
  align-items: center;
  gap: 15px;
  color: white;
}

.user-info-container a {
  color: white;
  text-decoration: none;
  font-weight: bold;
}

@media (max-width: 850px) {
  .nav-container {
    display: none;
  }
  .nav-container.active {
    display: flex;
    position: absolute;
    top: 70px;
    left: 0;
    width: 100%;
    background-color: rgba(0, 51, 102, 0.98);
    flex-direction: column;
    padding: 20px 0;
    gap: 0;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  }
  .nav-container.active nav {
    width: 100%;
  }
  .nav-container.active nav ul {
    flex-direction: column;
    align-items: flex-start;
  }
  .nav-container.active nav ul li {
    padding: 10px 20px;
    text-align: left;
    width: 100%;
  }
  .nav-container.active .btn-submeter {
    margin: 10px 20px;
    text-align: center;
  }
  .hamburger-menu {
    display: flex;
  }
}

.user-greeting {
  color: #f0f0f0;
  font-weight: normal;
  padding: 0 10px;
}

/* Responsividade geral para todas as telas */

/* Para telas muito grandes (desktops ultra-wide) */
@media (min-width: 1200px) {
  section,
  footer {
    max-width: 1140px; /* Aumenta a largura máxima para seções e rodapé */
  }
}

/* Para telas grandes (desktops) */
@media (max-width: 1024px) {
  .top-bar {
    padding: 10px 20px; /* Ajusta o padding da top-bar */
  }

  section {
    padding: 20px 30px; /* Reduz o padding das seções */
  }

  footer {
    padding: 20px 30px; /* Reduz o padding do rodapé */
  }
}

/* Para tablets e telas médias */
@media (max-width: 768px) {
  .top-bar {
    padding: 10px 15px; /* Reduz ainda mais o padding da top-bar */
  }

  .top-bar img {
    height: 45px; /* Reduz o tamanho do logo */
  }

  .top-bar nav ul {
    gap: 15px; /* Reduz o espaço entre os itens de navegação */
  }

  .top-bar .btn-submeter {
    padding: 7px 14px; /* Ajusta o padding do botão */
    margin-left: 15px; /* Ajusta a margem */
  }

  section {
    margin: 20px auto; /* Reduz a margem superior/inferior */
    padding: 15px 20px; /* Reduz o padding das seções */
  }

  section h1,
  section h2 {
    font-size: 1.8em; /* Ajusta o tamanho dos títulos */
    padding-bottom: 10px;
    margin-bottom: 15px;
  }

  .logos img {
    width: 100px; /* Reduz o tamanho das imagens de logo */
    height: 70px;
    padding: 8px;
    gap: 20px; /* Ajusta o espaçamento */
  }

  footer {
    margin: 30px auto; /* Reduz a margem do rodapé */
    padding: 20px 25px; /* Reduz o padding do rodapé */
    flex-direction: column; /* Coloca os itens do rodapé em coluna */
    text-align: center; /* Centraliza o texto no rodapé */
    gap: 20px; /* Reduz o espaçamento entre os itens */
  }

  footer .info {
    text-align: center; /* Centraliza o texto de informação */
  }

  .mapa iframe {
    height: 280px;
  }

  .modal-content {
    padding: 15px 20px; /* Reduz o padding do conteúdo do modal em telas menores */
    margin: 5% auto; /* Ajusta a margem para centralizar melhor */
  }

  .modal-content input[type="text"],
  .modal-content input[type="email"],
  .modal-content input[type="password"],
  .modal-content input[type="tel"],
  .modal-content textarea,
  .modal-content select {
    padding: 8px; /* Ajusta o padding dos inputs em telas menores */
    font-size: 0.95em; /* Ligeiramente menor fonte */
    margin-bottom: 12px; /* Ajusta a margem inferior para telas menores */
  }

  /* Ajuste responsivo para o botão de fechar (X) */
  .modal-close {
    right: 10px; /* Ajusta a distância da direita em telas menores */
    top: 8px;    /* Ajusta a distância do topo em telas menores */
    font-size: 1.3em; /* Reduz um pouco o tamanho do X */
  }
}

/* Para celulares e telas muito pequenas */
@media (max-width: 480px) {
  body {
    font-size: 0.9em;
  }

  .top-bar {
    padding: 8px 10px;
  }

  .top-bar img {
    height: 40px;
  }

  .top-bar nav ul {
    gap: 10px;
  }

  .top-bar nav ul li a {
    font-size: 0.9em;
  }

  .top-bar .btn-submeter {
    padding: 6px 12px;
    margin-left: 10px;
    font-size: 0.85em;
  }

  section {
    margin: 15px auto;
    padding: 15px;
  }

  section h1,
  section h2 {
    font-size: 1.5em;
    padding-bottom: 8px;
    margin-bottom: 10px;
  }

  .logos img {
    width: 80px;
    height: 50px;
    padding: 5px;
    gap: 15px;
  }

  footer {
    margin: 20px auto;
    padding: 15px 20px;
    gap: 15px;
  }

  footer img {
    max-height: 70px;
  }

  .mapa iframe {
    height: 220px;
  }

  .modal-content {
    padding: 15px;
    width: 95%;
    margin: 2.5% auto;
    max-height: 90vh;
  }

  .modal-content label {
    margin-top: 10px;
    margin-bottom: 3px;
  }

  .modal-content input[type="text"],
  .modal-content input[type="email"],
  .modal-content input[type="password"],
  .modal-content input[type="tel"],
  .modal-content textarea,
  .modal-content select {
    padding: 6px;
    font-size: 0.9em;
    margin-top: 3px;
    margin-bottom: 10px;
  }

  .modal-content button {
    padding: 8px;
    font-size: 0.9em;
    margin-top: 20px;
  }

  .modal-close {
    font-size: 1em;
    right: 5px;
    top: 5px;
  }

  #back-to-top img {
    height: 30px;
  }
}