/* ==========================================================================
   SEC Floating Button (Accessibility & Help Hub) - PCRU Royal Purple Theme
   ========================================================================== */

/* Accessibility Modifiers */
:root {
	--sec-accessibility-font-scale: 1;
	--sec-float-color: #5B21B6;
	--sec-float-offset: 30px;
}

html.sec-font-scaled body > *:not(.sec-float-hub) :where(p, span, a, li, button, input, textarea, select, label, td, th) {
	font-size: calc(1em * var(--sec-accessibility-font-scale, 1)) !important;
}

html.sec-font-scaled body > *:not(.sec-float-hub) :where(h1, .h1) {
	font-size: calc(2.25rem * var(--sec-accessibility-font-scale, 1)) !important;
}

html.sec-font-scaled body > *:not(.sec-float-hub) :where(h2, .h2) {
	font-size: calc(1.5rem * var(--sec-accessibility-font-scale, 1)) !important;
}

html.sec-font-scaled body > *:not(.sec-float-hub) :where(h3, .h3) {
	font-size: calc(1.25rem * var(--sec-accessibility-font-scale, 1)) !important;
}

html.sec-font-scaled body > *:not(.sec-float-hub) :where(h4, h5, h6, .h4, .h5, .h6) {
	font-size: calc(1.05rem * var(--sec-accessibility-font-scale, 1)) !important;
}

html.sec-font-scaled .sec-float-hub,
html.sec-font-scaled .sec-float-hub * {
	font-size: revert;
}

/* Grayscale/Contrast Body Modifier */
body.sec-contrast-active {
	background-color: #000000 !important;
}

body.sec-contrast-active > *:not(.sec-float-hub) {
	filter: contrast(145%) brightness(105%);
}

body.sec-contrast-active .sec-float-hub,
body.sec-contrast-active .sec-float-hub * {
	filter: none;
}

/* Floating Hub Container */
.sec-float-hub {
	position: fixed !important;
	z-index: 10050 !important;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	right: 18px !important;
	right: max(18px, env(safe-area-inset-right)) !important;
	left: auto !important;
	bottom: var(--sec-float-offset, 30px) !important;
	bottom: calc(var(--sec-float-offset, 30px) + env(safe-area-inset-bottom)) !important;
	top: auto !important;
	transform: none !important;
	width: 58px !important;
	height: auto !important;
	min-height: 58px;
	max-width: calc(100% - 40px);
	overflow: visible !important;
	pointer-events: none !important;
	isolation: isolate;
}

.sec-float-hub.is-open {
	width: min(300px, calc(100% - 40px)) !important;
}

.sec-float-hub.v-pos-bottom {
	bottom: var(--sec-float-offset, 30px) !important;
	bottom: calc(var(--sec-float-offset, 30px) + env(safe-area-inset-bottom)) !important;
	top: auto !important;
	transform: none !important;
}

.sec-float-hub.v-pos-top {
	top: var(--sec-float-offset, 30px) !important;
	top: calc(var(--sec-float-offset, 30px) + env(safe-area-inset-top)) !important;
	bottom: auto !important;
	transform: none !important;
}

.sec-float-hub.v-pos-middle {
	top: 50% !important;
	bottom: auto !important;
	transform: translateY(-50%) !important;
}

.sec-float-hub.position-bottom-right {
	right: 18px !important;
	right: max(18px, env(safe-area-inset-right)) !important;
	left: auto !important;
	align-items: flex-end;
}

.sec-float-hub.position-bottom-left {
	left: 18px !important;
	left: max(18px, env(safe-area-inset-left)) !important;
	right: auto !important;
	align-items: flex-start;
}

/* Floating Trigger Button (PCRU Royal Purple Gradient with Pulse & Ring) */
.sec-float-trigger {
	width: 58px;
	height: 58px;
	border-radius: 50%;
	background: linear-gradient(135deg, #4c1d95 0%, #5b21b6 50%, #6d28d9 100%) !important;
	color: #FFFFFF !important;
	border: 1.5px solid rgba(216, 180, 254, 0.4) !important;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 8px 24px rgba(76, 29, 149, 0.5), 0 0 16px rgba(168, 85, 247, 0.3) !important;
	transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
	outline: none;
	touch-action: manipulation;
	pointer-events: auto !important;
	position: relative;
}

.sec-float-trigger:hover {
	transform: scale(1.1) rotate(12deg);
	background: linear-gradient(135deg, #5b21b6 0%, #7c3aed 100%) !important;
	border-color: rgba(255, 255, 255, 0.8) !important;
	box-shadow: 0 12px 30px rgba(124, 58, 237, 0.6), 0 0 24px rgba(216, 180, 254, 0.5) !important;
}

.sec-float-trigger.active {
	transform: scale(0.92) rotate(-45deg);
	background: #1e0836 !important;
	border-color: rgba(216, 180, 254, 0.5) !important;
}

.sec-float-trigger .dashicons {
	font-size: 28px;
	width: 28px;
	height: 28px;
	line-height: 28px;
	color: #ffffff;
}

/* Expanding Floating Panel (Glassmorphism Deep Purple Panel) */
.sec-float-panel {
	position: absolute;
	width: min(300px, calc(100% - 40px));
	border-radius: 18px;
	padding: 22px 18px;
	background: linear-gradient(180deg, rgba(30, 8, 54, 0.96) 0%, rgba(16, 3, 32, 0.98) 100%) !important;
	border: 1px solid rgba(216, 180, 254, 0.25) !important;
	box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65), 0 0 25px rgba(124, 58, 237, 0.25) !important;
	backdrop-filter: blur(16px) !important;
	-webkit-backdrop-filter: blur(16px) !important;
	opacity: 0;
	pointer-events: none !important;
	transition: all 0.35s cubic-bezier(0.165, 0.84, 0.44, 1);
	z-index: 99998;
	right: 0;
	max-height: min(72vh, 580px);
	overflow-y: auto;
	overscroll-behavior: contain;
}

/* Expand direction */
.v-pos-bottom .sec-float-panel,
.v-pos-middle .sec-float-panel {
	bottom: 75px;
	top: auto;
	transform: translateY(20px) scale(0.95);
	transform-origin: bottom right;
}

.v-pos-top .sec-float-panel {
	top: 75px;
	bottom: auto;
	transform: translateY(-20px) scale(0.95);
	transform-origin: top right;
}

.sec-float-panel.is-open {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto !important;
}

.position-bottom-left .sec-float-panel {
	right: auto;
	left: 0;
}

/* Panel Header */
.sec-float-panel-header {
	margin-bottom: 15px;
	padding-bottom: 12px;
	border-bottom: 1px solid rgba(216, 180, 254, 0.2);
}

.sec-float-panel-header h3 {
	margin: 0;
	font-size: 15.5px;
	font-weight: 700;
	color: #ffffff;
	letter-spacing: 0.3px;
	display: flex;
	align-items: center;
	gap: 6px;
}

/* Panel Body Rows */
.sec-panel-row {
	margin-bottom: 16px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.sec-panel-row:last-child {
	margin-bottom: 0;
}

.row-label {
	font-size: 12.5px;
	color: rgba(240, 238, 255, 0.85);
	font-weight: 600;
}

.row-controls {
	display: flex;
	gap: 8px;
}

/* Panel Buttons */
.sec-panel-btn {
	flex: 1;
	background: rgba(255, 255, 255, 0.08);
	border: 1px solid rgba(216, 180, 254, 0.25);
	color: #F0EEFF;
	border-radius: 10px;
	padding: 8px 10px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.25s ease;
	outline: none;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 38px;
	touch-action: manipulation;
}

.sec-panel-btn:disabled {
	cursor: not-allowed;
	opacity: 0.45;
}

.sec-panel-btn:hover {
	background: rgba(124, 58, 237, 0.35);
	border-color: rgba(216, 180, 254, 0.6);
	color: #ffffff;
	box-shadow: 0 0 12px rgba(168, 85, 247, 0.3);
}

.sec-panel-btn.active {
	background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
	border-color: rgba(255, 255, 255, 0.4);
	color: #ffffff;
	box-shadow: 0 0 14px rgba(124, 58, 237, 0.5);
}

.btn-full {
	width: 100%;
}

/* Chat Links */
.sec-panel-chat-btn {
	display: block;
	width: 100%;
	padding: 10px 15px;
	border-radius: 10px;
	color: #FFFFFF !important;
	text-align: center;
	text-decoration: none;
	font-size: 13px;
	font-weight: 600;
	transition: all 0.25s ease;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
	border: 1px solid rgba(255, 255, 255, 0.15);
	box-sizing: border-box;
}

.sec-panel-chat-btn:hover {
	transform: translateY(-2px);
	filter: brightness(1.15);
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

/* Responsive adjustments */
@media (max-width: 480px) {
	.sec-float-hub {
		right: 14px !important;
		right: max(14px, env(safe-area-inset-right)) !important;
		max-width: calc(100% - 28px);
	}
	.sec-float-hub.is-open {
		width: calc(100% - 28px) !important;
	}
	.sec-float-panel {
		width: calc(100% - 28px);
		max-height: min(68vh, 520px);
	}
}

/* Fix overlap with Astra / Theme Scroll to top button */
#ast-scroll-top, .ast-scroll-top-icon, .scroll-to-top {
	bottom: calc(var(--sec-float-offset, 30px) + 70px) !important;
	z-index: 10040 !important;
}
