/**
 * Gallery Blur Toggle - Frontend Styles
 */

/* Toggle Container */
#gbt-toggle-container {
	position: fixed;
	z-index: 999999;
	transition: all 0.3s ease;
}

/* Position variants */
#gbt-toggle-container.gbt-position-bottom-right {
	bottom: 20px;
	right: 20px;
}

#gbt-toggle-container.gbt-position-bottom-left {
	bottom: 20px;
	left: 20px;
}

#gbt-toggle-container.gbt-position-top-right {
	top: 80px;
	right: 20px;
}

#gbt-toggle-container.gbt-position-top-left {
	top: 80px;
	left: 20px;
}

/* Toggle Button */
#gbt-toggle-btn {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 20px;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	color: #fff;
	border: none;
	border-radius: 50px;
	box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
	cursor: pointer;
	font-size: 14px;
	font-weight: 600;
	transition: all 0.3s ease;
	outline: none;
}

#gbt-toggle-btn:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

#gbt-toggle-btn:active {
	transform: translateY(0);
	box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

/* Active state (when blurred) */
#gbt-toggle-btn.active {
	background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
	box-shadow: 0 4px 15px rgba(245, 87, 108, 0.4);
}

#gbt-toggle-btn.active:hover {
	box-shadow: 0 6px 20px rgba(245, 87, 108, 0.5);
}

/* Icons */
.gbt-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
}

.gbt-icon svg {
	width: 100%;
	height: 100%;
}

/* Show/hide icons based on state */
#gbt-toggle-btn .gbt-icon-visible {
	display: inline-flex;
}

#gbt-toggle-btn .gbt-icon-blur {
	display: none;
}

#gbt-toggle-btn.active .gbt-icon-visible {
	display: none;
}

#gbt-toggle-btn.active .gbt-icon-blur {
	display: inline-flex;
}

/* Text */
.gbt-text {
	font-size: 14px;
	white-space: nowrap;
}

/* CSS-based blur class — prevents flash of unblurred content */
body.pv-blur-enabled .pvip-card-photo,
body.pv-blur-enabled .pvip-fav-card-img,
body.pv-blur-enabled .pv-item--blurred img {
	filter: blur(var(--gbt-blur-amount, 15px));
}

/* Blur animation */
.gbt-blurred {
	animation: gbt-blur-in 0.3s ease;
}

@keyframes gbt-blur-in {
	from {
		filter: none;
	}
	to {
		filter: blur(var(--gbt-blur-amount, 15px));
	}
}

/* Mobile responsive */
@media screen and (max-width: 768px) {
	#gbt-toggle-container {
		bottom: 15px !important;
		right: 15px !important;
		left: auto !important;
		top: auto !important;
	}

	#gbt-toggle-btn {
		padding: 10px 16px;
		font-size: 13px;
		border-radius: 40px;
	}

	.gbt-text {
		display: none; /* Hide text on mobile, show only icon */
	}

	#gbt-toggle-btn {
		width: 48px;
		height: 48px;
		padding: 0;
		justify-content: center;
	}

	.gbt-icon {
		width: 28px;
		height: 28px;
	}
}

/* Accessibility - Focus state */
#gbt-toggle-btn:focus {
	outline: 3px solid rgba(255, 255, 255, 0.5);
	outline-offset: 2px;
}

/* Tooltip hint */
#gbt-toggle-btn::before {
	content: attr(aria-label);
	position: absolute;
	bottom: calc(100% + 10px);
	right: 0;
	background: rgba(0, 0, 0, 0.9);
	color: #fff;
	padding: 8px 12px;
	border-radius: 6px;
	font-size: 12px;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease;
}

#gbt-toggle-btn::after {
	content: '';
	position: absolute;
	bottom: calc(100% + 2px);
	right: 20px;
	border: 4px solid transparent;
	border-top-color: rgba(0, 0, 0, 0.9);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease;
}

#gbt-toggle-btn:hover::before,
#gbt-toggle-btn:hover::after {
	opacity: 1;
}

/* Admin preview styles */
.gbt-preview img {
	transition: filter 0.3s ease;
}

.gbt-preview img:hover {
	filter: blur(15px);
}

/* Loading state */
#gbt-toggle-btn.loading {
	opacity: 0.6;
	pointer-events: none;
}

#gbt-toggle-btn.loading .gbt-icon {
	animation: gbt-spin 1s linear infinite;
}

@keyframes gbt-spin {
	from {
		transform: rotate(0deg);
	}
	to {
		transform: rotate(360deg);
	}
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
	#gbt-toggle-btn {
		box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
	}

	#gbt-toggle-btn:hover {
		box-shadow: 0 6px 20px rgba(0, 0, 0, 0.7);
	}
}

/* High contrast mode */
@media (prefers-contrast: high) {
	#gbt-toggle-btn {
		border: 2px solid #fff;
	}
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	#gbt-toggle-btn,
	.gbt-blurred {
		transition: none;
		animation: none;
	}
}

/* PVIP Feed integration — position above bottom nav */
body.pvip-feed-page #gbt-toggle-container,
body.pvip-feed-page #gbt-toggle-container.gbt-position-bottom-right,
body.pvip-feed-page #gbt-toggle-container.gbt-position-bottom-left {
	bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}

body.pvip-feed-page #gbt-toggle-btn {
	background: rgba(0, 0, 0, 0.5);
	backdrop-filter: blur(16px) saturate(180%);
	-webkit-backdrop-filter: blur(16px) saturate(180%);
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
	border: 0.5px solid rgba(255, 255, 255, 0.1);
}

body.pvip-feed-page #gbt-toggle-btn:hover {
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

body.pvip-feed-page #gbt-toggle-btn.active {
	background: rgba(233, 30, 99, 0.25);
	border-color: rgba(233, 30, 99, 0.3);
}

/* PVIP Favorites page — also above nav when present */
.pvip-favorites-page #gbt-toggle-container {
	bottom: 80px;
}

/* Ensure blur transition is smooth, no layout shift */
.pvip-card-photo,
.pvip-fav-card-img {
	transition: filter 0.3s ease;
}

/* ===== Lock Dialog ===== */
.gbt-lock-dialog {
	position: fixed;
	inset: 0;
	z-index: 9999999;
	background: rgba(0, 0, 0, 0.7);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity 0.3s ease;
	padding: 20px;
}

.gbt-lock-dialog.visible {
	opacity: 1;
}

.gbt-lock-dialog.fade-out {
	opacity: 0;
}

.gbt-lock-dialog-card {
	background: #1a1a2e;
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 20px;
	padding: 32px 28px;
	max-width: 340px;
	width: 100%;
	text-align: center;
}

.gbt-lock-dialog-card h3 {
	color: #fff;
	font-size: 22px;
	margin: 0 0 8px;
	font-weight: 700;
}

.gbt-lock-dialog-card p {
	color: rgba(255, 255, 255, 0.6);
	font-size: 14px;
	margin: 0 0 20px;
	line-height: 1.5;
}

.gbt-lock-options {
	display: grid;
	grid-template-columns: 1fr 1fr 1fr;
	gap: 8px;
	margin-bottom: 16px;
}

.gbt-lock-opt {
	padding: 12px 8px;
	background: rgba(255, 255, 255, 0.08);
	border: 1px solid rgba(255, 255, 255, 0.15);
	border-radius: 12px;
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
}

.gbt-lock-opt:hover {
	background: rgba(102, 126, 234, 0.3);
	border-color: rgba(102, 126, 234, 0.6);
	transform: scale(1.03);
}

.gbt-lock-opt:active {
	transform: scale(0.97);
}

.gbt-lock-skip {
	background: none;
	border: none;
	color: rgba(255, 255, 255, 0.4);
	font-size: 13px;
	cursor: pointer;
	padding: 8px;
	transition: color 0.2s;
}

.gbt-lock-skip:hover {
	color: rgba(255, 255, 255, 0.7);
}

/* ===== Lock Overlay (full screen while locked) ===== */
.gbt-lock-overlay {
	position: fixed;
	inset: 0;
	z-index: 9999998;
	background: linear-gradient(135deg, #0a0a1a 0%, #1a1a3e 50%, #0a0a1a 100%);
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity 0.5s ease;
}

.gbt-lock-overlay.visible {
	opacity: 1;
}

.gbt-lock-overlay.fade-out {
	opacity: 0;
	transition: opacity 0.5s ease;
}

.gbt-lock-content {
	text-align: center;
	padding: 40px 30px;
	max-width: 400px;
}

.gbt-lock-content.shake {
	animation: gbt-shake 0.5s ease;
}

@keyframes gbt-shake {
	0%, 100% { transform: translateX(0); }
	10%, 30%, 50%, 70%, 90% { transform: translateX(-8px); }
	20%, 40%, 60%, 80% { transform: translateX(8px); }
}

.gbt-lock-icon {
	font-size: 64px;
	margin-bottom: 16px;
	animation: gbt-pulse 3s ease-in-out infinite;
}

@keyframes gbt-pulse {
	0%, 100% { transform: scale(1); opacity: 1; }
	50% { transform: scale(1.1); opacity: 0.8; }
}

.gbt-lock-title {
	color: #fff;
	font-size: 28px;
	font-weight: 800;
	margin: 0 0 8px;
	letter-spacing: -0.02em;
}

.gbt-lock-timer {
	font-size: 48px;
	font-weight: 200;
	color: rgba(255, 255, 255, 0.9);
	font-variant-numeric: tabular-nums;
	letter-spacing: 2px;
	margin: 20px 0;
	font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
}

.gbt-lock-quote {
	color: rgba(255, 255, 255, 0.5);
	font-size: 16px;
	font-style: italic;
	line-height: 1.6;
	margin: 24px 0 16px;
	min-height: 52px;
}

.gbt-lock-hint {
	color: rgba(255, 255, 255, 0.3);
	font-size: 13px;
	margin: 0;
}

/* Print - hide button */
@media print {
	#gbt-toggle-container {
		display: none !important;
	}

	.gbt-blurred {
		filter: none !important;
	}
}
