/* AccessiBar Frontend Styles */

#accessibar-root {
	position: fixed;
	z-index: 99999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
	font-size: 16px;
	line-height: 1.4;
	direction: ltr;
}

#accessibar-root *:not(.accessibar-tool):not(.accessibar-panel__header):not(.accessibar-reset),
#accessibar-root *::before,
#accessibar-root *::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

/* Positions */
#accessibar-root.accessibar-pos-bottom-right {
	bottom: 20px;
	right: 20px;
}

#accessibar-root.accessibar-pos-bottom-left {
	bottom: 20px;
	left: 20px;
}

#accessibar-root.accessibar-pos-top-right {
	top: 20px;
	right: 20px;
}

#accessibar-root.accessibar-pos-top-left {
	top: 20px;
	left: 20px;
}

/* Toggle button */
.accessibar-toggle {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	width: var(--accessibar-size);
	height: var(--accessibar-size);
	border: none;
	border-radius: 50%;
	background: var(--accessibar-color);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	padding: 0;
	justify-content: center;
	overflow: hidden;
}

.accessibar-toggle:hover {
	transform: scale(1.1);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.accessibar-toggle:focus-visible {
	outline: 3px solid #000;
	outline-offset: 2px;
}

.accessibar-toggle--with-text {
	width: auto;
	border-radius: 25px;
	padding: 0 16px;
}

.accessibar-toggle svg {
	width: 60%;
	height: 60%;
	flex-shrink: 0;
	fill: currentColor;
}

.accessibar-toggle--with-text svg {
	width: 24px;
	height: 24px;
}

.accessibar-toggle__text {
	font-size: 14px;
	font-weight: 600;
	white-space: nowrap;
}

/* Panel */
.accessibar-panel {
	position: absolute;
	width: 280px;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
	padding: 16px;
	opacity: 0;
	visibility: hidden;
	transform: translateY(10px);
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.accessibar-panel--open {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

/* Panel position relative to button */
.accessibar-pos-bottom-right .accessibar-panel,
.accessibar-pos-bottom-left .accessibar-panel {
	bottom: calc(var(--accessibar-size) + 12px);
}

.accessibar-pos-top-right .accessibar-panel,
.accessibar-pos-top-left .accessibar-panel {
	top: calc(var(--accessibar-size) + 12px);
}

.accessibar-pos-bottom-right .accessibar-panel,
.accessibar-pos-top-right .accessibar-panel {
	right: 0;
}

.accessibar-pos-bottom-left .accessibar-panel,
.accessibar-pos-top-left .accessibar-panel {
	left: 0;
}

/* Panel header */
.accessibar-panel__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 0;
	padding: 2px 4px;
	border-bottom: 1px solid #e5e5e5;
}

.accessibar-panel__title {
	font-size: 15px;
	font-weight: 700;
	color: #1a1a1a;
}

.accessibar-panel__close {
	width: 28px;
	height: 28px;
	border: none;
	background: #f0f0f0;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #666;
	font-size: 18px;
	line-height: 1;
	transition: background 0.15s ease;
}

.accessibar-panel__close:hover {
	background: #ddd;
}

.accessibar-panel__close:focus-visible {
	outline: 2px solid var(--accessibar-color);
	outline-offset: 2px;
}

/* Tool items */
.accessibar-tool {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 2px 4px;
	border-bottom: 1px solid #f0f0f0;
}

.accessibar-tool:last-child {
	border-bottom: none;
}

.accessibar-tool__label {
	font-size: 13px;
	font-weight: 500;
	color: #333;
}

/* Toggle switch */
.accessibar-switch {
	position: relative;
	width: 40px;
	height: 22px;
	flex-shrink: 0;
}

.accessibar-switch input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.accessibar-switch__slider {
	position: absolute;
	inset: 0;
	background: #ccc;
	border-radius: 22px;
	cursor: pointer;
	transition: background 0.2s ease;
}

.accessibar-switch__slider::before {
	content: "";
	position: absolute;
	width: 18px;
	height: 18px;
	left: 2px;
	top: 2px;
	background: #fff;
	border-radius: 50%;
	transition: transform 0.2s ease;
}

.accessibar-switch input:checked + .accessibar-switch__slider {
	background: var(--accessibar-color);
}

.accessibar-switch input:checked + .accessibar-switch__slider::before {
	transform: translateX(18px);
}

.accessibar-switch input:focus-visible + .accessibar-switch__slider {
	outline: 2px solid var(--accessibar-color);
	outline-offset: 2px;
}

/* Font size controls */
.accessibar-fontsize {
	display: flex;
	gap: 4px;
}

.accessibar-fontsize__btn {
	width: 32px;
	height: 28px;
	border: 1px solid #ddd;
	background: #f8f8f8;
	border-radius: 4px;
	cursor: pointer;
	font-size: 12px;
	font-weight: 700;
	color: #333;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s ease;
}

.accessibar-fontsize__btn:hover {
	background: #e8e8e8;
}

.accessibar-fontsize__btn:focus-visible {
	outline: 2px solid var(--accessibar-color);
	outline-offset: 1px;
}

/* Reset button */
.accessibar-reset {
	display: block;
	width: 100%;
	margin-top: 0;
	padding: 8px;
	border: 1px solid #ddd;
	border-radius: 6px;
	background: #f8f8f8;
	color: #666;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s ease;
}

.accessibar-reset:hover {
	background: #eee;
	color: #333;
}

.accessibar-reset:focus-visible {
	outline: 2px solid var(--accessibar-color);
	outline-offset: 2px;
}

/* Hide on mobile */
@media (max-width: 768px) {
	#accessibar-root.accessibar-hide-mobile {
		display: none !important;
	}
}

/* === Accessibility modifier classes (applied to <html>) === */

html.accessibar-contrast,
html.accessibar-contrast body {
	background-color: #1a1a1a !important;
	color: #ffffff !important;
}

html.accessibar-contrast a {
	color: #ffff00 !important;
}

html.accessibar-contrast img {
	filter: brightness(0.9) contrast(1.1);
}

html.accessibar-links a {
	outline: 2px solid #0073e6 !important;
	outline-offset: 2px;
	text-decoration: underline !important;
}

html.accessibar-readable,
html.accessibar-readable body {
	font-family: "OpenDyslexic", sans-serif !important;
}

html.accessibar-readable *:not(#accessibar-root):not(#accessibar-panel) {
	font-family: inherit !important;
}

html.accessibar-readable #accessibar-root,
html.accessibar-readable #accessibar-root * {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif !important;
}

html.accessibar-no-animations *,
html.accessibar-no-animations *::before,
html.accessibar-no-animations *::after {
	animation-duration: 0s !important;
	animation-delay: 0s !important;
	transition-duration: 0s !important;
	transition-delay: 0s !important;
}

html.accessibar-big-cursor,
html.accessibar-big-cursor * {
	cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48'%3E%3Cpath d='M4 4l14 36 5-14 14-5z' fill='%23000' stroke='%23fff' stroke-width='2'/%3E%3C/svg%3E") 4 4, auto !important;
}
