/**
 * Yakapartir Planning Widget — V8 (feed style Eventbrite + load more)
 * Tous les styles sont scopés sous .yp-widget pour ne pas leak sur le thème WP.
 */

.yp-widget {
  --yp-primary: #2E2AB5;
  --yp-primary-soft: rgba(46, 42, 181, 0.08);
  --yp-accent: #FBD63A;
  --yp-heading: #54595F;
  --yp-text: #7A7A7A;
  --yp-bg: #FFFFF8;
  --yp-line: #E8E8E2;
  --yp-line-soft: #F2F2EE;
  --yp-card: #FFFFFF;
  --yp-orange-bg: #FEF3E0;
  --yp-orange-fg: #C26A1A;
  --yp-green-bg: #E8F5EE;
  --yp-green-fg: #2A8A5F;

  font-family: 'Lato', -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 15px; line-height: 1.55;
  color: var(--yp-text);
  background: var(--yp-bg);
}
.yp-widget *, .yp-widget *::before, .yp-widget *::after {
  box-sizing: border-box; -webkit-tap-highlight-color: transparent;
}

/* HEADER STICKY (toolbar + filters dans 1 seul wrapper, pas de gap mobile) */
.yp-widget .yp-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--yp-card);
}

/* TOOLBAR (stats) */
.yp-widget .yp-toolbar {
  background: var(--yp-card);
  border-bottom: 1px solid var(--yp-line);
  padding: 14px 20px;
}
.yp-widget .yp-wrap {
  max-width: 760px; margin: 0 auto;
  display: flex; align-items: center; gap: 14px;
}
.yp-widget .yp-stats {
  font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 17px;
  color: var(--yp-heading);
}
.yp-widget .yp-stats .yp-num { color: var(--yp-primary); }

/* FILTERS (dans le wrapper .yp-header sticky) */
.yp-widget .yp-filters {
  background: var(--yp-card);
  border-bottom: 1px solid var(--yp-line);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.yp-widget .yp-filters::-webkit-scrollbar { display: none; }
.yp-widget .yp-filters-inner {
  display: flex; gap: 8px; padding: 10px 20px;
  max-width: 1100px; margin: 0 auto;
}
.yp-widget .yp-chip {
  flex-shrink: 0;
  padding: 6px 14px;
  background: var(--yp-card); border: 1px solid var(--yp-line);
  border-radius: 20px;
  font-family: 'Lato', sans-serif; font-weight: 600; font-size: 13px; color: var(--yp-text);
  cursor: pointer; user-select: none;
  transition: all 0.15s;
}
.yp-widget .yp-chip:hover { border-color: var(--yp-primary); color: var(--yp-primary); }
.yp-widget .yp-chip.active {
  background: var(--yp-primary); color: white; border-color: var(--yp-primary);
}
.yp-widget .yp-chip.disabled {
  opacity: 0.4; pointer-events: none; cursor: not-allowed;
}
.yp-widget .yp-chip .yp-count { margin-left: 4px; opacity: 0.7; font-weight: 400; }
.yp-widget .yp-chip .yp-x {
  display: none;
  margin-left: 6px; padding: 0 0 0 6px;
  border-left: 1px solid rgba(255, 255, 255, 0.3);
  font-size: 14px; line-height: 1; opacity: 0.85;
}
.yp-widget .yp-chip.active .yp-x { display: inline-block; }
.yp-widget .yp-chip.active .yp-count { display: none; }

/* MAIN */
.yp-widget .yp-main {
  max-width: 760px; margin: 0 auto;
  padding: 16px 20px 30px;
}

/* GRID FEED */
.yp-widget .yp-events {
  display: grid;
  grid-template-columns: 1fr 1fr; /* 2 cols mobile */
  gap: 10px;
}

/* EVENT CARD (style Eventbrite) */
.yp-widget .yp-event {
  display: block;
  background: var(--yp-card); border: 1px solid var(--yp-line);
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none; color: inherit;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.08s, box-shadow 0.15s;
}
.yp-widget .yp-event:hover { border-color: var(--yp-primary); box-shadow: 0 4px 12px rgba(46,42,181,0.10); }
.yp-widget .yp-event:active { transform: scale(0.99); }
.yp-widget .yp-event.full { opacity: 0.6; }
.yp-widget .yp-event.full:hover { border-color: var(--yp-line); box-shadow: none; }

/* IMAGE + OVERLAYS */
.yp-widget .yp-event-media {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--yp-line-soft);
  overflow: hidden;
}

/* DOW + durée masqués sur viewport très étroit (< 360px), affichés sinon */
@media (max-width: 359px) {
  .yp-widget .yp-date-tag .yp-dow,
  .yp-widget .yp-time-tag .yp-dur { display: none; }
}
.yp-widget .yp-event-img,
.yp-widget .yp-event-img-fallback {
  position: absolute; inset: 0;
  background-size: cover; background-position: center; background-repeat: no-repeat;
}
.yp-widget .yp-event-img-fallback {
  background: var(--yp-primary-soft);
  display: flex; align-items: center; justify-content: center;
  color: var(--yp-primary); font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 38px;
}

/* DATE TAG (top-left) — compact pour tenir sur 320px */
.yp-widget .yp-date-tag {
  position: absolute; top: 6px; left: 6px;
  background: white; color: var(--yp-heading);
  padding: 3px 7px; border-radius: 4px;
  font-family: 'Lato', sans-serif; font-weight: 700; font-size: 10px;
  line-height: 1.2;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  display: inline-flex; align-items: baseline; gap: 3px;
}
.yp-widget .yp-date-tag .yp-dow {
  color: var(--yp-primary); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; font-size: 9px;
}
.yp-widget .yp-date-tag .yp-date-num {
  font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 12px; color: var(--yp-heading);
}
.yp-widget .yp-date-tag .yp-mon {
  color: var(--yp-text); font-weight: 600;
  text-transform: uppercase; font-size: 9px; letter-spacing: 0.04em;
}
.yp-widget .yp-date-tag.today { background: var(--yp-primary); color: white; }
.yp-widget .yp-date-tag.today .yp-dow,
.yp-widget .yp-date-tag.today .yp-date-num,
.yp-widget .yp-date-tag.today .yp-mon { color: white; }

/* TIME TAG (top-right) — compact, juste l'heure de début */
.yp-widget .yp-time-tag {
  position: absolute; top: 6px; right: 6px;
  background: rgba(0, 0, 0, 0.7); color: white;
  padding: 3px 7px; border-radius: 4px;
  font-family: 'Lato', sans-serif; font-weight: 700; font-size: 11px;
  line-height: 1.3;
}
.yp-widget .yp-time-tag .yp-dur { font-weight: 400; opacity: 0.85; font-size: 10px; }

/* Sur desktop ≥720px : on peut se permettre des tags un peu plus grands */
@media (min-width: 720px) {
  .yp-widget .yp-date-tag { padding: 4px 8px; font-size: 11px; top: 8px; left: 8px; }
  .yp-widget .yp-date-tag .yp-dow { font-size: 10px; }
  .yp-widget .yp-date-tag .yp-date-num { font-size: 13px; }
  .yp-widget .yp-date-tag .yp-mon { font-size: 10px; }
  .yp-widget .yp-time-tag { padding: 4px 8px; font-size: 12px; top: 8px; right: 8px; }
}

/* BODY */
.yp-widget .yp-event-body {
  padding: 10px 12px 12px;
  display: flex; flex-direction: column; gap: 4px;
  min-width: 0;
}
.yp-widget .yp-event-title {
  font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 14px; color: var(--yp-heading);
  line-height: 1.25; margin: 0;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  min-height: 35px;
}
.yp-widget .yp-event-meta {
  font-size: 12px; color: var(--yp-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.yp-widget .yp-event-meta:empty { display: none; }
.yp-widget .yp-event-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 4px;
}
.yp-widget .yp-event-price {
  font-family: 'Nunito', sans-serif; font-weight: 800; color: var(--yp-heading); font-size: 15px;
}
.yp-widget .yp-badge {
  padding: 2px 8px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; border-radius: 3px;
  font-family: 'Lato', sans-serif;
}
.yp-widget .yp-badge.low { background: var(--yp-orange-bg); color: var(--yp-orange-fg); }
.yp-widget .yp-badge.avail { background: var(--yp-green-bg); color: var(--yp-green-fg); }
.yp-widget .yp-badge.full { background: #F2F2F2; color: #555; }

/* LOAD MORE / END */
.yp-widget .yp-load-more-wrap {
  display: flex; justify-content: center;
  padding: 24px 0 0;
}
.yp-widget .yp-load-more {
  background: white;
  border: 1px solid var(--yp-line);
  color: var(--yp-heading);
  font-family: 'Lato', sans-serif; font-weight: 700; font-size: 14px;
  padding: 10px 22px; border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.yp-widget .yp-load-more:hover { border-color: var(--yp-primary); color: var(--yp-primary); }
.yp-widget .yp-end-message {
  text-align: center; color: var(--yp-text); font-size: 13px;
  padding: 24px 0 0;
}

/* EMPTY */
.yp-widget .yp-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--yp-text);
  background: var(--yp-card); border: 1px dashed var(--yp-line);
}
.yp-widget .yp-empty-label {
  font-family: 'Nunito', sans-serif; font-weight: 700; color: var(--yp-heading);
  font-size: 18px; margin-bottom: 6px;
}

/* FOOTNOTE */
.yp-widget .yp-footnote {
  margin: 32px 0 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--yp-line-soft);
  font-size: 12px; color: var(--yp-text); text-align: center;
}
.yp-widget .yp-footnote .yp-dot { color: var(--yp-accent); }

/* MODALE Yoplanning custom (globale, pas scopée) — popup avec backdrop */
.yp-modal {
  position: fixed; inset: 0; z-index: 9999999;
  background: rgba(0, 0, 0, 0.7);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: yp-modal-fade 0.2s ease-out;
}
@keyframes yp-modal-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.yp-modal-content {
  position: relative;
  background: white;
  border-radius: 12px;
  width: 100%; max-width: 1000px;
  height: 100%; max-height: 95vh;
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.yp-modal iframe {
  flex: 1 1 auto; width: 100%; height: 100%;
  border: 0; display: block;
}
.yp-modal-close {
  position: absolute; top: 12px; right: 12px;
  width: 36px; height: 36px;
  background: white; color: #54595F;
  border: 1px solid #E8E8E2; border-radius: 50%;
  font-size: 22px; line-height: 1;
  cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 10;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  transition: background 0.15s, border-color 0.15s;
}
.yp-modal-close:hover { background: #F5F5F5; border-color: #2E2AB5; }

/* Mobile : modale presque plein écran (mais backdrop visible) */
@media (max-width: 600px) {
  .yp-modal { padding: 8px; }
  .yp-modal-content { border-radius: 8px; max-height: 100%; }
  .yp-modal-close { top: 8px; right: 8px; width: 32px; height: 32px; font-size: 20px; }
}

/* DESKTOP ≥ 720px : main élargi 1100, grid auto-fill */
@media (min-width: 720px) {
  .yp-widget .yp-wrap { max-width: 1100px; }
  .yp-widget .yp-filters-inner { max-width: 1100px; }
  .yp-widget .yp-main { max-width: 1100px; }
  .yp-widget .yp-events {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
  }
}
