/* ============================================================
   Marcia Popolare dell'Educazione - style.css
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: 'Georgia', 'Times New Roman', serif;
  background: #fffde8;
  color: #1a2a35;
  line-height: 1.7;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--red); text-decoration: underline; }
a:hover { color: var(--red-dark); }
ul { list-style: none; }

/* --- Typography --- */
h1, h2, h3, h4, h5 {
  font-family: 'Georgia', serif;
  line-height: 1.25;
  font-weight: 700;
  color: #1a2a35;
}
h1 { font-size: clamp(1.8rem, 5vw, 3rem); }
h2 { font-size: clamp(1.4rem, 3.5vw, 2.2rem); }
h3 { font-size: 1.3rem; }
p { margin-bottom: 1em; }
.lead { font-size: 1.2rem; color: var(--text-muted); }

/* --- Layout --- */
.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 1.25rem;
}
.container-narrow { max-width: 760px; }
.text-center { text-align: center; }
.mt-lg { margin-top: 2rem; }
.mt-xl { margin-top: 3rem; }

/* --- Colors --- */
:root {
  --red: #d42d2d;
  --red-dark: #b51c1c;
  --red-light: #e63535;
  --header-bg: #9e2020;
  --header-hover: #7d1818;
  --blue: #1d4db5;
  --blue-mid: #3060c5;
  --yellow: #f5c518;
  --green: #1aa84e;
  --sand: #fffde8;
  --sand-dark: #fef6bf;
  --border: #e8d46a;
  --text-muted: #5a6a75;
  --white: #ffffff;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .65rem 1.5rem;
  border-radius: 3px;
  font-size: .95rem;
  font-weight: 700;
  font-family: 'Georgia', serif;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all .2s ease;
  letter-spacing: .02em;
}
.btn-primary { background: var(--red); color: var(--white); border-color: var(--red-dark); }
.btn-primary:hover { background: var(--red-dark); color: var(--white); }
.btn-secondary { background: var(--blue); color: var(--white); border-color: var(--blue); }
.btn-secondary:hover { background: var(--blue-mid); color: var(--white); }
.btn-outline { background: transparent; color: var(--blue); border-color: var(--blue); }
.btn-outline:hover { background: var(--blue); color: var(--white); }
.btn-success { background: var(--green); color: var(--white); border-color: var(--green); }
.btn-warning { background: #e67e22; color: var(--white); border-color: #ca6f1e; }
.btn-danger { background: var(--red); color: var(--white); border-color: var(--red-dark); }
.btn-lg { padding: .85rem 2rem; font-size: 1.1rem; }
.btn-sm { padding: .3rem .75rem; font-size: .82rem; }

/* --- Header --- */
.site-header {
  background: var(--header-bg);
  color: var(--white);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: .75rem;
  padding-bottom: .75rem;
  gap: 1rem;
}
.logo-link { display: flex; align-items: center; gap: .75rem; text-decoration: none; }
.logo-blob {
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; padding: 5px;
  border-radius: 42% 58% 55% 45% / 48% 40% 60% 52%;
  flex-shrink: 0;
  width: 52px; height: 52px;
}
.logo-img { height: 42px; width: auto; display: block; }
.logo-text {
  font-family: 'Nunito', sans-serif;
  font-size: clamp(0.95rem, 3.8vw, 1.25rem);
  font-weight: 900;
  color: var(--white);
  line-height: 1.15;
  letter-spacing: -0.01em;
}
@media (min-width: 768px) {
  .logo-text { white-space: nowrap; }
}
.main-nav ul {
  display: flex;
  align-items: center;
  gap: .25rem;
  flex-wrap: wrap;
}
.main-nav a {
  color: rgba(255,255,255,.85);
  text-decoration: none;
  padding: .4rem .75rem;
  border-radius: 3px;
  font-size: .93rem;
  transition: all .15s;
}
.main-nav a:hover, .main-nav a.active { color: var(--white); background: rgba(255,255,255,.15); }
.nav-cta { background: var(--red) !important; color: var(--white) !important; margin-left: .5rem; }
.nav-cta:hover { background: var(--red-dark) !important; }
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: .5rem;
}
.nav-toggle span { display: block; width: 26px; height: 2px; background: var(--white); border-radius: 2px; transition: .2s; }

/* --- Hero --- */
.hero { background: var(--sand-dark); padding: 4rem 0; border-bottom: 3px solid var(--red); }
.hero-inner { display: grid; grid-template-columns: 1fr 1.2fr; gap: 3rem; align-items: center; }
.hero-poster .poster-img {
  border-radius: 6px;
  box-shadow: 0 8px 30px rgba(0,0,0,.2);
  max-height: 520px;
  width: 100%;
  object-fit: contain;
}
.poster-placeholder {
  background: var(--header-bg);
  color: var(--white);
  height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 1.2rem;
}
.hero-title { font-size: clamp(2rem, 5vw, 3.5rem); color: var(--blue); margin-bottom: .5rem; }
.hero-subtitle { font-size: 1.2rem; color: var(--text-muted); margin-bottom: .5rem; }
.hero-tagline { font-size: 1.4rem; color: var(--red); font-style: italic; margin-bottom: 1.5rem; }
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 2rem; }
.hero-count { display: flex; align-items: baseline; gap: .5rem; }
.count-number { font-size: 3.5rem; font-weight: 700; color: var(--red); line-height: 1; }
.count-label { font-size: 1.1rem; color: var(--text-muted); }

/* --- Sections --- */
section { padding: 4rem 0; }
.section-header { text-align: center; margin-bottom: 2.5rem; }
.section-header h2 { margin-bottom: .5rem; }

/* --- Appello --- */
.section-appello { background: var(--white); }
.appello-text.prose p { max-width: 720px; margin-left: auto; margin-right: auto; }
.appello-text.prose h3 { color: var(--red); margin-top: 2rem; margin-bottom: 1rem; text-align: center; }
.appello-text.prose ul { list-style: disc; padding-left: 2rem; max-width: 720px; margin: 0 auto 1.5rem; }
.appello-text.prose li { margin-bottom: .5rem; }
.appello-text.prose hr { border: none; border-top: 2px solid var(--red); margin: 2.5rem auto; max-width: 200px; }
.firmatari { background: var(--sand-dark); border-radius: 8px; padding: 2rem; margin-top: 3rem; }
.firmatari h3 { color: var(--blue); margin-bottom: 1.5rem; text-align: center; }
.firmatari-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .75rem; }
.firmatari-list li { padding: .5rem 0; border-bottom: 1px solid var(--border); }
.firmatari-list span { display: block; font-size: .85rem; color: var(--text-muted); }
.appello-cta { text-align: center; margin-top: 3rem; }

/* --- Firmatari nella pagina adesioni --- */
.section-firmatari-pub {
  background: var(--sand-dark);
  padding: 3rem 0;
  border-bottom: 1px solid var(--border);
}
.firmatari-pub-title {
  color: var(--blue);
  text-align: center;
  margin-bottom: 2rem;
  font-size: 1.4rem;
}

/* --- Adesioni grid --- */
.section-adesioni { background: var(--sand-dark); }
.section-adesioni-full { background: var(--sand); }
.adhesions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.25rem; }
.adhesion-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem;
  border-top: 3px solid var(--red);
  transition: transform .2s, box-shadow .2s;
}
.adhesion-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,.1); }
.adhesion-type { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--red); margin-bottom: .4rem; }
.adhesion-name { font-size: 1.05rem; font-weight: 700; color: var(--blue); margin-bottom: .25rem; }
.adhesion-org { font-size: .9rem; color: var(--text-muted); margin-bottom: .25rem; }
.adhesion-place { font-size: .88rem; color: var(--text-muted); margin-bottom: .5rem; }
.adhesion-message { font-size: .88rem; font-style: italic; color: #555; border-left: 3px solid var(--red); padding-left: .75rem; margin-top: .5rem; }
.adhesion-date { font-size: .78rem; color: var(--text-muted); margin-top: .75rem; }

/* --- Filter form --- */
.filter-form, .admin-filter-form { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; margin-bottom: 1.5rem; }
.admin-toolbar { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1.5rem; flex-wrap: wrap; }
.filter-actions { display: flex; gap: .5rem; }
.results-count { margin-bottom: 1rem; color: var(--text-muted); }
.filter-row { display: flex; flex-wrap: nowrap; gap: 1rem; align-items: flex-end; width: 100%; }
.filter-row .form-group:first-child { flex: 1 1 auto; min-width: 0; }
.filter-row .filter-actions {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  gap: .5rem;
  align-items: stretch;
  padding-bottom: 0;
  min-width: 0;
}
.filter-row .filter-actions .btn {
  justify-content: center;
  min-height: 44px;
}

/* --- Mappa --- */
.map-container { height: 500px; border-radius: 8px; border: 2px solid var(--border); margin-bottom: 2rem; }
.map-list h2 { margin-bottom: 1rem; }
.map-list-items li { padding: .5rem 0; border-bottom: 1px solid var(--border); display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.adhesion-type-badge {
  font-size: .72rem;
  background: var(--header-bg);
  color: var(--white);
  padding: .15rem .5rem;
  border-radius: 30px;
}
.map-list-message { font-size: .85rem; font-style: italic; color: var(--text-muted); display: block; width: 100%; }
.map-popup strong { display: block; font-size: 1rem; color: var(--blue); }
.map-popup-type { display: block; font-size: .8rem; color: var(--red); }
.map-popup-city { display: block; font-size: .85rem; color: var(--text-muted); }
.map-popup-msg { font-style: italic; font-size: .85rem; color: #555; margin-top: .5rem; }

/* --- Mappa preview --- */
.section-mappa-preview { background: var(--blue); color: var(--white); }
.mappa-preview-inner { text-align: center; max-width: 600px; margin: 0 auto; }
.mappa-preview-text h2 { color: var(--white); margin-bottom: 1rem; }
.mappa-preview-text p { color: rgba(255,255,255,.8); margin-bottom: 1.5rem; }
.mappa-preview-text .btn-outline { color: var(--white); border-color: rgba(255,255,255,.6); }
.mappa-preview-text .btn-outline:hover { background: rgba(255,255,255,.15); }

/* --- Page hero --- */
.page-hero { background: var(--header-bg); color: var(--white); padding: 3rem 0; text-align: center; }
.page-hero h1 { color: var(--white); }
.page-hero p { color: rgba(255,255,255,.8); margin: 0; }

/* --- Forms --- */
.form-group { display: flex; flex-direction: column; gap: .4rem; flex: 1; min-width: 200px; }
.form-group label { font-size: .9rem; font-weight: 700; color: var(--blue); }
.form-group input, .form-group select, .form-group textarea {
  padding: .6rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  font-size: .95rem;
  font-family: inherit;
  background: var(--white);
  color: var(--blue);
  transition: border-color .15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(192,57,43,.15);
}
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.radio-group { display: flex; flex-wrap: wrap; gap: .75rem; }
.radio-label { display: flex; align-items: center; gap: .4rem; cursor: pointer; font-size: .93rem; }
.checkbox-label { display: flex; align-items: flex-start; gap: .6rem; cursor: pointer; font-size: .9rem; }
.checkbox-label input { margin-top: 3px; flex-shrink: 0; }
.form-actions { margin-top: 1.5rem; }
fieldset { border: 1.5px solid var(--border); border-radius: 4px; padding: 1rem 1.25rem; margin-bottom: 1rem; }
fieldset legend { font-weight: 700; color: var(--blue); padding: 0 .5rem; font-size: .95rem; }
.adhesion-form { background: var(--white); padding: 2rem; border-radius: 8px; border: 1px solid var(--border); display: flex; flex-direction: column; gap: 1rem; }

/* --- Alerts --- */
.alert {
  padding: 1.25rem 1.5rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
  border-left: 4px solid;
}
.alert-success { background: #eafaf1; border-color: var(--green); color: #1d6a3e; }
.alert-error { background: #fdecea; border-color: var(--red); color: #7b1a11; }
.alert-warning { background: #fef9e7; border-color: #f39c12; color: #7d5a00; }
.alert ul { list-style: disc; padding-left: 1.5rem; margin-top: .5rem; }

/* --- Contatti --- */
.contatti-layout { display: grid; grid-template-columns: 1fr 1.5fr; gap: 3rem; align-items: start; }
.contatti-list { list-style: none; padding: 0; margin-top: 1rem; }
.contatti-list li { margin-bottom: .75rem; }
.contatti-event { background: var(--sand-dark); border-radius: 6px; padding: 1.25rem; margin-top: 1.5rem; }
.contact-form { background: var(--white); padding: 2rem; border-radius: 8px; border: 1px solid var(--border); display: flex; flex-direction: column; gap: 1rem; }

/* --- Privacy --- */
.section-privacy .prose { padding: 0 0 3rem; }
.section-privacy .prose h2 { color: var(--blue); margin: 2rem 0 .75rem; }
.section-privacy .prose h3 { color: var(--red); margin: 1.5rem 0 .5rem; }
.section-privacy .prose ul { list-style: disc; padding-left: 1.5rem; margin-bottom: 1rem; }

/* --- Button row (side by side) --- */
.btn-row { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; }

/* --- Firmatari appello inline list --- */
.firmatari { margin-top: 2.5rem; }
.firmatari h3 { color: var(--blue); margin-bottom: 1rem; }
.firmatari-list { list-style: none; padding: 0; margin: 0; }
.firmatari-list li { display: flex; align-items: baseline; gap: .6rem; padding: .45rem 0; border-bottom: 1px solid rgba(0,0,0,.07); }
.firmatari-list li:last-child { border-bottom: none; }
.firmatari-list strong { color: var(--blue); font-size: .9rem; }
.firmatari-list span { color: var(--text-muted); font-size: .85rem; }

/* --- Firmatari home list (one per row) --- */
.firmatari-home-list { list-style: none; padding: 0; margin: 0; background: var(--white); border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.06); overflow: hidden; border: 1px solid var(--border); }
.firmatari-home-item { display: flex; align-items: baseline; gap: .75rem; padding: .65rem 1.25rem; border-bottom: 1px solid var(--border); transition: background .12s; }
.firmatari-home-item:last-child { border-bottom: none; }
.firmatari-home-item:hover { background: var(--sand); }
.firmatari-home-item strong { color: var(--blue); font-size: 1rem; min-width: 180px; flex-shrink: 0; }
.firmatari-home-item span { color: var(--text-muted); font-size: .92rem; }

/* --- Firmatari public page (card grid) --- */
.firmatari-pub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.firmatari-pub-item { background: var(--white); border: 1px solid var(--border); border-top: 4px solid var(--header-bg); border-radius: 6px; padding: 1.1rem; box-shadow: 0 1px 3px rgba(0,0,0,.05); transition: transform .15s; }
.firmatari-pub-item:hover { transform: translateY(-2px); }
.firmatari-pub-item strong { display: block; color: var(--blue); font-size: .95rem; margin-bottom: .3rem; }
.firmatari-pub-item span { display: block; color: var(--text-muted); font-size: .82rem; }
.firmatari-pub-contact { display: block; font-size: .75rem; color: var(--text-muted); margin-top: .25rem; }

/* --- Footer --- */
.site-footer { background: var(--blue); color: rgba(255,255,255,.85); padding: 3rem 0 0; }
.footer-inner { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2rem; padding-bottom: 2rem; }
.footer-logo { height: 60px; width: auto; margin-bottom: 1rem; filter: brightness(0) invert(1); }
.footer-col h3 { color: var(--white); font-size: 1rem; margin-bottom: .75rem; }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: .4rem; }
.footer-col a { color: rgba(255,255,255,.75); text-decoration: none; }
.footer-col a:hover { color: var(--white); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); padding: 1.25rem 0; text-align: center; font-size: .85rem; color: rgba(255,255,255,.6); }
.footer-bottom a { color: rgba(255,255,255,.7); }

/* --- Empty state --- */
.empty-state { text-align: center; padding: 3rem 0; color: var(--text-muted); }

/* --- Admin --- */
.admin-body { background: #f0f0f0; display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.admin-login-wrap { width: 100%; max-width: 400px; padding: 1rem; }
.admin-login-box { background: var(--white); border-radius: 8px; padding: 2.5rem; box-shadow: 0 4px 20px rgba(0,0,0,.1); text-align: center; }
.admin-logo { height: 80px; margin: 0 auto 1rem; }
.admin-login-sub { color: var(--text-muted); font-size: .9rem; margin-bottom: 1.5rem; }
.admin-login-back { margin-top: 1.5rem; font-size: .85rem; }
.admin-body-main { background: #f5f5f5; min-height: 100vh; }
.admin-nav { background: var(--blue); color: var(--white); position: sticky; top: 0; z-index: 100; }
.admin-nav-inner { max-width: 1400px; margin: 0 auto; padding: .75rem 1.25rem; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }
.admin-nav-brand { color: var(--white); font-weight: 700; text-decoration: none; font-size: .95rem; }
.admin-nav-links { display: flex; gap: .25rem; flex-wrap: wrap; }
.admin-nav-links a { color: rgba(255,255,255,.8); text-decoration: none; padding: .3rem .7rem; border-radius: 3px; font-size: .88rem; }
.admin-nav-links a:hover { background: rgba(255,255,255,.1); color: var(--white); }
.admin-logout { color: var(--red) !important; }
.admin-content { max-width: 1400px; margin: 0 auto; padding: 2rem 1.25rem; }
.admin-content h1 { margin-bottom: 1.5rem; }
.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--white); border-radius: 6px; padding: 1.5rem; text-align: center; border-top: 4px solid var(--blue); }
.stat-card.stat-success { border-color: var(--green); }
.stat-card.stat-warning { border-color: #e67e22; }
.stat-card.stat-danger { border-color: var(--red); }
.stat-card.stat-info { border-color: #3498db; }
.stat-number { font-size: 2.5rem; font-weight: 700; color: var(--blue); line-height: 1; }
.stat-label { font-size: .85rem; color: var(--text-muted); margin-top: .25rem; }
.admin-quick-links { display: flex; gap: 1rem; flex-wrap: wrap; }
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: 6px; overflow: hidden; font-size: .9rem; }
.admin-table th { background: var(--blue); color: var(--white); padding: .75rem 1rem; text-align: left; font-size: .85rem; }
.admin-table td { padding: .65rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tr:hover td { background: var(--sand-dark); }
.admin-actions-cell { white-space: nowrap; display: flex; gap: .25rem; flex-wrap: wrap; }
.status-badge { display: inline-block; padding: .2rem .6rem; border-radius: 30px; font-size: .78rem; font-weight: 700; }
.status-approved { background: #eafaf1; color: #1d6a3e; }
.status-pending { background: #fef9e7; color: #7d5a00; }
.status-rejected { background: #fdecea; color: #7b1a11; }

/* Message cards admin */
.message-card { background: var(--white); border-radius: 6px; padding: 1.25rem; margin-bottom: 1rem; border-left: 4px solid var(--border); }
.message-new { border-left-color: var(--red); }
.message-header { display: flex; flex-wrap: wrap; gap: 1rem; align-items: baseline; margin-bottom: .75rem; }
.message-subject { font-weight: 700; color: var(--blue); }
.message-date { font-size: .8rem; color: var(--text-muted); margin-left: auto; }
.message-body { background: var(--sand-dark); border-radius: 4px; padding: 1rem; font-size: .9rem; margin-bottom: .75rem; }
.message-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 1rem; }
.modal-box { background: var(--white); border-radius: 8px; padding: 2rem; width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto; }
.modal-box h2 { margin-bottom: 1.5rem; }

/* --- Scroll reveal --- */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity .6s ease, transform .6s ease; }
.reveal.revealed { opacity: 1; transform: none; }

/* --- Responsive --- */
@media (max-width: 768px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-poster { order: -1; }
  .poster-img { max-height: 300px; }
  .contatti-layout { grid-template-columns: 1fr; }
  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--blue);
    padding: 1rem;
  }
  .main-nav.nav-open { display: block; }
  .main-nav ul { flex-direction: column; }
  .nav-toggle { display: flex; }
  .header-inner { position: relative; }
  .filter-form { flex-direction: column; align-items: stretch; }
  .filter-row { flex-direction: column; align-items: stretch; gap: .75rem; }
  .filter-row .form-group:first-child { width: 100%; min-width: 0; }
  .filter-row .filter-actions { width: 100%; justify-content: stretch; }
  .filter-row .filter-actions .btn { flex: 1 1 0; }
  .form-row { flex-direction: column; }
  .adhesions-grid { grid-template-columns: 1fr; }
}
