/* =========================
   Global Styles - MI Supporti?!
   ========================= */

/* Reset base */
body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  background-color: #f5f7fa;
  color: #2c3e50;
}

/* Titoli */
h1, h2, h3, h4 {
  margin: 0 0 15px 0;
  font-weight: 600;
  color: #2c3e50;
}

/* Contenitori generici */
.section-box {
  background: #ffffff;
  padding: 20px;
  margin-bottom: 20px;
  border-radius: 10px;
  box-shadow: 0 1px 5px rgba(0,0,0,0.08);
}

/* -------------------------
   Form / Layout comuni
   ------------------------- */

.form-container {
  max-width: 1200px;
  margin: 30px auto;
  padding: 20px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px,1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.info-block {
  display: flex;
  flex-direction: column;
}
.info-block label {
  font-weight: 600;
  font-size: 13px;
  color: #34495e;
  margin-bottom: 4px;
}
.info-block input,
.info-block select {
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #ccc;
  background: #f9f9f9;
  font-size: 14px;
}
.info-block input:focus,
.info-block select:focus {
  border-color: #1abc9c;
  background: #fff;
  outline: none;
}

/* Pulsanti */
button, .btn {
  cursor: pointer;
  border: none;
  border-radius: 6px;
  padding: 10px 18px;
  font-size: 14px;
  line-height: 1.3;
  background-color: #2c3e50;
  color: #fff;
  transition: background-color .2s ease-in-out, transform .1s ease-in-out;
  max-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
button:hover, .btn:hover { background-color: #1abc9c; }
button:active, .btn:active { transform: scale(0.97); }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 15px;
  margin-top: 10px;
}
.btn-save { background-color: #2c3e50; color: #fff; }
.btn-save:hover { background-color: #1abc9c; }
.btn-cancel { background-color: #7f8c8d; color: #fff; }
.btn-cancel:hover { background-color: #95a5a6; }

.submit-btn {
  grid-column: 1 / -1;
  justify-self: center;
  margin-top: 20px;
  background-color: #2c3e50;
  color: white;
  padding: 12px 25px;
  font-size: 16px;
  border-radius: 6px;
  cursor: pointer;
  max-height: 48px;
}
.submit-btn:hover { background-color: #1abc9c; }

/* -------------------------
   Sezioni affiancate
   ------------------------- */

.dual-section {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  max-width: 1200px;
  margin: 30px auto;
}
.dual-section > div {
  flex: 1;
  background: #fff;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 1px 5px rgba(0,0,0,0.08);
}

/* -------------------------
   Griglie di card (strumenti/corsi)
   ------------------------- */

.strumenti-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px,1fr));
  gap: 15px;
}

.strumento-card {
  background: #fafafa;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}
.strumento-card img {
  max-width: 80px;
  margin-bottom: 8px;
}
.strumento-card button {
  background-color: #e74c3c;
  color: #fff;
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
.strumento-card button:hover { background-color: #c0392b; }

/* -------------------------
   Toast (Flash notifications)
   ------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  min-width: 260px;
  max-width: 520px;
  padding: 12px 14px;
  border-radius: 8px;
  background-color: #333;
  color: #fff;
  text-align: center;
  z-index: 9999;
  font-size: 14px;
  line-height: 1.35;
  box-shadow: 0 6px 18px rgba(0,0,0,.15);
  opacity: 0;
  visibility: hidden;
  transition: opacity .35s ease, bottom .35s ease, visibility .35s ease;
}
.toast.show {
  visibility: visible;
  opacity: 1;
  bottom: 50px;
}
/* Varianti coerenti con showToast(type) */
.toast.success { background-color: #1b5e20; }  /* verde */
.toast.info    { background-color: #0d47a1; }  /* blu   */
.toast.warning { background-color: #7a5a00; }  /* giallo scuro */
.toast.danger  { background-color: #b3261e; }  /* rosso */
/* Alias retrocompatibile */
.toast.error   { background-color: #b3261e; }

/* -------------------------
   Flash list (fallback HTML)
   ------------------------- */
.flash-container {
  max-width: 600px;
  margin: 20px auto;
}
.flash {
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 4px;
  font-size: 14px;
  text-align: center;
}
.flash.success { background-color: #d4edda; color: #155724; }
.flash.danger  { background-color: #f8d7da; color: #721c24; }
.flash.warning { background-color: #fff3cd; color: #856404; }

/* -------------------------
   Navbar - Notifiche
   ------------------------- */

.badge-notifiche {
  position: absolute;
  top: -5px;
  right: -10px;
  background-color: red;
  color: white;
  border-radius: 50%;
  padding: 3px 6px;
  font-size: 12px;
}

.dropdown-menu-notifiche {
  display: none;
  position: absolute;
  top: 30px;
  right: 0;
  background-color: white;
  border: 1px solid #ccc;
  z-index: 1000;
  list-style: none;
  padding: 5px 10px;
  width: 260px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  border-radius: 6px;
}
.dropdown-menu-notifiche.show { display: block; }
.dropdown-menu-notifiche li { padding: 5px 0; }
.dropdown-menu-notifiche a {
  text-decoration: none;
  color: #2c3e50;
  font-size: 14px;
}
.dropdown-menu-notifiche a:hover { color: #1abc9c; }
.no-notifiche { color: #666; font-size: 14px; }

/* -------------------------
   Pagine profilo (riutilizzabile)
   ------------------------- */

.page-title {
  text-align: center;
  color: #2c3e50;
  margin: 30px 0 10px;
  font-size: 24px;
}
.page-title i {
  color: #1a73e8;
  margin-right: 10px;
}

.container {
  max-width: 1100px;
  margin: 30px auto;
  padding: 20px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px,1fr));
  gap: 15px;
}

.info-block input {
  border: none;
  background: transparent;
  color: #2c3e50;
  font-size: 14px;
  padding: 0;
  outline: none;
}

/* -------------------------
   Responsive
   ------------------------- */

@media (max-width: 768px) {
  .grid-form { grid-template-columns: 1fr; }
  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .dual-section { flex-direction: column; }
}

/* Popup chiamata: chiuso di default, si apre solo con .open */
#popup-chiamata { display: none; }
#popup-chiamata.open { display: block; }

/* --- popup chiamata: chiuso di default, aperto solo con .open --- */
#popup-chiamata { display: none; }
#popup-chiamata:target { display: none !important; }  /* disattiva auto-open da :target */
#popup-chiamata.open { display: block !important; }
