/**
 * Widget Đánh giá sản phẩm (VDC)
 * Tham khảo: tổng quan điểm + phân bố sao + nút Viết đánh giá (đỏ) + lọc + danh sách đánh giá.
 */

.vdc-product-review-widget {
	box-sizing: border-box;
	padding: 16px;
	background: #f7f7f8;
	border-radius: 12px;
}

.vdc-product-review-widget *,
.vdc-product-review-widget *::before,
.vdc-product-review-widget *::after {
	box-sizing: border-box;
}

/* Đè lại một số style chung của theme bên trong widget */
.vdc-product-review-widget h3,
.vdc-product-review-widget h4 {
	margin: 0;
	font-weight: 700;
	color: #333;
	margin-bottom: 10px;
}

.vdc-product-review-widget p {
	margin: 0 0 4px;
	font-size: 14px;
	color: #444;
}

/* ---------- Tổng quan: điểm TB + nút Viết đánh giá ---------- */
.vdc-pr-summary {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 24px 32px;
	margin-bottom: 16px;
	padding: 24px 48px;
	background: #fff;
	border-radius: 12px;
}

.vdc-pr-overview {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px 0;
	flex: 0 1 20%;
	min-width: 0;
}

.vdc-pr-average-wrap {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
}

.vdc-pr-average {
	font-size: 48px;
	font-weight: 700;
	line-height: 1.2;
	color: #333;
}

.vdc-pr-average-max {
	font-size: 32px;
	font-weight: 500;
	color: #999;
}

.vdc-pr-stars-block {
	position: relative;
	display: inline-block;
	width: 70px; /* 5 sao x 14px */
	height: 14px;
	font-size: 0; /* ẩn ký tự sao nếu có */
	line-height: 0;
	overflow: hidden;
	background: none;
}

.vdc-pr-stars-block::before {
	content: "";
	position: absolute;
	inset: 0;
	background-image: url("/wp-content/themes/hello-elementor-child/assets/icons/rating-star.svg");
	background-repeat: repeat-x;
	background-size: 14px 14px;
	filter: grayscale(1);
	opacity: 0.3; /* sao nền xám nhạt */
}

.vdc-pr-stars-block .vdc-pr-stars-bg {
	font-size: 0;
	line-height: 0;
	color: transparent;
}

.vdc-pr-stars-fill {
	position: absolute;
	left: 0;
	top: 0;
	overflow: hidden;
	width: 0; /* sẽ được JS set theo % điểm */
	height: 100%;
	font-size: 0;
	background-image: url("/wp-content/themes/hello-elementor-child/assets/icons/rating-star.svg");
	background-repeat: repeat-x;
	background-size: 14px 14px;
	filter: none; /* sao được đánh giá màu cam */
	z-index: 1;
}

.vdc-pr-total-text {
	font-size: 14px;
	color: #666;
}

.vdc-pr-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 12px 24px;
	font-size: 12px;
	font-weight: 600;
	text-decoration: none;
	border: none;
	border-radius: 8px !important;
	white-space: nowrap;
	cursor: pointer;
	transition: opacity 0.2s, background-color 0.2s;
}

.vdc-pr-btn-write {
	background-color: #e74c3c;
	color: #fff;
}

.vdc-pr-btn-write:hover {
	opacity: 0.9;
	color: #fff;
}

/* ---------- Phân bố sao (thanh đỏ) ---------- */
.vdc-pr-breakdown {
	flex: 0 1 40%;
	min-width: 0;
}

.vdc-pr-row {
	display: flex;
	align-items: center;
	gap: 10px 12px;
}

.vdc-pr-row:last-child {
	margin-bottom: 0;
}

.vdc-pr-star-label {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	flex-shrink: 0;
}

.vdc-pr-star-number {
	color: black;
	font-size: 14px;
	font-weight: 500;
}

.vdc-pr-star-icon {
	width: 12px;
	height: 12px;
	background-image: url("/wp-content/themes/hello-elementor-child/assets/icons/rating-star.svg");
	background-repeat: no-repeat;
	background-size: 12px 12px;
	filter: none; /* sao màu cam */
}

.vdc-pr-bar-track {
	flex: 1;
	min-width: 80px;
	height: 8px;
	background: #f0f0f0;
	border-radius: 7px;
	overflow: hidden;
}

.vdc-pr-bar-fill {
	height: 100%;
	border-radius: 7px;
	background-color: #e74c3c;
	transition: width 0.3s ease;
}

.vdc-pr-meta {
	font-size: 13px;
	color: #555;
	white-space: nowrap;
	flex-shrink: 0;
	min-width: 70px;
}

/* ---------- Đánh giá theo trải nghiệm ---------- */
.vdc-pr-experience {
	flex: 0 1 40%;
	min-width: 0;
	border-left: 1px solid #eee;
	padding-left: 24px;
}

.vdc-pr-experience-title {
	margin: 0 0 12px;
	font-size: 15px;
	font-weight: 700;
	color: #333;
}

.vdc-pr-experience-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.vdc-pr-experience-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.vdc-pr-experience-label {
	font-size: 14px;
	font-weight: 500;
	color: #333;
	flex-shrink: 0;
}

.vdc-pr-experience-right {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
}

.vdc-pr-experience-stars {
	position: relative;
	display: inline-block;
	width: 60px;
	height: 12px;
	font-size: 0;
	line-height: 0;
	overflow: hidden;
	background: none;
}

.vdc-pr-experience-stars::before {
	content: "";
	position: absolute;
	inset: 0;
	background-image: url("/wp-content/themes/hello-elementor-child/assets/icons/rating-star.svg");
	background-repeat: repeat-x;
	background-size: 12px 12px;
	filter: grayscale(1);
	opacity: 0.3;
}

.vdc-pr-experience-stars-fill {
	position: absolute;
	left: 0;
	top: 0;
	overflow: hidden;
	height: 100%;
	font-size: 0;
	background-image: url("/wp-content/themes/hello-elementor-child/assets/icons/rating-star.svg");
	background-repeat: repeat-x;
	background-size: 12px 12px;
	filter: none;
	z-index: 1;
}

.vdc-pr-experience-meta {
	font-size: 13px;
	color: #666;
	white-space: nowrap;
}

.vdc-pr-empty {
	margin: 0;
	font-size: 14px;
	color: #666;
}

/* ---------- Lọc đánh giá (chips) ---------- */
.vdc-product-review-widget .vdc-pr-filters {
	margin-bottom: 20px;
}

.vdc-pr-filters-label {
	display: block;
	font-size: 14px;
	font-weight: 600;
	color: #333;
	margin-bottom: 10px;
}

.vdc-product-review-widget .vdc-pr-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.vdc-product-review-widget .vdc-pr-chip {
	display: inline-flex;
	align-items: center;
	padding: 8px 16px;
	font-size: 13px;
	font-weight: 500;
	color: #555 !important;
	background: #f5f5f5 !important;
	border: 1px solid #e0e0e0 !important;
	border-radius: 20px;
	cursor: pointer;
	transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.vdc-product-review-widget .vdc-pr-chip:hover {
	background: #eee !important;
	color: #333 !important;
}

.vdc-product-review-widget .vdc-pr-chip.is-active {
	background: #0066b3 !important;
	color: #fff !important;
	border-color: #0066b3 !important;
}

/* ---------- Danh sách đánh giá ---------- */
.vdc-pr-reviews-block {
	background: #fff;
	padding: 16px;
	border-radius: 12px;
}

.vdc-pr-list {
	display: flex;
	flex-direction: column;
	gap: 20px;
}

.vdc-pr-review-card {
	display: flex;
	gap: 16px;
	padding: 16px 0;
	border-bottom: 1px solid #eee;
}

.vdc-pr-review-card:last-child {
	border-bottom: none;
}

.vdc-pr-review-card.is-hidden {
	display: none;
}

.vdc-pr-review-avatar {
	width: 44px;
	height: 44px;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
	font-weight: 600;
	color: #666;
	background: #e8e8e8;
	border-radius: 50%;
}

.vdc-pr-review-body {
	flex: 1;
	min-width: 0;
}

.vdc-pr-review-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 12px;
	margin-bottom: 8px;
}

.vdc-pr-review-author {
	font-size: 15px;
	font-weight: 600;
	color: #333;
}

.vdc-pr-review-stars {
	display: inline-flex;
	align-items: center;
	gap: 2px;
}

.vdc-pr-review-star-icon {
	width: 14px;
	height: 14px;
	background-image: url("/wp-content/themes/hello-elementor-child/assets/icons/rating-star.svg");
	background-repeat: no-repeat;
	background-size: 14px 14px;
	filter: grayscale(1);
	opacity: 0.3; /* sao chưa đánh giá xám nhạt */
}

.vdc-pr-review-star-icon.is-filled {
	filter: none; /* sao được đánh giá màu cam */
	opacity: 1;
}

.vdc-pr-review-sentiment {
	font-size: 13px;
	color: #666;
}

.vdc-pr-review-content {
	font-size: 14px;
	line-height: 1.5;
	color: #444;
	margin-bottom: 8px;
}

.vdc-pr-review-content p {
	margin: 0 0 0.5em;
}

.vdc-pr-review-content p:last-child {
	margin-bottom: 0;
}

.vdc-pr-review-date {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 12px;
	color: #999;
}

/* ---------- Popup đánh giá ---------- */
.vdc-pr-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease, visibility 0.2s ease;
}

.vdc-pr-modal.is-open {
	opacity: 1;
	visibility: visible;
}

.vdc-pr-modal[hidden] {
	display: none !important;
}

.vdc-pr-modal:not([hidden]).is-open {
	display: flex !important;
}

.vdc-pr-modal-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	cursor: pointer;
}

.vdc-pr-modal-box {
	position: relative;
	width: 100%;
	max-width: 480px;
	max-height: 90vh;
	overflow-y: auto;
	background: #fff;
	border-radius: 10px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
	padding: 24px;
}

.vdc-pr-modal-close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 36px;
	height: 36px;
	padding: 0;
	font-size: 24px;
	line-height: 1;
	color: #666;
	background: none;
	border: none;
	cursor: pointer;
	transition: color 0.2s;
}

.vdc-pr-modal-close:hover {
	color: #000;
}

.vdc-pr-modal-title {
	margin: 0 0 20px;
	font-size: 20px;
	font-weight: 700;
	color: #333;
}

.vdc-pr-form .vdc-pr-form-row {
	margin-bottom: 16px;
}

.vdc-pr-form .vdc-pr-form-label {
	display: block;
	margin-bottom: 6px;
	font-size: 14px;
	font-weight: 600;
	color: #333;
}

.vdc-pr-form .vdc-pr-form-label .required {
	color: #c00;
}

.vdc-pr-stars-input {
	display: flex;
	gap: 4px;
	margin-bottom: 4px;
}

.vdc-pr-star-btn {
	width: 40px;
	height: 40px;
	padding: 0;
	font-size: 0; /* ẩn ký tự sao */
	line-height: 0;
	color: transparent;
	background-color: transparent;
	background-image: url("/wp-content/themes/hello-elementor-child/assets/icons/rating-star.svg");
	background-repeat: no-repeat;
	background-position: center;
	background-size: 24px 24px;
	border: none;
	cursor: pointer;
	transition: color 0.15s, transform 0.15s;
}

.vdc-pr-star-btn:hover,
.vdc-pr-star-btn.is-selected {
	filter: none;
	transform: scale(1.1);
}

.vdc-pr-input,
.vdc-pr-textarea {
	width: 100%;
	padding: 10px 12px;
	font-size: 14px;
	font-family: inherit;
	border: 1px solid #ccc;
	border-radius: 6px;
	transition: border-color 0.2s;
}

.vdc-pr-input:focus,
.vdc-pr-textarea:focus {
	outline: none;
	border-color: #0066b3;
}

.vdc-pr-textarea {
	resize: vertical;
	min-height: 100px;
}

.vdc-pr-form-error {
	display: block;
	margin-top: 4px;
	font-size: 12px;
	color: #c00;
}

.vdc-pr-form-message {
	margin-bottom: 16px;
	padding: 10px 12px;
	font-size: 14px;
	border-radius: 6px;
}

.vdc-pr-form-message.is-success {
	background: #e8f5e9;
	color: #2e7d32;
}

.vdc-pr-form-message.is-error {
	background: #ffebee;
	color: #c62828;
}

.vdc-pr-form-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: flex-end;
	margin-top: 20px;
}

.vdc-pr-btn-secondary {
	background-color: #666 !important;
	color: #fff;
}

.vdc-pr-btn-secondary:hover {
	opacity: 0.9;
	color: #fff;
}

.vdc-pr-btn-submit {
	background-color: #e74c3c !important;
	color: #fff;
}

.vdc-pr-btn-submit:hover {
	opacity: 0.9;
	color: #fff;
}

body.vdc-pr-modal-open {
	overflow: hidden;
}

/* ---------- WooCommerce core rating stars (thu nhỏ ~14px) ---------- */
.woocommerce .star-rating,
.woocommerce-page .star-rating {
	font-size: 14px;
	line-height: 14px;
	width: 70px !important; /* 5 sao x 14px */
	height: 14px !important;
}

.woocommerce .star-rating::before,
.woocommerce-page .star-rating::before {
	font-size: 14px;
	line-height: 14px;
}

.woocommerce .star-rating span,
.woocommerce-page .star-rating span {
	height: 14px !important;
	background-size: 14px 14px !important;
}

/* Sao trong form viết đánh giá WooCommerce */
.woocommerce p.stars a {
	font-size: 14px;
	width: 14px;
	height: 14px;
	line-height: 14px;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
	.vdc-product-review-widget {
		padding: 20px;
	}

	.vdc-pr-summary {
		flex-direction: column;
		gap: 20px;
		padding: 20px 40px;
	}

	.vdc-pr-overview {
		width: 100%;
	}

	.vdc-pr-average {
		font-size: 30px;
	}

	.vdc-pr-breakdown {
		width: 100%;
	}

	.vdc-pr-experience {
		width: 100%;
		min-width: 0;
		padding-left: 0;
		border-left: none;
	}
}

@media (max-width: 480px) {
	.vdc-product-review-widget {
		padding: 16px;
	}

	.vdc-pr-btn-write {
		width: 100%;
	}

	.vdc-pr-chips {
		gap: 6px;
	}

	.vdc-pr-chip {
		padding: 6px 12px;
		font-size: 12px;
	}

	.vdc-pr-review-card {
		flex-direction: column;
		align-items: flex-start;
		gap: 12px;
	}

	.vdc-pr-modal-box {
		padding: 20px;
	}

	.vdc-pr-form-actions {
		flex-direction: column;
	}

	.vdc-pr-form-actions .vdc-pr-btn {
		width: 100%;
	}
}
