/* =========================================================
   Let's Code Accessibility — Frontend widget styles
   ========================================================= */

/* ---------------------------------------------------------
   Widget container (fixed, isolated from theme)
   --------------------------------------------------------- */
#lcac-widget,
#lcac-widget *:where(:not(svg):not(svg *)),
#lcac-panel,
#lcac-panel *:where(:not(svg):not(svg *)) {
	all: unset;
	box-sizing: border-box;
}

/* Restore [hidden] behavior — reset by all:unset */
#lcac-panel[hidden],
#lcac-overlay[hidden] {
	display: none !important;
}

#lcac-widget {
	position: fixed;
	bottom: var(--lcac-btn-bottom, 24px);
	top: var(--lcac-btn-top, auto);
	right: var(--lcac-btn-right, 24px);
	left: var(--lcac-btn-left, auto);
	z-index: 999998;
	font-family: Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
	color: #1a1a1a;
}

/* ---------------------------------------------------------
   Trigger button
   --------------------------------------------------------- */
#lcac-trigger {
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--lcac-btn-size, 56px);
	height: var(--lcac-btn-size, 56px);
	border-radius: var(--lcac-btn-border-radius, 200px);
	padding: var(--lcac-btn-padding, 0px);
	background: var(--lcac-btn-bg, #0057b7);
	color: var(--lcac-btn-icon, #ffffff);
	border: none;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
	transition: transform 0.18s ease, box-shadow 0.18s ease;
	outline: none;
	position: relative;
}

#lcac-trigger svg {
	display: block;
	fill: currentColor;
	pointer-events: none;
	width: 26px;
	height: 26px;
}

#lcac-trigger:hover {
	transform: scale(1.06);
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

#lcac-trigger:focus-visible {
	outline: 3px solid var(--lcac-btn-bg, #0057b7);
	outline-offset: 3px;
	box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.8), 0 4px 14px rgba(0, 0, 0, 0.3);
}

/* ---------------------------------------------------------
   Panel
   Note: all panel child selectors are prefixed with #lcac-panel
   so their specificity (0,1,1,0) beats the all:unset rule (0,1,0,0).
   --------------------------------------------------------- */
#lcac-panel {
	position: fixed;
	bottom: calc(var(--lcac-btn-bottom, 24px) + var(--lcac-btn-size, 56px) + 12px);
	top: var(--lcac-btn-top, auto);
	right: var(--lcac-panel-right, 0);
	left: var(--lcac-panel-left, auto);
	width: 300px;
	max-height: min(540px, calc(100svh - var(--lcac-panel-anchor-y, 92px) - var(--lcac-panel-min-edge, 20px)));
	background: #ffffff;
	border-radius: 14px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.1);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	z-index: 999999;
	animation: lcac-panel-in 0.2s ease;
	font-family: Arial, sans-serif;
	font-size: var(--lcac-panel-font-size, 16px);
	line-height: 1.5;
	color: #1a1a1a;
}

@keyframes lcac-panel-in {
	from { opacity: 0; transform: translateY(8px) scale(0.97); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Panel header */
#lcac-panel .lcac-panel-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 16px 12px;
	border-bottom: 1px solid #e8e8e8;
	background: #f7f9fc;
	flex-shrink: 0;
}

#lcac-panel .lcac-panel-heading {
	font-size: 15px;
	font-weight: 600;
	color: #1a1a1a;
	margin: 0;
	flex: 1;
	display: block;
}

#lcac-close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	cursor: pointer;
	color: #666;
	background: transparent;
	border: none;
	transition: background 0.15s, color 0.15s;
	flex-shrink: 0;
}

#lcac-close svg {
	display: block;
	pointer-events: none;
	stroke: currentColor;
	fill: none;
	width: 18px;
	height: 18px;
}

#lcac-close:hover {
	background: #e8e8e8;
	color: #1a1a1a;
}

#lcac-close:focus-visible {
	outline: 2px solid #0057b7;
	outline-offset: 1px;
}

/* Panel body (scrollable) */
#lcac-panel .lcac-panel-body {
	overflow-y: auto;
	overflow-x: hidden;
	flex: 1;
	padding: 4px 0;
	scroll-behavior: smooth;
	display: block;
}

#lcac-panel .lcac-panel-body::-webkit-scrollbar {
	width: 4px;
}

#lcac-panel .lcac-panel-body::-webkit-scrollbar-track {
	background: transparent;
}

#lcac-panel .lcac-panel-body::-webkit-scrollbar-thumb {
	background: #d0d0d0;
	border-radius: 2px;
}

/* Panel footer */
#lcac-panel .lcac-panel-footer {
	padding: 10px 16px;
	border-top: 1px solid #e8e8e8;
	background: #f7f9fc;
	flex-shrink: 0;
	display: block;
}

#lcac-reset {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	color: #555;
	cursor: pointer;
	background: transparent;
	border: 1px solid #ccc;
	border-radius: 6px;
	padding: 6px 12px;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
}

#lcac-reset svg {
	display: block;
	pointer-events: none;
	stroke: currentColor;
	fill: none;
	width: 14px;
	height: 14px;
}

#lcac-reset:hover {
	background: #f0f0f0;
	border-color: #999;
	color: #1a1a1a;
}

#lcac-reset:focus-visible {
	outline: 2px solid #0057b7;
	outline-offset: 2px;
}

/* ---------------------------------------------------------
   Controls — shared
   --------------------------------------------------------- */
#lcac-panel .lcac-control {
	display: block;
	padding: 2px 16px;
	border-bottom: 1px solid #efefef;
}

#lcac-panel .lcac-control:last-child {
	border-bottom: none;
}

/* Toggle control row (mirrors stepper layout) */
#lcac-panel .lcac-toggle-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 12px;
	gap: 10px;
}

#lcac-panel .lcac-ctrl-label {
	font-size: 14px;
	font-weight: 500;
	color: #1a1a1a;
	flex: 1;
	display: block;
}

/* Enable / Disable pill button */
#lcac-panel .lcac-feature-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 4px 14px;
	border-radius: 20px;
	border: 1.5px solid #ccc;
	background: #fff;
	color: #555;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
	flex-shrink: 0;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
	line-height: 1.4;
}

#lcac-panel .lcac-feature-toggle:hover {
	background: #f2f5f9;
	border-color: #0057b7;
	color: #0057b7;
}

#lcac-panel .lcac-feature-toggle.lcac-active {
	background: #0057b7;
	border-color: #004a9e;
	color: #fff;
}

#lcac-panel .lcac-feature-toggle.lcac-active:hover {
	background: #004a9e;
}

#lcac-panel .lcac-feature-toggle:focus-visible {
	outline: 2px solid #0057b7;
	outline-offset: 2px;
}

/* Stepper control */
#lcac-panel .lcac-stepper {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 12px;
	gap: 10px;
}

#lcac-panel .lcac-stepper-controls {
	display: flex;
	align-items: center;
	gap: 4px;
	flex-shrink: 0;
}

#lcac-panel .lcac-stepper-dec,
#lcac-panel .lcac-stepper-inc {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	padding: 5px 4px;
	border-radius: 6px;
	border: 1px solid #ccc;
	background: #fff;
	cursor: pointer;
	font-size: 16px;
	font-weight: 600;
	color: #333;
	transition: background 0.12s, border-color 0.12s;
	line-height: 1;
}

#lcac-panel .lcac-stepper-dec:hover:not(:disabled),
#lcac-panel .lcac-stepper-inc:hover:not(:disabled) {
	background: #f2f5f9;
	border-color: #0057b7;
	color: #0057b7;
}

#lcac-panel .lcac-stepper-dec:focus-visible,
#lcac-panel .lcac-stepper-inc:focus-visible {
	outline: 2px solid #0057b7;
	outline-offset: 1px;
}

#lcac-panel .lcac-stepper-dec:disabled,
#lcac-panel .lcac-stepper-inc:disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

#lcac-panel .lcac-stepper-value {
	font-size: 13px;
	font-weight: 600;
	min-width: 28px;
	text-align: center;
	color: #333;
	display: block;
}

/* Description text */
#lcac-panel .lcac-ctrl-desc {
	font-size: 11.5px;
	color: #777;
	margin: 0 0 6px 12px;
	padding: 0;
	display: block;
}

/* ---------------------------------------------------------
   Overlay
   --------------------------------------------------------- */
#lcac-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.08);
	z-index: 999997;
	display: block;
}

/* ---------------------------------------------------------
   Accessibility feature modifiers (applied on <html>)
   --------------------------------------------------------- */

/* High contrast */
html.lcac-high-contrast,
html.lcac-high-contrast body {
	background-color: #000 !important;
	color: #ffff00 !important;
}

html.lcac-high-contrast *:not(#lcac-widget):not(#lcac-widget *):not(#lcac-panel):not(#lcac-panel *):not(#lcac-overlay) {
	background-color: #000 !important;
	color: #ffff00 !important;
	border-color: #ffff00 !important;
	outline-color: #ffff00 !important;
}

html.lcac-high-contrast a:not(#lcac-panel *) {
	color: #00ffff !important;
}

/* Grayscale — applied to html so that position:fixed elements (eg. cookie banner button)
   remain correctly positioned (html = viewport, so no containing-block shift). */
html.lcac-grayscale {
	filter: grayscale(100%) !important;
}

/* Invert colors — applied to html for the same reason as grayscale.
   The widget (direct html child) is double-inverted to restore its original appearance. */
html.lcac-invert-colors {
	filter: invert(100%) hue-rotate(180deg) !important;
}

html.lcac-invert-colors #lcac-widget,
html.lcac-invert-colors #lcac-overlay {
	filter: invert(100%) hue-rotate(180deg) !important;
}

/* Pause animations — excludes the read-text loader spinner */
html.lcac-pause-animations *:not(#lcac-widget):not(#lcac-widget *):not(#lcac-panel):not(#lcac-panel *):not(#lcac-read-text-loader):not(#lcac-read-text-loader *) {
	animation-play-state: paused !important;
	transition: none !important;
	animation-duration: 0.001ms !important;
}

/* Focus highlight */
html.lcac-focus-highlight *:focus,
html.lcac-focus-highlight *:focus-visible {
	outline: 3px solid #0057b7 !important;
	outline-offset: 3px !important;
	box-shadow: 0 0 0 6px rgba(0, 87, 183, 0.2) !important;
}

/* Underline all links */
html.lcac-links-underline a:not(#lcac-panel *) {
	text-decoration: underline !important;
}

/* Big cursor */
html.lcac-big-cursor,
html.lcac-big-cursor * {
	cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath d='M8 2L8 26L13 21L17 30L20 29L16 20L24 20Z' fill='%23000' stroke='%23fff' stroke-width='1.5'/%3E%3C/svg%3E") 8 2, auto !important;
}

/* Accessible font — forces Arial on all non-widget text */
html.lcac-accessible-font *:not(#lcac-widget):not(#lcac-widget *):not(#lcac-panel):not(#lcac-panel *):not(#lcac-overlay) {
	font-family: Arial, sans-serif !important;
}

/* Hide images — visibility:hidden preserves layout; background-image:none removes CSS/inline bg images */
html.lcac-hide-images img:not(#lcac-widget *):not(#lcac-panel *),
html.lcac-hide-images picture:not(#lcac-widget *):not(#lcac-panel *) {
	visibility: hidden !important;
}

html.lcac-hide-images *:not(#lcac-widget):not(#lcac-widget *):not(#lcac-panel):not(#lcac-panel *):not(#lcac-overlay) {
	background-image: none !important;
}

/* ---------------------------------------------------------
   Select control (language picker, etc.)
   --------------------------------------------------------- */
#lcac-panel .lcac-select-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 12px;
	gap: 10px;
}

#lcac-panel .lcac-select {
	appearance: auto;
	-webkit-appearance: auto;
	font-family: Arial, sans-serif;
	font-size: 12px;
	font-weight: 500;
	color: #333;
	background: #fff;
	border: 1.5px solid #ccc;
	border-radius: 6px;
	padding: 4px 8px;
	cursor: pointer;
	flex-shrink: 0;
	max-width: 150px;
	line-height: 1.4;
	transition: border-color 0.15s;
}

#lcac-panel .lcac-select:hover {
	border-color: #0057b7;
}

#lcac-panel .lcac-select:focus {
	outline: 2px solid #0057b7;
	outline-offset: 1px;
	border-color: #0057b7;
}

/* ---------------------------------------------------------
   Read text loader (fixed pill with spinner)
   --------------------------------------------------------- */
#lcac-read-text-loader {
	position: fixed;
	z-index: 1000000;
	display: flex;
	align-items: center;
	gap: 7px;
	background: rgba(0, 0, 0, 0.75);
	color: #fff;
	font-family: Arial, sans-serif;
	font-size: 12px;
	line-height: 1.4;
	padding: 5px 12px 5px 9px;
	border-radius: 20px;
	pointer-events: none;
	white-space: nowrap;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

#lcac-read-text-loader[hidden] {
	display: none !important;
}

#lcac-read-text-loader .lcac-loader-spinner {
	display: inline-block;
	width: 13px;
	height: 13px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: #fff;
	border-radius: 50%;
	animation: lcac-spin 0.75s linear infinite;
	flex-shrink: 0;
}

#lcac-read-text-loader .lcac-loader-label {
	display: block;
}

@keyframes lcac-spin {
	to { transform: rotate(360deg); }
}

/* ---------------------------------------------------------
   Responsive — mobile (≤600px): panel centered, max 70svh
   --------------------------------------------------------- */
@media (max-width: 600px) {
	#lcac-panel {
		top: 0 !important;
		bottom: 0 !important;
		left: var(--lcac-panel-min-edge, 20px) !important;
		right: var(--lcac-panel-min-edge, 20px) !important;
		width: auto !important;
		max-height: 70svh !important;
		margin: auto;
	}
}

/* ---------------------------------------------------------
   Responsive — very narrow screens (≤380px fallback)
   --------------------------------------------------------- */
@media (max-width: 380px) {
	#lcac-panel {
		left: 12px !important;
		right: 12px !important;
	}
}
