/* Imposta box-sizing globale */
*, *::before, *::after {
  box-sizing: border-box;
}

/* Contenitore della Navbar - larghezza 100% con padding laterale */
#navbar-container {
  width: 100%;
  padding: 0 20px; /* Spazio laterale: modifica questo valore per aumentare o ridurre il margine interno */
  position: relative;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100000;
  background: linear-gradient(135deg, #ff7e5f, #feb47b);
  display: flex;
  justify-content: center;
  align-items: center;
  height: 80px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.3s ease-in-out, opacity 0.3s ease-in-out;
}

/* Placeholder per mantenere lo spazio quando la navbar diventa fixed */
.navbar-placeholder {
  display: none;
  width: 100%;
  height: 80px;
}

/* Navbar fixed */
#navbar-container.fixed {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  background: linear-gradient(135deg, #ff7e5f, #feb47b);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  opacity: 1;
}

/* Nav-links (desktop) */
.nav-links {
  list-style: none;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin: 0;
  padding: 0;
}

/* Link (desktop) */
.nav-links li a {
  text-decoration: none;
  color: #fff;
  font-weight: bold;
  font-size: 18px;
  padding: 10px 14px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background 0.3s ease-in-out;
}

.nav-links li a:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Immagini nei link (desktop) */
.nav-links li a img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

/* Dropdown container */
.dropdown {
  position: relative;
}

/* Dropdown menu (desktop) */
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #ff7e5f, #feb47b);
  list-style: none;
  padding: 12px 0;
  margin: 0;
  width: auto;
  max-width: 300px;
  display: none;
  box-shadow: 0px 4px 6px rgba(0,0,0,0.2);
  border-radius: 8px;
  z-index: 100001;
  text-align: center;
  opacity: 0;
  transition: opacity 0.2s ease-in-out, top 0.2s ease-in-out;
}

.dropdown-menu.active {
  display: block;
  opacity: 1;
}

/* Link interni al dropdown: immagine e testo in colonna, centrati */
.dropdown-menu li a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px 12px;
  color: #fff;
  text-decoration: none;
  font-weight: bold;
  transition: background 0.2s ease-in-out;
}

.dropdown-menu li a:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Immagini nei link del dropdown (desktop) */
.dropdown-menu li a img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  margin-bottom: 4px;
}

/* Modalità Mobile */
@media (max-width: 768px) {
  /* Navbar container centrata con padding laterale */
  #navbar-container {
    justify-content: center;
    padding: 0 0px;
  }
  
  /* Bottone menu hamburger */
  .menu-toggle {
    display: block;
    font-size: 28px;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100002;
  }
  
  /* Nav-links Mobile: con margini laterali (left: 10px; right: 10px) */
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0px;
    right: 0px;
    background: linear-gradient(135deg, #ff7e5f, #feb47b);
    display: none;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    z-index: 100000;
    padding: 10px;
  }
  
  .nav-links.active {
    display: flex;
  }
  
  .nav-links::-webkit-scrollbar {
    display: none;
  }
  
  .nav-links li a {
    font-size: 14px;
    padding: 6px;
  }
  
  .nav-links li a img {
    width: 28px;
    height: 28px;
  }
  
  /* Dropdown Mobile: dimensioni e posizionamento */
  .dropdown-menu {
    transition: none;
    width: 90vw;
    max-width: 90vw;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
    font-size: 12px;
    box-shadow: 0px 4px 6px rgba(0,0,0,0.2);
    border-radius: 8px;
    background: linear-gradient(135deg, #ff7e5f, #feb47b);
  }
  
  /* Link interni al dropdown in mobile: immagine e testo centrati */
  .dropdown-menu li a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 8px 12px;
    white-space: nowrap;
  }
  
  .dropdown-menu li a img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    margin-bottom: 4px;
  }
}
