/* assets/style.css */
/* Reset leggero */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color: #101828;
  background: #f6f7f9;
  line-height: 1.5;
}

/* Layout basi */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
}
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Bottoni */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 6px;
  border: 1px solid #d0d5dd;
  background: #fff;
  cursor: pointer;
  text-decoration: none;
  color: #101828;
  font-weight: 600;
  transition: transform .05s ease, background .2s ease, box-shadow .2s ease;
}
.btn:hover { background: #f2f4f7; }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; }
.btn.danger { border-color: #fda4a4; color: #b42318; }
.btn.small { padding: 6px 10px; border-radius: 10px; font-size: 0.9rem; }

/* Card / form */
.card {
  background: #fff;
  border: 1px solid #e4e7ec;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(16,24,40,0.04), 0 1px 3px rgba(16,24,40,0.08);
  margin-bottom: 16px;
}

.card-bacheca {
  background: #fff;
  border: 1px solid #e4e7ec;
  border-radius: 16px;
  padding: 40px;
  box-shadow: 0 1px 2px rgba(16,24,40,0.04), 0 1px 3px rgba(16,24,40,0.08);
  margin-bottom: 36px;
}
.card.narrow { max-width: 440px; margin: 16px auto; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.form-field span { display: inline-block; font-size: 0.95rem; margin-bottom: 6px; color: #475467; }
input[type="text"], input[type="password"], input[type="url"], input[type="date"], textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d0d5dd;
  border-radius: 12px;
  background: #fff;
  outline: none;
}
input:focus, textarea:focus { border-color: #98a2b3; }
.actions { margin-top: 4px; }

/* Alert */
.alert {
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
  font-weight: 600;
}
.alert.success { background: #ecfdf3; color: #027a48; border: 1px solid #abefc6; }
.alert.error { background: #fef3f2; color: #b42318; border: 1px solid #fecaca; }
.muted { color: #667085; }

/* Calendar */
.calendar-wrap { overflow: hidden; }
.calendar-toolbar {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin-bottom: 12px;
}
.calendar-toolbar h2 {
  margin: 0; font-size: 1.25rem; font-weight: 800; color: #101828;
}
.hint { color: #667085; font-size: 0.9rem; }

.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.dow {
  font-weight: 700;
  color: #344054;
  background: #f2f4f7;
  border: 1px solid #e4e7ec;
  border-radius: 6px;
  padding: 10px 8px;
  text-align: center;
}

.day {
  min-height: 110px;
  background: #fff;
  border: 1px solid #e4e7ec;
  border-radius: 6px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.day.empty { background: transparent; border: none; }

.day-number {
  font-weight: 800;
  color: #0b1324;
  font-size: 0.95rem;
}
.events { display: flex; flex-direction: column; gap: 6px; }

.event-pill {
  display: inline-block;
  padding: 6px 8px;
  border-radius: 6px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  text-decoration: none;
  color: #1d2b6b;
  font-weight: 600;
  font-size: 0.9rem;
  word-break: break-word;
}
.event-pill:hover { background: #e0e7ff; }
.event-pill.no-link { opacity: 0.7; cursor: default; }

/* Event list admin */
.event-list {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.event-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px;
  border: 1px solid #e4e7ec; border-radius: 12px; background: #fff;
}

/* ===== Modal ===== */
.modal.hidden { display: none; }
.modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(16,24,40,0.5);
  backdrop-filter: blur(2px);
}
.modal-card {
  position: relative;
  width: min(560px, 92vw);
  background: #fff;
  border: 1px solid #e4e7ec;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(16,24,40,0.25);
  padding: 45px;
  z-index: 1;
}
.modal-close {
  position: absolute; right: 12px; top: 10px;
  background: transparent; border: 0; font-size: 24px; line-height: 1;
  cursor: pointer; color: #667085;
}
.modal-close:hover { color: #101828; }
.modal-title { margin: 0 0 8px; font-size: 1.25rem; font-weight: 800; color: #101828; }
.modal-desc { margin: 0 0 12px; color: #344054; white-space: pre-wrap; }
.modal-link-wrap { margin: 10px 0; display: flex; gap: 8px; align-items: center; }
.modal-link-wrap a { word-break: break-all; color: #1d2b6b; text-decoration: underline; }
.modal-cta-wrap { margin-top: 12px; }
.hidden { display: none !important; }
.event-pill { cursor: pointer; }

.autore-bacheca {
    color: grey;
    font-size: 14px;
    margin-top: 6px;
}

.titolo-bacheca {
    margin-bottom: 0px;
}

ul {
    padding: 20px;
}

/* Responsive */
@media (max-width: 640px) {
  .header h1 { font-size: 1.25rem; }
  .calendar { grid-template-columns: repeat(7, minmax(100px, 1fr)); }
  .day { min-height: 96px; }
  .modal-card {
      padding: 30px;
  }
  
  .card-bacheca {
      padding: 25px;
  }
}
