.quote-widget {
	width: 100%;
	max-width: var(--max-width);
	padding: clamp(0.75rem, 3vw, 1.5rem);
	background: rgba(255, 255, 255, 0.08);
	-webkit-backdrop-filter: blur(12px);
	backdrop-filter: blur(12px);
	border: 2px solid rgba(103, 126, 234, 0.3);
	border-radius: 16px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3),
		0 0 20px rgba(103, 126, 234, 0.25),
		inset 0 0 30px rgba(103, 126, 234, 0.05);
	transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
	position: relative;
	overflow: hidden;
	animation: quote-border-pulse 4s ease-in-out infinite;
}

/* Ensure content stays above the .quote-bg layer */
.quote-widget>* {
	position: relative;
	z-index: 1;
}

/* --- Quote per-quote background image ---
   .quote-bg is injected by JS into the widget's innerHTML each refresh.
   JS sets background-image, then adds .quote-bg--active after 50ms.
   Timeline (total 10 min = 600s):
     0s–30s:    invisible (delay)
     30s–300s:  fading in and unblurring  (270s)
     300s–600s: fully visible at max opacity, no blur  (stays)               */

.quote-bg {
	/* Both position and z-index must override .quote-widget>* { position:relative; z-index:1 } */
	position: absolute !important;
	inset: 0;
	z-index: 0 !important;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	opacity: 0;
	filter: blur(24px);
	border-radius: inherit;
}

/* Trigger animation by adding this class via JS */
.quote-bg--active {
	/* 30s delay, then 570s to cover the remaining 9.5 min of the 10 min quote cycle */
	animation: quoteBgUnblur 570s linear forwards;
	animation-delay: 30s;
}

/* Unblur from 0 to fully visible at 47% mark, then hold */
@keyframes quoteBgUnblur {
	0%   { opacity: 0;    filter: blur(24px); }
	47%  { opacity: 0.50; filter: blur(0px);  }
	100% { opacity: 0.50; filter: blur(0px);  }
}

.quote-widget:hover::before {
	opacity: 1;
	animation-duration: 8s;
}

.quote-widget:hover {
	box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4),
		0 0 30px rgba(103, 126, 234, 0.3);
	border-color: rgba(118, 75, 162, 0.5);
}

/* Quote header with icon */
.quote-header {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin-bottom: clamp(0.75rem, 2vw, 1rem);
	padding-bottom: 0.5rem;
	border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.quote-header i {
	font-size: clamp(1.2rem, 3vw, 1.5rem);
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

.quote-header span {
	font-size: clamp(0.75rem, 2vw, 0.9rem);
	color: var(--text-secondary, #b8c6db);
	font-weight: 500;
	letter-spacing: 0.5px;
}

/* Quote text styling */
.quote-widget__text {
	font-size: clamp(0.95rem, 2.5vw, 1.2rem);
	font-style: italic;
	line-height: 1.6;
	color: var(--neutral-white, #fff);
	position: relative;
	padding: clamp(0.5rem, 2vw, 1rem);
	margin-bottom: clamp(0.75rem, 2vw, 1rem);
	text-align: left;
	word-wrap: break-word;
	hyphens: auto;
}

/* Large watermark „ behind the text */
.quote-widget__text::before {
	content: "„";
	position: absolute;
	right: 67%;
	transform: translateX(-50%);
	top: 0rem;
	font-size: clamp(5.5rem, 12vw, 8rem);
	opacity: 0.15;
	color: var(--accent-gold, #ddc848);
	font-family: Georgia, serif;
	line-height: 1;
	pointer-events: none;
}

/* Decorative quote marks — match surrounding text exactly */
.quote-mark {
	font-family: inherit;
	font-size: inherit;
	color: inherit;
}

.quote-mark--open  { margin-right: 0.2em; }
.quote-mark--close { margin-left: 0.1em; }

/* Quote author styling */
.quote-widget__author {
	font-size: clamp(0.85rem, 2vw, 1.1rem);
	font-weight: 600;
	color: var(--text-secondary, #b8c6db);
	text-align: right;
	margin-bottom: clamp(0.75rem, 2vw, 1rem);
	padding-right: clamp(0.5rem, 2vw, 1rem);
}

/* Quote footer with metadata */
.quote-footer {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	padding-top: clamp(0.5rem, 2vw, 0.75rem);
	border-top: 1px solid rgba(255, 255, 255, 0.1);
	font-size: clamp(0.7rem, 1.8vw, 0.85rem);
	color: var(--text-muted, #8892b0);
}

/* Submitter info with tooltip */
.quote-submitter-wrapper {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: nowrap;
	gap: 0.5rem;
}

.quote-submitter-info {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	position: relative;
}

.quote-submitter {
	position: relative;
	cursor: help;
	color: var(--text-secondary, #b8c6db);
	transition: all 0.3s ease;
	font-weight: 500;
	text-decoration: underline;
	text-decoration-style: dotted;
	text-underline-offset: 2px;
}

.quote-submitter:hover {
	color: var(--neutral-white, #fff);
	text-decoration-style: solid;
}

/* Tooltip for submitter info */
.quote-tooltip {
	position: absolute;
	bottom: calc(100% + 10px);
	left: 50%;
	transform: translateX(-50%);
	background: rgba(35, 38, 52, 0.98);
	-webkit-backdrop-filter: blur(12px);
	backdrop-filter: blur(12px);
	border: 1px solid rgba(103, 126, 234, 0.3);
	border-radius: 12px;
	padding: clamp(0.6rem, 2vw, 0.9rem);
	min-width: clamp(200px, 40vw, 280px);
	max-width: calc(100vw - 2rem);
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6),
		0 0 20px rgba(103, 126, 234, 0.2);
	z-index: 1000;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.quote-submitter:hover .quote-tooltip {
	opacity: 1;
	visibility: visible;
	transform: translateX(-50%) translateY(-5px);
}

/* Tooltip arrow */
.quote-tooltip::after {
	content: '';
	position: absolute;
	top: 100%;
	left: 7%;
	transform: translateX(-50%);
	border-width: 8px 8px 0 8px;
	border-style: solid;
	border-color: rgba(35, 38, 52, 0.98) transparent transparent transparent;
}

/* Tooltip content layout */
.tooltip-content-wrapper {
	display: flex;
	gap: clamp(0.6rem, 2vw, 1rem);
	align-items: center;
}

.tooltip-avatar {
	width: clamp(40px, 10vw, 60px);
	height: clamp(40px, 10vw, 60px);
	border-radius: var(--radius-avatar, 12px);
	border: 2px solid rgba(103, 126, 234, 0.5);
	object-fit: cover;
	flex-shrink: 0;
}

.tooltip-info {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	min-width: 0;
}

.tooltip-info p {
	margin: 0;
	font-size: clamp(0.7rem, 1.8vw, 0.85rem);
	color: var(--text-secondary, #b8c6db);
	line-height: 1.4;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.tooltip-info strong {
	color: var(--neutral-white, #fff);
	font-weight: 600;
}

/* Loading state */
.quote-widget.loading {
	opacity: 0.6;
	pointer-events: none;
}

.quote-loader {
	text-align: center;
	padding: 2rem 1rem;
	color: var(--text-secondary, #b8c6db);
}

.quote-loader::after {
	content: "";
	display: inline-block;
	width: 20px;
	height: 20px;
	margin-left: 0.5rem;
	border: 3px solid rgba(103, 126, 234, 0.2);
	border-top-color: #667eea;
	border-radius: 50%;
	animation: quote-spin 0.8s linear infinite;
}

@keyframes quote-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Share & Like buttons (optional engagement) */
.quote-actions {
	display: flex;
	gap: 0.5rem;
	align-items: center;
}

.quote-action-btn {
	background: linear-gradient(135deg, rgba(255, 215, 0, 0.05) 0%, rgba(255, 180, 0, 0.05) 100%);
	border: 1px solid rgba(255, 215, 0, 0.3);
	border-radius: 10px;
	padding: 0.1rem 0.7rem;
	color: var(--text-secondary, #b8c6db);
	cursor: pointer;
	transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
	font-size: clamp(0.7rem, 1.8vw, 0.85rem);
	display: flex;
	align-items: center;
	gap: 0.3rem;
	position: relative;
	overflow: hidden;
	box-shadow: 0 2px 8px rgba(255, 215, 0, 0.1);
}

.quote-action-btn::before {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 0;
	height: 0;
	border-radius: 50%;
	background: radial-gradient(circle, rgba(255, 215, 0, 0.3) 0%, transparent 70%);
	transform: translate(-50%, -50%);
	transition: width 0.6s ease, height 0.6s ease;
}

.quote-action-btn:hover::before {
	width: 200px;
	height: 200px;
}

.quote-action-btn:hover {
	background: linear-gradient(135deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 180, 0, 0.15) 100%);
	border-color: rgba(255, 215, 0, 0.6);
	color: var(--neutral-white, #fff);
	transform: scale(1.1);
	box-shadow: 0 4px 16px rgba(255, 215, 0, 0.3),
		0 0 20px rgba(255, 215, 0, 0.2);
}

.quote-action-btn:active {
	transform: scale(1.05);
	transition: all 0.1s ease;
}

.quote-action-btn i {
	font-size: 1em;
	position: relative;
	z-index: 1;
}

.quote-action-btn lottie-player,
.quote-action-btn dotlottie-player {
	pointer-events: none;
	position: relative;
	z-index: 1;
	transition: transform 0.3s ease;
}

.quote-action-btn:hover dotlottie-player {
	transform: scale(1.1) rotate(5deg);
}

.quote-open-btn {
	background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(108, 92, 231, 0.08) 100%);
	border-color: rgba(59, 130, 246, 0.3);
	color: var(--primitive-blue-500, #3b82f6);
	text-decoration: none;
	box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.quote-open-btn::before {
	background: radial-gradient(circle, rgba(59, 130, 246, 0.3) 0%, transparent 70%);
}

.quote-open-btn:hover {
	background: linear-gradient(135deg, rgba(59, 130, 246, 0.18) 0%, rgba(108, 92, 231, 0.18) 100%);
	border-color: var(--primitive-blue-500, #3b82f6);
	color: #93c5fd;
	box-shadow: 0 4px 16px rgba(59, 130, 246, 0.35),
		0 0 20px rgba(59, 130, 246, 0.2);
}

.quote-open-btn svg {
	position: relative;
	z-index: 1;
	transition: transform 0.3s ease;
}

.quote-open-btn:hover svg {
	transform: scale(1.1) rotate(5deg);
}

/* Responsive adjustments */
@media (max-width: 250px) {
	.quote-widget {
		padding: 0.5rem;
	}

	.quote-footer {
		font-size: 0.6rem;
	}

	.quote-tooltip {
		min-width: 180px;
		padding: 0.6rem;
	}

	.tooltip-content-wrapper {
		gap: 0.4rem;
	}

	.tooltip-avatar {
		width: 32px;
		height: 32px;
	}
}

@media (min-width: 251px) and (max-width: 360px) {
	.quote-widget {
		padding: 0.65rem;
	}

	.quote-footer {
		font-size: 0.65rem;
	}

	.quote-tooltip {
		min-width: 200px;
	}

	.tooltip-avatar {
		width: 36px;
		height: 36px;
	}
}

@media (max-width: 767px) {
	/* Keep tooltip anchored to the name — relative positioning must stay on .quote-submitter */
	.quote-submitter-info {
		position: static;
	}

	.quote-submitter {
		position: relative;
	}

	.quote-tooltip {
		position: absolute;
		bottom: calc(100% + 8px);
		left: 0;
		right: auto;
		transform: none;
		min-width: 210px;
		max-width: min(280px, calc(100vw - 2rem));
		width: max-content;
	}

	.quote-submitter:hover .quote-tooltip {
		transform: translateY(-4px);
	}

	.tooltip-content-wrapper {
		flex-direction: row;
		text-align: left;
		align-items: center;
		gap: 0.6rem;
	}

	.tooltip-info p {
		white-space: normal;
		font-size: 0.75rem;
	}
}

@media (min-width: 768px) {
	.quote-widget {
		width: 100%;
	}

	.quote-footer {
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
	}

	/* Anchor tooltip to left so it doesn't jump off-screen at 768px+ */
	.quote-tooltip {
		left: 0;
		right: auto;
		transform: translateX(0);
	}

	.quote-submitter:hover .quote-tooltip {
		transform: translateX(0) translateY(-5px);
	}

	.quote-tooltip::after {
		left: 7%;
	}
}

/* Fade-in animation for quote updates */
@keyframes quote-fade-in {
	from {
		opacity: 0;
		transform: translateY(10px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.quote-widget.fade-in {
	animation: quote-fade-in 0.5s ease-out;
}

/* Border pulse animation */
@keyframes quote-border-pulse {

	0%,
	100% {
		border-color: rgba(103, 126, 234, 0.3);
		box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3),
			0 0 20px rgba(103, 126, 234, 0.25),
			inset 0 0 30px rgba(103, 126, 234, 0.05);
	}

	50% {
		border-color: rgba(118, 75, 162, 0.5);
		box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3),
			0 0 30px rgba(118, 75, 162, 0.4),
			inset 0 0 40px rgba(118, 75, 162, 0.08);
	}
}
