/* ============================================================
   SACH STAR RATING SYSTEM v3.1
   /wp-content/themes/YOUR-THEME/sach-rating/sach-rating.css
   ------------------------------------------------------------
   Sao được vẽ bằng CSS clip-path (hình vector thuần), KHÔNG dùng
   ký tự font ★ — tránh lỗi hiển thị vỡ hình do font hệ thống
   khác nhau giữa các máy/trình duyệt.
   ============================================================ */

.sach-comments-area *,
.sach-comments-area *::before,
.sach-comments-area *::after {
	box-sizing: border-box;
}

.sach-comments-area {
	font-family: inherit;
	color: #1a1a2e;
	max-width: 820px;
	margin: 2rem auto;
}

/* ════════════════════════════════════════════════════════════
   NGÔI SAO — hình dạng chung (clip-path polygon, vector thuần)
   ════════════════════════════════════════════════════════════ */
.sach-star-icon {
	display: inline-block;
	clip-path: polygon(
		50% 0%, 61% 35%, 98% 35%, 68% 57%,
		79% 91%, 50% 70%, 21% 91%, 32% 57%,
		2% 35%, 39% 35%
	);
	background-color: #e2e4e9; /* mặc định: rỗng */
	flex-shrink: 0;
}

.sach-star-icon.is-full {
	background-color: #f59e0b;
}

.sach-star-icon.is-half {
	background: linear-gradient(90deg, #f59e0b 50%, #e2e4e9 50%);
}

.sach-star-icon.is-empty {
	background-color: #e2e4e9;
}

/* Kích thước theo ngữ cảnh sử dụng */
.sach-star-icon--large {
	width: 22px;
	height: 22px;
}

.sach-star-icon--small {
	width: 14px;
	height: 14px;
}

/* ════════════════════════════════════════════════════════════
   TỔNG QUAN RATING
   ════════════════════════════════════════════════════════════ */
.sach-rating-summary {
	/*border: 1px solid #e5e7eb;*/
	/*border-radius: 14px;*/
	/*padding: 1.5rem 2rem;*/
	margin-bottom: 2rem;
	/*background: #fff;*/
}

.sach-rating-summary--shortcode {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 0.5rem 1rem;
	margin: 0;
	border-radius: 8px;
}

.sach-rating-title {
	font-size: 1.35rem;
	font-weight: 700;
	margin: 0 0 1.1rem;
	color: #111;
}

.sach-rating-overview {
	display: flex;
	align-items: center;
	gap: 1.25rem;
	flex-wrap: wrap;
}

.sach-rating-score {
	display: flex;
	align-items: baseline;
	gap: 2px;
	min-width: 72px;
}

.sach-big-score {
	font-size: 2.8rem;
	font-weight: 800;
	color: #1a1a2e;
	line-height: 1;
	letter-spacing: -1px;
}

.sach-big-score--empty {
	font-size: 1.9rem;
	color: #9ca3af;
}

.sach-score-max {
	font-size: 1rem;
	color: #6b7280;
	font-weight: 500;
	white-space: nowrap;
}

.sach-rating-stars-avg {
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.sach-rating-count {
	font-size: 0.85rem;
	color: #6b7280;
}

/* ════════════════════════════════════════════════════════════
   STARS DISPLAY (read-only, hàng sao trong summary + comment list)
   ════════════════════════════════════════════════════════════ */
.sach-stars {
	display: inline-flex;
	align-items: center;
	gap: 3px;
	line-height: 1;
}

/* ════════════════════════════════════════════════════════════
   DANH SÁCH COMMENT
   ════════════════════════════════════════════════════════════ */
.sach-comments-title {
	font-size: 1.1rem;
	font-weight: 600;
	margin: 0 0 1.25rem;
	color: #374151;
	border-bottom: 2px solid #f3f4f6;
	padding-bottom: 0.7rem;
}

.sach-comment-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.sach-comment-item {
	border-bottom: 1px solid #f3f4f6;
	padding: 1.2rem 0;
}

.sach-comment-item:last-child {
	border-bottom: none;
}

.sach-comment-item .children {
	list-style: none;
	padding-left: 3.5rem;
	margin: 0.5rem 0 0;
}

.sach-comment-body {
	display: flex;
	gap: 1rem;
	align-items: flex-start;
}

.sach-comment-avatar {
	flex-shrink: 0;
	flex: 0 0 40px;
}

.sach-avatar {
	border-radius: 50%;
	width: 46px;
	height: 46px;
}

.sach-comment-content {
	flex: 1;
	min-width: 0;
}

.sach-comment-meta {
	display: flex;
	align-items: center;
	gap: 0.55rem;
	flex-wrap: wrap;
	margin-bottom: 0.45rem;
}

.sach-comment-author {
	font-weight: 700;
	font-size: 0.9375rem;
	color: #111;
}

.sach-comment-stars {
	display: inline-flex;
	align-items: center;
}

.sach-comment-date {
	font-size: 0.78rem;
	color: #9ca3af;
	margin-left: auto;
}

.sach-comment-text {
	font-size: 0.9375rem;
	line-height: 1.65;
	color: #374151;
}

.sach-comment-text p:last-child {
	margin-bottom: 0;
}

.sach-reply-link {
	margin-top: 0.45rem;
}

.sach-reply-link a {
	font-size: 0.8rem;
	color: #6b7280;
	text-decoration: none;
	border: 1px solid #e5e7eb;
	padding: 2px 10px;
	border-radius: 20px;
	transition: all 0.18s;
	cursor: pointer;
}

.sach-reply-link a:hover {
	color: #111;
	border-color: #9ca3af;
	background: #f9fafb;
}

.comment-awaiting-moderation {
	font-size: 0.8rem;
	color: #d97706;
	background: #fef3c7;
	border-radius: 6px;
	padding: 3px 10px;
	display: inline-block;
	margin-bottom: 5px;
}

/* ════════════════════════════════════════════════════════════
   FORM PHẢN HỒI / TRẢ LỜI (#respond) — bao gồm cả reply form
   ════════════════════════════════════════════════════════════ */
#respond {
	margin-top: 2.5rem;
	background: #f9fafb;
	border: 1px solid #e5e7eb;
	border-radius: 14px;
	padding: 1.75rem 2rem;
}

#respond h3#reply-title {
	font-size: 1.2rem;
	font-weight: 700;
	margin: 0 0 0.5rem;
}

#respond #cancel-comment-reply-link {
	font-size: 0.8rem;
	font-weight: 400;
	color: #6b7280;
	text-decoration: none;
	margin-left: 8px;
}

#respond #cancel-comment-reply-link:hover {
	text-decoration: underline;
}

#respond .logged-in-as {
	font-size: 0.82rem;
	color: #6b7280;
	margin: 0 0 1.25rem;
}

#respond .logged-in-as a {
	color: #6366f1;
}

.sach-form-row {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin-bottom: 1rem;
}

.sach-form-row label {
	font-size: 0.875rem;
	font-weight: 600;
	color: #374151;
}

.sach-optional {
	font-weight: 400;
	color: #9ca3af;
	font-size: 0.82em;
}

.sach-field-note {
	font-size: 0.775rem;
	color: #9ca3af;
	margin-top: 2px;
}

#respond input[type="text"],
#respond input[type="email"],
#respond input[type="tel"],
#respond input[type="url"],
#respond textarea,
.sach-form-row input,
.sach-form-row textarea {
	border: 1px solid #d1d5db;
	border-radius: 8px;
	padding: 0.6rem 0.875rem;
	font-size: 0.9375rem;
	font-family: inherit;
	color: #111;
	background: #fff;
	width: 100%;
	transition: border-color 0.2s, box-shadow 0.2s;
}

#respond input:focus,
#respond textarea:focus,
.sach-form-row input:focus,
.sach-form-row textarea:focus {
	outline: none;
	border-color: #6366f1;
	box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

#respond textarea,
.sach-form-row textarea {
	min-height: 110px;
	resize: vertical;
}

#respond input::placeholder,
#respond textarea::placeholder,
.sach-form-row input::placeholder,
.sach-form-row textarea::placeholder {
	color: #c4c9d4;
	font-size: 0.875rem;
}

.sach-form-row .required,
#respond .required {
	color: #ef4444;
	margin-left: 2px;
}

.sach-input-error {
	border-color: #ef4444 !important;
	box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12) !important;
}

.sach-inline-error {
	font-size: 0.775rem;
	color: #ef4444;
	font-weight: 500;
	margin-top: 3px;
	display: block;
}

#respond .comment-form-comment label {
	display: block;
	font-size: 0.875rem;
	font-weight: 500;
	color: #374151;
	margin-bottom: 4px;
}

/* ════════════════════════════════════════════════════════════
   STAR SELECTOR (form) — bấm để chọn, hỗ trợ nửa sao
   ════════════════════════════════════════════════════════════ */
.sach-rating-field {
	margin-bottom: 1.2rem;
}

.sach-rating-label {
	display: block;
	font-size: 0.875rem;
	font-weight: 600;
	color: #374151;
	margin-bottom: 0.55rem;
}

.sach-rating-label .required {
	color: #ef4444;
	margin-left: 2px;
}

/* Radios ẩn hoàn toàn — chỉ dùng cho form value + keyboard focus */
.sach-star-radios {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.sach-star-selector {
	position: relative;
	display: inline-block;
}

.sach-star-visuals {
	display: inline-flex;
	gap: 6px;
}

.sach-star-visual {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	cursor: pointer;
}

.sach-star-visual .sach-star-icon {
	width: 30px;
	height: 30px;
	transition: transform 0.1s ease;
}

.sach-star-visual:hover .sach-star-icon {
	transform: scale(1.08);
}

/* Vùng bấm vô hình, chia đôi mỗi sao (trái = nửa, phải = đầy) */
.sach-star-hit {
	position: absolute;
	top: 0;
	bottom: 0;
	width: 50%;
	z-index: 2;
	cursor: pointer;
}

.sach-star-hit--left {
	left: 0;
}

.sach-star-hit--right {
	right: 0;
}

.sach-star-hint {
	font-size: 0.78rem;
	color: #9ca3af;
	margin: 8px 0 0;
	min-height: 1em;
	transition: color 0.15s;
}

.sach-star-hint.is-error {
	color: #ef4444;
	font-weight: 600;
}

/* ── Submit ─────────────────────────────────────────────────── */
.sach-submit-btn,
#respond .submit {
	background: #1a1a2e;
	color: #fff;
	border: none;
	border-radius: 8px;
	padding: 0.65rem 1.75rem;
	font-size: 0.9375rem;
	font-weight: 700;
	font-family: inherit;
	cursor: pointer;
	transition: background 0.2s, transform 0.1s;
	margin-top: 0.5rem;
	letter-spacing: 0.01em;
}

.sach-submit-btn:hover,
#respond .submit:hover {
	background: #2d2d4e;
}

.sach-submit-btn:active,
#respond .submit:active {
	transform: translateY(1px);
}

.sach-submit-btn:disabled,
#respond .submit:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 600px) {
	.sach-comment-body {
		gap: 0.75rem;
	}
	#respond {
		padding: 1.25rem 1rem;
	}
	.sach-rating-overview {
		gap: 1rem;
	}
	.sach-big-score {
		font-size: 2.1rem;
	}
	.sach-star-icon--large {
		width: 18px;
		height: 18px;
	}
	.sach-star-visual {
		width: 26px;
		height: 26px;
	}
	.sach-star-visual .sach-star-icon {
		width: 24px;
		height: 24px;
	}
}
