/**
 * Estilos estructurales base del widget de reseñas.
 * El aspecto visual (color, tipografía, fondo, borde…) se controla desde
 * Elementor mediante selectores; aquí solo va la maquetación imprescindible.
 */

/* --- Contenedor general --- */
.erw-reviews {
	display: flex;
	flex-direction: column;
	gap: 24px;
}

/* --- Fila superior: resumen + desglose + botón --- */
.erw-reviews__top {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 32px;
}

/* --- Resumen (promedio) --- */
.erw-reviews__summary {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 4px;
}

.erw-reviews__avg {
	line-height: 1;
	font-size: 44px;
	font-weight: 700;
}

.erw-reviews__count {
	font-size: 13px;
}

/* --- Estrellas con relleno parcial --- */
.erw-stars {
	position: relative;
	display: inline-block;
	font-size: 20px;
	line-height: 1;
	white-space: nowrap;
	letter-spacing: 2px;
}

.erw-stars__track {
	display: block;
}

.erw-stars__fill {
	position: absolute;
	top: 0;
	left: 0;
	display: block;
	overflow: hidden;
	white-space: nowrap;
	width: 0;
}

/* --- Desglose por nivel --- */
.erw-reviews__breakdown {
	display: flex;
	flex-direction: column;
	gap: 8px;
	flex: 1 1 240px;
	min-width: 200px;
}

.erw-bar {
	display: flex;
	align-items: center;
	gap: 10px;
}

.erw-bar__label {
	display: inline-flex;
	align-items: center;
	gap: 3px;
	flex: 0 0 auto;
	line-height: 1;
}

.erw-bar__label-star {
	font-size: 0.9em;
}

.erw-bar__track {
	position: relative;
	flex: 1 1 auto;
	height: 8px;
	border-radius: 8px;
	overflow: hidden;
}

.erw-bar__fill {
	display: block;
	height: 100%;
	width: 0;
	border-radius: 8px;
}

.erw-bar__count {
	flex: 0 0 auto;
	min-width: 2ch;
	text-align: right;
	line-height: 1;
}

/* --- Botón --- */
.erw-reviews__action {
	display: flex;
	margin-left: auto;
}

.erw-reviews__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 14px 28px;
	border-radius: 6px;
	text-decoration: none;
	line-height: 1.2;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease;
}

/* --- Reseña destacada --- */
.erw-reviews__featured {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 16px;
	padding: 20px 24px;
	border-radius: 10px;
}

.erw-review__main {
	display: flex;
	flex-direction: column;
	gap: 8px;
	flex: 1 1 60%;
	min-width: 240px;
}

.erw-review__title {
	margin: 0;
	font-weight: 600;
}

.erw-review__text {
	margin: 0;
	line-height: 1.5;
}

.erw-review__meta {
	display: flex;
	flex-direction: column;
	gap: 4px;
	text-align: right;
	flex: 0 0 auto;
}

/* --- Enlace "Ver todas" --- */
.erw-reviews__all-row {
	display: flex;
	justify-content: flex-end;
}

.erw-reviews__all {
	text-decoration: none;
}

.erw-reviews__all:hover,
.erw-reviews__all:focus {
	text-decoration: underline;
}

/* --- Estado vacío: modo compacto (mensaje + botón centrados) --- */
.erw-reviews--empty {
	align-items: center;
	text-align: center;
}

.erw-reviews__empty {
	margin: 0;
}

/* --- Estado vacío: modo placeholder (mismo layout con datos a cero) --- */
.erw-reviews--placeholder .erw-reviews__avg {
	opacity: 0.55;
}

.erw-reviews--placeholder .erw-reviews__empty {
	text-align: center;
	opacity: 0.85;
}

/* --- Ventana modal --- */
.erw-reviews-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background-color: rgba(15, 42, 67, 0.55);
}

.erw-reviews-modal[hidden] {
	display: none !important;
}

.erw-reviews-modal__card {
	position: relative;
	width: 100%;
	max-width: 640px;
	max-height: calc(100vh - 32px);
	overflow-y: auto;
	padding: 28px;
	background-color: #ffffff;
	border-radius: 12px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.erw-reviews-modal__close {
	position: absolute;
	top: 10px;
	right: 12px;
	width: 32px;
	height: 32px;
	padding: 0;
	background: transparent;
	border: 0;
	font-size: 26px;
	line-height: 1;
	color: #6b7280;
	cursor: pointer;
}

.erw-reviews-modal__close:hover,
.erw-reviews-modal__close:focus {
	color: #0f2a43;
}

.erw-reviews-modal__title {
	margin: 0 32px 16px 0;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.3;
}

/* Formulario nativo de WooCommerce dentro del modal: quitamos el título
   duplicado ("Sé el primero en valorar…") porque ya ponemos el nuestro. */
.erw-reviews-modal__body #reply-title {
	display: none;
}

.erw-reviews-modal__body #commentform,
.erw-reviews-modal__body .comment-form {
	margin: 0;
}

.erw-reviews-modal__body #commentform p,
.erw-reviews-modal__body .comment-form p {
	margin: 0 0 12px;
}

.erw-reviews-modal__body .comment-form label {
	display: block;
	margin-bottom: 4px;
	font-weight: 600;
	font-size: 14px;
}

.erw-reviews-modal__body .comment-form input[type="text"],
.erw-reviews-modal__body .comment-form input[type="email"],
.erw-reviews-modal__body .comment-form textarea,
.erw-reviews-modal__body .comment-form select {
	width: 100%;
	padding: 8px 10px;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	font: inherit;
	box-sizing: border-box;
}

.erw-reviews-modal__body .comment-form textarea {
	min-height: 100px;
	resize: vertical;
}

.erw-reviews-modal__body .comment-form-rating {
	margin: 0 0 12px;
}

.erw-reviews-modal__body .form-submit {
	margin: 12px 0 0;
}

.erw-reviews-modal__body .form-submit .submit {
	padding: 10px 20px;
	background: #1b5fa8;
	color: #fff;
	border: 0;
	border-radius: 6px;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.erw-reviews-modal__body .form-submit .submit:hover,
.erw-reviews-modal__body .form-submit .submit:focus {
	background: #164b84;
}

/* Bloquea el scroll del body mientras el modal está abierto. */
body.erw-modal-open {
	overflow: hidden;
}

/* Mensajes de fallback cuando WooCommerce no imprime el formulario. */
.erw-reviews-modal__notice {
	margin: 0;
	color: #6b7280;
	line-height: 1.5;
}

.erw-reviews-modal__admin-notice {
	background: #fff7ed;
	border: 1px solid #fdba74;
	border-radius: 8px;
	padding: 12px 14px;
	color: #7c2d12;
	line-height: 1.5;
	font-size: 14px;
}

.erw-reviews-modal__admin-notice p {
	margin: 0 0 8px;
}

.erw-reviews-modal__admin-notice ul {
	margin: 0;
	padding-left: 20px;
}

/* --- Responsive --- */
@media (max-width: 600px) {
	.erw-reviews__action {
		margin-left: 0;
		width: 100%;
	}

	.erw-reviews__button {
		width: 100%;
	}

	.erw-review__meta {
		text-align: left;
	}
}
