/* ============================================
   VARIABLES CSS
   ============================================ */
:root {
  --fam-primary: #7b4ee0;
  --fam-card-bg: #1c1d1f;
  --fam-text: #ffffff;
  --fam-green: #3ab54a;
  --fam-border: #e2e2e2;
  --fam-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  --fam-radius: 14px;
}

/* ============================================
   TYPOGRAPHIE - CHARTE GRAPHIQUE
   ============================================ */
body .fam-catalogue-grid,
body .fam-card,
body .filter-sidebar,
body .fam-formation-content {
  font-family: "Open Sans", "Roboto", sans-serif;
}

.fam-card__title,
.fam-card__title a,
.filter-title,
.hero__title,
.fam-formation-content__title-h2,
.fam-formation-content__section-badge,
.fam-formation-content__module-title,
.fam-formation-content__price-name,
.fam-formation-content__price-num,
.fam-catalogue-domaine-title,
.fam-catalogue-item-title,
.fam-btn,
.hero__btn {
  font-family: "Poppins", "Open Sans", sans-serif;
}

/* ============================================
   GRILLE CATALOGUE
   ============================================ */
.fam-catalogue-grid {
  display: grid;
  gap: 30px;
  padding: 0;
}

.fam-catalogue-grid.fam-grid--1 {
  grid-template-columns: 1fr;
}

.fam-catalogue-grid.fam-grid--2 {
  grid-template-columns: repeat(2, 1fr);
}

.fam-catalogue-grid.fam-grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

/* ============================================
   CARTE FORMATION
   ============================================ */
.fam-card {
  background: var(--fam-card-bg, #1c1d1f);
  border-radius: var(--fam-radius, 14px);
  overflow: hidden;
  box-shadow: var(--fam-shadow, 0 20px 40px rgba(0, 0, 0, 0.25));
  transition: all 0.3s ease;
  height: 100%;
  display: flex !important;
  flex-direction: column;
  opacity: 1 !important;
  visibility: visible !important;
}

.fam-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35);
}

/* ============================================
   WIDGET FUSIONNÉ : Catalogue Complet (Filtres + Grille)
   ============================================ */
.elementor-widget-fam-catalogue-complet .fam-catalogue-complete,
.fam-catalogue-complete {
  display: flex !important;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 32px;
  width: 100%;
  box-sizing: border-box;
}

.fam-catalogue-complete__filtres {
  flex: 0 0 25%;
  width: 25%;
  min-width: 0;
  box-sizing: border-box;
}

.fam-catalogue-complete__grille {
  flex: 1 1 0%;
  width: auto;
  min-width: 0;
  box-sizing: border-box;
}

.fam-catalogue-complete--filtres-droite {
  flex-direction: row-reverse;
}

@media (max-width: 900px) {
  .fam-catalogue-complete {
    flex-wrap: wrap;
    flex-direction: column;
  }

  .fam-catalogue-complete__filtres,
  .fam-catalogue-complete__grille {
    width: 100%;
    flex: 1 1 100%;
  }
}

/* Card Media */
.fam-card__media {
  position: relative;
  height: 180px;
  background: linear-gradient(180deg, #2b2c2e 0%, #161618 100%);
  overflow: hidden;
  flex-shrink: 0;
}

.fam-card__photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
}

.fam-card__photo-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    rgba(0, 0, 0, 0.55) 0%,
    rgba(0, 0, 0, 0.15) 45%,
    rgba(0, 0, 0, 0) 60%
  );
}

/* Badges sur l'image */
.fam-card__badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: #f0b94d;
  color: #1c1d1f;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
  padding: 5px 12px;
  border-radius: 5px;
  z-index: 2;
  font-family: "Poppins", sans-serif;
}

.fam-card__category-badge {
  position: absolute;
  bottom: 12px;
  left: 12px;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 5px;
  z-index: 2;
  background: var(--fam-primary, #7b4ee0);
  font-family: "Poppins", sans-serif;
}

/* Card Body */
.fam-card__body {
  padding: 16px 18px 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.fam-card__title {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 700;
  color: var(--fam-text, #ffffff);
  line-height: 1.3;
  font-family: "Poppins", sans-serif;
}

.fam-card__title a {
  color: var(--fam-text, #ffffff);
  text-decoration: none;
  transition: color 0.3s ease;
}

.fam-card__title a:hover {
  color: var(--fam-primary, #7b4ee0);
}

.fam-card__author {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--fam-primary, #7b4ee0);
  font-weight: 500;
  font-family: "Poppins", sans-serif;
}

.fam-card__author i {
  margin-right: 4px;
}

.fam-card__desc {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.5;
  color: #c6c6c8;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-family: "Open Sans", sans-serif;
}

/* Rating */
.fam-card__rating {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.fam-card__rating-score {
  font-size: 13px;
  font-weight: 700;
  color: #f0b94d;
  font-family: "Poppins", sans-serif;
}

.fam-card__stars {
  display: flex;
  gap: 1px;
}

.fam-card__stars svg {
  width: 14px;
  height: 14px;
}

.fam-card__rating-count {
  font-size: 12px;
  color: #9a9a9c;
  font-family: "Open Sans", sans-serif;
}

/* Price */
.fam-card__price {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}

.fam-card__price-now {
  font-size: 19px;
  font-weight: 700;
  color: var(--fam-text, #ffffff);
  font-family: "Poppins", sans-serif;
}

.fam-card__price-old {
  font-size: 14px;
  color: #9a9a9c;
  text-decoration: line-through;
  font-family: "Open Sans", sans-serif;
}

/* Financement badges */
.fam-card__financement {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.fam-fin-badge {
  background: var(--fam-primary, #7b4ee0);
  color: #ffffff;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: "Poppins", sans-serif;
}

.fam-fin-badge i {
  font-size: 10px;
}

/* Handicap */
.fam-card__handicap {
  font-size: 11px;
  color: #9a9a9c;
  margin-bottom: 12px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  font-family: "Open Sans", sans-serif;
}

.fam-card__handicap i {
  margin-right: 6px;
}

/* Footer */
.fam-card__footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Boutons */
.fam-btn {
  font-weight: 600;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 6px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.25s ease;
  cursor: pointer;
  border: none;
  width: 100%;
  justify-content: center;
  font-family: "Poppins", sans-serif;
}

.fam-btn--primary {
  background: var(--fam-primary, #7b4ee0);
  color: #ffffff;
}

.fam-btn--primary:hover {
  background: var(--fam-primary, #7b4ee0);
  opacity: 0.85;
  color: #ffffff;
  transform: translateY(-2px);
}

/* ============================================
   FILTER SIDEBAR - DESIGN EXACT
   ============================================ */

.filter-sidebar {
  font-family: "Open Sans", "Helvetica Neue", sans-serif;
  font-size: 14px;
  color: #1a1a1a;
  max-width: 240px;
  background: #ffffff;
  border: 1px solid #e6e6e6;
  border-radius: 8px;
  padding: 16px;
}

/* --- Section (chaque bloc filtrable) --- */
.filter-section {
  border-top: 1px solid #e6e6e6;
  padding: 14px 0;
}

.filter-section:first-child {
  border-top: none;
  padding-top: 0;
}

.filter-section:last-child {
  padding-bottom: 0;
}

.filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  margin-bottom: 10px;
}

.filter-title {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #1a1a1a;
  font-family: "Poppins", sans-serif;
}

.filter-clear {
  font-size: 12px;
  color: #737373;
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  font-family: "Open Sans", sans-serif;
  padding: 0;
}

.filter-clear:hover {
  color: #1a1a1a;
}

/* --- Liste des options --- */
.filter-options-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ============================================
   FILTER OPTION - DESIGN EXACT
   ============================================ */
.filter-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 14px;
  border-radius: 4px;
  transition: background-color 0.2s ease;
  font-family: "Open Sans", sans-serif;
}

.filter-option:hover {
  background-color: #f5f5f5;
}

/* Indentation des sous-catégories */
.filter-option.child {
  padding-left: 28px;
}

.filter-option.grandchild {
  padding-left: 44px;
}

/* ============================================
   CHECKMARK - DESIGN EXACT
   ============================================ */
.checkmark {
  width: 16px;
  height: 16px;
  border: 1.5px solid #ccc;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

/* État CHECKED */
.filter-option.checked .checkmark {
  border-color: #333;
  color: #333;
}

.filter-option.checked .checkmark i {
  color: #333;
}

.filter-option.checked .label {
  font-weight: 500;
}

/* Labels */
.filter-option .label {
  flex: 1;
  font-size: 13px;
  color: #1a1a1a;
  transition: font-weight 0.2s ease;
  font-family: "Open Sans", sans-serif;
}

.cat-count {
  font-size: 12px;
  color: #737373;
  margin-left: auto;
  flex-shrink: 0;
  font-family: "Open Sans", sans-serif;
}

/* ============================================
   ANIMATION
   ============================================ */
.fam-card {
  animation: famCardFadeIn 0.4s ease forwards;
}

@keyframes famCardFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   RESPONSIVE GRILLE
   ============================================ */
@media (min-width: 901px) {
  .fam-catalogue-grid.fam-grid--3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 601px) and (max-width: 900px) {
  .fam-catalogue-grid.fam-grid--3,
  .fam-catalogue-grid.fam-grid--2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .fam-catalogue-grid.fam-grid--3,
  .fam-catalogue-grid.fam-grid--2,
  .fam-catalogue-grid.fam-grid--1 {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   RESPONSIVE FILTERS
   ============================================ */
@media screen and (max-width: 768px) {
  .filter-sidebar {
    max-width: 100%;
    padding: 12px;
  }

  .filter-title {
    font-size: 11px;
  }

  .filter-option .label {
    font-size: 12px;
  }

  .cat-count {
    font-size: 11px;
  }

  .filter-option.child {
    padding-left: 24px;
  }

  .filter-option.grandchild {
    padding-left: 36px;
  }

  .checkmark {
    width: 14px;
    height: 14px;
  }
}

@media screen and (max-width: 480px) {
  .filter-sidebar {
    padding: 10px;
    border-radius: 4px;
  }

  .filter-title {
    font-size: 10px;
  }

  .filter-clear {
    font-size: 10px;
  }

  .filter-option .label {
    font-size: 11px;
  }

  .cat-count {
    font-size: 10px;
  }

  .filter-option {
    gap: 8px;
    padding: 4px 10px;
  }

  .filter-option.child {
    padding-left: 20px;
  }

  .filter-option.grandchild {
    padding-left: 30px;
  }

  .checkmark {
    width: 14px;
    height: 14px;
    border-width: 1.5px;
  }

  .filter-section {
    padding: 10px 0;
  }

  .filter-section:first-child {
    padding-top: 0;
  }
}

/* ============================================
   CORRECTIONS POUR LE FILTRAGE
   ============================================ */
.fam-card[style*="display: none"] {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  height: 0 !important;
  overflow: hidden !important;
  padding: 0 !important;
  margin: 0 !important;
  transform: scale(0.95);
}

/* Message d'erreur */
.fam-no-result {
  display: inline-block;
  margin-left: 5px;
  color: #e74c3c;
  font-weight: normal;
}

/* ============================================
   FILTER COUNT HIDDEN
   ============================================ */
.filter-count-hidden {
  display: none !important;
}
