/**
 * Feedback Modal & Inline Rating Styles
 *
 * Star rating widget (inline + popup) and review modal.
 *
 * @package MphbGuestServices
 * @since 2.0.0
 */

/* ========================================
 * Inline Rating Widget
 * ======================================== */

.gs-car-card__title-row {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
}

.gs-car-card__title-row .gs-car-card__title {
	min-height: auto;
}

.gs-item-title-row {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
}

.gs-item-title-row .mphb-gs-item-title {
	min-height: auto;
}

.gs-meal-card__content .gs-inline-rating {
	margin-top: 4px;
}

.gs-inline-rating {
	display: inline-flex;
	gap: 1px;
	align-items: center;
	margin: 0;
	line-height: 1;
	min-height: 14px;
}

.gs-inline-rating__star,
.gs-inline-rating__star:hover,
.gs-inline-rating__star:focus,
.gs-inline-rating__star:active,
.gs-inline-rating__star.gs-inline-rating__star--filled {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	background: transparent !important;
	background-color: transparent !important;
	border: none !important;
	box-shadow: none !important;
	cursor: pointer;
	transition: color 150ms ease, transform 150ms ease;
	-webkit-appearance: none;
	appearance: none;
}

.gs-inline-rating__star {
	color: #d1d5db !important;
}

.gs-inline-rating__star svg {
	width: 14px;
	height: 14px;
	fill: currentColor !important;
}

.gs-inline-rating__star--filled {
	color: #f59e0b !important;
}

.gs-inline-rating__star:hover {
	color: #fbbf24 !important;
	transform: scale(1.15);
}

.gs-inline-rating--submitting {
	pointer-events: none;
	opacity: 0.5;
}

.gs-inline-rating--static {
	pointer-events: none;
}

.gs-inline-rating--placeholder {
	display: block;
	height: 14px;
	pointer-events: none;
}

.gs-inline-rating--static .gs-inline-rating__star {
	cursor: default;
}

.gs-inline-rating__thanks {
	font-size: 12px;
	color: var(--gs-color-text-soft, #64748b);
	animation: gs-feedback-fade-in 300ms ease;
}

/* ========================================
 * Feedback Modal Overlay
 * ======================================== */

.gs-feedback-overlay {
	position: fixed !important;
	top: 0 !important;
	left: 0 !important;
	right: 0 !important;
	bottom: 0 !important;
	width: 100vw !important;
	height: 100vh !important;
	background: rgba(0, 0, 0, 0.5) !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	z-index: 100002 !important;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease, visibility 0.2s ease;
	padding: 20px !important;
	box-sizing: border-box !important;
	margin: 0 !important;
}

.gs-feedback-overlay--active {
	opacity: 1;
	visibility: visible;
}

/* ========================================
 * Feedback Modal Container
 * ======================================== */

.gs-feedback-overlay .gs-feedback-modal {
	display: flex !important;
	flex-direction: column !important;
	background: #fff !important;
	border-radius: 12px !important;
	box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2) !important;
	width: 480px !important;
	max-width: calc(100vw - 40px) !important;
	max-height: 90vh !important;
	overflow: hidden !important;
	transform: scale(0.95) translateY(-10px);
	transition: transform 0.2s ease;
	margin: 0 auto !important;
	position: relative !important;
	box-sizing: border-box !important;
}

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

/* ========================================
 * Modal Header
 * ======================================== */

.gs-feedback-modal__header {
	display: flex !important;
	align-items: center !important;
	justify-content: space-between !important;
	padding: 16px 20px !important;
	border-bottom: 1px solid #e2e8f0 !important;
	flex-shrink: 0 !important;
}

.gs-feedback-modal__title {
	font-size: 16px !important;
	font-weight: 600 !important;
	margin: 0 !important;
	color: #1e293b !important;
}

.gs-feedback-modal__subtitle {
	font-size: 13px;
	font-weight: 400;
	color: #64748b;
	margin: 2px 0 0;
}

.gs-feedback-modal__close {
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: 32px !important;
	height: 32px !important;
	padding: 0 !important;
	background: transparent !important;
	border: none !important;
	border-radius: 6px !important;
	color: #64748b !important;
	cursor: pointer !important;
	transition: background-color 0.15s ease !important;
}

.gs-feedback-modal__close:hover {
	background: #f1f5f9 !important;
}

.gs-feedback-modal__close svg {
	width: 18px;
	height: 18px;
	stroke: currentColor;
}

/* ========================================
 * Modal Body
 * ======================================== */

.gs-feedback-modal__body {
	padding: 20px !important;
	overflow-y: auto !important;
	max-height: calc(90vh - 160px) !important;
	display: flex;
	flex-direction: column;
	gap: 16px;
	scrollbar-width: none !important;
	-ms-overflow-style: none !important;
}

.gs-feedback-modal__body::-webkit-scrollbar {
	display: none !important;
}

/* ========================================
 * Question Row (label + stars)
 * ======================================== */

.gs-feedback__question {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.gs-feedback__question-label {
	font-size: 14px;
	font-weight: 500;
	color: #1e293b;
}

.gs-feedback__star-group {
	display: inline-flex;
	gap: 4px;
	align-items: center;
}

.gs-feedback__star-btn {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	padding: 2px !important;
	background: none !important;
	border: none !important;
	cursor: pointer !important;
	color: #d1d5db !important;
	transition: color 150ms ease, transform 150ms ease !important;
}

.gs-feedback__star-btn svg {
	width: 24px !important;
	height: 24px !important;
	fill: currentColor !important;
}

.gs-feedback__star-btn--filled {
	color: #f59e0b !important;
}

.gs-feedback__star-btn:hover {
	color: #fbbf24 !important;
	transform: scale(1.15) !important;
}

.gs-feedback__star-label {
	font-size: 12px;
	color: #64748b;
	margin-left: 8px;
	min-width: 60px;
}

/* ========================================
 * Question Pages (checkout pagination)
 * ======================================== */

.gs-feedback__page {
	display: none;
	flex-direction: column;
	gap: 16px;
}

.gs-feedback__page--active {
	display: flex;
}

/* ========================================
 * Divider between service & item questions
 * ======================================== */

.gs-feedback__divider {
	height: 1px;
	background: #e2e8f0;
	margin: 4px 0;
}

/* ========================================
 * Comment Textarea
 * ======================================== */

.gs-feedback__textarea-label {
	font-size: 14px;
	font-weight: 500;
	color: #1e293b;
}

.gs-feedback__textarea {
	width: 100%;
	min-height: 80px;
	padding: 12px;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	font-family: inherit;
	font-size: 14px;
	color: #1e293b;
	background: #f8fafc;
	resize: vertical;
	box-sizing: border-box;
	transition: border-color 0.15s ease;
}

.gs-feedback__textarea:focus {
	outline: none;
	border-color: var(--gs-color-primary, #3b82f6);
}

.gs-feedback__textarea::placeholder {
	color: #94a3b8;
}

/* ========================================
 * Modal Footer
 * ======================================== */

.gs-feedback-modal__footer {
	display: flex !important;
	align-items: center !important;
	gap: 12px !important;
	padding: 16px 20px !important;
	background: #f8fafc !important;
	border-top: 1px solid #e2e8f0 !important;
	flex-shrink: 0 !important;
}

.gs-feedback__queue-indicator {
	font-size: 12px;
	color: #94a3b8;
	margin-right: auto;
}

.gs-feedback-modal__btn {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	padding: 12px 20px !important;
	font-size: 14px !important;
	font-weight: 600 !important;
	border-radius: 8px !important;
	cursor: pointer !important;
	transition: all 0.15s ease !important;
	white-space: nowrap !important;
}

.gs-feedback-modal__btn--dismiss {
	background: #fff !important;
	border: 1px solid #e2e8f0 !important;
	color: #64748b !important;
}

.gs-feedback-modal__btn--dismiss:hover {
	background: #f1f5f9 !important;
	border-color: #cbd5e1 !important;
}

.gs-feedback-modal__btn--dismiss-all {
	background: #fff !important;
	border: 1px solid #fca5a5 !important;
	color: #dc2626 !important;
	margin-right: auto !important;
}

.gs-feedback-modal__btn--dismiss-all:hover {
	background: #fef2f2 !important;
	border-color: #f87171 !important;
}

.gs-feedback-modal__btn--submit {
	background: linear-gradient(135deg, var(--gs-color-primary, #3b82f6) 0%, var(--gs-color-primary-hover, #2563eb) 100%) !important;
	border: none !important;
	color: #fff !important;
}

.gs-feedback-modal__btn--submit:hover {
	filter: brightness(1.1) !important;
}

.gs-feedback-modal__btn--submit:disabled {
	opacity: 0.5 !important;
	cursor: not-allowed !important;
	filter: none !important;
}

.gs-feedback-modal__btn--hidden {
	display: none !important;
}

.gs-feedback-modal__btn--prev {
	background: #fff !important;
	border: 1px solid #e2e8f0 !important;
	color: #64748b !important;
}

.gs-feedback-modal__btn--prev:hover {
	background: #f1f5f9 !important;
	border-color: #cbd5e1 !important;
}

.gs-feedback-modal__btn--next {
	background: linear-gradient(135deg, var(--gs-color-primary, #3b82f6) 0%, var(--gs-color-primary-hover, #2563eb) 100%) !important;
	border: none !important;
	color: #fff !important;
}

.gs-feedback-modal__btn--next:hover {
	filter: brightness(1.1) !important;
}

/* ========================================
 * Animations
 * ======================================== */

@keyframes gs-feedback-fade-in {
	from {
		opacity: 0;
		transform: translateY(-4px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

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

@media (max-width: 480px) {
	.gs-feedback-overlay .gs-feedback-modal {
		width: 100% !important;
		max-width: calc(100vw - 24px) !important;
	}

	.gs-feedback-modal__body {
		padding: 16px !important;
	}

	.gs-feedback-modal__footer {
		flex-wrap: wrap;
	}

	.gs-feedback__question {
		gap: 4px;
	}
}

/* ========================================
 * Dark Mode Support
 * ======================================== */

/*
 * The feedback overlay is appended to document.body (outside .mphb-gs-shell)
 * so modal selectors must target the overlay's own data-theme attribute.
 * Inline rating widgets live inside .mphb-gs-shell so they keep that prefix.
 */

/* --- Dark Mode Variables (overlay) --- */
@media (prefers-color-scheme: dark) {
	.gs-feedback-overlay[data-theme="auto"] {
		--gs-fb-overlay-bg: rgba(0, 0, 0, 0.75);
		--gs-fb-modal-bg: #1a1d23;
		--gs-fb-border: #2d3139;
		--gs-fb-text: #e5e7eb;
		--gs-fb-text-muted: #9ca3af;
		--gs-fb-close-hover-bg: rgba(255, 255, 255, 0.1);
		--gs-fb-star-empty: #4b5563;
		--gs-fb-input-bg: #20242c;
		--gs-fb-placeholder: #6b7280;
		--gs-fb-btn-hover-border: #3d4149;
		--gs-fb-danger-border: #7f1d1d;
		--gs-fb-danger-text: #fca5a5;
		--gs-fb-danger-hover-bg: #2d1a1a;
		--gs-fb-danger-hover-border: #991b1b;
	}
}
.gs-feedback-overlay[data-theme="dark"] {
	--gs-fb-overlay-bg: rgba(0, 0, 0, 0.75);
	--gs-fb-modal-bg: #1a1d23;
	--gs-fb-border: #2d3139;
	--gs-fb-text: #e5e7eb;
	--gs-fb-text-muted: #9ca3af;
	--gs-fb-close-hover-bg: rgba(255, 255, 255, 0.1);
	--gs-fb-star-empty: #4b5563;
	--gs-fb-input-bg: #20242c;
	--gs-fb-placeholder: #6b7280;
	--gs-fb-btn-hover-border: #3d4149;
	--gs-fb-danger-border: #7f1d1d;
	--gs-fb-danger-text: #fca5a5;
	--gs-fb-danger-hover-bg: #2d1a1a;
	--gs-fb-danger-hover-border: #991b1b;
}

/* --- Dark Mode Variables (inline rating inside .mphb-gs-shell) --- */
@media (prefers-color-scheme: dark) {
	.mphb-gs-shell[data-theme="auto"] {
		--gs-fb-inline-star-empty: #6b7280;
		--gs-fb-inline-thanks: #9ca3af;
	}
}
.mphb-gs-shell[data-theme="dark"] {
	--gs-fb-inline-star-empty: #6b7280;
	--gs-fb-inline-thanks: #9ca3af;
}

/* --- Dark Mode Rules (overlay — written once, uses var() with light fallbacks) --- */
.gs-feedback-overlay[data-theme="auto"],
.gs-feedback-overlay[data-theme="dark"] {
	background: var(--gs-fb-overlay-bg, rgba(0, 0, 0, 0.5)) !important;
}

.gs-feedback-overlay[data-theme="auto"] .gs-feedback-modal,
.gs-feedback-overlay[data-theme="dark"] .gs-feedback-modal {
	background: var(--gs-fb-modal-bg, #fff) !important;
}

.gs-feedback-overlay[data-theme="auto"] .gs-feedback-modal__header,
.gs-feedback-overlay[data-theme="dark"] .gs-feedback-modal__header {
	border-bottom-color: var(--gs-fb-border, #e2e8f0) !important;
}

.gs-feedback-overlay[data-theme="auto"] .gs-feedback-modal__title,
.gs-feedback-overlay[data-theme="dark"] .gs-feedback-modal__title {
	color: var(--gs-fb-text, #1e293b) !important;
}

.gs-feedback-overlay[data-theme="auto"] .gs-feedback-modal__subtitle,
.gs-feedback-overlay[data-theme="dark"] .gs-feedback-modal__subtitle {
	color: var(--gs-fb-text-muted, #64748b);
}

.gs-feedback-overlay[data-theme="auto"] .gs-feedback-modal__close,
.gs-feedback-overlay[data-theme="dark"] .gs-feedback-modal__close {
	color: var(--gs-fb-text, #64748b) !important;
}

.gs-feedback-overlay[data-theme="auto"] .gs-feedback-modal__close:hover,
.gs-feedback-overlay[data-theme="dark"] .gs-feedback-modal__close:hover {
	background: var(--gs-fb-close-hover-bg, #f1f5f9) !important;
}

.gs-feedback-overlay[data-theme="auto"] .gs-feedback__question-label,
.gs-feedback-overlay[data-theme="dark"] .gs-feedback__question-label {
	color: var(--gs-fb-text, #1e293b);
}

.gs-feedback-overlay[data-theme="auto"] .gs-feedback__star-btn,
.gs-feedback-overlay[data-theme="dark"] .gs-feedback__star-btn {
	color: var(--gs-fb-star-empty, #d1d5db) !important;
}

.gs-feedback-overlay[data-theme="auto"] .gs-feedback__star-btn--filled,
.gs-feedback-overlay[data-theme="dark"] .gs-feedback__star-btn--filled {
	color: #f59e0b !important;
}

.gs-feedback-overlay[data-theme="auto"] .gs-feedback__star-btn:hover,
.gs-feedback-overlay[data-theme="dark"] .gs-feedback__star-btn:hover {
	color: #fbbf24 !important;
}

.gs-feedback-overlay[data-theme="auto"] .gs-feedback__star-label,
.gs-feedback-overlay[data-theme="dark"] .gs-feedback__star-label {
	color: var(--gs-fb-text-muted, #64748b);
}

.gs-feedback-overlay[data-theme="auto"] .gs-feedback__divider,
.gs-feedback-overlay[data-theme="dark"] .gs-feedback__divider {
	background: var(--gs-fb-border, #e2e8f0);
}

.gs-feedback-overlay[data-theme="auto"] .gs-feedback__textarea,
.gs-feedback-overlay[data-theme="dark"] .gs-feedback__textarea {
	background: var(--gs-fb-input-bg, #f8fafc);
	border-color: var(--gs-fb-border, #e2e8f0);
	color: var(--gs-fb-text, #1e293b);
}

.gs-feedback-overlay[data-theme="auto"] .gs-feedback__textarea::placeholder,
.gs-feedback-overlay[data-theme="dark"] .gs-feedback__textarea::placeholder {
	color: var(--gs-fb-placeholder, #94a3b8);
}

.gs-feedback-overlay[data-theme="auto"] .gs-feedback__textarea-label,
.gs-feedback-overlay[data-theme="dark"] .gs-feedback__textarea-label {
	color: var(--gs-fb-text, #1e293b);
}

.gs-feedback-overlay[data-theme="auto"] .gs-feedback-modal__footer,
.gs-feedback-overlay[data-theme="dark"] .gs-feedback-modal__footer {
	background: var(--gs-fb-input-bg, #f8fafc) !important;
	border-top-color: var(--gs-fb-border, #e2e8f0) !important;
}

.gs-feedback-overlay[data-theme="auto"] .gs-feedback-modal__btn--dismiss,
.gs-feedback-overlay[data-theme="dark"] .gs-feedback-modal__btn--dismiss {
	background: var(--gs-fb-modal-bg, #fff) !important;
	border-color: var(--gs-fb-border, #e2e8f0) !important;
	color: var(--gs-fb-text-muted, #64748b) !important;
}

.gs-feedback-overlay[data-theme="auto"] .gs-feedback-modal__btn--dismiss:hover,
.gs-feedback-overlay[data-theme="dark"] .gs-feedback-modal__btn--dismiss:hover {
	background: var(--gs-fb-input-bg, #f1f5f9) !important;
	border-color: var(--gs-fb-btn-hover-border, #cbd5e1) !important;
}

.gs-feedback-overlay[data-theme="auto"] .gs-feedback-modal__btn--dismiss-all,
.gs-feedback-overlay[data-theme="dark"] .gs-feedback-modal__btn--dismiss-all {
	background: var(--gs-fb-modal-bg, #fff) !important;
	border-color: var(--gs-fb-danger-border, #fca5a5) !important;
	color: var(--gs-fb-danger-text, #dc2626) !important;
}

.gs-feedback-overlay[data-theme="auto"] .gs-feedback-modal__btn--dismiss-all:hover,
.gs-feedback-overlay[data-theme="dark"] .gs-feedback-modal__btn--dismiss-all:hover {
	background: var(--gs-fb-danger-hover-bg, #fef2f2) !important;
	border-color: var(--gs-fb-danger-hover-border, #f87171) !important;
}

.gs-feedback-overlay[data-theme="auto"] .gs-feedback-modal__btn--prev,
.gs-feedback-overlay[data-theme="dark"] .gs-feedback-modal__btn--prev {
	background: var(--gs-fb-modal-bg, #fff) !important;
	border-color: var(--gs-fb-border, #e2e8f0) !important;
	color: var(--gs-fb-text-muted, #64748b) !important;
}

.gs-feedback-overlay[data-theme="auto"] .gs-feedback-modal__btn--prev:hover,
.gs-feedback-overlay[data-theme="dark"] .gs-feedback-modal__btn--prev:hover {
	background: var(--gs-fb-input-bg, #f1f5f9) !important;
	border-color: var(--gs-fb-btn-hover-border, #cbd5e1) !important;
}

/* --- Dark Mode Rules (inline rating — written once) --- */
.mphb-gs-shell[data-theme="auto"] .gs-inline-rating__star,
.mphb-gs-shell[data-theme="dark"] .gs-inline-rating__star {
	color: var(--gs-fb-inline-star-empty, #d1d5db) !important;
}

.mphb-gs-shell[data-theme="auto"] .gs-inline-rating__star--filled,
.mphb-gs-shell[data-theme="dark"] .gs-inline-rating__star--filled {
	color: #f59e0b !important;
}

.mphb-gs-shell[data-theme="auto"] .gs-inline-rating__star:hover,
.mphb-gs-shell[data-theme="dark"] .gs-inline-rating__star:hover {
	color: #fbbf24 !important;
}

.mphb-gs-shell[data-theme="auto"] .gs-inline-rating__thanks,
.mphb-gs-shell[data-theme="dark"] .gs-inline-rating__thanks {
	color: var(--gs-fb-inline-thanks, var(--gs-color-text-soft, #64748b));
}

/* ========================================
 * Test Mode Trigger Button
 * ======================================== */

.gs-feedback-test-trigger {
	position: fixed !important;
	bottom: 20px !important;
	right: 20px !important;
	z-index: 100001 !important;
	display: flex !important;
	align-items: center !important;
	gap: 8px !important;
	padding: 12px 16px !important;
	background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
	color: #fff !important;
	border: none !important;
	border-radius: 24px !important;
	font-size: 13px !important;
	font-weight: 600 !important;
	cursor: pointer !important;
	box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4) !important;
	transition: transform 0.15s ease, box-shadow 0.15s ease !important;
}

.gs-feedback-test-trigger:hover {
	transform: translateY(-2px) !important;
	box-shadow: 0 6px 16px rgba(245, 158, 11, 0.5) !important;
}

.gs-feedback-test-trigger svg {
	width: 16px !important;
	height: 16px !important;
	fill: currentColor !important;
}
