/**
 * Styles for Facebook posts display - Modern card style
 * Grille fixe de 3 colonnes avec défilement horizontal
 */

.facebook-posts-carousel {
  margin: 15px auto 30px;
  max-width: 100%;
  position: relative;
  padding: 0 50px; /* Espace pour les boutons de défilement */
}

/* Ajustement pour rapprocher du titre */
.ftco-section.ftco-causes .container > .row:first-child {
  margin-bottom: 10px;
}

/* Container for all posts - 3 colonnes fixes */
.facebook-posts-container {
  display: flex;
  gap: 30px; /* Espacement entre les cartes */
  padding: 10px 0 70px 0; /* un peu plus d'espace pour les boutons */
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  overflow: visible; /* Permet aux éléments de déborder pour voir les boutons */
  height: 570px; /* Hauteur augmentée pour accommoder les cartes plus hautes */
}

/* Mode natif pour mobile/tablette: défilement horizontal avec snap */
.facebook-posts-container.native-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  position: relative;
  height: auto; /* Laisser la hauteur s'ajuster naturellement */
  padding-bottom: 8px; /* espace pour un éventuel scrollbar */
  
  /* Masquer la scrollbar sur mobile et tablette */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE et Edge */
}

/* Masquer la scrollbar pour Chrome, Safari et Opera */
.facebook-posts-container.native-scroll::-webkit-scrollbar {
  display: none;
}

.facebook-posts-container.native-scroll .facebook-post-container {
  position: relative;
  transform: none !important;
  opacity: 1 !important;
  z-index: 1 !important;
  width: auto; /* la largeur est gérée par flex-basis */
  flex: 0 0 80%;
  scroll-snap-align: start;
}

/* Boutons de défilement */
.scroll-btn {
  position: absolute;
  top: 225px; /* Position ajustée pour être au milieu des cartes plus hautes */
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 4px;
  background-color: #ff0a54;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  border: none;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  transition: all 0.3s ease;
  font-weight: 500;
}

.scroll-btn:hover {
  background-color: #e00048;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.scroll-btn.prev {
  left: 5px;
}

.scroll-btn.next {
  right: 5px;
}

/* Conteneur pour la carte et le bouton */
.facebook-post-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start; /* bouton aligné à gauche comme le contenu */
  width: calc(33.333% - 20px);
  position: absolute; /* requis par le carrousel */
  height: auto;
  padding-bottom: 10px; /* réduit l'espace sous la carte */
}

/* Individual post card */
.facebook-post.card-style {
  background-color: #ffffff;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
  height: 450px; /* Augmentée pour accommoder 6 lignes de texte */
  margin-bottom: 8px; /* Marge réduite pour rapprocher le bouton */
  width: 100%;
  position: relative; /* annule le position: absolute hérité de .facebook-post */
}

/* (Ancien bloc .facebook-post supprimé: inutilisé et source de conflits) */

.facebook-post:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

/* Styles pour l'en-tête avec le logo et le nom */
.card-style .post-author {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid #f0f0f0;
}

.card-style .author-avatar {
  width: 36px;
  height: 36px;
  border-radius: 0; /* pas de cercle */
  overflow: visible; /* ne pas rogner le logo */
  margin-right: 10px;
  background: transparent; /* pas de fond */
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-style .author-avatar img {
  height: 100%;
  width: auto; /* conserver les proportions du logo */
  object-fit: contain;
  display: block;
}

.card-style .author-info {
  display: flex;
  flex-direction: column;
}

.card-style .author-name {
  font-weight: 600;
  font-size: 14px;
  color: #333;
  line-height: 1.2;
}

.card-style .post-date {
  font-size: 12px;
  color: #888;
  line-height: 1.2;
}

/* Post content - sous l'en-tête */
.card-style .post-content {
  padding: 15px 20px;
  flex-grow: 0;
  display: flex;
  flex-direction: column;
  background-color: #ffffff;
  text-align: left;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 6; /* Limite tout le contenu à 6 lignes */
  line-clamp: 6;
  -webkit-box-orient: vertical;
  text-overflow: ellipsis;
}

/* Hashtags sous le texte */
.card-style .post-hashtags {
  font-size: 13px;
  color: #666;
  margin-top: 10px;
  font-family: 'Work Sans', sans-serif;
  display: inline; /* Pour que les hashtags restent sur la même ligne si possible */
}

/* Post image - remplit le bas de la carte */
.card-style .post-image {
  width: 100%;
  flex: 1;
  overflow: hidden;
  position: relative;
  margin-top: 8px; /* Légère séparation avec le texte */
  padding: 0;
  border-top: 1px solid #f0f0f0; /* Ligne discrète pour distinguer texte et image */
}

.card-style .post-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Conteneur pour le bouton d'action */
.post-action {
  display: flex;
  justify-content: center;
  margin-top: 10px;
  width: 100%;
  position: relative; /* s'assure que le bouton reste au-dessus */
  z-index: 2;
}

/* Bouton "Lire la suite" détaché */
.post-link {
  display: inline-block;
  padding: 8px 20px;
  background-color: #ff0a54;
  color: #fff !important;
  text-decoration: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin: 5px 0;
}

.post-link:hover {
  background-color: #d40045;
  color: #fff !important;
  text-decoration: none;
}

/* Post title - nouveau style */
.card-style .post-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin-bottom: 4px; /* Réduit de 12px à 4px pour rapprocher le titre du texte */
  line-height: 1.3;
  font-family: 'Work Sans', sans-serif;
}

/* Post text - nouveau style */
.card-style .post-text {
  font-size: 14px;
  line-height: 1.3; /* Réduit de 1.5 à 1.3 pour un interligne plus serré */
  color: #666;
  margin-bottom: 15px;
  flex-grow: 1;
  font-family: 'Work Sans', sans-serif;
}


/* RSS icon */
.rss-icon {
  display: none; /* Masquer l'icône RSS qui n'est plus nécessaire */
}

.rss-icon:hover {
  background-color: rgba(242, 101, 34, 0.2);
  transform: rotate(90deg);
}

/* Responsive adjustments */
@media (max-width: 992px) {
  .facebook-posts-carousel {
    padding: 0 40px;
  }
  
  .facebook-posts-container {
    height: 590px; /* Augmentée pour accommoder les cartes plus hautes */
    gap: 25px; /* Espacement ajusté pour responsive */
  }

  /* En mode natif, taille des cartes sur tablette */
  .facebook-posts-container.native-scroll .facebook-post-container {
    flex: 0 0 50%;
  }
  
  .scroll-btn {
    width: 34px;
    height: 34px;
    font-size: 14px;
    top: 205px; /* Ajustement pour tablette avec cartes plus hautes */
  }
  
  .facebook-post-container {
    width: calc(50% - 12.5px); /* Largeur ajustée pour gap de 25px */
  }
  
  .facebook-post.card-style {
    height: 410px; /* Augmentée pour accommoder 6 lignes de texte */
  }
  
  .card-style .post-title {
    font-size: 16px;
  }
  
  .card-style .post-text {
    font-size: 13px;
    -webkit-line-clamp: 3;
    line-clamp: 3;
  }
  
}

@media (max-width: 768px) {
  .facebook-posts-carousel {
    padding: 0 30px;
  }
  
  .facebook-posts-container {
    gap: 20px; /* Espacement ajusté pour responsive */
    height: 510px; /* Augmentée pour accommoder les cartes plus hautes */
  }

  /* En mode natif, taille des cartes sur petits tablets/large mobiles */
  .facebook-posts-container.native-scroll .facebook-post-container {
    flex: 0 0 65%;
  }
  
  .card-style .post-image {
    height: 160px;
  }
  
  .card-style .post-author {
    padding: 10px 15px;
  }
  
  .card-style .author-avatar {
    width: 32px;
    height: 32px;
  }
  
  .card-style .post-content {
    padding: 12px 15px 8px 15px;
  }
  
  .card-style .post-text {
    font-size: 13px;
  }
  
  .facebook-post-container {
    width: calc(50% - 10px); /* Largeur ajustée pour gap de 20px */
  }
  
  .facebook-post.card-style {
    height: 330px; /* Augmentée pour accommoder 6 lignes de texte */
    margin-bottom: 10px;
  }
  
  .scroll-btn {
    width: 30px;
    height: 30px;
    font-size: 12px;
    top: 165px; /* Ajustement pour mobile avec cartes plus hautes */
  }
  
  .card-style .post-content {
    padding: 15px;
  }
  
  .card-style .post-title {
    margin-bottom: 2px; /* Réduit de 8px à 2px pour rapprocher le titre du texte */
  }
}

@media (max-width: 576px) {
  .facebook-posts-carousel {
    padding: 0;
  }
  
  .facebook-posts-container {
    height: 480px; /* Hauteur ajustée pour accommoder plus de texte et le bouton */
  }
  
  /* En mode natif, hauteur automatique pour éviter les coupures */
  .facebook-posts-container.native-scroll {
    height: auto;
    min-height: 400px;
  }

  /* En mode natif, une carte par écran sur mobile */
  .facebook-posts-container.native-scroll .facebook-post-container {
    flex: 0 0 85%;
  }
  
  .facebook-post-container {
    width: 100%;
  }
  
  .facebook-post.card-style {
    height: 300px;
    margin-bottom: 12px;
  }
  
  .card-style .post-image {
    height: 140px; /* Hauteur réduite pour mobile */
  }
  
  .card-style .post-author {
    padding: 8px 12px;
  }
  
  .card-style .author-avatar {
    width: 28px;
    height: 28px;
  }
  
  .card-style .author-name {
    font-size: 13px;
  }
  
  .card-style .post-date {
    font-size: 11px;
  }
  
  .card-style .post-content {
    padding: 10px 12px 5px 12px;
  }
  
  /* Ajustement du texte sur mobile */
  .card-style .post-text {
    font-size: 13px; /* Texte légèrement plus petit */
    margin-bottom: 10px;
  }
  
  
  .post-action {
    justify-content: center;
    margin-top: 8px;
  }
  
  .post-action .post-link {
    font-size: 13px;
    padding: 6px 18px;
    margin: 3px 0;
  }
  
  .card-style .post-title {
    font-size: 15px;
    margin-bottom: 8px;
  }
  
  .card-style .post-content {
    padding: 12px;
  }
  
  .scroll-btn {
    display: none;
  }
}

/* Loading spinner */
.spinner-border {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  vertical-align: text-bottom;
  border: 0.25em solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spinner-border .75s linear infinite;
}

@keyframes spinner-border {
  to { transform: rotate(360deg); }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Alert styles */
.alert {
  position: relative;
  padding: 0.75rem 1.25rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  border-radius: 0.25rem;
}

.alert-warning {
  color: #856404;
  background-color: #fff3cd;
  border-color: #ffeeba;
}

/* Follow message and additional social icons under Facebook cards */
.follow-text {
  font-weight: 600;
  color: #333;
}

.social-follow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid #e0e0e0;
  background-color: #ffffff;
  color: #ff0a54;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.social-icon span {
  font-size: 22px;
  line-height: 1;
}

/* TikTok icon (inline SVG) */
.social-icon.tiktok svg {
  width: 24px;
  height: 24px;
}

.social-icon.tiktok svg path {
  fill: #ff0a54;
}

.social-icon:hover {
  background-color: #ff0a54;
  color: #ffffff;
  border-color: #ff0a54;
  box-shadow: 0 6px 14px rgba(255, 10, 84, 0.25);
}

.social-icon.instagram:hover span,
.social-icon.instagram:hover span:before {
  color: #ffffff;
}

.social-icon.tiktok:hover svg path {
  fill: #ffffff;
}

@media (max-width: 576px) {
  .follow-text {
    font-size: 16px;
  }
  .social-icon {
    width: 42px;
    height: 42px;
  }
  .social-icon span {
    font-size: 20px;
  }
  .social-icon.tiktok svg {
    width: 22px;
    height: 22px;
  }
}