/**
 * Frontend styles for MD Customer Reviews.
 *
 * @package MD_Customer_Reviews
 */

/* Core variables & styling tokens */
:root {
	--mdcr-gold: #F6B60B;
	--mdcr-verified: #2196F3;
	--mdcr-text-main: #333333;
	--mdcr-text-muted: #777777;
	--mdcr-bg-card: #ffffff;
	--mdcr-border: #f0f0f0;
	--mdcr-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Trigger Button */
.mdcr-trigger {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: var(--mdcr-bg-card);
	border: 1px solid #ddd;
	padding: 10px 16px;
	border-radius: 30px;
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	color: var(--mdcr-text-main);
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
	transition: var(--mdcr-transition);
}
.mdcr-trigger:hover,
.mdcr-trigger:focus-visible {
	border-color: #bbb;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	outline: none;
}
.mdcr-trigger-count {
	color: var(--mdcr-text-muted);
	font-weight: normal;
}

/* Stars Rating */
.mdcr-stars {
	vertical-align: middle;
	user-select: none;
}
.mdcr-star-svg {
	display: inline-block;
	vertical-align: top;
}

/* Scroll Lock safe technique */
body.mdcr-scroll-locked {
	position: fixed;
	width: 100%;
	overflow: hidden;
}

/* Popup Overlay */
.mdcr-popup-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.55);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 999999;
	backdrop-filter: blur(4px);
	padding: 20px;
	box-sizing: border-box;
}

/* Popup Card */
.mdcr-popup-card {
	background: var(--mdcr-bg-card);
	border-radius: 16px;
	width: 100%;
	max-width: 760px;
	height: 85vh;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
	position: relative;
	animation: mdcrScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Sticky Header */
.mdcr-popup-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 20px 24px;
	border-bottom: 1px solid var(--mdcr-border);
	background: var(--mdcr-bg-card);
	position: sticky;
	top: 0;
	z-index: 10;
}
.mdcr-header-left {
	display: flex;
	align-items: center;
	gap: 12px;
}
.mdcr-header-logo {
	width: 56px;
	height: 56px;
	object-fit: cover;
	border-radius: 8px;
	border: 1px solid var(--mdcr-border);
}
.mdcr-header-title {
	font-size: 18px;
	font-weight: 700;
	color: var(--mdcr-text-main);
	line-height: 1.2;
}
.mdcr-header-domain {
	font-size: 13px;
	color: var(--mdcr-text-muted);
	margin-top: 2px;
}
.mdcr-header-right {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	margin-right: 48px;
}
.mdcr-header-avg {
	font-size: 26px;
	font-weight: 800;
	color: var(--mdcr-text-main);
	line-height: 1;
}
.mdcr-header-stars {
	margin: 4px 0;
}
.mdcr-header-count {
	font-size: 12px;
	color: var(--mdcr-text-muted);
}
.mdcr-popup-close {
	position: absolute;
	top: 20px;
	right: 20px;
	width: 44px;
	height: 44px;
	border: none;
	background: transparent;
	font-size: 22px;
	cursor: pointer;
	color: var(--mdcr-text-muted);
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	transition: var(--mdcr-transition);
}
.mdcr-popup-close:hover {
	background: rgba(0, 0, 0, 0.05);
	color: var(--mdcr-text-main);
}

/* Scrollable Popup Body */
.mdcr-popup-body {
	flex: 1;
	overflow-y: auto;
	padding: 24px;
	-webkit-overflow-scrolling: touch;
}
.mdcr-reviews-list {
	display: flex;
	flex-direction: column;
	gap: 24px;
}

/* Single Review Card */
.mdcr-review-card {
	border-bottom: 1px solid var(--mdcr-border);
	padding-bottom: 24px;
}
.mdcr-review-card:last-child {
	border-bottom: none;
	padding-bottom: 0;
}
.mdcr-card-header {
	display: flex;
	align-items: center;
	position: relative;
	margin-bottom: 12px;
}
.mdcr-card-avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	font-weight: 700;
	font-size: 16px;
	margin-right: 12px;
	flex-shrink: 0;
}
.mdcr-card-author-meta {
	flex: 1;
}
.mdcr-card-author-name {
	font-weight: 700;
	color: var(--mdcr-text-main);
	font-size: 15px;
}
.mdcr-card-sub-meta {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: 2px;
}
.mdcr-card-stars {
	display: inline-flex;
	align-items: center;
}
.mdcr-card-dot {
	color: var(--mdcr-text-muted);
	font-size: 12px;
}
.mdcr-card-date {
	font-size: 12px;
	color: var(--mdcr-text-muted);
}
.mdcr-card-source {
	display: flex;
	align-items: center;
	justify-content: center;
	margin-left: 12px;
}
.mdcr-source-img {
	width: 18px;
	height: 18px;
	object-fit: contain;
}
.mdcr-source-txt {
	font-size: 11px;
	background: #f0f0f0;
	padding: 2px 6px;
	border-radius: 4px;
	color: var(--mdcr-text-muted);
}

/* Content & Clamp */
.mdcr-card-content {
	font-size: 14px;
	line-height: 1.5;
	color: #444;
}
.mdcr-card-text {
	display: -webkit-box;
	-webkit-line-clamp: 4;
	-webkit-box-orient: vertical;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: pre-line;
}
.mdcr-card-text.expanded {
	display: block;
	-webkit-line-clamp: unset;
	overflow: visible;
}
.mdcr-read-more-btn {
	background: none;
	border: none;
	color: var(--mdcr-verified);
	font-weight: 700;
	font-size: 13px;
	padding: 0;
	margin-top: 6px;
	cursor: pointer;
	font-family: inherit;
}
.mdcr-read-more-btn:hover {
	text-decoration: underline;
}

/* Gallery thumbnails */
.mdcr-card-gallery {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 14px;
}
.mdcr-photo-thumb {
	width: 96px;
	height: 96px;
	border-radius: 8px;
	overflow: hidden;
	display: block;
	position: relative;
	border: 1px solid var(--mdcr-border);
	transition: var(--mdcr-transition);
}
.mdcr-photo-thumb:hover {
	transform: scale(1.03);
	box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}
.mdcr-photo-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Lightbox Image Overlay */
.mdcr-lightbox-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: #111111;
	z-index: 1000000;
	display: flex;
	align-items: stretch;
	justify-content: stretch;
	animation: mdcrFadeIn 0.25s ease;
}
.mdcr-lightbox-close {
	position: fixed;
	top: 20px;
	right: 20px;
	width: 48px;
	height: 48px;
	border: 1px solid rgba(255, 255, 255, 0.25);
	/* Solid dark background so the button stays visible over both the dark
	   image area and the white review-info panel on the right. */
	background: rgba(0, 0, 0, 0.65);
	color: #fff;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1000010;
	transition: var(--mdcr-transition);
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
	backdrop-filter: blur(4px);
}
.mdcr-lightbox-close:hover,
.mdcr-lightbox-close:focus-visible {
	background: rgba(0, 0, 0, 0.85);
	transform: scale(1.05);
	outline: none;
}

/* Lightbox Card Structure */
.mdcr-lightbox-card {
	width: 100%;
	height: 100%;
	display: flex;
}
.mdcr-lightbox-media-side {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	background: #111;
}
.mdcr-lightbox-img-wrap {
	max-width: 90%;
	max-height: 90vh;
	display: flex;
	align-items: center;
	justify-content: center;
	user-select: none;
}
#mdcr-lightbox-img {
	max-width: 100%;
	max-height: 90vh;
	object-fit: contain;
	border-radius: 4px;
	box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.mdcr-lightbox-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 48px;
	height: 48px;
	border: none;
	background: rgba(255, 255, 255, 0.1);
	color: #fff;
	font-size: 28px;
	cursor: pointer;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	user-select: none;
	z-index: 1005;
	transition: var(--mdcr-transition);
}
.mdcr-lightbox-nav:hover {
	background: rgba(255, 255, 255, 0.2);
}
.mdcr-lightbox-prev {
	left: 20px;
}
.mdcr-lightbox-next {
	right: 20px;
}
.mdcr-lightbox-counter {
	position: absolute;
	bottom: 20px;
	left: 50%;
	transform: translateX(-50%);
	color: rgba(255,255,255,0.7);
	font-size: 14px;
	background: rgba(0,0,0,0.5);
	padding: 4px 12px;
	border-radius: 20px;
	user-select: none;
}

/* Lightbox panel info column */
.mdcr-lightbox-info-side {
	width: 340px;
	background: var(--mdcr-bg-card);
	border-left: 1px solid var(--mdcr-border);
	display: flex;
	flex-direction: column;
	flex-shrink: 0;
	z-index: 1002;
	overflow-y: auto;
	box-sizing: border-box;
}
.mdcr-lightbox-info-inner {
	padding: 24px;
}

/* Mobile responsive specifications */
@media (max-width: 768px) {
	.mdcr-popup-overlay {
		padding: 0;
	}
	.mdcr-popup-card {
		height: 100dvh;
		max-height: 100dvh;
		border-radius: 0;
		padding-top: env(safe-area-inset-top);
		padding-bottom: env(safe-area-inset-bottom);
	}
	.mdcr-popup-header {
		padding: 16px;
	}
	.mdcr-header-right {
		margin-right: 36px;
	}
	.mdcr-popup-close {
		top: 10px;
		right: 10px;
	}
	.mdcr-photo-thumb {
		width: 80px;
		height: 80px;
	}

	/* Lightbox Mobile layout */
	.mdcr-lightbox-card {
		flex-direction: column;
		overflow-y: auto;
	}
	.mdcr-lightbox-media-side {
		flex: none;
		height: 60vh;
		width: 100%;
	}
	.mdcr-lightbox-img-wrap {
		max-height: 50vh;
	}
	#mdcr-lightbox-img {
		max-height: 50vh;
	}
	.mdcr-lightbox-info-side {
		width: 100%;
		border-left: none;
		border-top: 1px solid var(--mdcr-border);
		flex: 1;
		overflow: visible;
	}
	.mdcr-lightbox-nav {
		width: 40px;
		height: 40px;
	}
	.mdcr-lightbox-prev {
		left: 10px;
	}
	.mdcr-lightbox-next {
		right: 10px;
	}
}

/* CSS Animations */
@keyframes mdcrScaleIn {
	from {
		opacity: 0;
		transform: scale(0.95);
	}
	to {
		opacity: 1;
		transform: scale(1);
	}
}
@keyframes mdcrFadeIn {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

/* Accessibility reduced motion */
@media (prefers-reduced-motion: reduce) {
	.mdcr-popup-card,
	.mdcr-lightbox-overlay,
	.mdcr-trigger,
	.mdcr-photo-thumb,
	.mdcr-lightbox-close,
	.mdcr-lightbox-nav {
		animation: none !important;
		transition: none !important;
		transform: none !important;
	}
}
