html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: sans-serif;
  display: flex;
  flex-direction: column;
  box-sizing: border-box; /* importante per evitare sbordi */
}

/* Header */
header.agros-header {
  display: flex;
  flex-direction: column;
  width: 100%;
  flex: 0 0 auto;
}

/* Topbar: logo a sinistra, titolo al centro, utente a destra */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background-color: #212529;
  color: #fff;
}

.topbar .logo {
  height: 64px;
  justify-self: start;
}

.topbar .title {
  margin: 0;
  text-align: center;
  font-size: 28px;
  letter-spacing: 0.25rem;
}

.userbox {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 12px;
}

.userbox .username {
  font-weight: 600;
}

.userbox .logout {
  color: #ffd1d1;
  text-decoration: none;
  font-weight: 600;
}

.userbox .logout:hover {
  text-decoration: underline;
}

/* Nav full-width sotto la topbar */
.mainnav {
  display: flex;
  justify-content: center; /* centra i link */
  align-items: center;
  gap: 20px;
  padding: 8px 0; /* solo top/bottom, no sbordi laterali */
  width: 100%;
  background-color: #0d6efd;
  border-top: 1px solid rgba(255,255,255,0.15);
  box-sizing: border-box;
}

.mainnav a {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}

.mainnav a:hover {
  text-decoration: underline;
}

/* Footer */
footer {
  height: 40px;
  background-color: #0d6efd;
  color: white;
  text-align: center;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.1);
  z-index: 10;
}

/* === COMMON === */
main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

/* === PAGE: MAP === */
body.page-map main {
  padding-bottom: 60px;
}

body.page-map #map {
  flex: 1 1 auto;
  height: 100%;
}

/* === PAGE: CHART === */
body.page-chart main {
  padding: 20px;
  padding-bottom: 80px;
}

body.page-chart .chart-container {
  margin-bottom: 30px;
}

/* === Scelta zona - label + bottone === */
.zone-form {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  background-color: #f8f8f8;
  border-bottom: 1px solid #ddd;
}

.zone-form label {
  font-weight: bold;
}

.zone-form select {
  padding: 0.5rem;
  font-size: 1rem;
  border-radius: 4px;
  border: 1px solid #ccc;
}

.zone-form button {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  background-color: #0d6efd;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.zone-form button:hover {
  background-color: #212529;
}

/* Responsive */
@media (max-width: 600px) {
  .topbar .logo { height: 48px; }
  .topbar .title { font-size: 22px; letter-spacing: 0.15rem; }
  .mainnav { gap: 14px; }
}

.userbox {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px; /* spazio tra username e logout */
  white-space: nowrap; /* impedisce che vada a capo */
}

body.page-login {
    /* Sfondo con immagine e overlay semitrasparente bianco */
    background: linear-gradient(rgba(255,255,255,0.6), rgba(255,255,255,0.6)),
                url('img/smartagriculture.jpg') no-repeat center center fixed;
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: fixed;

    /* Assicura che l’altezza copra tutto lo schermo */
    min-height: 100vh;
    margin: 0;
    padding: 0;

    /* Centra contenuto se vuoi */
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Centra il form */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 70vh;
}

.login-form {
  background: #fff;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 0 15px rgba(0,0,0,0.2);
  width: 300px;
  display: flex;
  flex-direction: column;
}

.login-form h2 {
  text-align: center;   
  margin-bottom: 1.5rem;
}

.login-form label {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  font-weight: bold;
}

.login-form input {
  padding: 0.5rem;
  border-radius: 6px;
  border: 1px solid #ccc;
}

.login-form button {
  margin-top: 1.5rem;
  padding: 0.75rem;
  border: none;
  border-radius: 8px;
  background-color: #007bff;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
}

.login-form button:hover {
  background-color: #0056b3;
}

.title-img {
  height: 50px; /* regola secondo necessità */
  margin-left: 10px; /* spazio tra logo e scritta */
  vertical-align: middle; /* allineamento verticale con il logo */
}

/* POP-up responsive

/* popup base */
.popup-content {
  font-size: 0.9rem;
  line-height: 1.4;
}

/* popup mobile */
.popup-content.mobile-popup {
  font-size: 2rem;
  line-height: 1.6;
  padding: 12px 16px;
}
