/* --- Modal --- */
.modal {
  display: none;
  position: fixed;
  z-index: 1050;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  justify-content: center;
  align-items: center;
  padding: 1rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-content {
  background: #fff;
  border-radius: 12px;
  width: 420px;
  max-width: 100%;
  padding: 2.5rem 3rem;
  box-shadow: 0 10px 30px rgba(165,42,42,0.3);
  position: relative;
  font-family: 'Montserrat', sans-serif;
  color: #333;
  max-height: 90vh;
  overflow-y: auto;
}

.close-btn {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 2rem;
  background: none;
  border: none;
  cursor: pointer;
  color: #a52a2a;
  transition: color 0.3s ease;
  padding: 0;
  line-height: 1;
}

.close-btn:hover,
.close-btn:focus {
  color: #7a1d1d;
  outline: none;
}

.register-tab-buttons {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.8rem;
  justify-content: center;
  flex-wrap: wrap;
}

.tab-btn {
  flex: 1 1 30%;
  min-width: 90px;
  padding: 0.7rem 0;
  background: #f7f7f7;
  border: none;
  border-radius: 10px 10px 0 0;
  font-weight: 700;
  font-size: 1.05rem;
  color: #666;
  cursor: pointer;
  transition: background-color 0.3s ease, color 0.3s ease;
  text-align: center;
  user-select: none;
}

.tab-btn.active,
.tab-btn:focus {
  background: #a52a2a;
  color: #fff;
  outline: none;
  box-shadow: 0 4px 12px rgba(165,42,42,0.5);
}

.form {
  display: none;
  flex-direction: column;
}

.form.active {
  display: flex;
}

.tab-content {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}

.tab-content.active {
  display: block;
}

form label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
  color: #4a4a4a;
  font-size: 1rem;
}

form input {
  width: 100%;
  padding: 0.65rem 0rem;
  margin-bottom: 1.3rem;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

form input:focus {
  border-color: #a52a2a;
  outline: none;
}

.btn-submit {
  background-color: #a52a2a;
  color: white;
  border: none;
  padding: 0.85rem 0;
  border-radius: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  cursor: pointer;
  transition: background-color 0.3s ease;
  box-shadow: 0 4px 10px rgba(165,42,42,0.4);
  user-select: none;
}

.btn-submit:hover,
.btn-submit:focus {
  background-color: #7a1d1d;
  box-shadow: 0 6px 15px rgba(122,29,29,0.6);
  outline: none;
}

.switch-text {
  text-align: center;
  font-size: 1rem;
  margin-top: 1.3rem;
  color: #555;
}

.switch-text a {
  color: #a52a2a;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  transition: color 0.3s ease;
}

.switch-text a:hover,
.switch-text a:focus {
  color: #7a1d1d;
  outline: none;
}

@keyframes fadeIn {
  from {opacity: 0; transform: translateY(10px);}
  to {opacity: 1; transform: translateY(0);}
}

/* --- Header Mobile --- */
.header-mobile {
  display: none; /* nascosto su desktop */
  background: #fff;
  border-bottom: 1px solid #ddd;
  font-family: 'Montserrat', sans-serif;
}

/* Logo centrato in alto */
.header-mobile .header-top {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem 0;
}

.header-mobile .logo-img {
  max-height: 50px;
  width: auto;
}

/* Riga sotto: hamburger, ricerca, login */
.header-mobile .header-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem 1rem;
  gap: 0.8rem;
  background: #f9f9f9;
}

/* Hamburger */
.header-mobile .hamburger {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 28px;
  height: 22px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
}

.header-mobile .hamburger-bar {
  height: 3px;
  background-color: #37403c;
  border-radius: 2px;
}

/* Barra ricerca */
.header-mobile .search-form {
  flex: 1;
  display: flex;
  align-items: center;
  background: #f0f0e6;
  border-radius: 6px;
  overflow: hidden;
  height: 36px;
}

.header-mobile .search-form input {
  border: none;
  padding: 0 0.75rem;
  font-size: 1rem;
  outline: none;
  width: 100%;
  background: transparent;
}

.header-mobile .search-form button {
  border: none;
  background: #a52a2a;
  color: white;
  padding: 0 0.8rem;
  cursor: pointer;
  font-size: 1.1rem;
  transition: background-color 0.3s ease;
}

.header-mobile .search-form button:hover {
  background-color: #7a1d1d;
}

/* Icona login */
.header-mobile .login-link {
  color: #37403c;
  font-size: 1.6rem;
  text-decoration: none;
  display: flex;
  align-items: center;
}

/* Menu mobile nascosto */
.header-mobile .mobile-menu {
  display: none;
  background: #f0f0e6;
  padding: 1rem;
  border-top: 1px solid #ccc;
  box-shadow: inset 0 1px 4px rgba(0,0,0,0.1);
}

.header-mobile .menu-section {
  margin-bottom: 1.5rem;
}

.header-mobile .menu-section h3 {
  font-weight: 700;
  margin-bottom: 0.8rem;
  color: #7e8a6e;
  font-size: 1.1rem;
}

.header-mobile .menu-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.header-mobile .menu-section ul li {
  margin-bottom: 0.6rem;
}

.header-mobile .menu-section ul li a {
  color: #37403c;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  transition: color 0.3s ease;
}

.header-mobile .menu-section ul li a:hover {
  color: #a52a2a;
}

/* Mostra menu quando attivo */
.header-mobile .mobile-menu.active {
  display: block;
}

/* Mostra header mobile solo sotto 991px */
@media (max-width: 991px) {
  .header-mobile {
    display: block;
  }
  .navbar,
  .topbar {
    display: none;
  }
}

/* Responsive input search */
@media (min-width: 600px) {
  .header-mobile .search-form input {
    width: 250px;
  }
}

@media (max-width: 599px) {
  .header-mobile .search-form input {
    width: 140px;
  }
}
