@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

/* CSS Variables for Premium Styling */
:root {
	--cr-font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	--cr-color-primary: #2563eb;
	--cr-color-primary-hover: #1d4ed8;
	--cr-color-star: #ffb600;
	--cr-color-star-empty: #e2e8f0;
	--cr-color-text-main: #1e293b;
	--cr-color-text-muted: #64748b;
	--cr-color-bg-card: #ffffff;
	--cr-color-bg-widget: #f8fafc;
	--cr-color-border: #e2e8f0;
	--cr-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
	--cr-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
	--cr-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
	--cr-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
	--cr-border-radius-sm: 8px;
	--cr-border-radius-md: 12px;
	--cr-border-radius-lg: 20px;
}

/* Core Widget Wrapper */
.cr-widget-wrapper {
	font-family: var(--cr-font-family);
	color: var(--cr-color-text-main);
	background: var(--cr-color-bg-widget);
	border-radius: var(--cr-border-radius-lg);
	padding: 32px;
	margin: 20px 0;
	border: 1px solid var(--cr-color-border);
	box-shadow: var(--cr-shadow-sm);
	position: relative;
	box-sizing: border-box;
}

.cr-widget-wrapper * {
	box-sizing: border-box;
}

.cr-widget-container {
	display: flex;
	gap: 32px;
	align-items: stretch;
}

/* Left Profile / Summary Card */
.cr-summary-card {
	flex: 0 0 300px;
	background: var(--cr-color-bg-card);
	border: 1px solid var(--cr-color-border);
	border-radius: var(--cr-border-radius-md);
	padding: 28px;
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	box-shadow: var(--cr-shadow-md);
	justify-content: center;
}

.cr-business-info {
	margin-bottom: 16px;
	padding-bottom: 16px;
	border-bottom: 2px solid var(--cr-color-border);
	width: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.cr-business-logo {
	width: 72px;
	height: 72px;
	object-fit: contain;
	border-radius: var(--cr-border-radius-sm);
	margin-bottom: 12px;
	box-shadow: var(--cr-shadow-sm);
}

.cr-business-logo-placeholder {
	width: 72px;
	height: 72px;
	border-radius: var(--cr-border-radius-sm);
	background: linear-gradient(135deg, #eff6ff, #dbeafe);
	color: var(--cr-color-primary);
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 12px;
	box-shadow: var(--cr-shadow-sm);
}

.cr-business-title {
	font-size: 18px;
	font-weight: 700;
	margin: 0;
	line-height: 1.4;
	color: var(--cr-color-text-main);
}

.cr-rating-summary {
	margin-bottom: 24px;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.cr-avg-stars-wrapper {
	margin-bottom: 8px;
}

.cr-avg-stars-wrapper .cr-star {
	font-size: 24px;
	margin: 0 2px;
}

.cr-rating-meta {
	display: flex;
	align-items: center;
	gap: 8px;
}

.cr-rating-avg-text {
	font-size: 20px;
	font-weight: 700;
	color: var(--cr-color-text-main);
}

.cr-total-reviews-count {
	font-size: 14px;
	color: var(--cr-color-text-muted);
}

.cr-write-review-btn {
	width: 100%;
	background: var(--cr-color-bg-card);
	color: var(--cr-color-text-main);
	border: 1px solid var(--cr-color-border);
	padding: 12px 24px;
	font-size: 15px;
	font-weight: 600;
	border-radius: var(--cr-border-radius-sm);
	cursor: pointer;
	transition: all 0.2s ease;
	display: inline-flex;
	justify-content: center;
	align-items: center;
	box-shadow: var(--cr-shadow-sm);
}

.cr-write-review-btn:hover {
	background: var(--cr-color-text-main);
	color: #ffffff;
	border-color: var(--cr-color-text-main);
	transform: translateY(-2px);
	box-shadow: var(--cr-shadow-md);
}

.cr-write-review-btn:active {
	transform: translateY(0);
}

/* Right Reviews Column & Slider */
.cr-reviews-slider-column {
	flex: 1;
	min-width: 0; /* Prevents flex items from breaking layout overflow */
	display: flex;
	flex-direction: column;
	justify-content: center;
	position: relative;
}

.cr-reviews-carousel {
	position: relative;
	width: 100%;
	overflow: visible;
}

.cr-carousel-track-wrapper {
	overflow: hidden;
	width: 100%;
	border-radius: var(--cr-border-radius-md);
}

.cr-carousel-track {
	display: flex;
	transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
	will-change: transform;
}

.cr-carousel-slide {
	flex: 0 0 100%; /* Show one slide at a time by default */
	width: 100%;
	padding: 4px; /* Give room for card box shadows */
}

/* Responsive carousel layouts */
@media (min-width: 900px) {
	.cr-carousel-slide {
		flex: 0 0 50%; /* Show two slides at a time on desktop */
	}
}

/* Review Card Styling */
.cr-review-card {
	background: var(--cr-color-bg-card);
	border: 1px solid var(--cr-color-border);
	border-radius: var(--cr-border-radius-md);
	padding: 24px;
	height: 100%;
	display: flex;
	flex-direction: column;
	box-shadow: var(--cr-shadow-md);
	transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cr-review-card:hover {
	transform: translateY(-4px);
	box-shadow: var(--cr-shadow-lg);
}

.cr-review-header {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 12px;
	position: relative;
}

.cr-reviewer-avatar {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: linear-gradient(135deg, #3b82f6, #6366f1);
	color: #ffffff;
	font-weight: 600;
	font-size: 15px;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: var(--cr-shadow-sm);
	letter-spacing: 0.5px;
}

/* Assign dynamic gradients via nth-child to give list life */
.cr-carousel-slide:nth-child(2n) .cr-reviewer-avatar {
	background: linear-gradient(135deg, #10b981, #059669);
}
.cr-carousel-slide:nth-child(3n) .cr-reviewer-avatar {
	background: linear-gradient(135deg, #f59e0b, #d97706);
}
.cr-carousel-slide:nth-child(4n) .cr-reviewer-avatar {
	background: linear-gradient(135deg, #ec4899, #db2777);
}

.cr-reviewer-details {
	flex: 1;
	min-width: 0;
}

.cr-reviewer-name {
	font-size: 15px;
	font-weight: 600;
	margin: 0 0 2px 0;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.cr-review-date {
	font-size: 12px;
	color: var(--cr-color-text-muted);
	display: block;
}

.cr-provider-logo {
	color: #4285F4;
	display: flex;
	align-items: center;
}

.cr-review-rating-row {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 12px;
}

.cr-review-stars {
	display: inline-flex;
}

.cr-star {
	color: var(--cr-color-star-empty);
	font-size: 18px;
}

.cr-star.full {
	color: var(--cr-color-star);
}

.cr-star.half {
	position: relative;
	color: var(--cr-color-star-empty);
}

.cr-star.half::before {
	content: '★';
	position: absolute;
	left: 0;
	top: 0;
	width: 50%;
	overflow: hidden;
	color: var(--cr-color-star);
}

.cr-verified-badge {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 11px;
	font-weight: 500;
	color: var(--cr-color-primary);
	background: #eff6ff;
	padding: 2px 8px;
	border-radius: 20px;
}

.cr-verified-badge svg {
	fill: var(--cr-color-primary);
}

.cr-review-body {
	flex: 1;
}

.cr-review-text {
	font-size: 14px;
	line-height: 1.6;
	color: #334155;
	margin: 0;
	word-break: break-word;
}

/* Slider Controls Styles */
.cr-carousel-btn {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: var(--cr-color-bg-card);
	border: 1px solid var(--cr-color-border);
	color: var(--cr-color-text-main);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: var(--cr-shadow-md);
	transition: all 0.2s ease;
	z-index: 10;
}

.cr-carousel-btn:hover {
	background: var(--cr-color-primary);
	color: #ffffff;
	border-color: var(--cr-color-primary);
	box-shadow: var(--cr-shadow-lg);
}

.cr-carousel-btn:focus {
	outline: none;
}

.cr-btn-prev {
	left: -20px;
}

.cr-btn-next {
	right: -20px;
}

.cr-carousel-dots {
	display: flex;
	justify-content: center;
	gap: 8px;
	margin-top: 24px;
}

.cr-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--cr-color-star-empty);
	border: none;
	padding: 0;
	cursor: pointer;
	transition: all 0.2s ease;
}

.cr-dot.active {
	background: var(--cr-color-primary);
	width: 24px;
	border-radius: 4px;
}

.cr-no-reviews {
	text-align: center;
	padding: 40px;
	background: var(--cr-color-bg-card);
	border: 1px dashed var(--cr-color-border);
	border-radius: var(--cr-border-radius-md);
	color: var(--cr-color-text-muted);
}

/* Modal Popup Styles */
.cr-modal-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(15, 23, 42, 0.4);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 999999;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
	padding: 20px;
}

.cr-modal-overlay.active {
	opacity: 1;
	pointer-events: auto;
}

.cr-modal-content {
	background: #ffffff;
	border-radius: var(--cr-border-radius-lg);
	box-shadow: var(--cr-shadow-xl);
	width: 100%;
	max-width: 500px;
	padding: 36px;
	position: relative;
	transform: scale(0.92) translateY(20px);
	transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
	max-height: 90vh;
	overflow-y: auto;
}

.cr-modal-overlay.active .cr-modal-content {
	transform: scale(1) translateY(0);
}

.cr-modal-close {
	position: absolute;
	top: 20px;
	right: 20px;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	border: none;
	background: #f1f5f9;
	font-size: 20px;
	line-height: 32px;
	color: var(--cr-color-text-muted);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: all 0.2s ease;
}

.cr-modal-close:hover {
	background: #e2e8f0;
	color: var(--cr-color-text-main);
}

.cr-modal-header {
	margin-bottom: 28px;
}

.cr-modal-title {
	font-size: 22px;
	font-weight: 700;
	margin: 0 0 6px 0;
	color: var(--cr-color-text-main);
}

.cr-modal-subtitle {
	font-size: 14px;
	color: var(--cr-color-text-muted);
	margin: 0;
}

/* Form Styles */
.cr-form-group {
	margin-bottom: 20px;
	display: flex;
	flex-direction: column;
}

.cr-form-label {
	font-size: 14px;
	font-weight: 600;
	margin-bottom: 8px;
	color: var(--cr-color-text-main);
}

.cr-required {
	color: #ef4444;
	margin-left: 3px;
}

.cr-form-input,
.cr-form-textarea {
	width: 100%;
	border: 1px solid var(--cr-color-border);
	border-radius: var(--cr-border-radius-sm);
	padding: 12px 16px;
	font-size: 15px;
	font-family: inherit;
	background: #f8fafc;
	color: var(--cr-color-text-main);
	transition: all 0.2s ease;
}

.cr-form-input:focus,
.cr-form-textarea:focus {
	outline: none;
	border-color: var(--cr-color-primary);
	background: #ffffff;
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.cr-form-textarea {
	resize: vertical;
}

/* Interactive Star Selector */
.cr-rating-group {
	align-items: flex-start;
}

.cr-star-selector {
	display: flex;
	gap: 6px;
	margin-bottom: 4px;
}

.cr-star-btn {
	font-size: 32px;
	color: var(--cr-color-star-empty);
	cursor: pointer;
	transition: transform 0.15s ease, color 0.15s ease;
	user-select: none;
}

.cr-star-btn:hover {
	transform: scale(1.2);
}

.cr-star-btn.hover,
.cr-star-btn.selected {
	color: var(--cr-color-star);
}

/* Errors & Validation */
.cr-validation-error {
	font-size: 12px;
	color: #ef4444;
	margin-top: 6px;
	display: none;
}

/* Message Alerts */
.cr-form-message {
	padding: 12px 16px;
	border-radius: var(--cr-border-radius-sm);
	font-size: 14px;
	margin-bottom: 20px;
	display: none;
	line-height: 1.4;
}

.cr-form-message.success {
	display: block;
	background: #f0fdf4;
	border: 1px solid #bbf7d0;
	color: #166534;
}

.cr-form-message.error {
	display: block;
	background: #fef2f2;
	border: 1px solid #fca5a5;
	color: #991b1b;
}

/* Submit Actions & Button Loading State */
.cr-form-actions {
	margin-top: 24px;
}

.cr-submit-btn {
	width: 100%;
	background: var(--cr-color-primary);
	color: #ffffff;
	border: none;
	padding: 14px 28px;
	font-size: 16px;
	font-weight: 600;
	border-radius: var(--cr-border-radius-sm);
	cursor: pointer;
	transition: all 0.2s ease;
	display: flex;
	justify-content: center;
	align-items: center;
	position: relative;
	box-shadow: var(--cr-shadow-md);
}

.cr-submit-btn:hover {
	background: var(--cr-color-primary-hover);
	transform: translateY(-2px);
	box-shadow: var(--cr-shadow-lg);
}

.cr-submit-btn:active {
	transform: translateY(0);
}

.cr-btn-loader {
	width: 20px;
	height: 20px;
	border: 3px solid rgba(255, 255, 255, 0.3);
	border-radius: 50%;
	border-top-color: #ffffff;
	animation: spin 0.8s linear infinite;
	position: absolute;
	display: none;
}

.cr-submit-btn.loading {
	color: transparent;
	pointer-events: none;
}

.cr-submit-btn.loading .cr-btn-loader {
	display: block;
}

/* Spinner Animation */
@keyframes spin {
	to { transform: rotate(360deg); }
}

/* Widget Responsive Adaptations */
@media (max-width: 768px) {
	.cr-widget-container {
		flex-direction: column;
		gap: 24px;
	}
	.cr-summary-card {
		flex: 1 1 auto;
		width: 100%;
	}
	.cr-btn-prev {
		left: -8px;
	}
	.cr-btn-next {
		right: -8px;
	}
	.cr-widget-wrapper {
		padding: 20px;
	}
}
