/* ===== Avis Google Carousel =====
 *
 * Le dimensionnement est piloté par avis-google.js : le script mesure la
 * largeur RÉELLE du conteneur (colonne Elementor, popup, onglet, sidebar...)
 * et pose data-taille="xs|sm|md|lg" sur le carousel.
 * Aucune media query n'est donc nécessaire : une colonne étroite dans un
 * grand écran est traitée comme un petit écran, et les cartes ne peuvent
 * jamais se réduire à une colonne de quelques mots.
 *
 * Anti-conflit (Elementor, Royal Addons, thème) :
 * - TOUS les sélecteurs commencent par .avis-google-carousel : rien ne
 *   s'applique aux autres carousels de la page ;
 * - la feuille de style de Swiper n'est pas chargée : le strict nécessaire
 *   est repris ci-dessous, limité à ce carousel. Le plugin peut ainsi
 *   utiliser le Swiper d'Elementor sans dépendre de sa feuille de style ;
 * - la spécificité (2 classes) passe devant les styles globaux de boutons et
 *   d'images du kit Elementor et des thèmes.
 *
 * Couleurs : toutes passent par les variables --avis-... ci-dessous.
 * L'onglet Style du widget Elementor les remplace pour CE widget seulement.
 */

.avis-google-carousel {
	--avis-carte-fond: #fff;
	--avis-carte-bordure: #ededed;
	--avis-nom: #202124;
	--avis-date: #9aa0a6;
	--avis-texte: #5f6368;
	--avis-voir-plus: #9aa0a6;
	--avis-voir-plus-survol: #4285F4;
	--avis-etoile-pleine: #fbbc05;
	--avis-etoile-vide: #e0e0e0;
	--avis-initiale: #fff;
	--avis-initiale-fond-1: #4285F4;
	--avis-initiale-fond-2: #34A853;
	--avis-fleche: #fff;
	--avis-fleche-fond: #202124;
	--avis-point: rgba(0, 0, 0, 0.2);
	--avis-point-actif: #4285F4;

	position: relative;
	z-index: 1;
	display: block;
	overflow: hidden;
	width: 100%;
	max-width: 100%;
	margin: 0;
	padding: 6px 4px 38px;
	list-style: none;
	touch-action: pan-y; /* swipe horizontal, défilement vertical de la page conservé */
	box-sizing: border-box;
}

.avis-google-carousel *,
.avis-google-carousel *::before,
.avis-google-carousel *::after {
	box-sizing: border-box;
}

/* Gouttière réservée aux flèches, uniquement s'il y a la place. */
.avis-google-carousel[data-taille="md"],
.avis-google-carousel[data-taille="lg"] {
	padding-left: 46px;
	padding-right: 46px;
}

/* --- Piste et slides (base Swiper) --- */
.avis-google-carousel .swiper-wrapper {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: stretch; /* toutes les cartes à la même hauteur */
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	box-sizing: content-box;
	transition-property: transform;
	transform: translate3d(0, 0, 0);
}

.avis-google-carousel .swiper-slide {
	position: relative;
	flex-shrink: 0;
	display: flex;
	height: auto;
	min-width: 0;
	padding: 8px 0; /* marge verticale pour l'ombre des cartes */
	transition-property: transform;
}

/* Avant l'init de Swiper (ou si le JS ne se charge pas) : une carte pleine
   largeur plutôt qu'une rangée de colonnes écrasées. */
.avis-google-carousel:not(.swiper-initialized) .swiper-slide {
	width: 100%;
}

/* Zone lue par les lecteurs d'écran, jamais visible. */
.avis-google-carousel .swiper-notification {
	position: absolute;
	top: 0;
	left: 0;
	z-index: -1000;
	opacity: 0;
	pointer-events: none;
}

/* --- Carte --- */
.avis-google-carousel .avis-card {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 12px;
	width: 100%;
	min-width: 0;
	background: var(--avis-carte-fond);
	border: 1px solid var(--avis-carte-bordure);
	border-radius: 12px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
	padding: 18px;
	transition: box-shadow .2s ease;
}

.avis-google-carousel .avis-card:hover {
	box-shadow: 0 8px 22px rgba(0, 0, 0, 0.09);
}

/* --- Étoiles --- */
.avis-google-carousel .avis-etoiles {
	display: inline-flex;
	flex-wrap: nowrap;
	gap: 1px;
	font-size: 16px;
	line-height: 1;
}

.avis-google-carousel .avis-etoiles .etoile.pleine {
	color: var(--avis-etoile-pleine);
}

.avis-google-carousel .avis-etoiles .etoile.vide {
	color: var(--avis-etoile-vide);
}

/* --- Texte de l'avis --- */
.avis-google-carousel .avis-texte-wrap {
	flex: 1 1 auto;
	min-width: 0;
}

.avis-google-carousel .avis-texte {
	font-size: 14px;
	line-height: 1.55;
	color: var(--avis-texte);
	min-width: 0;
	/* Neutralise un éventuel word-break:break-all du thème, qui coupait les
	   mots en plein milieu ("arrondisse / ment"). */
	word-break: normal;
	overflow-wrap: break-word;
	hyphens: none;
	white-space: normal;
}

/* Texte coupé à 4 lignes tant qu'il n'est pas déplié. */
.avis-google-carousel .avis-texte.is-clamped {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 4;
	line-clamp: 4;
	overflow: hidden;
	/* Filet de sécurité : si le thème neutralise -webkit-line-clamp, la carte
	   reste bornée à 4 lignes au lieu de s'étirer sur tout l'écran. */
	max-height: calc(1.55em * 4 + 2px);
}

/* --- Bouton "Voir plus" ---
   Les styles de boutons du kit Elementor / du thème visent aussi :hover et
   :focus : on neutralise les trois états. */
.avis-google-carousel .avis-voir-plus,
.avis-google-carousel .avis-voir-plus:hover,
.avis-google-carousel .avis-voir-plus:focus {
	background: none;
	border: none;
	border-radius: 0;
	box-shadow: none;
	text-shadow: none;
}

.avis-google-carousel .avis-voir-plus {
	display: inline-block;
	width: auto;
	height: auto;
	min-height: 0;
	padding: 0;
	margin: 3px 0 0;
	color: var(--avis-voir-plus);
	font-family: inherit;
	font-size: 12px;
	font-weight: 400;
	line-height: 1.4;
	letter-spacing: normal;
	text-transform: none;
	text-decoration: none;
	cursor: pointer;
	transition: color .2s ease;
}

/* Après un clic, le bouton garde le focus : certains thèmes passent alors le
   texte en blanc, ce qui le rendait invisible sur la carte. */
.avis-google-carousel .avis-voir-plus:focus {
	color: var(--avis-voir-plus);
}

.avis-google-carousel .avis-voir-plus:hover {
	color: var(--avis-voir-plus-survol);
	text-decoration: underline;
}

/* --- En-tête : photo + nom + date --- */
.avis-google-carousel .avis-header {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.avis-google-carousel .avis-photo {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	overflow: hidden;
	flex: 0 0 auto;
	background: linear-gradient(135deg, var(--avis-initiale-fond-1), var(--avis-initiale-fond-2));
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Passe devant ".elementor img { height: auto }" qui déformait la photo. */
.avis-google-carousel .avis-photo img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	object-fit: cover;
}

.avis-google-carousel .avis-initiale {
	color: var(--avis-initiale);
	font-size: 17px;
	font-weight: 700;
	line-height: 1;
	text-transform: uppercase;
}

.avis-google-carousel .avis-meta {
	display: flex;
	flex-direction: column;
	line-height: 1.3;
	min-width: 0;
	flex: 1 1 auto;
}

.avis-google-carousel .avis-nom {
	font-weight: 600;
	font-size: 14px;
	color: var(--avis-nom);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	word-break: normal;
}

.avis-google-carousel .avis-date {
	font-size: 12px;
	color: var(--avis-date);
	white-space: nowrap;
}

/* --- Flèches de navigation --- */
.avis-google-carousel .swiper-button-prev,
.avis-google-carousel .swiper-button-next {
	position: absolute;
	top: calc(50% - 19px); /* compense le padding-bottom de la pagination */
	z-index: 10;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	margin: 0;
	padding: 0;
	transform: translateY(-50%);
	color: var(--avis-fleche);
	background: var(--avis-fleche-fond);
	border: none;
	border-radius: 50%;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
	cursor: pointer;
}

.avis-google-carousel .swiper-button-prev {
	left: 2px;
	right: auto;
}

.avis-google-carousel .swiper-button-next {
	right: 2px;
	left: auto;
}

/* Chevron dessiné en CSS : pas besoin de la police d'icônes de Swiper. */
.avis-google-carousel .swiper-button-prev::after,
.avis-google-carousel .swiper-button-next::after {
	content: '';
	display: block;
	width: 9px;
	height: 9px;
	border-style: solid;
	border-color: currentColor;
	border-width: 2px 2px 0 0;
	font-size: 0;
	line-height: 0;
}

.avis-google-carousel .swiper-button-next::after {
	margin-left: -3px;
	transform: rotate(45deg);
}

.avis-google-carousel .swiper-button-prev::after {
	margin-left: 3px;
	transform: rotate(-135deg);
}

.avis-google-carousel .swiper-button-prev.swiper-button-disabled,
.avis-google-carousel .swiper-button-next.swiper-button-disabled {
	opacity: .35;
	cursor: auto;
	pointer-events: none;
}

/* Tous les avis tiennent à l'écran : ni flèches ni points. */
.avis-google-carousel .swiper-button-prev.swiper-button-lock,
.avis-google-carousel .swiper-button-next.swiper-button-lock,
.avis-google-carousel .swiper-pagination.swiper-pagination-lock {
	display: none;
}

/* Conteneur étroit : pas de place pour les flèches, on garde le swipe. */
.avis-google-carousel[data-taille="xs"] .swiper-button-prev,
.avis-google-carousel[data-taille="xs"] .swiper-button-next,
.avis-google-carousel[data-taille="sm"] .swiper-button-prev,
.avis-google-carousel[data-taille="sm"] .swiper-button-next {
	display: none;
}

/* --- Pagination (points) --- */
.avis-google-carousel .swiper-pagination {
	position: absolute;
	bottom: 8px;
	left: 0;
	z-index: 10;
	width: 100%;
	font-size: 0;
	line-height: 0;
	text-align: center;
	transform: translate3d(0, 0, 0);
	transition: opacity .3s;
}

/* Points "dynamiques" : Swiper fixe la largeur de la zone, on la centre. */
.avis-google-carousel .swiper-pagination.swiper-pagination-bullets-dynamic {
	left: 50%;
	overflow: hidden;
	white-space: nowrap;
	transform: translateX(-50%);
}

.avis-google-carousel .swiper-pagination .swiper-pagination-bullet {
	display: inline-block;
	width: 8px;
	height: 8px;
	margin: 0 4px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: var(--avis-point);
	box-shadow: none;
	opacity: 1; /* la transparence est dans la couleur, réglable dans Elementor */
	cursor: pointer;
}

.avis-google-carousel .swiper-pagination .swiper-pagination-bullet-active {
	background: var(--avis-point-actif);
}

.avis-google-carousel .swiper-pagination-bullets-dynamic .swiper-pagination-bullet {
	position: relative;
	transform: scale(.33);
	transition: transform .2s, left .2s;
}

.avis-google-carousel .swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active,
.avis-google-carousel .swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-main {
	transform: scale(1);
}

.avis-google-carousel .swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev,
.avis-google-carousel .swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next {
	transform: scale(.66);
}

.avis-google-carousel .swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev-prev,
.avis-google-carousel .swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next-next {
	transform: scale(.33);
}

/* --- Conteneurs très étroits : on resserre --- */
.avis-google-carousel[data-taille="sm"] .avis-card {
	padding: 16px 14px;
	gap: 10px;
}

.avis-google-carousel[data-taille="xs"] .avis-card {
	padding: 14px 12px;
	gap: 10px;
}

.avis-google-carousel[data-taille="xs"] .avis-photo {
	width: 34px;
	height: 34px;
}

.avis-google-carousel[data-taille="xs"] .avis-initiale {
	font-size: 15px;
}

.avis-google-carousel[data-taille="xs"] .avis-nom {
	font-size: 13px;
}

.avis-google-carousel[data-taille="xs"] .avis-texte {
	font-size: 13px;
}

/* --- Repli si le JS n'a pas encore posé data-taille --- */
@media (max-width: 600px) {
	.avis-google-carousel:not([data-taille]) .swiper-button-prev,
	.avis-google-carousel:not([data-taille]) .swiper-button-next {
		display: none;
	}
}
