/**
 * Advanced Reviews — стили под тему «Кровельный Мир»
 * Палитра: #432928, #5e4948, #8b0a0e, #60090b, #e99c02, #ffc011
 * Шрифты: HelveticaNeueCyr, Akrobat
 */

.reviews-section,
.advanced-reviews-summary-widget,
.review-form-modal {
	--ar-color-text: #432928;
	--ar-color-muted: #666666;
	--ar-color-accent: #8b0a0e;
	--ar-color-accent-dark: #60090b;
	--ar-color-hover: #e99c02;
	--ar-color-gold: #ffc011;
	--ar-color-gold-light: #ffe799;
	--ar-color-bg: #f5f5f5;
	--ar-color-white: #ffffff;
	--ar-font: "HelveticaNeueCyr", sans-serif;
	--ar-font-title: "Akrobat", sans-serif;
	--ar-radius-lg: 6px;
	--ar-radius-md: 6px;
	--ar-radius-sm: 6px;
	--ar-transition: 0.3s;
}

/* ---- Секция отзывов ---- */
.reviews-section {
	font-family: var(--ar-font);
	font-size: 16px;
	line-height: 24px;
	color: var(--ar-color-muted);
	padding-top: 10px;
	padding-bottom: 78px;
	background: var(--ar-color-bg);
}

.reviews-section *,
.reviews-section *::before,
.reviews-section *::after {
	box-sizing: border-box;
}

.reviews-section h1,
.reviews-section h2,
.reviews-section h3,
.reviews-section h4,
.reviews-section h5,
.reviews-section h6 {
	padding: 0;
	margin: 0;
	font-weight: normal;
	font-family: var(--ar-font-title);
	color: var(--ar-color-text);
}

.reviews-section p {
	padding: 0;
	margin: 0;
}

.reviews-section button,
.reviews-section input,
.reviews-section textarea {
	font-family: inherit;
}

.reviews-section input,
.reviews-section textarea {
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
}

/* ---- Заголовок секции ---- */
.reviews-section .reviews-header {
	padding-top: 25px;
	padding-bottom: 35px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	flex-wrap: wrap;
}

.reviews-section .reviews-title,
.reviews-section .title .reviews-title {
	font-family: var(--ar-font);
	font-size: 30px;
	line-height: 1.2;
	font-weight: 500;
	color: var(--ar-color-text);
}

.reviews-section .title {
	padding-top: 25px;
	padding-bottom: 0;
}

/* ---- Кнопки темы ---- */
.reviews-section .btn-main,
.review-form-modal .btn-main,
.reviews-section .btn.btn--brown,
.review-form-modal .btn.btn--brown {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: auto;
	min-width: 136px;
	height: 47px;
	padding: 0 20px;
	background-color: var(--ar-color-accent);
	background-image: linear-gradient(180deg, #60090b 0%, rgba(96, 9, 11, 0) 100%);
	border-radius: 23.5px;
	font-family: var(--ar-font-title);
	font-size: 16px;
	font-weight: 700;
	color: #eeeeee;
	text-align: center;
	line-height: 45px;
	border: none;
	cursor: pointer;
	transition: 0.5s;
	position: relative;
	z-index: 1;
	text-decoration: none;
}

.reviews-section .btn-main::before,
.review-form-modal .btn-main::before,
.reviews-section .btn.btn--brown::before,
.review-form-modal .btn.btn--brown::before {
	content: '';
	position: absolute;
	top: 2px;
	left: 2px;
	display: block;
	width: calc(100% - 4px);
	height: calc(100% - 4px);
	background: #fff;
	transition: 0.3s;
	opacity: 0;
	border-radius: 23.5px;
	z-index: -1;
}

.reviews-section .btn-main:hover,
.review-form-modal .btn-main:hover,
.reviews-section .btn.btn--brown:hover,
.review-form-modal .btn.btn--brown:hover {
	color: var(--ar-color-accent-dark);
}

.reviews-section .btn-main:hover::before,
.review-form-modal .btn-main:hover::before,
.reviews-section .btn.btn--brown:hover::before,
.review-form-modal .btn.btn--brown:hover::before {
	opacity: 1;
}

.reviews-section .btn-simple,
.reviews-section .btn.btn--black {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: auto;
	min-width: 136px;
	height: 47px;
	padding: 0 20px;
	background-color: #5e4948;
	border-radius: 23.5px;
	font-family: var(--ar-font-title);
	font-size: 16px;
	font-weight: 700;
	color: #eeeeee;
	border: none;
	cursor: pointer;
	transition: 0.5s;
	position: relative;
	z-index: 1;
	white-space: nowrap;
}

.reviews-section .btn-simple::before,
.reviews-section .btn.btn--black::before {
	content: '';
	position: absolute;
	top: 2px;
	left: 2px;
	display: block;
	width: calc(100% - 4px);
	height: calc(100% - 4px);
	background: #fff;
	transition: 0.3s;
	opacity: 0;
	border-radius: 23.5px;
	z-index: -1;
}

.reviews-section .btn-simple:hover,
.reviews-section .btn.btn--black:hover {
	color: #5e4948;
}

.reviews-section .btn-simple:hover::before,
.reviews-section .btn.btn--black:hover::before {
	opacity: 1;
}

/* ---- Карточки отзывов ---- */
.reviews-section .reviews-list {
	margin-top: 0;
	max-width: 750px;
	margin-left: auto;
	margin-right: auto;
}

.reviews-section .item-review,
.reviews-section .review-item {
	position: relative;
	padding: 31px 58px 30px;
	margin-bottom: 30px;
	background: var(--ar-color-white);
	box-shadow: 2px 4px 20px 0 rgba(67, 41, 39, 0.2);
	z-index: 1;
	transition: 0.3s;
}

.reviews-section .item-review:last-child,
.reviews-section .review-item:last-child {
	margin-bottom: 0;
}

.reviews-section .item-review__head,
.reviews-section .review-header {
	margin-bottom: 16px;
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
}

.reviews-section .title-small,
.reviews-section .review-author {
	font-family: var(--ar-font);
	font-size: 18px;
	line-height: 1.2;
	font-weight: 700;
	color: var(--ar-color-text);
}

.reviews-section .date-main,
.reviews-section .review-date {
	color: var(--ar-color-text);
	font-family: var(--ar-font-title);
	font-size: 16px;
	line-height: 1.2;
	margin-top: 4px;
}

.reviews-section .review-rating {
	font-size: 18px;
	line-height: 1;
	color: var(--ar-color-gold);
	letter-spacing: 2px;
	flex-shrink: 0;
	white-space: nowrap;
}

.reviews-section .review-title {
	font-size: 16px;
	font-weight: 700;
	margin-bottom: 12px;
	color: var(--ar-color-accent);
}

.reviews-section .review-text {
	font-size: 14px;
	line-height: 24px;
	color: var(--ar-color-muted);
	margin-bottom: 20px;
	text-indent: 23px;
}

/* ---- Кнопки «Полезно» ---- */
.reviews-section .review-helpful {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 12px;
}

.reviews-section .helpful-btn {
	height: 36px;
	padding: 0 14px;
	font-size: 14px;
	line-height: 1;
	color: var(--ar-color-text);
	background: #eeeeee;
	border: none;
	border-radius: var(--ar-radius-sm);
	cursor: pointer;
	transition: var(--ar-transition);
	font-family: var(--ar-font);
}

.reviews-section .helpful-btn:hover {
	background: var(--ar-color-gold-light);
	color: var(--ar-color-accent);
}

.reviews-section .helpful-btn.active {
	color: #fff;
	background: var(--ar-color-accent);
}

/* ---- Пустой список ---- */
.reviews-section .no-reviews {
	text-align: center;
	padding: 40px 20px;
	font-size: 16px;
	line-height: 24px;
	color: var(--ar-color-muted);
	background: var(--ar-color-white);
	box-shadow: 2px 4px 20px 0 rgba(67, 41, 39, 0.2);
}

/* ---- Модальное окно (как .modal темы) ---- */
.review-form-modal {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	min-height: 0;
	background-color: rgba(0, 0, 0, 0.4);
	z-index: 1000;
	overflow: hidden;
	font-family: var(--ar-font);
}

.review-form-modal.active {
	display: block;
	opacity: 1;
	min-height: 100vh;
}

.review-form-modal .review-form-content {
	display: flex;
	justify-content: center;
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 540px;
	max-width: 99%;
	opacity: 1;
	transition: 0.7s;
	padding: 37px 50px 27px;
	box-shadow: 5px 9px 30px 0 rgba(67, 41, 39, 0.33);
	background: #f5f5f5 url("/wp-content/themes/km/img/bg-form.png") repeat center center;
	border-radius: var(--ar-radius-lg);
	max-height: 90vh;
	overflow: auto;
}

.review-form-modal .title-middle {
	margin-bottom: 15px;
	font-size: 30px;
	line-height: 36px;
	font-weight: 700;
	text-transform: uppercase;
	color: var(--ar-color-text);
	text-align: center;
	font-family: var(--ar-font);
}

.review-form-modal .close-form {
	background: none;
	border: none;
	outline: none;
	position: absolute;
	top: 9px;
	right: 9px;
	display: block;
	width: 30px;
	height: 30px;
	cursor: pointer;
	z-index: 300;
	transition: 0.3s;
	font-size: 0;
	padding: 0;
}

.review-form-modal .close-form::before,
.review-form-modal .close-form::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	display: block;
	width: 20px;
	height: 3px;
	background-color: var(--ar-color-accent);
	border-radius: 1.5px;
	transition: 0.3s;
}

.review-form-modal .close-form::before {
	transform: translate(-50%, -50%) rotate(45deg);
}

.review-form-modal .close-form::after {
	transform: translate(-50%, -50%) rotate(-45deg);
}

.review-form-modal .close-form:hover::before,
.review-form-modal .close-form:hover::after {
	background-color: var(--ar-color-hover);
}

/* ---- Поля формы (как .form темы) ---- */
.review-form-modal .item-form {
	margin-bottom: 22px;
	text-align: center;
}

.review-form-modal .item-form input,
.review-form-modal .item-form textarea {
	display: block;
	width: 100%;
	background-color: var(--ar-color-white);
	border: 1px solid #f5f5f5;
	border-radius: var(--ar-radius-md);
	font-size: 18px;
	line-height: 1.2;
	font-weight: 400;
	color: var(--ar-color-text);
	text-align: center;
	transition: 0.3s;
	resize: none;
}

.review-form-modal .item-form input {
	height: 58px;
}

.review-form-modal .item-form textarea {
	height: 136px;
	padding-top: 20px;
}

.review-form-modal .item-form input:focus,
.review-form-modal .item-form textarea:focus {
	outline: none;
	box-shadow: 0 0 20px rgba(67, 41, 40, 0.3);
}

.review-form-modal .item-form input::placeholder,
.review-form-modal .item-form textarea::placeholder {
	color: #999999;
	font-size: 18px;
	font-family: var(--ar-font);
}

.review-form-modal .item-form--rating {
	text-align: left;
}

.review-form-modal .rating-label {
	display: block;
	margin-bottom: 10px;
	font-size: 16px;
	font-weight: 500;
	color: var(--ar-color-text);
}

.review-form-modal .rating-input {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	justify-content: center;
}

.review-form-modal .rating-input input[type="radio"] {
	display: none;
}

.review-form-modal .rating-input label {
	margin: 0;
	padding: 8px 12px;
	font-size: 14px;
	line-height: 1;
	color: var(--ar-color-gold);
	background: var(--ar-color-white);
	border-radius: var(--ar-radius-sm);
	cursor: pointer;
	transition: var(--ar-transition);
	border: 2px solid transparent;
}

.review-form-modal .rating-input label:hover {
	border-color: var(--ar-color-gold);
}

.review-form-modal .rating-input input[type="radio"]:checked + label {
	background: var(--ar-color-accent);
	color: #fff;
	border-color: var(--ar-color-accent);
}

.review-form-modal .form-info {
	margin-bottom: 18px;
	text-align: center;
}

.review-form-modal .form-info p {
	font-size: 13px;
	line-height: 1.2;
	color: var(--ar-color-muted);
}

.review-form-modal .btn-main,
.review-form-modal .btn.btn--brown {
	margin: 0 auto;
	display: flex;
}

/* ---- Уведомления ---- */
.review-form-modal .alert {
	padding: 12px 16px;
	border-radius: var(--ar-radius-sm);
	margin-bottom: 16px;
	font-size: 14px;
	text-align: center;
}

.review-form-modal .alert-success {
	background: #d1f7c4;
	color: var(--ar-color-accent-dark);
}

.review-form-modal .alert-error {
	background: #ffe0e0;
	color: #c0152f;
}

/* ---- Виджет сводной оценки в карточке товара ---- */
.advanced-reviews-summary-widget {
	display: inline-flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
	font-family: var(--ar-font);
	font-size: 16px;
	line-height: 24px;
	color: var(--ar-color-text);
	margin: 0 0 15px;
}

.card-product .advanced-reviews-summary-widget {
	margin-bottom: 20px;
}

.advanced-reviews-summary-widget .summary-rating-stars {
	display: inline-block;
}

.advanced-reviews-summary-widget .stars-outer {
	position: relative;
	display: inline-block;
	font-size: 20px;
	line-height: 1;
	color: #cccccc;
}

.advanced-reviews-summary-widget .stars-outer::before {
	content: "★★★★★";
}

.advanced-reviews-summary-widget .stars-inner {
	position: absolute;
	top: 0;
	left: 0;
	white-space: nowrap;
	overflow: hidden;
	width: 0;
	color: var(--ar-color-gold);
	transition: width 0.5s ease-in-out;
}

.advanced-reviews-summary-widget .stars-inner::before {
	content: "★★★★★";
}

.advanced-reviews-summary-widget .summary-rating-value {
	font-size: 16px;
	font-weight: 700;
	color: var(--ar-color-accent-dark);
	font-family: var(--ar-font-title);
}

.advanced-reviews-summary-widget .summary-reviews-count-link {
	font-family: var(--ar-font-title);
	font-size: 14px;
	line-height: 1.2;
	font-weight: 700;
	color: var(--ar-color-accent);
	text-decoration: none;
	transition: var(--ar-transition);
	border-bottom: 1px solid transparent;
}

.advanced-reviews-summary-widget .summary-reviews-count-link:hover {
	color: var(--ar-color-hover);
	border-bottom-color: var(--ar-color-hover);
}

/* ---- Адаптив ---- */
@media (max-width: 780px) {
	.reviews-section .reviews-list {
		width: 100%;
	}

	.reviews-section .item-review,
	.reviews-section .review-item {
		padding: 21px 20px 30px;
	}

	.reviews-section .item-review__head,
	.reviews-section .review-header {
		flex-direction: column;
		align-items: flex-start;
	}

	.review-form-modal .review-form-content {
		width: 100%;
		top: 20px;
		transform: translate(-50%, 0);
		padding-left: 20px;
		padding-right: 20px;
	}
}

@media (max-width: 500px) {
	.reviews-section .reviews-header {
		flex-direction: column;
		align-items: flex-start;
	}

	.reviews-section .reviews-title,
	.reviews-section .title .reviews-title {
		font-size: 24px;
	}

	.reviews-section .btn-simple,
	.reviews-section .btn.btn--black {
		width: 100%;
	}

	.review-form-modal .title-middle {
		font-size: 24px;
		line-height: 1.4;
	}

	.review-form-modal .item-form input,
	.review-form-modal .item-form textarea {
		font-size: 16px;
		height: 50px;
	}

	.review-form-modal .item-form textarea {
		height: 106px;
	}

	.review-form-modal .rating-input {
		flex-direction: column;
	}

	.review-form-modal .rating-input label {
		width: 100%;
		text-align: center;
	}
}
