/*
 * TDG — avis produits. Chargé uniquement sur les fiches activées dans
 * Outils > TDG Divi > Avis produits (classe body.tdg-reviews ajoutée côté serveur).
 * Indépendant de Divi : fonctionne avec le module Divi « Avis » comme avec l'onglet WooCommerce natif.
 * Couleurs : modifier uniquement les variables ci-dessous.
 */
body.tdg-reviews #reviews {
	--tdg-green: #00463b;
	--tdg-green-hover: #006450;
	--tdg-form-bg: #f3f5ed;
	--tdg-form-border: #dfe6d9;
	--tdg-field-border: #cbd8c9;
	--tdg-card-border: #e0e7db;
	--tdg-text: #24382f;
	--tdg-label: #2c4337;
	--tdg-star: #b68d53;
}

/* Titre WooCommerce : doublon du titre de section Divi -> masqué visuellement, conservé pour les lecteurs d'écran. */
body.tdg-reviews.tdg-reviews--hide-title #reviews .woocommerce-Reviews-title {
	position: absolute !important; width: 1px !important; height: 1px !important;
	margin: -1px !important; padding: 0 !important; border: 0 !important;
	overflow: hidden !important; clip: rect(0 0 0 0) !important; clip-path: inset(50%) !important; white-space: nowrap !important;
}

/* Aucun avis approuvé : pas de titre ni de phrase « aucun avis », le formulaire suffit. */
body.tdg-reviews.tdg-reviews--empty #reviews .woocommerce-Reviews-title,
body.tdg-reviews.tdg-reviews--empty #reviews .woocommerce-noreviews { display: none !important; }

/* Liste des avis : cartes */
body.tdg-reviews #reviews #comments .commentlist { padding: 0 !important; margin: 0 0 22px !important; }
body.tdg-reviews #reviews #comments .commentlist > li {
	list-style: none !important; background: #fff !important; border: 1px solid var(--tdg-card-border) !important;
	border-radius: 14px !important; margin: 0 0 12px !important; padding: 18px !important;
}
body.tdg-reviews #reviews #comments .commentlist > li .comment_container { display: flex; gap: 14px; align-items: flex-start; }
body.tdg-reviews #reviews #comments .commentlist > li img.avatar {
	position: static !important; float: none !important; width: 44px !important; height: 44px !important;
	border-radius: 50% !important; padding: 0 !important; border: 0 !important; flex: 0 0 44px;
}
body.tdg-reviews #reviews #comments .comment-text { margin: 0 !important; padding: 0 !important; border: 0 !important; flex: 1 1 auto; min-width: 0; }
body.tdg-reviews #reviews #comments .comment-text .star-rating { float: right; color: var(--tdg-star) !important; }
body.tdg-reviews #reviews #comments .comment-text .meta { color: var(--tdg-label) !important; font-size: 14px !important; margin: 0 0 6px !important; }
body.tdg-reviews #reviews #comments .comment-text .description p { color: var(--tdg-text) !important; margin: 0 !important; }

/* Formulaire */
body.tdg-reviews #reviews #review_form_wrapper {
	display: block; box-sizing: border-box; max-width: 870px; margin: 18px 0 !important;
	background: var(--tdg-form-bg) !important; border: 1px solid var(--tdg-form-border) !important;
	border-radius: 18px !important; padding: clamp(20px, 3vw, 34px) !important;
	box-shadow: 0 6px 22px rgba(35, 54, 42, .04) !important;
}
/* Divi peut imbriquer un second conteneur portant le même id : on neutralise le doublon. */
body.tdg-reviews #reviews #review_form_wrapper #review_form_wrapper {
	background: transparent !important; border: 0 !important; border-radius: 0 !important;
	padding: 0 !important; margin: 0 !important; box-shadow: none !important; max-width: none;
}
body.tdg-reviews #reviews #respond { margin: 0 !important; padding: 0 !important; border: 0 !important; background: transparent !important; }
body.tdg-reviews #reviews #respond .comment-reply-title {
	display: block !important; color: var(--tdg-text) !important; font-size: 21px !important; font-weight: 600 !important;
	line-height: 1.4 !important; margin: 0 0 16px !important; padding: 0 !important;
}
body.tdg-reviews #reviews #commentform p { margin: 0 0 16px !important; padding: 0 !important; }
body.tdg-reviews #reviews #commentform label {
	display: block !important; color: var(--tdg-label) !important; font-size: 14px !important;
	font-weight: 600 !important; margin: 0 0 8px !important;
}
body.tdg-reviews #reviews #commentform .required { color: #a14a2a !important; text-decoration: none !important; }
body.tdg-reviews #reviews #commentform textarea,
body.tdg-reviews #reviews #commentform input[type="text"],
body.tdg-reviews #reviews #commentform input[type="email"],
body.tdg-reviews #reviews #commentform input[type="url"] {
	display: block !important; box-sizing: border-box !important; width: 100% !important; max-width: 100% !important;
	background: #fff !important; border: 1px solid var(--tdg-field-border) !important; border-radius: 10px !important;
	color: var(--tdg-text) !important; padding: 12px 14px !important; box-shadow: none !important;
	font-family: inherit !important; font-size: 16px !important; /* 16 px : évite le zoom automatique sur iPhone */
	line-height: 1.5 !important;
}
body.tdg-reviews #reviews #commentform textarea { min-height: 145px !important; resize: vertical !important; }
body.tdg-reviews #reviews #commentform textarea:focus-visible,
body.tdg-reviews #reviews #commentform input:focus-visible,
body.tdg-reviews #reviews #commentform .stars a:focus-visible {
	outline: 2px solid var(--tdg-green) !important; outline-offset: 2px !important;
}

/* Étoiles WooCommerce natives */
body.tdg-reviews #reviews #commentform .comment-form-rating { margin-bottom: 16px !important; }
body.tdg-reviews #reviews #commentform p.stars { margin: 4px 0 0 !important; line-height: 1 !important; }
body.tdg-reviews #reviews #commentform p.stars a,
body.tdg-reviews #reviews #commentform p.stars a::before { color: var(--tdg-star) !important; }
body.tdg-reviews #reviews #commentform p.stars a { font-size: 22px !important; width: 1.15em !important; height: 1.15em !important; }

/* Case « enregistrer mon nom » : case et texte sur la même ligne */
body.tdg-reviews #reviews #commentform .comment-form-cookies-consent { display: flex !important; gap: 10px; align-items: flex-start; }
body.tdg-reviews #reviews #commentform .comment-form-cookies-consent input { flex: 0 0 auto; width: 18px !important; height: 18px !important; margin: 3px 0 0 !important; accent-color: var(--tdg-green); }
body.tdg-reviews #reviews #commentform .comment-form-cookies-consent label { display: inline !important; font-weight: 400 !important; margin: 0 !important; }

/* Bouton (input ou button selon le gabarit) */
body.tdg-reviews #reviews #commentform .form-submit { margin: 20px 0 0 !important; text-align: left !important; }
body.tdg-reviews #reviews #commentform #submit,
body.tdg-reviews #reviews #commentform .form-submit .submit {
	display: inline-block !important; float: none !important; margin: 0 !important; width: auto !important;
	background: var(--tdg-green) !important; color: #fff !important; border: 0 !important;
	border-radius: 28px !important; padding: 13px 26px !important; min-width: 165px !important;
	font-family: inherit !important; font-size: 15px !important; font-weight: 600 !important; line-height: 1.2 !important;
	box-shadow: none !important; cursor: pointer !important; text-transform: none !important; letter-spacing: normal !important;
}
body.tdg-reviews #reviews #commentform #submit::after { display: none !important; } /* icône flèche Divi */
body.tdg-reviews #reviews #commentform #submit:hover,
body.tdg-reviews #reviews #commentform #submit:focus-visible { background: var(--tdg-green-hover) !important; }

/* Titre visible : « N avis · note moyenne X sur 5 » */
body.tdg-reviews #reviews .woocommerce-Reviews-title {
	color: var(--tdg-text) !important; font-size: 17px !important; font-weight: 600 !important;
	line-height: 1.4 !important; margin: 0 0 14px !important; padding: 0 !important;
}

/* Réponses (fil d'un avis) */
body.tdg-reviews #reviews #comments .commentlist ul.children {
	list-style: none !important; margin: 14px 0 0 58px !important; padding: 0 !important;
}
body.tdg-reviews #reviews #comments .commentlist ul.children > li {
	list-style: none !important; margin: 0 0 8px !important; padding: 14px 16px !important;
	background: #fff !important; border: 1px solid var(--tdg-card-border) !important; border-radius: 12px !important;
}
/* Réponse de la boutique : fond vert pâle et mention */
body.tdg-reviews #reviews #comments .commentlist li.tdg-shop-reply,
body.tdg-reviews #reviews #comments .commentlist ul.children > li.tdg-shop-reply {
	background: var(--tdg-form-bg) !important; border-color: var(--tdg-form-border) !important;
	border-left: 3px solid var(--tdg-green) !important;
}
body.tdg-reviews #reviews .tdg-shop-reply-label {
	display: inline-block; margin: 0 0 6px !important; padding: 2px 10px !important;
	background: var(--tdg-green) !important; color: #fff !important; border-radius: 20px;
	font-size: 12px !important; font-weight: 600 !important; line-height: 1.6 !important;
}
body.tdg-reviews #reviews #comments .commentlist ul.children img.avatar { width: 36px !important; height: 36px !important; flex-basis: 36px; }

@media (max-width: 767px) {
	body.tdg-reviews #reviews #comments .commentlist > li { padding: 14px !important; }
	body.tdg-reviews #reviews #comments .commentlist ul.children { margin: 12px 0 0 0 !important; }
	body.tdg-reviews #reviews #comments .commentlist ul.children > li { padding: 12px !important; }
	body.tdg-reviews #reviews #comments .commentlist img.avatar { width: 32px !important; height: 32px !important; flex-basis: 32px; }
	body.tdg-reviews #reviews #comments .comment-text .star-rating { float: none; display: block; margin: 0 0 4px !important; }
	body.tdg-reviews #reviews #review_form_wrapper { padding: 18px !important; border-radius: 12px !important; }
	body.tdg-reviews #reviews #commentform #submit { width: 100% !important; }
}
