/* ============================================================
   AGENDA PAGE — 91 FM
   ============================================================ */

/* ---------- Variables ---------- */
.ag {
  --ag-brand:       #d91319;
  --ag-ink:         #0f172a;
  --ag-muted:       #4b5a78;
  --ag-panel:       #ffffff;
  --ag-border:      rgba(220, 228, 240, 0.96);
  --ag-radius:      18px;
  --ag-wrap:        min(var(--page-max-width), calc(100% - 2 * var(--page-side-margin)));
  --ag-gap:         14px;
  background: #f3f6fb;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ---------- Hero ---------- */
.ag-hero {
  position: relative;
  overflow: hidden; /* repli pour les navigateurs sans `clip` */
  overflow: clip;
  padding: 72px 0 64px;
}

.ag-hero::before {
  content: '';
  position: absolute;
  inset: -30px;
  background: url('https://media.webradio91fm.fr/assets/content/backgrounds/agenda.jpg') center / cover no-repeat;
  filter: blur(8px);
  transform: scale(1.08);
  opacity: 0.75;
  z-index: 0;
}

.ag-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(8, 14, 30, 0.58);
  z-index: 1;
}

.ag-hero-inner {
  position: relative;
  z-index: 2;
  width: var(--ag-wrap);
  margin: 0 auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ag-hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.ag-hero-kicker::before,
.ag-hero-kicker::after {
  content: '';
  display: block;
  width: 24px;
  height: 2px;
  background: var(--ag-brand);
  border-radius: 99px;
}

.ag-hero h1 {
  margin: 0 0 18px;
  font-size: clamp(3.8rem, 10vw, 7.5rem);
  font-weight: 900;
  font-style: italic;
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: transparent;
  -webkit-text-stroke: 2px rgba(255, 255, 255, 0.82);
}

.ag-hero-sub {
  margin: 0;
  font-size: clamp(14px, 2vw, 17px);
  color: rgba(255, 255, 255, 0.68);
  line-height: 1.5;
  max-width: 44ch;
  font-weight: 400;
}

/* ---------- Body ---------- */
.ag-body {
  flex: 1;
  padding: 28px 0 60px;
}

.ag-wrap {
  width: var(--ag-wrap);
  margin: 0 auto;
}

/* ---------- Toolbar (filtres) ---------- */
.ag-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.ag-toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1 1 auto;
  min-width: 0;
}

.ag-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ag-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--ag-muted);
  white-space: nowrap;
}

/* Pill de filtre */
.ag-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1.5px solid rgba(15, 23, 42, 0.1);
  background: #ffffff;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ag-muted);
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease, color .14s ease;
  white-space: nowrap;
  user-select: none;
}

.ag-pill:hover {
  border-color: rgba(15, 23, 42, 0.22);
  color: var(--ag-ink);
}

.ag-pill[aria-pressed="true"],
.ag-pill.is-active {
  background: var(--ag-brand);
  border-color: var(--ag-brand);
  color: #ffffff;
}
.ag-pill svg { flex-shrink: 0; stroke: currentColor; }
.ag-pill img { flex-shrink: 0; transition: filter .14s ease; }
.ag-pill.is-active img,
.ag-pill[aria-pressed="true"] img { filter: brightness(0) invert(1); }
.ag-badge svg { flex-shrink: 0; }

/* Sélecteur de mois */
.ag-date-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ag-date-input,
.ag-date-input.flatpickr-input.flatpickr-input { /* override flatpickr */
  padding: 6px 12px;
  border-radius: 999px;
  border: 1.5px solid rgba(15, 23, 42, 0.1);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ag-muted);
  cursor: pointer;
  transition: border-color .14s ease;
  background: #fff;
  min-width: 0;
  width: auto;
}
.ag-date-input:hover,
.ag-date-input:focus {
  border-color: rgba(15, 23, 42, 0.24);
  outline: none;
  color: var(--ag-ink);
}
.ag-date-clear {
  border: none;
  background: none;
  font-size: 11px;
  color: var(--ag-muted);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 50%;
  line-height: 1;
  transition: color .14s;
}
.ag-date-clear:hover { color: var(--ag-brand); }

/* Flatpickr — couleurs 91 FM */
.flatpickr-day.selected,
.flatpickr-day.selected:hover {
  background: var(--ag-brand);
  border-color: var(--ag-brand);
}
.flatpickr-day.today { border-color: var(--ag-brand); }
.flatpickr-day.today:hover { background: var(--ag-brand); border-color: var(--ag-brand); color: #fff; }
.flatpickr-months .flatpickr-prev-month:hover svg,
.flatpickr-months .flatpickr-next-month:hover svg { fill: var(--ag-brand); }
.flatpickr-day:not(.disabled):not(.selected):not(.prevMonthDay):not(.nextMonthDay) { font-weight: 700; }

/* ---------- Grille ---------- */
.ag-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--ag-gap);
}

/* ---------- Carte ---------- */
.ag-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--ag-radius);
  background: var(--ag-panel);
  border: 1px solid var(--ag-border);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
  transition: transform .18s ease, box-shadow .18s ease;
}

.ag-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.09);
}

.ag-card a {
  display: grid;
  grid-template-rows: auto 1fr;
  color: inherit;
  text-decoration: none;
  height: 100%;
}

/* Media */
.ag-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #e8eef7;
  overflow: hidden;
}

.ag-media picture {
  display: block;
  width: 100%;
  height: 100%;
}

.ag-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform .28s ease;
}

.ag-card:hover .ag-media img {
  transform: scale(1.04);
}

.ag-media::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(15, 23, 42, 0.14) 100%);
  pointer-events: none;
}

/* Badge catégorie */
.ag-badge {
  position: absolute;
  left: 10px;
  top: 10px;
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(22, 37, 70, 0.88);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .02em;
  z-index: 1;
  max-width: calc(100% - 20px);
  gap: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Corps */
.ag-body-card {
  padding: 14px 14px 13px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ag-title {
  margin: 0;
  font-size: 15px;
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--ag-ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden; /* repli pour les navigateurs sans `clip` */
  overflow: clip;
}

.ag-meta {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ag-meta-row {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 12px;
  line-height: 1.3;
  color: var(--ag-muted);
}

.ag-icon {
  width: 13px;
  height: 13px;
  margin-top: 1px;
  flex: 0 0 auto;
  color: var(--ag-brand);
}

/* ---------- Placeholder image ---------- */
.ag-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e2eaf6, #f0f4fb);
}

.ag-placeholder svg {
  width: 36px;
  height: 36px;
  color: #b8c5da;
}

/* ---------- Skeleton ---------- */
@keyframes agShimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

.ag-skeleton-media,
.ag-skel-line {
  background: linear-gradient(90deg,
    rgba(224, 231, 241, 0.7),
    rgba(248, 250, 252, 0.95),
    rgba(224, 231, 241, 0.7));
  background-size: 200% 100%;
  animation: agShimmer 1.3s linear infinite;
}

.ag-skeleton-media {
  aspect-ratio: 16 / 10;
  width: 100%;
}

.ag-skel-line {
  height: 13px;
  border-radius: 999px;
  margin-top: 10px;
}

.ag-skel-line:first-child { margin-top: 0; }
.ag-skel-line--lg  { width: 85%; }
.ag-skel-line--md  { width: 65%; }
.ag-skel-line--sm  { width: 48%; }

.ag-skeleton-body {
  padding: 14px;
}

/* ---------- États vides / erreur ---------- */
.ag-state {
  grid-column: 1 / -1;
  padding: 56px 24px 60px;
  text-align: center;
  border-radius: var(--ag-radius);
  background: #fff;
  border: 1px solid var(--ag-border);
}

.ag-state-emoji {
  margin: 0 0 12px;
  font-size: 2.8rem;
  line-height: 1;
}

.ag-state-title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ag-ink);
}

.ag-state-sub {
  margin: 0;
  font-size: 14px;
  color: var(--ag-muted);
  line-height: 1.5;
  max-width: 36ch;
  margin-inline: auto;
}

/* ---------- Page blanche (0 événement en base) ---------- */
.ag-blank-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 24px 56px;
  text-align: center;
  background: #fff;
}

.ag-blank-page-img {
  width: min(42vw, 480px);
  min-width: 180px;
  margin-bottom: 36px;
  animation: agFloat 3.8s ease-in-out infinite;
}

@keyframes agFloat {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-12px); }
}

.ag-blank-page-title {
  margin: 0 0 16px;
  font-size: clamp(1.8rem, 4.5vw, 5rem);
  font-weight: 900;
  font-style: italic;
  letter-spacing: -0.04em;
  line-height: 0.92;
  color: var(--ag-ink);
  white-space: nowrap;
}

.ag-blank-page-sub {
  margin: 0 0 28px;
  font-size: clamp(14px, 1.8vw, 16px);
  color: var(--ag-muted);
  line-height: 1.6;
  max-width: 38ch;
}

.ag-blank-page-action {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.ag-blank-page-cta-text {
  font-size: 15px;
  font-weight: 500;
  color: var(--ag-muted);
}

.ag-blank-page-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 15px 32px;
  border-radius: 999px;
  background: var(--ag-brand);
  color: #fff !important;
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: -0.01em;
  transition: background .15s, transform .15s, box-shadow .15s;
  box-shadow: 0 6px 24px rgba(217,19,25,.35);
}

.ag-blank-page-btn:hover {
  background: #be0e14;
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(217,19,25,.45);
}

@media (max-width: 640px) {
  .ag-blank-page { min-height: 52vh; padding: 48px 20px 64px; }
  .ag-blank-page-title { white-space: normal; }
  .ag-blank-page-img { width: min(70vw, 280px); }
}

/* ---------- Load more ---------- */
.ag-more {
  display: flex;
  justify-content: center;
  margin-top: 28px;
}

.ag-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 26px;
  border-radius: 999px;
  border: 1.5px solid rgba(15, 23, 42, 0.15);
  background: #fff;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ag-ink);
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease, transform .14s ease;
}

.ag-more-btn:hover {
  background: var(--ag-ink);
  border-color: var(--ag-ink);
  color: #fff;
  transform: translateY(-1px);
}

.ag-more-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* Vue carte */
/* Map layout */
.ag-map-wrap { display: flex; margin-bottom: 24px; border-radius: 16px; overflow: hidden; box-shadow: 0 4px 20px rgba(15,23,42,.08); height: 520px; }
.ag-map-sidebar { width: 300px; flex-shrink: 0; overflow-y: auto; background: #fff; border-right: 1.5px solid rgba(220,228,240,.9); }
.ag-map { flex: 1; min-width: 0; height: 100%; }

/* Sidebar cards */
.ag-mcard { display: flex; align-items: stretch; gap: 0; border-bottom: 1px solid rgba(220,228,240,.7); text-decoration: none; color: inherit; transition: background .12s; cursor: pointer; }
.ag-mcard:hover, .ag-mcard.is-hovered { background: #f4f6fb; }
.ag-mcard.is-hovered { box-shadow: inset 3px 0 0 var(--ag-brand); }
.ag-mcard--nogeo { opacity: .6; }
.ag-mcard-img { width: 86px; flex-shrink: 0; overflow: hidden; position: relative; background: #e8edf5; }
.ag-mcard-img picture, .ag-mcard-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ag-mcard-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #b0bdd0; }
.ag-mcard-placeholder svg { width: 22px; height: 22px; }
.ag-mcard-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; padding: 10px 12px; }
.ag-mcard-badge { font-size: 10px !important; padding: 2px 7px !important; align-self: flex-start; }
.ag-mcard-title { font-size: 12.5px; font-weight: 700; color: #0f172a; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.35; }
.ag-mcard-meta { display: flex; align-items: center; gap: 4px; font-size: 11px; color: #4b5a78; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-mcard-meta svg { flex-shrink: 0; color: var(--ag-brand); }

@media (max-width: 720px) {
  .ag-map-wrap { flex-direction: column; height: auto; }
  .ag-map-sidebar { width: 100%; max-height: 240px; border-right: none; border-bottom: 1.5px solid rgba(220,228,240,.9); }
  .ag-map { height: 340px; }
}

/* Toggle liste/carte */
.ag-view-toggle { display: inline-flex; border: 1.5px solid rgba(15,23,42,.12); border-radius: 10px; overflow: hidden; }
.ag-view-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; background: #fff; border: none; cursor: pointer; color: var(--ag-muted); transition: background .13s ease, color .13s ease; }
.ag-view-btn:first-child { border-right: 1.5px solid rgba(15,23,42,.12); }
.ag-view-btn.is-active { background: var(--ag-ink); color: #fff; }
.ag-view-btn:hover:not(.is-active) { background: #f4f6fb; color: var(--ag-ink); }

/* Bouton Près de moi */
.ag-nearby-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; border: 1.5px solid rgba(15,23,42,.1); background: #fff; font-size: 12.5px; font-weight: 700; color: var(--ag-muted); cursor: pointer; transition: all .14s ease; white-space: nowrap; }
.ag-nearby-btn:hover { border-color: var(--ag-brand); color: var(--ag-brand); }
.ag-nearby-btn.is-active { background: var(--ag-brand); border-color: var(--ag-brand); color: #fff; }

/* Barre tri proximité */
.ag-nearby-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; padding: 9px 14px; border-radius: 10px; background: #fff3f3; border: 1.5px solid rgba(217,19,25,.18); font-size: 13px; font-weight: 600; color: #d91319; }
.ag-nearby-reset { margin-left: auto; padding: 4px 10px; border-radius: 999px; border: 1.5px solid rgba(217,19,25,.25); background: transparent; color: #d91319; font-size: 12px; font-weight: 700; cursor: pointer; transition: background .13s ease; }
.ag-nearby-reset:hover { background: rgba(217,19,25,.08); }
.ag-nearby-form { display: flex; align-items: center; gap: 6px; flex: 1; }
.ag-nearby-input { flex: 1; min-width: 0; padding: 4px 10px; border-radius: 8px; border: 1.5px solid rgba(217,19,25,.3); font-size: 13px; font-weight: 600; color: #0f172a; background: #fff; outline: none; }
.ag-nearby-input:focus { border-color: #d91319; }
.ag-nearby-go { padding: 4px 12px; border-radius: 8px; border: none; background: #d91319; color: #fff; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.ag-nearby-go:hover { background: #b91219; }
.ag-nearby-go:disabled { opacity: .5; cursor: default; }

/* Proposez votre événement */
.ag-propose {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 48px;
  padding: 24px 28px;
  border-radius: 18px;
  background: #f4f6fb;
  border: 1.5px dashed rgba(15,23,42,.12);
}
.ag-propose-text {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ag-muted);
}
.ag-propose-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  border-radius: 999px;
  background: var(--ag-brand);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: opacity .15s ease, transform .15s ease;
}
.ag-propose-btn:hover { opacity: .88; transform: translateY(-1px); }
.ag-propose-btn:visited { color: #fff; }

/* ---------- Filtres période ---------- */
.ag-period-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.ag-period-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1.5px solid rgba(15,23,42,.16);
  background: transparent;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ag-ink);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.ag-period-btn:hover { border-color: var(--ag-brand); color: var(--ag-brand); }
.ag-period-btn.is-active { background: var(--ag-ink); border-color: var(--ag-ink); color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .ag-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .ag-hero {
    padding: 48px 0 40px;
  }

  .ag-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .ag-body {
    padding: 20px 0 48px;
  }
}

@media (max-width: 480px) {
  .ag-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .ag-toolbar {
    gap: 8px;
  }

  .ag-toolbar-left {
    justify-content: center;
  }

  .ag-toolbar-right {
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
  }

  .ag-count,
  .ag-view-toggle,
  .ag-date-input {
    display: none;
  }
}
