:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --primary: #0057a3;       /* colore principale un po' più scuro e serio */
  --success: #28a745;       /* verde per entrate, più banking */
  --danger: #dc3545;        /* rosso più sobrio per uscite */
  --text: #2c3e50;          /* grigio scuro */
  --muted: #7f8c8d;         /* grigio medio */
  --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  --border-radius: 10px;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

body {
  font-family: var(--font-family);
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 40px 20px;
  display: flex;
  justify-content: center;
  min-height: 100vh;
}

.container {
  background: var(--card);
  padding: 40px 35px;
  border-radius: var(--border-radius);
  max-width: 650px;
  width: 100%;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 25px;
}

header {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative; /* Per posizionare il logo a destra */
  margin-bottom: 10px;
}

header h1 {
  font-weight: 700;
  font-size: 1.8rem;
  color: var(--primary);
  margin: 0;
  text-align: center;
  flex: 1;
}

header img {
  position: absolute;
  right: 0;
  height: 40px;
  user-select: none;
}

/* Label e form */
label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text);
}

select,
input[type="text"],
input[type="number"],
input[type="date"] {
  width: 100%;
  padding: 12px 14px;
  margin-top: 5px;
  border-radius: var(--border-radius);
  border: 1.8px solid #d1d9e6;
  font-size: 16px;
  box-sizing: border-box;
  transition: border-color 0.3s ease;
}

select:focus,
input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 6px rgba(0, 87, 163, 0.4);
}

/* Bottoni */
button {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 12px 20px;
  margin-top: 10px;
  margin-right: 10px;
  border-radius: var(--border-radius);
  font-size: 16px;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.04em;
  box-shadow: 0 3px 8px rgba(0, 87, 163, 0.3);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

button:hover {
  background: #003d75;
  box-shadow: 0 6px 12px rgba(0, 61, 117, 0.5);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Lista transazioni */
.transazioni {
  margin-top: 30px;
}

ul#lista {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 320px;
  overflow-y: auto;
  border-radius: var(--border-radius);
  border: 1.5px solid #e1e8f0;
  background: #fafbfc;
  box-shadow: inset 0 0 6px #eaeef4;
}

ul#lista li {
  padding: 14px 18px;
  margin: 0;
  border-left: 6px solid;
  background: #fff;
  border-radius: 0 10px 10px 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  font-weight: 500;
  font-size: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.entrata {
  border-color: var(--success);
  color: var(--success);
}

.uscita {
  border-color: var(--danger);
  color: var(--danger);
}

/* Saldo */
#saldoContainer {
  margin-top: 30px;
  font-size: 24px;
  text-align: right;
  color: var(--primary);
  font-weight: 700;
  letter-spacing: 0.05em;
  user-select: none;
}

#saldo {
  font-weight: 900;
  font-size: 28px;
}

/* Responsive */
@media (max-width: 500px) {
  .container {
    padding: 25px 20px;
  }

  button {
    width: 100%;
    margin-right: 0;
    margin-bottom: 10px;
  }
}

/* Gruppi form */
.form-group {
  margin-bottom: 22px;
}

/* Navigazione */
.navbar {
  display: flex;
  justify-content: space-around;
  background-color: var(--card);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  margin-bottom: 30px;
  padding: 10px 0;
}

.navbar a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 16px;
  padding: 8px 14px;
  transition: background 0.2s ease, color 0.2s ease;
  border-radius: var(--border-radius);
}

.navbar a:hover,
.navbar a.active {
  background-color: rgba(0, 87, 163, 0.1);
  color: var(--primary);
}

/* Sezioni visibili / nascoste */
.page {
  display: none;
}

.page.active {
  display: block;
}

/* --- SEZIONE CONTO --- */
#conto {
  padding: 30px 25px;
  max-width: 600px;
  margin: 0 auto;
  background: var(--card);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  font-family: var(--font-family);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

#conto h1 {
  text-align: center;
  margin-bottom: 25px;
  font-weight: 700;
  color: var(--primary);
  font-size: 2rem;
  user-select: none;
}

#saldoContainer {
  font-weight: 700;
  font-size: 1.5em;
  margin-bottom: 20px;
  text-align: center;
  color: var(--primary);
  user-select: none;
  padding: 10px 0;
  border-radius: var(--border-radius);
  background: #e6f0fc; /* leggera tonalità azzurra per evidenziare */
  box-shadow: inset 0 0 8px rgba(0, 87, 163, 0.15);
}

#lista {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 350px;
  overflow-y: auto;
  border-radius: var(--border-radius);
  border: 1.5px solid #d9e6f2;
  background: #f9fbfe;
  box-shadow: inset 0 0 10px #dbe5f7;
}

#lista li {
  background-color: var(--card);
  border-left: 6px solid transparent;
  padding: 14px 18px;
  margin-bottom: 14px;
  box-shadow: 0 3px 6px rgba(0,0,0,0.06);
  font-size: 1.05em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 6px;
  color: var(--text);
  transition: background-color 0.25s ease;
}

#lista li.entrata {
  border-left-color: var(--success);
  color: var(--success);
}

#lista li.uscita {
  border-left-color: var(--danger);
  color: var(--danger);
}

#lista li:hover {
  background-color: #eef5fc;
}

#mostraAltroBtn {
  display: block;
  margin: 25px auto 0;
  padding: 12px 28px;
  font-size: 1.1em;
  background-color: var(--primary);
  border: none;
  color: white;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(0, 87, 163, 0.4);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  user-select: none;
}

#mostraAltroBtn:hover {
  background-color: #003d75;
  box-shadow: 0 6px 14px rgba(0, 61, 117, 0.6);
}
input[type="text"],
input[list] {
  width: 100%;
  padding: 12px 14px;
  margin-top: 5px;
  border-radius: var(--border-radius);
  border: 1.8px solid #d1d9e6;
  font-size: 16px;
  box-sizing: border-box;
  transition: border-color 0.3s ease;
  background-color: #fff;
  color: var(--text);
  font-family: var(--font-family);
}
input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[list]:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 6px rgba(0, 87, 163, 0.4);
}

:root {
  --primary: #007bff;
  --primary-hover: #0056b3;
  --muted: #6c757d;
  --card: #fff;
  --border-radius: 12px;
  --shadow: 0 6px 20px rgba(0, 123, 255, 0.2);
}

#login-form {
  max-width: 400px;
  margin: 5rem auto;
  background: var(--card);
  padding: 50px 40px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 30px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  transition: transform 0.3s ease;
}

#login-form:hover {
  transform: translateY(-5px);
}

#login-form h2 {
  text-align: center;
  font-size: 2rem;
  color: var(--primary);
  font-weight: 800;
  margin-bottom: 0;
  letter-spacing: 1.2px;
}

#login-form input[type="text"],
#login-form input[type="password"] {
  padding: 18px 20px;
  border-radius: var(--border-radius);
  border: 2px solid #ccc;
  font-size: 1.1rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  box-sizing: border-box;
}

#login-form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(0, 123, 255, 0.6);
  background-color: #e9f2ff;
}

#login-form button[type="submit"] {
  background: var(--primary);
  color: white;
  font-weight: 900;
  padding: 18px 0;
  border-radius: var(--border-radius);
  font-size: 1.2rem;
  cursor: pointer;
  border: none;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 5px 15px rgba(0, 123, 255, 0.4);
  user-select: none;
}

#login-form button[type="submit"]:hover,
#login-form button[type="submit"]:focus {
  background-color: var(--primary-hover);
  box-shadow: 0 8px 20px rgba(0, 86, 179, 0.7);
  outline: none;
}

#forgot-password {
  display: block;
  text-align: center;
  margin-top: 15px;
  font-size: 1rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.3s ease;
  user-select: none;
}

#forgot-password:hover,
#forgot-password:focus {
  color: var(--primary);
  text-decoration: underline;
  outline: none;
}
#confirmExitPopup {
  display: none;
  position: absolute;
  top: -130px; /* Posiziona sopra il bottone */
  right: 0;
  background: var(--card);
  border: 1px solid #ccc;
  padding: 14px 16px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  border-radius: var(--border-radius);
  z-index: 100;
  font-family: var(--font-family);
  color: var(--text);
  width: max-content;
  max-width: 250px;
}
#confirmExitPopup {
  display: none;
  position: absolute;
  top: -130px; /* Posiziona sopra il bottone */
  right: 0;
  background: var(--card);
  border: 1px solid #ccc;
  padding: 14px 16px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  border-radius: var(--border-radius);
  z-index: 100;
  font-family: var(--font-family);
  color: var(--text);
  width: max-content;
  max-width: 250px;
}
