/**
 * Rich Reviews - Frontend styles.
 *
 * Styles for review upload form, photo gallery, and lightbox.
 *
 * @package Rich_Reviews_For_WooCommerce
 */

/* ==========================================================================
   Upload Section
   ========================================================================== */

.rr-upload-section {
	margin: 1.5em 0;
}

/* Toggle button */
.rr-upload-toggle {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	padding: 12px 16px;
	border: 1px solid #dcdcde;
	border-radius: 8px;
	background: #fff;
	cursor: pointer;
	font-size: 0.95em;
	color: #1d2327;
	transition: border-color 0.2s, background-color 0.2s;
}

.rr-upload-toggle:hover {
	border-color: #8c8f94;
	background: #f9f9f9;
}

.rr-upload-toggle[aria-expanded="true"] {
	border-color: #8c8f94;
	border-radius: 8px 8px 0 0;
	border-bottom-color: #e0e0e0;
}

.rr-toggle-icons {
	display: flex;
	align-items: center;
	gap: 4px;
	color: #50575e;
}

.rr-toggle-icon {
	display: block;
}

.rr-toggle-text {
	font-weight: 600;
}

.rr-toggle-hint {
	font-weight: 400;
	color: #787c82;
	font-size: 0.85em;
}

.rr-toggle-chevron {
	margin-left: auto;
	color: #787c82;
	transition: transform 0.25s;
}

.rr-upload-toggle[aria-expanded="true"] .rr-toggle-chevron {
	transform: rotate(180deg);
}

/* Collapsible panel */
.rr-upload-panel {
	display: none;
	padding: 16px;
	border: 1px solid #8c8f94;
	border-top: none;
	border-radius: 0 0 8px 8px;
}

.rr-upload-panel.rr-panel-open {
	display: block;
}

.rr-upload-label {
	display: block;
	font-weight: 600;
	margin-bottom: 0.5em;
	font-size: 0.95em;
}

.rr-upload-optional {
	font-weight: 400;
	color: #666;
	font-size: 0.85em;
}

/* SVG dropzone icons */
.rr-dropzone-icon-svg {
	color: #50575e;
}

/* ==========================================================================
   Dropzone
   ========================================================================== */

.rr-dropzone {
	border: 2px dashed #c3c4c7;
	border-radius: 8px;
	padding: 2em 1.5em;
	text-align: center;
	cursor: pointer;
	transition: border-color 0.2s, background-color 0.2s;
	background-color: #fafafa;
}

.rr-dropzone:hover,
.rr-dropzone:focus {
	border-color: #2271b1;
	background-color: #f0f6fc;
	outline: none;
}

.rr-dropzone--active {
	border-color: #2271b1;
	background-color: #e7f3ff;
	border-style: solid;
}

.rr-dropzone--full {
	opacity: 0.5;
	pointer-events: none;
}

.rr-dropzone-content {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.4em;
}

.rr-dropzone-text {
	font-size: 0.95em;
	color: #1d2327;
}

.rr-dropzone-hint {
	font-size: 0.8em;
	color: #787c82;
}

.rr-photo-input {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ==========================================================================
   Preview Grid
   ========================================================================== */

.rr-preview-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 1em;
}

.rr-preview-grid:empty {
	display: none;
}

.rr-preview-item {
	position: relative;
	width: 80px;
	height: 80px;
	border-radius: 6px;
	overflow: hidden;
	border: 2px solid #dcdcde;
	background: #f6f7f7;
}

.rr-preview-item--uploading {
	opacity: 0.7;
}

.rr-preview-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.rr-preview-spinner {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 20px;
	height: 20px;
	margin: -10px 0 0 -10px;
	border: 2px solid rgba(0, 0, 0, 0.15);
	border-top-color: #2271b1;
	border-radius: 50%;
	animation: rr-spin 0.7s linear infinite;
}

@keyframes rr-spin {
	to {
		transform: rotate(360deg);
	}
}

.rr-preview-remove {
	position: absolute;
	top: 2px;
	right: 2px;
	width: 20px;
	height: 20px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.6);
	color: #fff;
	font-size: 14px;
	line-height: 20px;
	text-align: center;
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.2s;
}

.rr-preview-item:hover .rr-preview-remove {
	opacity: 1;
}

/* ==========================================================================
   Upload Errors
   ========================================================================== */

.rr-upload-errors {
	margin-top: 0.75em;
}

.rr-upload-error {
	color: #d63638;
	font-size: 0.85em;
	margin: 0.3em 0;
	padding: 0.4em 0.8em;
	background: #fcf0f1;
	border-radius: 4px;
	border-left: 3px solid #d63638;
}

/* ==========================================================================
   Review Gallery (display)
   ========================================================================== */

.rr-review-gallery {
	margin-top: 1em;
}

.rr-gallery-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.rr-gallery-item {
	display: block;
	width: 80px;
	height: 80px;
	border-radius: 6px;
	overflow: hidden;
	border: 1px solid #dcdcde;
	transition: transform 0.2s, box-shadow 0.2s;
}

.rr-gallery-item:hover,
.rr-gallery-item:focus {
	transform: scale(1.05);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	outline: none;
}

.rr-gallery-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* ==========================================================================
   Media Pending Notice
   ========================================================================== */

.rr-media-pending {
	margin-top: 0.75em;
	padding: 0.6em 1em;
	background: #fcf9e8;
	border-left: 3px solid #dba617;
	border-radius: 4px;
	font-size: 0.85em;
	color: #6e4e00;
}

.rr-media-pending p {
	margin: 0;
}

/* ==========================================================================
   Lightbox
   ========================================================================== */

.rr-lightbox-open {
	overflow: hidden;
}

.rr-lightbox-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.85);
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
}

.rr-lightbox-content {
	max-width: 90vw;
	max-height: 85vh;
}

.rr-lightbox-img {
	max-width: 90vw;
	max-height: 85vh;
	object-fit: contain;
	border-radius: 4px;
}

.rr-lightbox-close {
	position: absolute;
	top: 16px;
	right: 16px;
	width: 40px;
	height: 40px;
	border: none;
	background: rgba(255, 255, 255, 0.15);
	color: #fff;
	font-size: 28px;
	line-height: 40px;
	text-align: center;
	border-radius: 50%;
	cursor: pointer;
	transition: background-color 0.2s;
}

.rr-lightbox-close:hover {
	background: rgba(255, 255, 255, 0.3);
}

.rr-lightbox-prev,
.rr-lightbox-next {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 44px;
	height: 44px;
	border: none;
	background: rgba(255, 255, 255, 0.15);
	color: #fff;
	font-size: 28px;
	line-height: 44px;
	text-align: center;
	border-radius: 50%;
	cursor: pointer;
	transition: background-color 0.2s;
}

.rr-lightbox-prev {
	left: 16px;
}

.rr-lightbox-next {
	right: 16px;
}

.rr-lightbox-prev:hover,
.rr-lightbox-next:hover {
	background: rgba(255, 255, 255, 0.3);
}

/* ==========================================================================
   Uploading state for submit button
   ========================================================================== */

.rr-uploading {
	opacity: 0.6;
	cursor: wait !important;
}

/* ==========================================================================
   Video Upload Section
   ========================================================================== */

.rr-video-upload-section {
	margin-top: 1.25em;
}

.rr-video-dropzone {
	border: 2px dashed #c3c4c7;
	border-radius: 8px;
	padding: 1.5em 1.25em;
	text-align: center;
	cursor: pointer;
	transition: border-color 0.2s, background-color 0.2s;
	background-color: #fafafa;
}

.rr-video-dropzone:hover,
.rr-video-dropzone:focus {
	border-color: #2271b1;
	background-color: #f0f6fc;
	outline: none;
}

.rr-video-preview {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 0.75em 1em;
	border: 1px solid #dcdcde;
	border-radius: 8px;
	background: #f6f7f7;
	position: relative;
}

.rr-video-preview--ready {
	border-color: #00a32a;
	background: #f0faf0;
}

.rr-video-preview-info {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 1;
	min-width: 0;
}

.rr-video-preview-icon {
	font-size: 1.5em;
	flex-shrink: 0;
}

.rr-video-preview-name {
	font-size: 0.9em;
	font-weight: 500;
	color: #1d2327;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.rr-video-preview-size {
	font-size: 0.8em;
	color: #787c82;
	flex-shrink: 0;
}

.rr-video-progress {
	width: 100%;
	height: 4px;
	background: #dcdcde;
	border-radius: 2px;
	overflow: hidden;
	position: absolute;
	bottom: 0;
	left: 0;
	border-radius: 0 0 8px 8px;
}

.rr-video-progress-bar {
	height: 100%;
	background: #2271b1;
	border-radius: 2px;
	transition: width 0.2s;
}

.rr-video-remove {
	width: 28px;
	height: 28px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.08);
	color: #50575e;
	font-size: 16px;
	line-height: 28px;
	text-align: center;
	cursor: pointer;
	flex-shrink: 0;
	transition: background-color 0.2s, color 0.2s;
}

.rr-video-remove:hover {
	background: rgba(214, 54, 56, 0.1);
	color: #d63638;
}

/* ==========================================================================
   Video Embed (display in reviews)
   ========================================================================== */

.rr-review-video {
	margin-top: 1em;
}

.rr-video-embed-wrap {
	position: relative;
	padding-bottom: 56.25%; /* 16:9 */
	height: 0;
	overflow: hidden;
	border-radius: 8px;
	background: #000;
	max-width: 560px;
}

.rr-video-iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border: 0;
	border-radius: 8px;
}

.rr-video-processing {
	margin-top: 0.75em;
	padding: 0.6em 1em;
	background: #f0f6fc;
	border-left: 3px solid #2271b1;
	border-radius: 4px;
	font-size: 0.85em;
	color: #135e96;
}

.rr-video-processing p {
	margin: 0;
}

.rr-video-error {
	margin-top: 0.75em;
	padding: 0.6em 1em;
	background: #fcf0f1;
	border-left: 3px solid #d63638;
	border-radius: 4px;
	font-size: 0.85em;
	color: #8a1116;
}

.rr-video-error p {
	margin: 0;
}

/* ==========================================================================
   Media Slider (Amazon-style carousel above reviews)
   ========================================================================== */

.rr-media-slider {
	margin-bottom: 2em;
	padding-bottom: 1.5em;
	border-bottom: 1px solid #e0e0e0;
}

.rr-slider-title {
	font-size: 1.1em;
	font-weight: 600;
	margin: 0 0 0.75em;
	color: #1d2327;
}

.rr-slider-viewport {
	position: relative;
}

.rr-slider-track {
	display: flex;
	gap: 16px;
	overflow-x: auto;
	scroll-behavior: smooth;
	scrollbar-width: none;
	-ms-overflow-style: none;
	padding: 4px 0;
}

.rr-slider-track::-webkit-scrollbar {
	display: none;
}

.rr-slider-slide {
	flex: 0 0 auto;
	width: 180px;
	cursor: pointer;
}

.rr-slide-media {
	width: 180px;
	height: 180px;
	border-radius: 8px;
	overflow: hidden;
	background: #f6f7f7;
	border: 1px solid #dcdcde;
}

.rr-slide-photo-link {
	display: block;
	width: 100%;
	height: 100%;
}

.rr-slide-photo-link img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.2s;
}

.rr-slide-photo-link:hover img {
	transform: scale(1.05);
}

.rr-slide-video-wrap {
	position: relative;
	width: 100%;
	height: 100%;
	background: #000;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}

.rr-slide-video-wrap iframe {
	width: 100%;
	height: 100%;
	border: 0;
}

.rr-slide-video-play {
	width: 50px;
	height: 50px;
	background: rgba(255, 255, 255, 0.9);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.2s;
}

.rr-slide-video-wrap:hover .rr-slide-video-play {
	transform: scale(1.1);
}

.rr-play-icon {
	font-size: 22px;
	color: #1d2327;
	margin-left: 3px;
}

/* Slide info (reviewer + stars) */
.rr-slide-info {
	padding: 8px 2px 0;
}

.rr-slide-rating {
	font-size: 13px;
	line-height: 1;
	margin-bottom: 4px;
}

.rr-slide-rating .star-full {
	color: #ffb900;
}

.rr-slide-rating .star-empty {
	color: #ccc;
}

.rr-slide-excerpt {
	margin: 0;
	font-size: 0.8em;
	color: #50575e;
	line-height: 1.4;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.rr-slide-author {
	font-size: 0.75em;
	color: #787c82;
	font-style: italic;
}

/* Slider navigation arrows */
.rr-slider-arrow {
	position: absolute;
	top: 90px;
	transform: translateY(-50%);
	width: 36px;
	height: 36px;
	border: 1px solid #dcdcde;
	background: rgba(255, 255, 255, 0.95);
	color: #1d2327;
	font-size: 22px;
	line-height: 34px;
	text-align: center;
	border-radius: 50%;
	cursor: pointer;
	z-index: 2;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
	transition: background-color 0.2s, box-shadow 0.2s;
}

.rr-slider-arrow:hover {
	background: #fff;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.rr-slider-arrow--prev {
	left: -12px;
}

.rr-slider-arrow--next {
	right: -12px;
}

.rr-slider-arrow:disabled {
	opacity: 0.3;
	cursor: default;
}

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

@media (max-width: 480px) {
	.rr-dropzone {
		padding: 1.5em 1em;
	}

	.rr-preview-item,
	.rr-gallery-item {
		width: 64px;
		height: 64px;
	}

	.rr-lightbox-prev,
	.rr-lightbox-next {
		width: 36px;
		height: 36px;
		font-size: 22px;
		line-height: 36px;
	}

	.rr-video-dropzone {
		padding: 1em 0.75em;
	}

	.rr-video-embed-wrap {
		max-width: 100%;
	}

	.rr-slider-slide {
		width: 140px;
	}

	.rr-slide-media {
		width: 140px;
		height: 140px;
	}

	.rr-slider-arrow {
		top: 70px;
		width: 30px;
		height: 30px;
		font-size: 18px;
		line-height: 28px;
	}

	.rr-slider-arrow--prev {
		left: -6px;
	}

	.rr-slider-arrow--next {
		right: -6px;
	}
}
