/* ==========================================================================
   Review Module — стили для системы комментариев
   ========================================================================== */

.review-container {
	max-width: 800px;
	margin: 0 auto;
}

/* --- Комментарий --- */
.review-item {
	padding: 15px;
	margin-bottom: 10px;
	background: #f9f9f9;
	border-radius: 4px;
	border: 1px solid #eee;
}

/* Вложенность */
.review-item[data-depth="1"] {
	margin-left: 30px;
}
.review-item[data-depth="2"],
.review-item[data-depth="3"] {
	margin-left: 60px;
}

/* --- Мета (автор + дата) --- */
.review-meta {
	margin-bottom: 8px;
	color: #666;
	font-size: 0.9em;
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.review-meta .review-avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	object-fit: cover;
}

.review-meta .review-avatar-placeholder {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: #ccc;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	font-size: 14px;
	font-weight: bold;
}

.review-author {
	font-weight: bold;
	color: #333;
}

.review-date {
	font-size: 0.85em;
	color: #999;
}

/* --- Текст комментария --- */
.review-text {
	padding: 10px;
	background: #fff;
	border-radius: 3px;
	line-height: 1.5;
	word-break: break-word;
}

.review-text a {
	color: #2196F3;
	text-decoration: underline;
}

/* --- Действия --- */
.review-actions {
	margin-top: 8px;
	display: flex;
	gap: 8px;
	align-items: center;
	flex-wrap: wrap;
}

/* --- Кнопки голосования --- */
.review-vote-btn {
	cursor: pointer;
	border: none;
	background: none;
	padding: 4px 8px;
	font-size: 0.9em;
	color: #888;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	border-radius: 3px;
	transition: color 0.2s, background 0.2s;
}

.review-vote-btn:hover {
	background: #eee;
}

.review-vote-btn--active[data-vote="1"] {
	color: #4CAF50;
	font-weight: bold;
}

.review-vote-btn--active[data-vote="-1"] {
	color: #f44336;
	font-weight: bold;
}

/* --- Кнопки Reply / Delete --- */
.review-action-btn {
	cursor: pointer;
	border: none;
	background: none;
	padding: 4px 8px;
	font-size: 0.85em;
	color: #888;
	border-radius: 3px;
	transition: color 0.2s, background 0.2s;
}

.review-action-btn:hover {
	background: #eee;
	color: #333;
}

.review-delete-btn:hover {
	color: #f44336;
}

/* --- Бейдж "Guest" --- */
.review-guest-badge {
	background: #eee;
	padding: 2px 6px;
	border-radius: 3px;
	font-size: 0.8em;
	color: #999;
}

/* --- Форма --- */
.review-form-wrapper {
	max-width: 800px;
	margin: 20px auto 10px;
	padding: 15px;
	background: #f9f9f9;
	border-radius: 4px;
	border: 1px solid #eee;
}

.review-form-wrapper h3 {
	margin-top: 0;
	margin-bottom: 10px;
}

/* --- Тулбар форматирования --- */
.review-toolbar {
	margin-bottom: 5px;
	display: flex;
	gap: 4px;
}

.review-toolbar-btn {
	padding: 4px 10px;
	cursor: pointer;
	border: 1px solid #ccc;
	background: #fff;
	border-radius: 3px;
	font-size: 0.9em;
	transition: background 0.2s;
}

.review-toolbar-btn:hover {
	background: #eee;
}

/* --- Textarea --- */
.review-textarea {
	width: 100%;
	padding: 10px;
	border: 1px solid #ccc;
	border-radius: 3px;
	resize: vertical;
	font-family: inherit;
	font-size: 0.95em;
	box-sizing: border-box;
	min-height: 80px;
}

.review-textarea:focus {
	outline: none;
	border-color: #2196F3;
}

/* --- Кнопка отправки --- */
.review-submit-btn {
	margin-top: 8px;
	padding: 8px 20px;
	cursor: pointer;
	background: #2196F3;
	color: #fff;
	border: none;
	border-radius: 3px;
	font-size: 0.95em;
	transition: background 0.2s;
}

.review-submit-btn:hover {
	background: #1976D2;
}

.review-submit-btn:disabled {
	background: #ccc;
	cursor: not-allowed;
}

/* --- Инпуты гостя --- */
.review-guest-fields {
	margin-bottom: 10px;
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.review-input {
	padding: 8px;
	border: 1px solid #ccc;
	border-radius: 3px;
	max-width: 300px;
	width: 100%;
	font-size: 0.95em;
	box-sizing: border-box;
}

.review-input:focus {
	outline: none;
	border-color: #2196F3;
}

/* --- Капча --- */
.review-captcha {
	margin-bottom: 10px;
}

/* --- Загрузчик --- */
.review-loader {
	text-align: center;
	padding: 20px;
	color: #999;
}

/* --- Кнопка "Load more" --- */
.review-load-more {
	display: block;
	margin: 10px auto;
	padding: 8px 20px;
	cursor: pointer;
	background: #fff;
	border: 1px solid #ccc;
	border-radius: 3px;
	font-size: 0.95em;
	transition: background 0.2s;
}

.review-load-more:hover {
	background: #f0f0f0;
}

/* Скрытая кнопка — сохраняет место в DOM для IntersectionObserver */
.review-load-more--hidden {
	visibility: hidden;
	height: 1px;
	padding: 0;
	margin: 0;
	border: none;
	overflow: hidden;
}

/* --- Инлайн-форма ответа --- */
.review-reply-form {
	margin-top: 10px;
	padding: 10px;
	background: #f0f0f0;
	border-radius: 4px;
	border: 1px solid #ddd;
}

.review-reply-form .review-textarea {
	min-height: 60px;
}

.review-reply-form .review-reply-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 5px;
	font-size: 0.85em;
	color: #666;
}

/* Гостевые поля в inline форме */
.review-reply-form .review-guest-fields {
	margin-bottom: 5px;
}
.review-reply-form .review-guest-fields .review-input {
	padding: 4px 8px;
	font-size: 0.9em;
	max-width: 48%;
}

.review-reply-cancel {
	cursor: pointer;
	border: none;
	background: none;
	color: #888;
	font-size: 0.85em;
	padding: 2px 6px;
}

.review-reply-cancel:hover {
	color: #f44336;
}

/* --- Пустое состояние --- */
.review-empty {
	text-align: center;
	padding: 30px;
	color: #999;
	font-size: 0.95em;
}

/* --- Комментарий на модерации (видно только admin) --- */
.review-item--pending {
	border-left: 3px solid #ffe082;
	background: #fffde7;
}

.review-pending-badge {
	background: #fff3e0;
	color: #e65100;
	padding: 2px 8px;
	border-radius: 3px;
	font-size: 0.8em;
	font-weight: bold;
}

/* --- Кнопка Edit --- */
.review-edit-btn:hover {
	color: #2196F3;
}

/* --- Бейдж "(ред.)" --- */
.review-edited-badge {
	display: inline-block;
	font-size: 0.8em;
	color: #999;
	font-style: italic;
	margin-top: 4px;
}

/* --- Форма редактирования --- */
.review-edit-form {
	margin-top: 8px;
	padding: 10px;
	background: #f5f5f5;
	border-radius: 4px;
	border: 1px solid #ddd;
}

.review-edit-form .review-edit-textarea {
	min-height: 80px;
}

.review-edit-buttons {
	margin-top: 8px;
	display: flex;
	gap: 8px;
	align-items: center;
}

/* --- Кнопка Toggle (N ответов / Свернуть) --- */
.review-toggle-btn {
	color: #2196F3;
	font-weight: 500;
}

.review-toggle-btn:hover {
	color: #1565C0;
	background: #e3f2fd;
}

/* --- Бейдж новых ответов на кнопке toggle --- */
.review-new-replies-badge {
	display: inline-block;
	background: #ff5722;
	color: #fff;
	padding: 1px 6px;
	border-radius: 10px;
	font-size: 0.75em;
	font-weight: bold;
	margin-left: 4px;
	vertical-align: middle;
}

/* --- Плашка «N новых комментариев» --- */
.review-new-banner {
	background: #e3f2fd;
	border: 1px solid #90caf9;
	border-radius: 4px;
	padding: 10px 15px;
	margin-bottom: 10px;
	text-align: center;
	font-size: 0.95em;
	color: #1565C0;
}

.review-new-banner-btn {
	cursor: pointer;
	border: 1px solid #90caf9;
	background: #fff;
	color: #2196F3;
	padding: 4px 12px;
	border-radius: 3px;
	font-size: 0.9em;
	margin-left: 8px;
	transition: background 0.2s;
}

.review-new-banner-btn:hover {
	background: #bbdefb;
}

/* --- Картинка в комментарии --- */
.review-image {
	margin-top: 8px;
}

.review-image img {
	max-width: 100%;
	max-height: 400px;
	border-radius: 4px;
	border: 1px solid #eee;
	cursor: pointer;
}

.review-image img:hover {
	border-color: #ccc;
}

/* --- Кнопка прикрепления фото --- */
.review-attach-btn,
.review-attach-btn-inline {
	cursor: pointer;
	border: 1px solid #ccc;
	background: #fff;
	padding: 4px 10px;
	border-radius: 3px;
	font-size: 1.1em;
	transition: background 0.2s;
}

.review-attach-btn:hover,
.review-attach-btn-inline:hover {
	background: #f0f0f0;
}

/* --- Контейнер прикрепления (кнопка + превью) --- */
.review-attach-inline {
	margin-top: 6px;
	display: flex;
	align-items: flex-start;
	gap: 10px;
	flex-wrap: wrap;
}

/* --- Превью прикреплённого файла --- */
.review-attach-preview {
	display: inline-block;
}

.review-attach-preview-item {
	display: inline-block;
	position: relative;
}

.review-attach-preview-item img {
	max-width: 120px;
	max-height: 80px;
	border-radius: 4px;
	border: 1px solid #ddd;
	object-fit: cover;
}

.review-attach-remove {
	position: absolute;
	top: -6px;
	right: -6px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	border: none;
	background: #f44336;
	color: #fff;
	font-size: 14px;
	line-height: 18px;
	text-align: center;
	cursor: pointer;
	padding: 0;
}

/* ==========================================================================
   Skeleton Preloader — анимированные плашки при загрузке
   ========================================================================== */

@keyframes review-skeleton-pulse {
	0% { opacity: 1; }
	50% { opacity: 0.4; }
	100% { opacity: 1; }
}

.review-skeleton {
	padding: 15px;
	margin-bottom: 10px;
	background: #f9f9f9;
	border-radius: 4px;
	border: 1px solid #eee;
	animation: review-skeleton-pulse 1.5s ease-in-out infinite;
}

.review-skeleton__meta {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 12px;
}

.review-skeleton__avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: #ddd;
	flex-shrink: 0;
}

.review-skeleton__name {
	width: 100px;
	height: 14px;
	border-radius: 3px;
	background: #ddd;
}

.review-skeleton__date {
	width: 70px;
	height: 12px;
	border-radius: 3px;
	background: #e8e8e8;
}

.review-skeleton__text {
	padding: 10px;
	background: #fff;
	border-radius: 3px;
	margin-bottom: 10px;
}

.review-skeleton__line {
	height: 12px;
	border-radius: 3px;
	background: #e8e8e8;
	margin-bottom: 8px;
}

.review-skeleton__line:last-child {
	margin-bottom: 0;
}

.review-skeleton__actions {
	display: flex;
	gap: 10px;
}

.review-skeleton__btn {
	width: 50px;
	height: 20px;
	border-radius: 3px;
	background: #eee;
}

/* ==========================================================================
   Анимации
   ========================================================================== */

/* Flash-анимация при обновлении счётчика */
.review-count-updated {
	animation: count-flash 0.6s ease-in-out;
}
@keyframes count-flash {
	0%, 100% { background: transparent; }
	50% { background: #ffd700; color: #333; }
}

/* --- Заблокированные поля гостя (уже отправлял) --- */
.review-guest-locked {
	font-size: 0.9em;
	color: #666;
	padding: 4px 0;
}

/* --- Кнопка Approve (admin) --- */
.review-approve-btn {
	color: #4CAF50;
	font-weight: 500;
}

.review-approve-btn:hover {
	color: #2E7D32;
	background: #e8f5e9;
}

/* Fade-in для новых комментариев */
.review-item-new {
	animation: review-fade-in 0.6s ease-in;
}
@keyframes review-fade-in {
	from { opacity: 0; transform: translateY(-10px); background: #fffde7; }
	to { opacity: 1; transform: translateY(0); background: #f9f9f9; }
}
