/* =========================
  STILI NAVBAR
  ========================= */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(to left, #045b99, #02223b);
  padding: 15px 30px;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 10000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  flex-wrap: wrap;
}

/* Effetto hover sul logo */
.navbar .logo a:hover {
  color: #b3c6ff;
}

/* =========================
  LINK DI NAVIGAZIONE
  ========================= */
.nav-links {
  font-family: "Oxanium", sans-serif;
  font-weight: 550;
  font-style: normal;
  font-size: 30px;
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links li {
  margin: 0 20px;
  position: relative;
}

.nav-links a {
  color: white;
  text-decoration: none;
  position: relative;
  transition: color 0.3s ease, transform 0.3s ease;
}

/* Animazione sottolineatura su hover */
.nav-links a::after {
  content: "";
  position: absolute;
  width: 100%;
  transform: scaleX(0);
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: #b3c6ff;
  transform-origin: bottom right;
  transition: transform 0.25s ease-out;
}

.nav-links a:hover::after {
  transform: scaleX(1);
  transform-origin: bottom left;
}

.nav-links a:hover {
  color: #b3c6ff;
  transform: scale(1.1);
}

/* Posizionamento dropdown */
.nav-links .dropdown {
  position: relative;
}

/* =========================
  MENU A DISCESA (DROPDOWN)
  ========================= */
.navbar .dropdown-servizi {
  position: absolute;
  background-color: #02223b;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  display: none;
  max-width: 350px;
  width: max-content;
  word-wrap: break-word;
  word-break: break-word;
  white-space: normal;
  border-radius: 5px;
  padding: 5px 0;
}

/* Mostra il dropdown al passaggio del mouse */
.navbar .dropdown:hover .dropdown-servizi {
  display: block;
}

.navbar .dropdown-servizi a {
  display: block;
  padding: 10px 16px;
  text-decoration: none;
  color: white;
  transition: background-color 0.3s ease;
  white-space: normal;
  word-wrap: break-word;
  word-break: break-word;
}

.navbar .dropdown-servizi a:hover {
  background-color: #b3c6ff;
  color: #02223b;
}

/* =========================
  CONTATTACI BUTTON
  ========================= */
.contattaci-btn {
  background-color: #b3c6ff;
  color: #02223b;
  font-family: "Oxanium", sans-serif;
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 900;
}

.contattaci-btn:hover {
  background-color: #a1b5f5;
}

/* =========================
  OVERLAY & FORM POPUP
  ========================= */
.overlay {
  padding-top: 450px;
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.7);
  justify-content: center;
  align-items: center;
  z-index: 9999;
  overflow-y: auto; /* Vertical scroll if needed */
}

.overlay.active {
  display: flex;
}

.form-popup {
  background-color: #02223b;
  padding: 30px;
  border-radius: 20px;
  width: 90%;
  max-width: 500px;
  color: white;
  font-family: "Oxanium", sans-serif;
  margin: 20px; /* Prevent form from touching screen edges */
  max-height: 90vh; /* Limit max height */
  overflow-y: auto; /* Internal scroll if content too long */
}

.form-popup input,
.form-popup textarea {
  width: 100%;
  padding: 10px;
  margin-top: 8px;
  margin-bottom: 16px;
  border: 1px solid #b3c6ff;
  border-radius: 8px;
  background-color: #013554;
  color: white;
  font-family: "Oxanium", sans-serif;
}

.form-popup button {
  padding: 10px 20px;
  margin-right: 10px;
  border: none;
  border-radius: 8px;
  background-color: #b3c6ff;
  color: #02223b;
  font-family: "Oxanium", sans-serif;
  cursor: pointer;
}

.form-popup button:hover {
  background-color: #a1b5f5;
}

/* =========================
  NAVBAR SPACER
  ========================= */
.navbar-spacer {
  height: 120px; /* or calc(100% of navbar) */
}

/* =========================
  BODY PADDING FOR NAVBAR
  ========================= */
body {
  padding-top: 120px; /* default for desktop */
}

/* =========================
  MEDIA QUERIES RESPONSIVE NAVBAR
  ========================= */
@media (max-width: 1024px) {
  .logo {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-bottom: 10px;
}

.logo img {
  width: 80px;
  height: auto;
}
  .navbar {
   flex-direction: column;
   align-items: stretch;
   padding: 10px 20px;
  }
  
  .nav-links {
    align-items: center;
   flex-direction: column;
   width: 100%;
   font-size: 24px;
  }

  
  .nav-links li {
   margin: 10px 0;
   text-align: center;
  }

  .contattaci-btn {
   margin-top: 10px;
   width: 100%;
   font-size: 18px;
  }

  .navbar .dropdown-servizi {
   position: static;
   box-shadow: none;
   background-color: transparent;
   padding: 0;
  }

  .navbar .dropdown-servizi a {
   padding: 10px;
   background-color: #02223b;
   margin-top: 2px;
  }

  body {
   padding-top: 200px; /* more height in responsive */
  }

  .navbar-spacer {
   height: 200px;
  }
}

@media (max-width: 768px) {
  .logo img {
  width: 60px;
}

  .nav-links {
   align-items: center;
   font-size: 20px;
  }

  .contattaci-btn {
   font-size: 16px;
   padding: 8px 16px;
  }

  .form-popup {
   padding: 20px;
   width: 95%;
  }

  .form-popup h2 {
   font-size: 22px;
  }

  .form-popup button {
   font-size: 14px;
  }
}
