/* ================================================================
   Smart Posts Display Pro — Frontend Styles
   ================================================================ */

:root {
  --spd-accent: #6366f1;
  --spd-cols: 3;
  --spd-gap: 24px;
  --spd-radius: 12px;
  --spd-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --spd-shadow: 0 4px 20px rgba(0,0,0,0.08);
  --spd-shadow-hover: 0 12px 40px rgba(0,0,0,0.15);
  --spd-text: #1e293b;
  --spd-muted: #64748b;
  --spd-border: #e2e8f0;
  --spd-bg: #ffffff;
  --spd-bg-soft: #f8fafc;
}

.spd-wrap { font-family: inherit; box-sizing: border-box; }
.spd-wrap *, .spd-wrap *::before, .spd-wrap *::after { box-sizing: inherit; }

.spd-no-posts { color: var(--spd-muted); padding: 2rem; text-align: center; }

/* ================================================================
   CARD
   ================================================================ */
.spd-card {
  background: var(--spd-bg);
  border: 1px solid var(--spd-border);
  border-radius: var(--spd-radius, 12px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--spd-transition), box-shadow var(--spd-transition);
  box-shadow: var(--spd-shadow);
  height: 100%;
}
.spd-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--spd-shadow-hover);
}

.spd-card__thumb-wrap {
  display: block;
  position: relative;
  overflow: hidden;
  aspect-ratio: 16/10;
  background: var(--spd-bg-soft);
}
.spd-card__thumb {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.spd-card:hover .spd-card__thumb { transform: scale(1.04); }

.spd-card__badge {
  position: absolute;
  top: 12px; left: 12px;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 100px;
  backdrop-filter: blur(4px);
}

.spd-card__body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 10px;
}
.spd-card__cats { display: flex; flex-wrap: wrap; gap: 6px; }
.spd-card__cat {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-decoration: none;
  opacity: 0.9;
}
.spd-card__cat:hover { opacity: 1; text-decoration: underline; }

.spd-card__title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
  margin: 0;
  color: var(--spd-text);
}
.spd-card__title a {
  color: inherit;
  text-decoration: none;
  transition: color var(--spd-transition);
}
.spd-card__title a:hover { color: var(--spd-accent); }

.spd-card__excerpt {
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--spd-muted);
  margin: 0;
  flex: 1;
}

.spd-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--spd-border);
  flex-wrap: wrap;
}
.spd-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 0.75rem;
  color: var(--spd-muted);
}
.spd-card__meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}
.spd-card__btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 6px;
  white-space: nowrap;
  transition: opacity var(--spd-transition), transform var(--spd-transition);
}
.spd-card__btn:hover { opacity: 0.88; transform: translateX(2px); }

/* ================================================================
   GRID
   ================================================================ */
.spd-grid-wrap { width: 100%; }
.spd-grid {
  display: grid;
  grid-template-columns: repeat(var(--spd-cols, 3), 1fr);
  gap: var(--spd-gap, 24px);
}
@media (max-width: 1024px) {
  .spd-grid { grid-template-columns: repeat(min(var(--spd-cols, 3), 2), 1fr); }
}
@media (max-width: 640px) {
  .spd-grid { grid-template-columns: 1fr; }
}

/* ================================================================
   PAGINATION NUMÉROTÉE
   ================================================================ */
.spd-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid #e2e8f0;
}
.spd-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 6px;
  border-radius: 8px;
  border: 1.5px solid #e2e8f0;
  background: #fff;
  color: #475569;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.spd-page-btn:hover:not(:disabled) {
  border-color: var(--spd-btn, #6366f1);
  color: var(--spd-btn, #6366f1);
  background: color-mix(in srgb, var(--spd-btn, #6366f1) 10%, #fff);
}
/* Fallback for browsers without color-mix */
@supports not (color: color-mix(in srgb, red 10%, blue)) {
  .spd-page-btn:hover:not(:disabled) {
    background: #f0f4ff;
  }
}
.spd-page-btn.is-active {
  background: var(--spd-btn, #6366f1);
  border-color: var(--spd-btn, #6366f1);
  color: #fff;
  pointer-events: none;
}
.spd-page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.spd-page-btn--arrow {
  min-width: 40px;
  color: #94a3b8;
}
.spd-page-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: #94a3b8;
  font-size: 0.9rem;
}

/* Loading overlay during page change */
.spd-grid-wrap.is-loading .spd-grid {
  opacity: 0.4;
  pointer-events: none;
  transition: opacity 0.2s;
}
.spd-grid-wrap.is-loading .spd-pagination {
  pointer-events: none;
  opacity: 0.6;
}


/* ================================================================
   SLIDER
   ================================================================ */
.spd-slider-wrap { width: 100%; }
.spd-slider {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  aspect-ratio: 16/7;
  background: #0f172a;
  min-height: 340px;
}
@media (max-width: 640px) {
  .spd-slider { aspect-ratio: unset; min-height: 420px; }
}

.spd-slider__track {
  display: flex;
  height: 100%;
  transition: transform 0.7s cubic-bezier(0.77, 0, 0.175, 1);
}
.spd-slider__slide {
  position: relative;
  min-width: 100%;
  height: 100%;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.spd-slider__bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: transform 8s ease;
}
.spd-slider__slide.is-active .spd-slider__bg { transform: scale(1.05); }

.spd-slider__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.3) 50%, transparent 100%);
}

.spd-slider__content {
  position: relative;
  z-index: 2;
  padding: 40px;
  max-width: 680px;
  color: #fff;
}
@media (max-width: 640px) {
  .spd-slider__content { padding: 24px; }
}

.spd-slider__cat {
  display: inline-block;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 100px;
  text-decoration: none;
  margin-bottom: 14px;
}

.spd-slider__title {
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  font-weight: 800;
  line-height: 1.2;
  margin: 0 0 12px;
}
.spd-slider__title a { color: inherit; text-decoration: none; }
.spd-slider__title a:hover { text-decoration: underline; }

.spd-slider__excerpt {
  font-size: 0.95rem;
  line-height: 1.6;
  opacity: 0.85;
  margin: 0 0 20px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.spd-slider__meta {
  display: flex;
  gap: 16px;
  font-size: 0.8rem;
  opacity: 0.7;
  margin-bottom: 20px;
}

.spd-slider__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  padding: 10px 24px;
  border-radius: 100px;
  transition: opacity 0.2s, transform 0.2s;
}
.spd-slider__btn:hover { opacity: 0.88; transform: translateX(3px); }

.spd-slider__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  width: 48px; height: 48px;
  border-radius: 50%;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.spd-slider__arrow:hover { background: rgba(255,255,255,0.3); }
.spd-slider__arrow--prev { left: 20px; }
.spd-slider__arrow--next { right: 20px; }

.spd-slider__dots {
  position: absolute;
  bottom: 20px;
  right: 40px;
  display: flex;
  gap: 8px;
  z-index: 10;
}
.spd-slider__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  cursor: pointer;
  transition: all 0.3s;
  border: none;
  padding: 0;
}
.spd-slider__dot.is-active {
  background: #fff;
  width: 24px;
  border-radius: 4px;
}

.spd-slider__counter {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10;
  color: rgba(255,255,255,0.7);
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(0,0,0,0.25);
  padding: 4px 10px;
  border-radius: 100px;
  backdrop-filter: blur(4px);
}

/* ================================================================
   CAROUSEL
   ================================================================ */
.spd-carousel-wrap { width: 100%; }
.spd-carousel {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.spd-carousel__viewport {
  flex: 1;
  overflow: hidden;
  border-radius: 4px;
}
.spd-carousel__track {
  display: flex;
  gap: var(--spd-gap, 24px);
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}
.spd-carousel__item {
  flex-shrink: 0;
  /* width calculated by JS */
}

.spd-carousel__arrow {
  flex-shrink: 0;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--spd-accent, #6366f1);
  color: var(--spd-accent, #6366f1);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  box-shadow: var(--spd-shadow);
  z-index: 2;
}
.spd-carousel__arrow:hover {
  background: var(--spd-accent, #6366f1);
  color: #fff;
}
.spd-carousel__arrow:disabled { opacity: 0.3; cursor: default; }

.spd-carousel__dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}
.spd-carousel__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--spd-border, #e2e8f0);
  cursor: pointer;
  border: none;
  transition: all 0.3s;
}
.spd-carousel__dot.is-active {
  background: var(--spd-accent, #6366f1);
  width: 20px;
  border-radius: 4px;
}

/* ================================================================
   Animations
   ================================================================ */
@keyframes spd-fade-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.spd-card { animation: spd-fade-in 0.4s ease both; }
.spd-grid .spd-card:nth-child(1) { animation-delay: 0.05s; }
.spd-grid .spd-card:nth-child(2) { animation-delay: 0.10s; }
.spd-grid .spd-card:nth-child(3) { animation-delay: 0.15s; }
.spd-grid .spd-card:nth-child(4) { animation-delay: 0.20s; }
.spd-grid .spd-card:nth-child(5) { animation-delay: 0.25s; }
.spd-grid .spd-card:nth-child(6) { animation-delay: 0.30s; }

/* Loading skeleton */
.spd-card.is-loading .spd-card__thumb-wrap,
.spd-card.is-loading .spd-card__title,
.spd-card.is-loading .spd-card__excerpt {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: spd-shimmer 1.5s infinite;
  border-radius: 4px;
  color: transparent;
}
@keyframes spd-shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ================================================================
   FILTRE PAR CATÉGORIE (grille)
   ================================================================ */
.spd-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}
.spd-filter__btn {
  appearance: none;
  border: 1.5px solid #e2e8f0;
  background: #fff;
  color: #334155;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .18s ease;
}
.spd-filter__btn:hover {
  border-color: var(--spd-accent, #6366f1);
  color: var(--spd-accent, #6366f1);
}
.spd-filter__btn.is-active {
  background: var(--spd-accent, #6366f1);
  border-color: var(--spd-accent, #6366f1);
  color: #fff;
}
.spd-grid-wrap.is-loading .spd-grid { pointer-events: none; }

/* ================================================================
   LISTE DES CATÉGORIES  [smart_posts_categories]
   ================================================================ */
.spd-cats { margin: 0 0 24px; }
.spd-cats__title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 14px;
  color: #0f172a;
}

/* Pills */
.spd-cats__pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.spd-cats__pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  color: #334155;
  background: #f1f5f9;
  padding: 9px 16px;
  border-radius: 999px;
  transition: all .18s ease;
}
.spd-cats__pill:hover {
  background: var(--spd-accent, #6366f1);
  color: #fff;
}
.spd-cats__pill-count {
  font-size: 12px;
  font-weight: 700;
  background: rgba(0,0,0,.08);
  padding: 1px 8px;
  border-radius: 999px;
}
.spd-cats__pill:hover .spd-cats__pill-count {
  background: rgba(255,255,255,.25);
}

/* List */
.spd-cats__list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
}
.spd-cats__item + .spd-cats__item { border-top: 1px solid #f1f5f9; }
.spd-cats__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  color: #334155;
  font-size: 15px;
  font-weight: 500;
  padding: 12px 16px;
  transition: background .15s ease, color .15s ease;
}
.spd-cats__link:hover {
  background: #f8fafc;
  color: var(--spd-accent, #6366f1);
}
.spd-cats__count {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  background: #f1f5f9;
  padding: 2px 9px;
  border-radius: 999px;
}

/* Dropdown */
.spd-cats__select {
  width: 100%;
  max-width: 320px;
  font: inherit;
  font-size: 15px;
  color: #334155;
  padding: 11px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}
.spd-cats__select:focus {
  outline: none;
  border-color: var(--spd-accent, #6366f1);
}

/* ================================================================
   LISTE D'ARTICLES RÉCENTS  [smart_posts_recent layout="list"]
   ================================================================ */
.spd-recent { width: 100%; }
.spd-recent__list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.spd-recent__item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  align-items: flex-start;
}
.spd-recent__item + .spd-recent__item { border-top: 1px solid #f1f5f9; }
.spd-recent__thumb-wrap {
  flex: 0 0 84px;
  width: 84px;
  height: 84px;
  border-radius: 10px;
  overflow: hidden;
  display: block;
}
.spd-recent__thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .3s ease;
}
.spd-recent__item:hover .spd-recent__thumb { transform: scale(1.06); }
.spd-recent__body {
  flex: 1 1 auto;
  min-width: 0;
}
.spd-recent__cat {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  text-decoration: none;
  color: var(--spd-accent, #6366f1);
  margin-bottom: 4px;
}
.spd-recent__title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}
.spd-recent__title a {
  color: #0f172a;
  text-decoration: none;
  transition: color .15s ease;
}
.spd-recent__title a:hover { color: var(--spd-accent, #6366f1); }
.spd-recent__excerpt {
  margin: 0 0 6px;
  font-size: 13px;
  line-height: 1.5;
  color: #64748b;
}
.spd-recent__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: #94a3b8;
}
.spd-recent__date {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
