/**
 * Rockbros — SECCIÓN DE RESEÑAS (rediseño estilo USA)
 * ============================================================================
 * Reemplaza la pestaña de valoraciones por una sección full-width fondo gris,
 * debajo del producto. Grid de tarjetas monocromas (Barlow), encabezado con
 * promedio + desglose de barras, form con toggle, load-more por tandas.
 * Markup: woocommerce/single-product-reviews.php + rb_render_review_card().
 * Gateado ?rediseno=1 (enqueue en functions.php, solo is_product).
 *
 * Design system: D1 esquinas RECTAS, D2 MONOCROMO (estrellas negras, NO doradas:
 * el dorado se reserva al badge de Google de tercero), D3 aire, D4 Barlow.
 * ============================================================================ */

/* ---- Franja full-width fondo claro (rompe el contenedor de Astra) --------- */
.rb-reviews {
	width: 100vw;
	margin-left: calc(50% - 50vw);
	background: #f4f4f3;
	border-top: 1px solid #e7e7e5;
	padding: 56px 0;
	font-family: "Barlow", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: #1a1a1a;
}

.rb-reviews__inner {
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 24px;
}

/* ---- Encabezado: promedio a la izquierda, botón a la derecha -------------- */
.rb-reviews__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 20px;
	flex-wrap: wrap;
}

.rb-reviews__title {
	font-size: 22px;
	font-weight: 700;
	letter-spacing: .01em;
	margin: 0 0 10px;
	color: #1a1a1a;
}

.rb-reviews__avg {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}
/* Astra envuelve las estrellas en .review-rating con float:right → el conteo quedaba
   a la izquierda y las estrellas a la derecha. Matamos el float y forzamos las
   estrellas PRIMERO. */
.rb-reviews__avg .review-rating,
.rb-reviews__avg .star-rating { float: none; margin: 0; }
.rb-reviews__avg .review-rating { order: -1; line-height: 1; }

.rb-reviews__count {
	font-size: 14px;
	color: #6b6b6b;
}

/* ---- Botón "Escribir reseña" (píldora, excepción D1 de botones) ----------- */
.rb-reviews__write {
	display: inline-block;
	cursor: pointer;
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .06em;
	padding: 11px 22px;
	border: 1.5px solid #1a1a1a;
	border-radius: 999px;
	color: #1a1a1a;
	background: transparent;
	transition: background .2s ease, color .2s ease;
	white-space: nowrap;
}
.rb-reviews__write:hover {
	background: #1a1a1a;
	color: #fff;
}

/* ---- Grid de tarjetas — masonry (column-count) para empacar sin huecos ---- */
.rb-reviews__grid {
	column-count: 2;
	column-gap: 16px;
	margin-top: 28px;
}

.rb-review {
	background: #fff;
	border: 1px solid #e7e7e5;
	border-radius: 0;               /* D1 recto */
	padding: 20px 22px;
	margin: 0 0 16px;
	break-inside: avoid;
	-webkit-column-break-inside: avoid;
	transition: border-color .2s ease, box-shadow .2s ease;
}
.rb-review:hover {
	border-color: #c5c5c2;
	box-shadow: 0 2px 12px rgba(0, 0, 0, .05);
}

.rb-review__head {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px 10px;
	margin-bottom: 10px;
}
.rb-review__avatar {
	flex: 0 0 auto;
	width: 34px;
	height: 34px;
	border-radius: 999px;
	background: #ececea;
	color: #707070;
	font-weight: 700;
	font-size: 14px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-transform: uppercase;
}
.rb-review__author {
	font-weight: 600;
	font-size: 15px;
	color: #1a1a1a;
}
.rb-review__verified {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: #707070;
}
.rb-review__check {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 14px;
	height: 14px;
	border-radius: 999px;
	background: #707070;
	color: #fff;
	font-size: 9px;
	line-height: 1;
}
.rb-review__date {
	margin-left: auto;
	font-size: 12px;
	color: #9a9a9a;
}
.rb-review__text {
	margin-top: 8px;
	font-size: 14.5px;
	line-height: 1.55;
	color: #444;
}
.rb-review__text p { margin: 0 0 8px; }
.rb-review__text p:last-child { margin-bottom: 0; }

/* ---- Estrellas MONOCROMAS (mecanismo nativo de WooCommerce) --------------- */
.rb-reviews .star-rating { margin: 2px 0; float: none; }   /* WC las pone float:right → se metían en el texto */
.rb-reviews .star-rating::before { color: #d9d9d9; }       /* vacías */
.rb-reviews .star-rating span::before { color: #1a1a1a; }  /* llenas */
.rb-reviews__avg .star-rating { font-size: 1.15em; }
.rb-review .star-rating { font-size: .92em; margin: 0 0 10px; }  /* en tarjeta, un punto más chicas, línea propia */

/* ---- Botón "Ver más reseñas" --------------------------------------------- */
.rb-reviews__more-wrap {
	text-align: center;
	margin-top: 24px;
}
.rb-reviews__more {
	cursor: pointer;
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .06em;
	padding: 12px 30px;
	border: 1.5px solid #1a1a1a;
	border-radius: 999px;
	background: transparent;
	color: #1a1a1a;
	transition: background .2s ease, color .2s ease, opacity .2s ease;
}
.rb-reviews__more:hover { background: #1a1a1a; color: #fff; }
.rb-reviews__more.is-loading { opacity: .5; cursor: default; }

/* ---- Estado vacío -------------------------------------------------------- */
.rb-reviews__empty-msg {
	margin: 22px 0 0;
	font-size: 15px;
	color: #6b6b6b;
}

/* ---- Formulario en MODAL (<dialog> nativo) ------------------------------- */
.rb-reviews__modal {
	border: 0;
	padding: 0;
	background: transparent;
	width: 92%;
	max-width: 520px;
	max-height: 90vh;
	overflow: visible;
}
.rb-reviews__modal::backdrop { background: rgba(20, 20, 20, .55); }
.rb-reviews__modal-box {
	position: relative;
	background: #fff;
	padding: 36px 30px 30px;
	max-height: 90vh;
	overflow-y: auto;
	box-shadow: 0 20px 60px rgba(0, 0, 0, .28);
}
.rb-reviews__modal .rb-reviews__modal-close {
	/* !important en la geometría: el estilo global de botones del sitio le metía
	   min-width/padding/margin → deformaba el círculo y lo empujaba fuera de la caja. */
	position: absolute !important;
	top: 10px !important;
	right: 10px !important;
	width: 34px !important;
	height: 34px !important;
	min-width: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 999px;
	background: transparent;
	box-shadow: none !important;
	font-size: 22px;
	line-height: 1;
	color: #8a8a8a;
	cursor: pointer;
	transition: background .15s ease, color .15s ease;
}
/* !important para matar el :hover verde heredado de los botones del sitio */
.rb-reviews__modal-close:hover,
.rb-reviews__modal-close:focus,
.rb-reviews__modal-close:active {
	background: #efefef !important;
	color: #1a1a1a !important;
	outline: none;
}
.rb-reviews__formwrap { max-width: none; }

/* ---- Form dentro del modal: bordes sólidos + estrellas grandes/oscuras ---- */
.rb-reviews__modal #review_form input[type="text"],
.rb-reviews__modal #review_form input[type="email"],
.rb-reviews__modal #review_form textarea {
	border: 1px solid #cfcfcf !important;   /* el textarea heredaba borde punteado */
	border-radius: 0;
}
/* selector de estrellas (WooCommerce p.stars a) → más grande y monocromo */
.rb-reviews__modal .comment-form-rating { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rb-reviews__modal .comment-form-rating label { margin: 0; }
.rb-reviews__modal p.stars { margin: 0; font-size: 1.5em; }
.rb-reviews__modal p.stars a { color: #1a1a1a; }
.rb-reviews__modal p.stars a:hover,
.rb-reviews__modal p.stars.selected a.active,
.rb-reviews__modal p.stars:hover a { color: #1a1a1a; }

.rb-reviews__formwrap .comment-reply-title {
	display: block;
	font-size: 18px;
	font-weight: 700;
	margin-bottom: 16px;
	color: #1a1a1a;
}
.rb-reviews__formwrap label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	margin-bottom: 6px;
	color: #1a1a1a;
}
.rb-reviews__formwrap input[type="text"],
.rb-reviews__formwrap input[type="email"],
.rb-reviews__formwrap textarea {
	width: 100%;
	font-family: inherit;
	font-size: 14px;
	padding: 11px 14px;
	border: 1px solid #cfcfcf;
	border-radius: 0;               /* D1 recto */
	background: #fff;
	color: #1a1a1a;
}
.rb-reviews__formwrap input:focus,
.rb-reviews__formwrap textarea:focus {
	outline: none;
	border-color: #1a1a1a;
}
.rb-reviews__formwrap .comment-form-author,
.rb-reviews__formwrap .comment-form-email,
.rb-reviews__formwrap .comment-form-comment,
.rb-reviews__formwrap .comment-form-rating { margin: 0 0 16px; }

/* selector de estrellas del form: lo nativo de WC (p.stars a) → monocromo */
.rb-reviews__formwrap .stars a { color: #1a1a1a; }
.rb-reviews__formwrap .stars a:hover,
.rb-reviews__formwrap .stars a.active { color: #1a1a1a; }
.rb-reviews__formwrap select#rating { font-family: inherit; padding: 8px 10px; }

.rb-reviews__formwrap .form-submit .submit {
	cursor: pointer;
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	padding: 13px 30px;
	border: 0;
	border-radius: 999px;          /* botón = píldora (refinamiento D1) */
	background: #1a1a1a;
	color: #fff;
	transition: transform .15s ease;
}
.rb-reviews__formwrap .form-submit .submit:hover { transform: translateY(-1px); }

/* ---- Móvil: 1 columna ---------------------------------------------------- */
@media (max-width: 767px) {
	.rb-reviews { padding: 40px 0; }
	.rb-reviews__inner { padding: 0 16px; }
	.rb-reviews__grid { column-count: 1; }
	.rb-reviews__header { gap: 14px; }
}
