/**
 * Base Review Styles
 * Shared styles for all review display styles
 *
 * @package Wootimize_Review
 * @since 2.0.0
 */

/* ==========================================================================
   Reviews Wrapper Base
   ========================================================================== */

.wootimize-reviews-wrapper {
	/* margin controlled by dynamic CSS from settings */
}

/* Override theme styles on comment list items (high specificity to beat theme CSS) */
#reviews .commentlist li.review,
#reviews .commentlist li.comment {
	padding-left: 0 !important;
	padding-right: 0 !important;
	list-style: none !important;
}

/* ==========================================================================
   Review Item Base
   ========================================================================== */

.wootimize-review {
	background: #fff;
	border-style: solid;
	/* Default values - will be overridden by dynamic CSS from settings */
	border-width: 1px;
	border-color: #e0e0e0;
	border-radius: 8px;
	padding: 20px;
}

/* Default spacing between reviews - will be overridden by dynamic CSS from Item Margin settings */
.wootimize-reviews-wrapper .wootimize-review:not(:last-child),
#reviews .wootimize-reviews-wrapper .wootimize-review:not(:last-child),
#reviews .wootimize-reviews-container .wootimize-review:not(:last-child) {
	margin-bottom: 24px;
}

/* Hover effects controlled by dynamic CSS based on Appearance Settings */

/* ==========================================================================
   Review Header
   ========================================================================== */

.review__header {
	display: flex;
	gap: 12px;
	margin-bottom: 16px;
}

.review__avatar {
	border-radius: 50%;
	width: 48px;
	height: 48px;
	flex-shrink: 0;
	object-fit: cover;
}

/* Avatar with initials fallback */
.review__avatar--initials {
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	user-select: none;
}

.review__meta {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.review__author {
	font-weight: 600;
	font-size: 15px;
	color: #1e1e1e;
	margin: 0;
}

.review__date {
	font-size: 13px;
	color: #666;
}

/* ==========================================================================
   Star Rating
   ========================================================================== */

.wootimize-star-rating {
	display: flex;
	align-items: center;
	gap: 2px;
}

.wootimize-star-rating .star {
	color: #ffc107;
	font-size: 16px;
	line-height: 1;
}

.wootimize-star-rating.wootimize-star-rating-small .star {
	font-size: 14px;
}

.wootimize-star-rating.wootimize-star-rating-large .star {
	font-size: 24px;
}

.wootimize-star-rating .star-empty {
	color: #ddd;
}

.wootimize-star-rating .rating-count {
	margin-left: 6px;
	font-size: 13px;
	color: #666;
}

/* ==========================================================================
   Review Content
   ========================================================================== */

.review__content {
	margin-bottom: 16px;
	line-height: 1.6;
	color: #333;
	font-size: 14px;
}

.review__content p {
	margin: 0 0 8px 0;
}

.review__content p:last-child {
	margin-bottom: 0;
}

/* ==========================================================================
   Review Media
   ========================================================================== */

.review__media {
	margin-top: 16px;
}

.review-media-grid,
.review-media-list {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.review-media-item {
	position: relative;
	width: var(--review-images-width, 80px);
	height: var(--review-images-height, 80px);
	overflow: hidden;
	border-radius: 6px;
	cursor: pointer;
	flex-shrink: 0;
}

.review-media-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	display: block;
	transition: transform 0.3s ease;
}

.review-media-item:hover img {
	transform: scale(1.05);
}

.review-media-item.review-media-embed .play-icon {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	font-size: 24px;
	color: #fff;
	background: rgba(0, 0, 0, 0.7);
	width: 40px;
	height: 40px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	padding-left: 3px;
}

.review-media-video video {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 6px;
}

/* ==========================================================================
   Rating Summary Base
   ========================================================================== */

.wootimize-rating-summary {
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	padding: 24px;
	margin-bottom: 24px;
}

.rating-summary-left {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
}

.average-rating {
	font-size: 48px;
	font-weight: 700;
	color: #1e1e1e;
	line-height: 1;
}

.total-reviews {
	font-size: 14px;
	color: #666;
}

.rating-bar-row {
	display: flex;
	align-items: center;
	gap: 12px;
}

.rating-bar-label {
	font-size: 14px;
	color: #666;
	min-width: 40px;
}

.rating-bar {
	flex: 1;
	height: 8px;
	background: #e0e0e0;
	border-radius: 4px;
	overflow: hidden;
}

.rating-bar-fill {
	height: 100%;
	background: #ffc107;
	transition: width 0.3s ease;
}

.rating-bar-count {
	font-size: 14px;
	color: #666;
	min-width: 30px;
	text-align: right;
}

/* ==========================================================================
   Media Gallery Base
   ========================================================================== */

.wootimize-media-gallery {
	display: grid;
	gap: 12px;
	margin: 24px 0;
}

.wootimize-media-gallery .gallery-item {
	position: relative;
	aspect-ratio: 1;
	overflow: hidden;
	border-radius: 8px;
	cursor: pointer;
}

.wootimize-media-gallery .gallery-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.wootimize-media-gallery .gallery-item:hover img {
	transform: scale(1.1);
}

/* ==========================================================================
   No Reviews
   ========================================================================== */

.wootimize-no-reviews {
	text-align: center;
	padding: 40px;
	color: #666;
	font-size: 15px;
	background: #f9f9f9;
	border-radius: 8px;
}

/* ==========================================================================
   Responsive Base
   ========================================================================== */

@media screen and (max-width: 768px) {
	.wootimize-review {
		padding: 16px;
	}

	.review__header {
		gap: 10px;
		margin-bottom: 12px;
	}

	.review__avatar {
		width: 40px;
		height: 40px;
	}

	.review__author {
		font-size: 14px;
	}

	.review__date {
		font-size: 12px;
	}

	.review__content {
		font-size: 14px;
		margin-bottom: 12px;
	}

	.average-rating {
		font-size: 40px;
	}

	.wootimize-rating-summary {
		padding: 16px;
		margin-bottom: 16px;
	}

	.rating-bar-row {
		gap: 8px;
	}

	.rating-bar-label {
		font-size: 13px;
		min-width: 35px;
	}

	.rating-bar-count {
		font-size: 13px;
		min-width: 25px;
	}

	.wootimize-media-gallery {
		gap: 8px;
		margin: 16px 0;
	}
}

@media screen and (max-width: 480px) {
	.wootimize-review {
		padding: 12px;
	}

	.review__header {
		flex-wrap: wrap;
		gap: 8px;
	}

	.review__avatar {
		width: 36px;
		height: 36px;
	}

	.review__author {
		font-size: 13px;
	}

	.review__date {
		font-size: 11px;
	}

	.review__content {
		font-size: 13px;
		line-height: 1.5;
	}

	.wootimize-star-rating .star {
		font-size: 14px;
	}

	.wootimize-star-rating.wootimize-star-rating-small .star {
		font-size: 12px;
	}

	.wootimize-star-rating.wootimize-star-rating-large .star {
		font-size: 20px;
	}

	.review-media-grid,
	.review-media-list {
		gap: 6px;
	}

	.review-media-item {
		width: calc(var(--review-images-width, 80px) * 0.8);
		height: calc(var(--review-images-height, 80px) * 0.8);
	}

	.review-media-item.review-media-embed .play-icon {
		width: 32px;
		height: 32px;
		font-size: 18px;
	}

	.average-rating {
		font-size: 36px;
	}

	.total-reviews {
		font-size: 13px;
	}

	.wootimize-rating-summary {
		padding: 12px;
	}

	.rating-bar-label,
	.rating-bar-count {
		font-size: 12px;
	}

	.rating-bar {
		height: 6px;
	}

	.wootimize-no-reviews {
		padding: 24px 16px;
		font-size: 14px;
	}
}

/* Touch-friendly tap targets for mobile */
@media (hover: none) and (pointer: coarse) {
	.review-media-item {
		min-height: 44px;
		min-width: 44px;
	}

	.wootimize-media-gallery .gallery-item {
		min-height: 44px;
		min-width: 44px;
	}

	/* Remove hover effects on touch devices */
	.wootimize-review:hover {
		box-shadow: none;
	}

	.review-media-item:hover img,
	.wootimize-media-gallery .gallery-item:hover img {
		transform: none;
	}
}
