/* CDS Sync — Eventi (Iniziative) list.
   Recreation of cittadellasperanza.org/iniziativa/ on the synced "eventi" CPT:
   toolbar (search · custom calendar · Prossimi/Passati · vista) over month-grouped
   cards in a Lista or Griglia layout.
   Self-contained + defensive so it looks consistent inside any theme / Elementor. */

.cds-eventi {
  --cds-blue: #02A3E0;
  --cds-blue-dark: #0285ba;
  --cds-ink: #1f2733;
  --cds-muted: #6b7480;
  --cds-card: #ffffff;
  --cds-line: #e6e9ef;
  --cds-soft: #f4f7fb;
  --cds-radius: 14px;
  --cds-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
  --cds-cols: 3;
  font-family: inherit;
  color: var(--cds-ink);
  position: relative;
  line-height: 1.5;
}
.cds-eventi *,
.cds-eventi *::before,
.cds-eventi *::after { box-sizing: border-box; }

/* Reset theme-injected button/input chrome inside the widget (defensive).
   padding:0 here is important — themes add button padding that otherwise breaks
   the calendar's 7-column day grid. Specific buttons re-declare their padding. */
.cds-eventi button {
  margin: 0;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  line-height: normal;
  background: none;
  border: none;
  box-shadow: none;
  text-transform: none;
  letter-spacing: normal;
  color: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.cds-eventi button:focus-visible { outline: 2px solid var(--cds-blue); outline-offset: 2px; }
/* Stop themes from painting a (often red) background on button hover/focus. */
.cds-eventi button:hover,
.cds-eventi button:focus,
.cds-eventi button:active { background-color: transparent; }
.cds-eventi input { font-family: inherit; box-shadow: none; }

/* ====================== Toolbar ====================== */
.cds-ev-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 0 0 24px;
}

.cds-ev-search {
  position: relative;
  flex: 1 1 300px;
  min-width: 200px;
  display: flex;
  align-items: center;
}
.cds-ev-search__ico {
  position: absolute;
  left: 18px;
  display: inline-flex;
  color: var(--cds-muted);
  pointer-events: none;
  z-index: 1;
}
.cds-eventi .cds-ev-search__input {
  width: 100%;
  height: 52px;
  margin: 0;
  padding: 0 44px 0 48px;
  border: 1px solid var(--cds-line);
  border-radius: 999px;
  background: var(--cds-card);
  color: var(--cds-ink);
  font-size: 16px;
  line-height: normal;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.cds-eventi .cds-ev-search__input::placeholder { color: var(--cds-muted); opacity: 1; }
.cds-eventi .cds-ev-search__input:focus {
  outline: none;
  border-color: var(--cds-blue);
  box-shadow: 0 0 0 4px rgba(2, 163, 224, .14);
}
.cds-eventi .cds-ev-search__input::-webkit-search-cancel-button { -webkit-appearance: none; }
.cds-eventi .cds-ev-search__clear {
  position: absolute;
  right: 12px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--cds-soft);
  color: var(--cds-muted);
  font-size: 20px;
  line-height: 1;
}
.cds-eventi .cds-ev-search__clear:hover { color: var(--cds-ink); background: #e6ebf2; }

.cds-ev-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---- Custom date (calendar) trigger ---- */
.cds-ev-datewrap { position: relative; }
.cds-eventi .cds-ev-date {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 52px;
  padding: 0 16px;
  border: 1px solid var(--cds-line);
  border-radius: 999px;
  background: var(--cds-card);
  color: var(--cds-ink);
  font-size: 15px;
  font-weight: 600;
}
.cds-eventi .cds-ev-date:hover { border-color: var(--cds-blue); background: var(--cds-card); }
.cds-eventi .cds-ev-date[aria-expanded="true"] {
  border-color: var(--cds-blue);
  box-shadow: 0 0 0 4px rgba(2, 163, 224, .14);
}
.cds-ev-date__ico { display: inline-flex; color: var(--cds-blue); flex: none; }
.cds-ev-date__label { white-space: nowrap; }
.cds-ev-date__clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-left: 2px;
  border-radius: 50%;
  background: var(--cds-soft);
  color: var(--cds-muted);
  font-size: 16px;
  line-height: 1;
  flex: none;
}
.cds-ev-date__clear:hover { background: #e6ebf2; color: var(--cds-ink); }

/* ---- Prossimi / Passati ---- */
.cds-ev-scope {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--cds-line);
  border-radius: 999px;
  background: var(--cds-soft);
}
.cds-eventi .cds-ev-scope__btn {
  padding: 0 18px;
  height: 44px;
  border-radius: 999px;
  background: transparent;
  color: var(--cds-muted);
  font-size: 15px;
  font-weight: 600;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.cds-eventi .cds-ev-scope__btn:hover { color: var(--cds-ink); background: transparent; }
.cds-eventi .cds-ev-scope__btn.is-active {
  background: var(--cds-blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(2, 163, 224, .35);
}
.cds-eventi .cds-ev-scope__btn.is-active:hover { color: #fff; background: var(--cds-blue); }

/* ---- Vista (Lista / Griglia) ---- */
.cds-ev-view {
  display: inline-flex;
  padding: 4px;
  gap: 2px;
  border: 1px solid var(--cds-line);
  border-radius: 12px;
  background: var(--cds-soft);
}
.cds-eventi .cds-ev-view__btn {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  color: var(--cds-muted);
  transition: background .15s ease, color .15s ease;
}
.cds-eventi .cds-ev-view__btn:hover { color: var(--cds-ink); background: rgba(2, 163, 224, .10); }
.cds-eventi .cds-ev-view__btn.is-active,
.cds-eventi .cds-ev-view__btn.is-active:hover {
  background: var(--cds-card);
  color: var(--cds-blue);
  box-shadow: 0 1px 3px rgba(16, 24, 40, .12);
}

/* ====================== Custom calendar popover ====================== */
.cds-ev-cal-pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  width: 320px;
  max-width: calc(100vw - 32px);
  padding: 16px;
  background: var(--cds-card);
  border: 1px solid var(--cds-line);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(16, 24, 40, .18);
}
.cds-ev-cal-pop[hidden] { display: none; }
.cds-ev-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.cds-ev-cal-head__label { font-weight: 800; font-size: 15px; }
.cds-eventi .cds-ev-cal-nav {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  color: var(--cds-ink);
  font-size: 20px;
  flex: none;
}
.cds-eventi .cds-ev-cal-nav:hover { background: var(--cds-soft); color: var(--cds-blue); }
.cds-ev-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.cds-ev-cal-dow {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--cds-muted);
  padding: 4px 0 4px;
}
.cds-eventi .cds-ev-cal-day {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  font-size: 14px;
  color: var(--cds-ink);
  transition: background .12s ease, color .12s ease;
}
.cds-eventi .cds-ev-cal-day:hover { background: rgba(2, 163, 224, .12); color: var(--cds-blue); }
.cds-eventi .cds-ev-cal-day.is-muted { color: #c2c8d2; }
.cds-eventi .cds-ev-cal-day.is-today { box-shadow: inset 0 0 0 1.5px var(--cds-blue); }
.cds-eventi .cds-ev-cal-day.is-selected {
  background: var(--cds-blue);
  color: #fff;
  font-weight: 700;
}
.cds-eventi .cds-ev-cal-day.is-empty { pointer-events: none; }
/* Event dot */
.cds-ev-cal-day.has-events::after {
  content: "";
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cds-blue);
}
.cds-ev-cal-day.is-selected.has-events::after { background: #fff; }
.cds-ev-cal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--cds-line);
}
.cds-eventi .cds-ev-cal-foot button {
  font-size: 13px;
  font-weight: 700;
  color: var(--cds-blue);
  padding: 4px 2px;
}
.cds-eventi .cds-ev-cal-foot .cds-ev-cal-clear { color: var(--cds-muted); }
.cds-eventi .cds-ev-cal-foot button:hover { text-decoration: underline; background: transparent; }

/* ====================== Count line ====================== */
.cds-ev-count {
  margin: 0 0 16px;
  color: var(--cds-muted);
  font-size: 15px;
}
.cds-ev-count strong { color: var(--cds-ink); }

/* ====================== Month groups ====================== */
.cds-ev-month { margin: 0; }
.cds-ev-month + .cds-ev-month { margin-top: 40px; } /* clear gap between months */
.cds-ev-month__title {
  margin: 0 0 16px;
  padding: 0 0 8px;
  font-size: clamp(17px, 2vw, 21px);
  font-weight: 800;
  letter-spacing: .2px;
  color: var(--cds-ink);
  border-bottom: 2px solid var(--cds-line);
}

.cds-ev-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }

/* ====================== Event card (base = LISTA, horizontal) ====================== */
.cds-ev-card {
  position: relative;
  display: grid;
  align-items: stretch;
  background: var(--cds-card);
  border: 1px solid var(--cds-line);
  border-radius: var(--cds-radius);
  box-shadow: var(--cds-shadow);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  /* No overflow:hidden — it would clip the upward calendar dropdown.
     Corners are clipped per-element instead (badge + media). */
}
.cds-ev-card--media   { grid-template-columns: 92px minmax(160px, 220px) 1fr; }
.cds-ev-card--nomedia { grid-template-columns: 92px 1fr; }
.cds-ev-card:hover {
  transform: translateY(-2px);
  border-color: rgba(2, 163, 224, .45);
  box-shadow: 0 2px 4px rgba(16, 24, 40, .05), 0 16px 32px rgba(16, 24, 40, .1);
}

/* Whole-card click target (sits beneath the interactive children). */
.cds-ev-card__link { position: absolute; inset: 0; z-index: 1; }
.cds-ev-badge,
.cds-ev-card__media,
.cds-ev-card__body { position: relative; z-index: 2; }

/* Date badge */
.cds-ev-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: linear-gradient(160deg, var(--cds-blue), var(--cds-blue-dark));
  color: #fff;
  padding: 14px 8px;
  text-align: center;
  border-radius: var(--cds-radius) 0 0 var(--cds-radius);
}
.cds-ev-badge__day { font-size: 30px; font-weight: 800; line-height: 1; }
.cds-ev-badge__mon { font-size: 12px; font-weight: 700; letter-spacing: 1.5px; opacity: .92; }

/* Media — the image absolutely fills its cell. Using position:absolute (instead
   of height:100%) avoids the CSS-grid quirk where a stretched cell isn't a
   "definite" height, which left the image at its intrinsic size with empty space
   below it when the body column was taller. */
.cds-ev-card__media {
  display: block;
  position: relative;
  overflow: hidden;
  background: var(--cds-soft);
  min-height: 160px; /* fallback so the cell never collapses */
}
.cds-ev-card__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}
.cds-ev-card:hover .cds-ev-card__img { transform: scale(1.04); }

/* Body */
.cds-ev-card__body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.cds-ev-card__dow {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--cds-blue);
}
.cds-ev-card__title {
  margin: 0;
  font-size: clamp(17px, 1.6vw, 20px);
  font-weight: 700;
  line-height: 1.3;
}
.cds-eventi .cds-ev-card__title a { color: var(--cds-ink); text-decoration: none; }
.cds-ev-card:hover .cds-ev-card__title a { color: var(--cds-blue); }

.cds-ev-meta {
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}
.cds-ev-meta__item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--cds-muted);
  font-size: 14px;
}
.cds-ev-meta__ico { display: inline-flex; color: var(--cds-blue); flex: none; }

.cds-ev-card__excerpt {
  margin: 4px 0 0;
  color: var(--cds-muted);
  font-size: 14.5px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Footer */
.cds-ev-card__foot {
  margin-top: auto;
  padding-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.cds-eventi .cds-ev-card__more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--cds-blue);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}
.cds-ev-card__more span { transition: transform .18s ease; }
.cds-ev-card:hover .cds-ev-card__more span { transform: translateX(4px); }

/* Calendar dropdown */
.cds-ev-cal { position: relative; }
.cds-eventi .cds-ev-cal__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--cds-line);
  border-radius: 999px;
  color: var(--cds-muted);
  font-size: 13px;
  font-weight: 600;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.cds-eventi .cds-ev-cal__btn:hover,
.cds-eventi .cds-ev-cal__btn[aria-expanded="true"] {
  border-color: var(--cds-blue);
  color: var(--cds-blue);
  background: rgba(2, 163, 224, .06);
}
.cds-ev-cal__menu {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  z-index: 30;
  min-width: 200px;
  padding: 6px;
  background: var(--cds-card);
  border: 1px solid var(--cds-line);
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(16, 24, 40, .18);
}
.cds-ev-cal__menu[hidden] { display: none; }
.cds-ev-cal__title {
  display: block;
  padding: 6px 10px 8px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--cds-muted);
}
.cds-eventi .cds-ev-cal__item {
  display: block;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--cds-ink);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}
.cds-eventi .cds-ev-cal__item:hover { background: var(--cds-soft); color: var(--cds-blue); }

/* "Gratuito" tag */
.cds-ev-tag {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: #0a7d3c;
  background: #e6f6ec;
  border-radius: 999px;
  padding: 4px 10px;
}
.cds-ev-card__media .cds-ev-tag--free {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
}
.cds-ev-tag--inline { padding: 2px 9px; }

/* ====================== GRIGLIA (stacked cards in columns) ====================== */
.cds-ev-list--grid .cds-ev-grid {
  grid-template-columns: repeat(var(--cds-cols), minmax(0, 1fr));
}
.cds-ev-list--grid .cds-ev-card,
.cds-ev-list--grid .cds-ev-card--media,
.cds-ev-list--grid .cds-ev-card--nomedia { grid-template-columns: 1fr; }
.cds-ev-list--grid .cds-ev-card__media {
  order: -1;
  aspect-ratio: 16 / 9;
  min-height: 0;
  border-radius: var(--cds-radius) var(--cds-radius) 0 0;
}
.cds-ev-list--grid .cds-ev-card__img { min-height: 0; height: 100%; }
.cds-ev-list--grid .cds-ev-card--media .cds-ev-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 3;
  flex-direction: row;
  gap: 6px;
  align-items: baseline;
  border-radius: 10px;
  padding: 8px 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .28);
}
.cds-ev-list--grid .cds-ev-card--media .cds-ev-badge__day { font-size: 22px; }
.cds-ev-list--grid .cds-ev-card--media .cds-ev-badge__mon { font-size: 11px; }
.cds-ev-list--grid .cds-ev-card--nomedia .cds-ev-badge {
  flex-direction: row;
  gap: 6px;
  align-items: baseline;
  justify-content: flex-start;
  padding: 16px 18px 0;
  background: none;
  color: var(--cds-blue);
  border-radius: 0;
}
.cds-ev-list--grid .cds-ev-card--nomedia .cds-ev-badge__day { font-size: 22px; }
.cds-ev-list--grid .cds-ev-card--nomedia .cds-ev-badge__mon { opacity: .8; }

/* ====================== CALENDARIO (month grid) ====================== */
/* The scope toggle + date picker are list concepts — hide them in calendar view. */
.cds-eventi[data-layout="calendar"] .cds-ev-scope,
.cds-eventi[data-layout="calendar"] .cds-ev-datewrap { display: none; }

.cds-ev-cal-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
}
.cds-ev-cal-month {
  flex: 1 1 auto;
  margin: 0;
  text-align: center;
  font-size: clamp(18px, 2.4vw, 24px);
  font-weight: 800;
}
.cds-ev-cal-month::first-letter { text-transform: uppercase; }
.cds-eventi .cds-ev-cal-pglink {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--cds-line);
  border-radius: 10px;
  background: var(--cds-card);
  color: var(--cds-ink);
  font-size: 22px;
  flex: none;
}
.cds-eventi .cds-ev-cal-pglink:hover { border-color: var(--cds-blue); color: var(--cds-blue); background: var(--cds-card); }
.cds-eventi .cds-ev-cal-todaybtn {
  height: 42px;
  padding: 0 16px;
  border: 1px solid var(--cds-line);
  border-radius: 10px;
  background: var(--cds-card);
  color: var(--cds-ink);
  font-weight: 700;
  font-size: 14px;
  flex: none;
}
.cds-eventi .cds-ev-cal-todaybtn:hover { border-color: var(--cds-blue); color: var(--cds-blue); background: var(--cds-card); }

/* Grid: 1px gaps over a line-colored background draw the calendar rules.
   minmax(0,1fr) lets the 7 columns shrink to the container (chips truncate)
   instead of expanding to fit their text and overflowing the width. */
.cds-ev-cal-table {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: var(--cds-line);
  border: 1px solid var(--cds-line);
  border-radius: var(--cds-radius);
  overflow: hidden;
}
.cds-ev-cal-wd {
  background: var(--cds-soft);
  text-align: center;
  padding: 10px 4px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--cds-muted);
}
.cds-ev-cal-cell {
  background: var(--cds-card);
  min-height: 116px;
  min-width: 0;        /* allow the cell to shrink so chips can truncate */
  overflow: hidden;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cds-ev-cal-cell.is-out { background: #fafbfd; }
.cds-ev-cal-num {
  align-self: flex-start;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  color: var(--cds-ink);
}
.cds-ev-cal-cell.is-out .cds-ev-cal-num { color: #c2c8d2; font-weight: 500; }
.cds-ev-cal-cell.is-today .cds-ev-cal-num { background: var(--cds-blue); color: #fff; }

.cds-ev-cal-chip {
  display: flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
  max-width: 100%;
  padding: 3px 7px;
  border-radius: 6px;
  border-left: 3px solid var(--cds-blue);
  background: rgba(2, 163, 224, .1);
  color: var(--cds-ink);
  font-size: 12px;
  line-height: 1.3;
  text-decoration: none;
}
.cds-ev-cal-chip:hover { background: rgba(2, 163, 224, .2); }
.cds-ev-cal-chip__t { font-weight: 700; color: var(--cds-blue); flex: none; }
.cds-ev-cal-chip__t--ongoing { font-size: 13px; line-height: 1; }
.cds-ev-cal-chip__x { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Mobile agenda (hidden on desktop) */
.cds-ev-cal-agenda { display: none; }
.cds-ev-cal-aday {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--cds-line);
}
.cds-ev-cal-aday:last-child { border-bottom: 0; }
.cds-ev-cal-adate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 2px;
}
.cds-ev-cal-anum { font-size: 22px; font-weight: 800; line-height: 1; color: var(--cds-ink); }
.cds-ev-cal-aday.is-today .cds-ev-cal-anum { color: var(--cds-blue); }
.cds-ev-cal-awd { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--cds-muted); }
.cds-ev-cal-alist { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cds-ev-cal-chip--agenda {
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 8px;
}
.cds-ev-cal-chip--agenda .cds-ev-cal-chip__x { white-space: normal; }
.cds-ev-cal-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--cds-muted);
  background: var(--cds-soft);
  border: 1px dashed var(--cds-line);
  border-radius: var(--cds-radius);
}

/* ====================== Pagination ====================== */
.cds-ev-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 28px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--cds-line);
}
.cds-ev-pages { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cds-eventi .cds-ev-page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 42px;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--cds-line);
  border-radius: 10px;
  background: var(--cds-card);
  color: var(--cds-ink);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.cds-eventi .cds-ev-page:hover { border-color: var(--cds-blue); color: var(--cds-blue); }
.cds-eventi .cds-ev-page.is-active {
  background: var(--cds-blue);
  border-color: var(--cds-blue);
  color: #fff;
  cursor: default;
}
.cds-ev-page--gap { border: 0; background: transparent; min-width: 24px; padding: 0; }
.cds-eventi .cds-ev-page--disabled { opacity: .4; pointer-events: none; }

/* ====================== Empty + loading ====================== */
.cds-ev-empty {
  text-align: center;
  padding: 54px 20px;
  color: var(--cds-muted);
  background: var(--cds-soft);
  border: 1px dashed var(--cds-line);
  border-radius: var(--cds-radius);
}
.cds-ev-empty__ico { display: inline-flex; color: var(--cds-blue); opacity: .6; }
.cds-ev-empty__ico svg { width: 40px; height: 40px; }
.cds-ev-empty p { margin: 10px 0 0; font-size: 16px; }

.cds-ev-results { transition: opacity .2s ease; }
.cds-eventi.is-loading .cds-ev-results { opacity: .5; pointer-events: none; }

.cds-ev-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 160px;
  background: rgba(255, 255, 255, .35);
  z-index: 5;
  pointer-events: none;
}
.cds-eventi.is-loading .cds-ev-overlay { display: flex; }
.cds-ev-spinner {
  position: sticky;
  top: 40vh;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid rgba(2, 163, 224, .25);
  border-top-color: var(--cds-blue);
  animation: cds-ev-spin .7s linear infinite;
}
@keyframes cds-ev-spin { to { transform: rotate(360deg); } }

/* ====================== Responsive ====================== */
@media (max-width: 1024px) { .cds-eventi { --cds-cols: 2; } }

@media (max-width: 760px) {
  .cds-ev-card--media { grid-template-columns: 78px minmax(120px, 150px) 1fr; }
  .cds-ev-card__body { padding: 16px; }
}

@media (max-width: 680px) {
  /* Month grid is too cramped on phones → switch to the stacked agenda. */
  .cds-ev-cal-table { display: none; }
  .cds-ev-cal-agenda { display: block; }
}

@media (max-width: 600px) {
  .cds-eventi { --cds-cols: 1; }
  .cds-ev-toolbar { gap: 10px; }
  .cds-ev-search { flex: 1 1 100%; }
  .cds-ev-tools { width: 100%; gap: 8px; }
  .cds-ev-datewrap { flex: 1 1 100%; order: 3; }
  .cds-eventi .cds-ev-date { width: 100%; justify-content: center; }
  .cds-ev-scope { flex: 1 1 auto; }
  .cds-eventi .cds-ev-scope__btn { flex: 1 1 0; padding: 0 10px; }
  .cds-ev-view { flex: none; }
  .cds-ev-cal-pop { right: auto; left: 0; }
  .cds-ev-pagination { justify-content: center; }
  .cds-eventi .cds-ev-page--prev,
  .cds-eventi .cds-ev-page--next { order: 2; }

  /* LISTA cards stack like the grid cards on phones. */
  .cds-ev-card--media,
  .cds-ev-card--nomedia { grid-template-columns: 1fr; }
  .cds-ev-card--media .cds-ev-card__media {
    order: -1;
    aspect-ratio: 16 / 9;
    min-height: 0;
    border-radius: var(--cds-radius) var(--cds-radius) 0 0;
  }
  .cds-ev-card--media .cds-ev-card__img { min-height: 0; }
  .cds-ev-card--media .cds-ev-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 3;
    flex-direction: row;
    gap: 6px;
    align-items: baseline;
    border-radius: 10px;
    padding: 8px 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .28);
  }
  .cds-ev-card--media .cds-ev-badge__day { font-size: 22px; }
  .cds-ev-card--media .cds-ev-badge__mon { font-size: 11px; }
  .cds-ev-card--nomedia .cds-ev-badge {
    flex-direction: row;
    gap: 6px;
    align-items: baseline;
    justify-content: flex-start;
    padding: 16px 16px 0;
    background: none;
    color: var(--cds-blue);
    border-radius: 0;
  }
  .cds-ev-card--nomedia .cds-ev-badge__day { font-size: 22px; }
  .cds-ev-card--nomedia .cds-ev-badge__mon { opacity: .8; }
}

@media (max-width: 380px) {
  .cds-ev-cal-pop { width: calc(100vw - 24px); padding: 12px; }
  .cds-eventi .cds-ev-cal-day { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .cds-ev-card, .cds-ev-card__img, .cds-ev-card__more span, .cds-ev-results { transition: none; }
  .cds-ev-spinner { animation-duration: 1.4s; }
}
