/* Reset e base */ 
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  scroll-behavior: smooth;
}

body {
  background: url('sfondo.png') repeat;
  background-color: #f5faff;
  color: #2c3e50;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

@media (max-width: 600px) {
  body { padding: 10px; }
}

/* Container “card” */
.container {
  width: 100%;
  max-width: 720px;
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  margin-bottom: 40px;
}
.container h2 {
  text-align: center;
  margin-bottom: 24px;
  color: #34495e;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Form e input */
form label {
  display: block;
  margin-bottom: 16px;
  font-weight: 600;
  color: #3b3b3b;
}
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
input[type="file"] {
  width: 100%;
  padding: 10px;
  border: 1.8px solid #ccc;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color .25s, box-shadow .25s;
}
input:focus,
textarea:focus,
input[type="file"]:focus {
  border-color: #5dade2;
  box-shadow: 0 0 8px rgba(93,173,226, .6);
  outline: none;
}
textarea {
  resize: vertical;
  min-height: 80px;
}

/* Pulsanti */
.button {
  display: block;
  width: 100%;
  padding: 12px;
  margin-top: 8px;
  background: #3498db;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .3s, transform .2s;
}
.button:hover {
  background: #217dbb;
  transform: scale(1.02);
}

.btn-small {
  display: inline-block;
  padding: 6px 10px;
  font-size: 0.85rem;
  border-radius: 6px;
  background: #5dade2;
  color: #fff;
  border: none;
  margin-top: 8px;
  text-decoration: none;
  transition: background .3s;
}
.btn-small:hover {
  background: #3498db;
}

/* Lista risultati (ricerca) */
ul {
  list-style: none;
  margin-top: 24px;
}
li {
  background: #ecf0f1;
  padding: 16px;
  margin-bottom: 16px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
li:hover {
  background: #d6e9fb;
}

/* Link di ritorno */
.back-link {
  display: inline-block;
  margin-top: 20px;
  color: #2980b9;
  text-decoration: none;
  font-weight: 600;
  transition: color .3s;
}
.back-link:hover {
  color: #1b4f72;
  text-decoration: underline;
}

/* Errori */
.error {
  color: #c0392b;
  margin-bottom: 16px;
}

/* Registro Contatti: stile tabella */
#registro-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
#registro-table thead {
  background: linear-gradient(90deg, #74ebd5 0%, #ACB6E5 100%);
}
#registro-table th {
  padding: 12px 16px;
  color: #fff;
  text-transform: uppercase;
  font-size: 0.9rem;
  text-align: left;
}
#registro-table td {
  padding: 12px 16px;
  background: #fff;
  font-size: 0.9rem;
  color: #333;
  border-bottom: 1px solid #ececec;
}
#registro-table tbody tr:nth-child(2n) td {
  background: #f7f9fa;
}
#registro-table tbody tr:hover td {
  background: #e0f7fa;
}

@media (max-width: 600px) {
  .container {
    padding: 16px;
    max-width: 100%;
  }
  #registro-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
  #registro-table thead,
  #registro-table tbody,
  th,
  td,
  tr {
    display: inline-block;
    vertical-align: top;
  }
  #registro-table thead {
    position: sticky;
    top: 0;
  }
}

/* Stato connessione server (DB) */
.server-status {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: #e0f8e9;
  color: #2e7d32;
  padding: 12px 24px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  z-index: 999;
  transition: background 0.3s, color 0.3s;
}

.server-status.offline {
  background: #fdecea;
  color: #c0392b;
}

/* Pulsante informazioni (rettangolare in basso a destra) */
.info-button {
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: #3498db;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  z-index: 1001;
}
.info-button:hover {
  background: #217dbb;
}

/* Modale sfondo */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.4);
}

/* Modale contenuto */
.modal-content {
  background-color: #fff;
  margin: 80px auto;
  padding: 24px;
  border-radius: 12px;
  max-width: 480px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  position: relative;
}

/* X di chiusura */
.modal-content .close {
  color: #888;
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 1.4rem;
  font-weight: bold;
  cursor: pointer;
}
.modal-content .close:hover {
  color: #000;
}

/* Lista link info */
ul.info-links {
  list-style: none;
  padding-left: 0;
}
ul.info-links li {
  margin-bottom: 8px;
}
ul.info-links a {
  color: #2e86de;
  text-decoration: none;
}
ul.info-links a:hover {
  text-decoration: underline;
}

/* Immagine assistenza */
.image-container {
  margin-top: 16px;
}
.image-container img {
  max-width: 100%;
  border-radius: 10px;
}