/**
 * WCAG Menu Widget Styles
 * 
 * @package DM_WCAG_Core
 */

/* ====================================
   SKIP LINK
   ==================================== */
.dm-wcag-skip-link {
	position: absolute;
	top: -999px;
	left: -999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
	z-index: 999999;
}

.dm-wcag-skip-link:focus {
	position: fixed;
	top: 0;
	left: 0;
	width: auto;
	height: auto;
	padding: 15px 20px;
	background: #000;
	color: #fff;
	text-decoration: none;
	font-weight: bold;
	z-index: 999999;
	outline: 3px solid #4CAF50;
	outline-offset: 2px;
}

/* ====================================
   SCREEN READER ONLY TEXT
   ==================================== */
.dm-wcag-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border-width: 0;
}

/* ====================================
   MENU WRAPPER
   ==================================== */
.dm-wcag-menu-wrapper {
	position: relative;
}

/* ====================================
   MAIN MENU
   ==================================== */
.dm-wcag-menu {
	position: relative;
	width: 100%;
	/* Ensure transparent background on desktop unless overridden by specific desktop controls */
	background: transparent;
	color: #FFFFFF !important;
}

.dm-wcag-menu__container {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
}

/* ====================================
   LOGO
   ==================================== */
.dm-wcag-menu__logo {
	flex-shrink: 0;
}

.dm-wcag-menu__logo a {
	display: block;
	line-height: 0;
}

.dm-wcag-menu__logo img {
	max-width: 100%;
	height: auto;
	display: block;
}

/* Focus styles managed by global WCAG settings */

/* ====================================
   MENU LIST
   ==================================== */
.dm-wcag-menu__list {
	display: flex;
	list-style: none;
	margin: 0;
	padding: 0;
	flex-grow: 1;
	justify-content: center;
}

.dm-wcag-menu--vertical .dm-wcag-menu__list {
	flex-direction: column;
	align-items: flex-start;
}

/* ====================================
   MENU ITEMS
   ==================================== */
.dm-wcag-menu__item {
	position: relative;
	margin: 0;
	padding: 0;
	list-style: none;
}

.dm-wcag-menu__item>a {
	display: flex;
	align-items: center;
	text-decoration: none;
	transition: color 0.3s ease, background-color 0.3s ease;
	cursor: pointer;
}

/* Focus styles managed by global WCAG settings */

.dm-wcag-menu__dropdown-indicator {
	display: inline-flex;
	margin-left: 5px;
	transition: transform 0.3s ease;
}

.dm-wcag-menu__item[aria-expanded="true"] .dm-wcag-menu__dropdown-indicator {
	transform: rotate(180deg);
}

/* ====================================
   SUBMENU / DROPDOWN
   ==================================== */
.dm-wcag-menu__submenu {
	position: absolute;
	top: 100%;
	left: 0;
	min-width: 200px;
	margin: 0;
	padding: 0;
	list-style: none;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-10px);
	transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0.3s;
	z-index: 1000;
}

.dm-wcag-menu__item[aria-expanded="true"]>.dm-wcag-menu__submenu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
	transition: opacity 0.3s ease, transform 0.3s ease;
}

.dm-wcag-menu__submenu .dm-wcag-menu__item {
	display: block;
	width: 100%;
}

.dm-wcag-menu__submenu .dm-wcag-menu__item>a {
	padding: 10px 20px;
	display: block;
	width: 100%;
	white-space: nowrap;
	transition: background-color 0.3s ease, color 0.3s ease;
}

.dm-wcag-menu__submenu .dm-wcag-menu__item>a:hover,
.dm-wcag-menu__submenu .dm-wcag-menu__item>a:focus {
	background-color: rgba(255, 255, 255, 0.1);
	border-radius: 0;
	/* Domyślnie ostre krawędzie dla środkowych elementów */
}

/* Pierwszy element - zaokrąglone tylko górne rogi (dziedziczone z kontenera) */
.dm-wcag-menu__submenu .dm-wcag-menu__item:first-child>a:hover,
.dm-wcag-menu__submenu .dm-wcag-menu__item:first-child>a:focus {
	border-radius: inherit;
	border-bottom-left-radius: 0;
	border-bottom-right-radius: 0;
}

/* Ostatni element - zaokrąglone tylko dolne rogi (dziedziczone z kontenera) */
.dm-wcag-menu__submenu .dm-wcag-menu__item:last-child>a:hover,
.dm-wcag-menu__submenu .dm-wcag-menu__item:last-child>a:focus {
	border-radius: inherit;
	border-top-left-radius: 0;
	border-top-right-radius: 0;
}

/* ====================================
   CTA BUTTON
   ==================================== */
.dm-wcag-menu__cta-wrapper {
	flex-shrink: 0;
	margin-left: auto;
}

.dm-wcag-menu__cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
	transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease;
	cursor: pointer;
	white-space: nowrap;
}

/* Focus styles managed by global WCAG settings */

.dm-wcag-menu__cta:active {
	transform: scale(0.98);
}

.dm-wcag-menu__cta-icon {
	display: inline-flex;
	align-items: center;
}

/* ====================================
   MOBILE TOGGLE
   ==================================== */
.dm-wcag-menu__toggle {
	display: none;
	flex-direction: column;
	justify-content: space-around;
	width: 30px;
	height: 25px;
	background: transparent;
	border: none;
	cursor: pointer;
	padding: 0;
	z-index: 10;
}

/* Focus styles managed by global WCAG settings */

.dm-wcag-menu__toggle span {
	width: 100%;
	height: 3px;
	background-color: currentColor;
	transition: all 0.3s ease;
	transform-origin: center;
}

.dm-wcag-menu__toggle[aria-expanded="true"] span:nth-child(1) {
	transform: translateY(11px) rotate(45deg);
}

.dm-wcag-menu__toggle[aria-expanded="true"] span:nth-child(2) {
	opacity: 0;
}

.dm-wcag-menu__toggle[aria-expanded="true"] span:nth-child(3) {
	transform: translateY(-11px) rotate(-45deg);
}

/* ====================================
   HIGH CONTRAST MODE SUPPORT
   ==================================== */
@media (prefers-contrast: high) {

	/* High contrast focus styles managed by global WCAG settings */
}

/* ====================================
   REDUCED MOTION SUPPORT
   ==================================== */
@media (prefers-reduced-motion: reduce) {

	.dm-wcag-menu__item>a,
	.dm-wcag-menu__cta,
	.dm-wcag-menu__dropdown-indicator,
	.dm-wcag-menu__submenu,
	.dm-wcag-menu__toggle span {
		transition: none;
	}
}

/* ====================================
   OFFCANVAS CONTAINER - BASE STYLES
   Background color controlled by Elementor on all devices
   ==================================== */
.dm-wcag-menu__offcanvas-container {
	display: flex;
	flex-direction: column;
	flex-grow: 1;
}

/* ====================================
   DESKTOP STYLES (above mobile breakpoint)
   On desktop, the container flows normally in the document.
   ==================================== */
@media screen and (min-width: 769px) {
	.dm-wcag-menu__offcanvas-container {
		flex-direction: row;
		align-items: center;
		position: static;
		visibility: visible;
		opacity: 1;
		transform: none;
	}

	/* Hide mobile-only elements on desktop */
	.dm-wcag-menu__panel-header,
	.dm-wcag-menu__panel-backdrop,
	.dm-wcag-menu__footer {
		display: none;
	}

	/* Items wrapper flows normally on desktop */
	.dm-wcag-menu__items-wrapper {
		display: flex;
		flex-grow: 1;
		padding: 0;
		overflow: visible;
	}

	/* Ensure list and items are transparent on desktop */
	.dm-wcag-menu__list,
	.dm-wcag-menu__item {
		background-color: transparent !important;
	}

	/* Force container transparency on desktop to override any Elementor settings */
	body .dm-wcag-menu__offcanvas-container {
		background-color: transparent !important;
	}
}

/* ====================================
   MOBILE/TABLET MENU STYLES
   ==================================== */
@media screen and (max-width: 768px) {

	.dm-wcag-menu__toggle {
		display: flex;
	}

	/* Offcanvas container - full screen panel */
	.dm-wcag-menu__offcanvas-container {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		flex-direction: column;
		align-items: stretch;
		justify-content: flex-start;
		opacity: 0;
		visibility: hidden;
		transform: translateX(-100%);
		transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0.3s;
		z-index: 999;
		overflow: hidden;
		/* Background color is controlled by Elementor */
	}

	.dm-wcag-menu__toggle[aria-expanded="true"]~.dm-wcag-menu__offcanvas-container {
		opacity: 1;
		visibility: visible;
		transform: translateX(0);
		transition: opacity 0.3s ease, transform 0.3s ease;
	}

	/* Show mobile-only elements */
	.dm-wcag-menu__panel-header {
		display: flex;
		flex-shrink: 0;
		order: 0;
		/* First item - at top */
	}

	.dm-wcag-menu__panel-backdrop {
		display: block;
	}

	/* Items wrapper - scrollable middle section, takes remaining space */
	.dm-wcag-menu__items-wrapper {
		flex-grow: 1;
		flex-shrink: 1;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		padding: 20px;
		order: 1;
		/* Middle */
	}

	/* Footer - always at bottom */
	.dm-wcag-menu__footer {
		display: flex;
		flex-shrink: 0;
		margin-top: auto;
		order: 2;
		/* Last item - at bottom */
	}

	/* Reset List Styles for Mobile */
	.dm-wcag-menu__list {
		display: flex;
		flex-direction: column;
		margin: 0;
		padding: 0;
	}

	.dm-wcag-menu__item {
		border-bottom: 1px solid rgba(255, 255, 255, 0.1);
	}

	.dm-wcag-menu__item:not(:last-child) {
		margin-right: 0;
	}

	.dm-wcag-menu__item>a {
		padding: 15px 10px;
		width: 100%;
		justify-content: space-between;
	}

	.dm-wcag-menu__submenu {
		position: static;
		transform: none;
		opacity: 1;
		visibility: visible;
		background: rgba(255, 255, 255, 0.05);
		margin-top: 0;
		display: none;
	}

	.dm-wcag-menu__item[aria-expanded="true"]>.dm-wcag-menu__submenu {
		display: block;
	}

	.dm-wcag-menu__cta-wrapper {
		margin-left: 0;
		margin-top: 20px;
		padding: 0 10px;
	}

	.dm-wcag-menu__cta {
		width: 100%;
		justify-content: center;
	}
}

/* ====================================
   HAMBURGER POSITION
   ==================================== */
.dm-wcag-menu--hamburger-left .dm-wcag-menu__toggle {
	order: -1;
}

/* ====================================
   MOBILE LOGO
   ==================================== */
.dm-wcag-menu__logo--mobile {
	display: none !important;
}

@media screen and (max-width: 768px) {
	.dm-wcag-menu__logo--desktop {
		display: none !important;
	}

	.dm-wcag-menu__logo--mobile {
		display: block !important;
	}

	/* Hide CTA on Mobile */
	.dm-wcag-menu--hide-cta-mobile .dm-wcag-menu__cta-wrapper {
		display: none !important;
	}
}

/* ====================================
   MOBILE PANEL COMPONENTS
   ==================================== */

/* Backdrop Overlay */
.dm-wcag-menu__panel-backdrop {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: rgba(0, 0, 0, 0.5);
	z-index: 998;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.dm-wcag-menu__toggle[aria-expanded="true"]~.dm-wcag-menu__panel-backdrop {
	opacity: 1;
	visibility: visible;
	transition: opacity 0.3s ease;
}

/* Panel Header - Sticky Top Bar (Flex Item) */
.dm-wcag-menu__panel-header {
	display: none;
	flex-shrink: 0;
	justify-content: space-between;
	align-items: center;
	padding: 15px 20px;
	box-sizing: border-box;
	background: inherit;
	z-index: 10;
	border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Footer (Flex Item) */
.dm-wcag-menu__footer {
	display: none;
	/* Flex by default when active */
	flex-shrink: 0;
	align-items: center;
	padding: 20px;
	margin-top: auto;
	box-sizing: border-box;
	border-top: 1px solid rgba(255, 255, 255, 0.1);
	flex-wrap: wrap;
	/* Allow wrapping on small screens */
	z-index: 10;
}

/* Panel Logo */
.dm-wcag-menu__panel-logo {
	flex-shrink: 0;
	order: 0;
}

.dm-wcag-menu__panel-logo img {
	max-height: 40px;
	width: auto;
	display: block;
}

/* Close Button */
.dm-wcag-menu__close {
	display: flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: none;
	padding: 8px;
	cursor: pointer;
	color: inherit;
	transition: background-color 0.3s ease, color 0.3s ease, opacity 0.3s ease;
	margin-left: auto;
	order: 1;
}

.dm-wcag-menu__close svg {
	width: 24px;
	height: 24px;
	display: block;
}

@media screen and (max-width: 768px) {
	.dm-wcag-menu__panel-backdrop {
		display: block;
	}

	.dm-wcag-menu__panel-header {
		display: flex;
	}

	/* Removed padding-top override as it's handled by flex layout now */

	.dm-wcag-menu__footer {
		display: flex;
		justify-content: center;
		/* Default centering, overridden by Elementor settings if valid selectors exist */
		gap: 20px;
		padding-bottom: 30px;
	}

	/* Mobile Menu Footer Specifics */
	.mobile-menu-footer {
		/* Ensures flex is active even if dm-wcag class has issues */
		display: flex;
		justify-content: center;
		gap: 20px;
		padding-bottom: 30px;
	}

	.mobile-footer-item {
		display: flex;
		align-items: center;
		gap: 8px;
		text-decoration: none;
		color: inherit !important;
	}

	.footer-item-label {
		font-size: 14px;
		/* Optional: Add more specific styling if needed */
	}
}

/* ====================================
   FOCUS VISIBLE POLYFILL
   ==================================== */
/* Focus visible styles managed by global WCAG settings */

/* ====================================
   ANIMATIONS
   ==================================== */
@keyframes dmMenuFadeIn {
	from {
		opacity: 0;
		transform: translateY(10px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Staggered Animation Logic - Only when enabled */
@media screen and (max-width: 768px) {
	.dm-wcag-menu--animate-stagger .dm-wcag-menu__offcanvas-container .dm-wcag-menu__item {
		opacity: 0;
		animation: dmMenuFadeIn 0.4s ease forwards;
	}

	.dm-wcag-menu--animate-stagger .dm-wcag-menu__toggle[aria-expanded="true"]~.dm-wcag-menu__offcanvas-container .dm-wcag-menu__item {
		/* Animation is triggered when container opens */
	}

	/* Stagger Delays */
	.dm-wcag-menu--animate-stagger .dm-wcag-menu__item:nth-child(1) {
		animation-delay: 0.05s;
	}

	.dm-wcag-menu--animate-stagger .dm-wcag-menu__item:nth-child(2) {
		animation-delay: 0.1s;
	}

	.dm-wcag-menu--animate-stagger .dm-wcag-menu__item:nth-child(3) {
		animation-delay: 0.15s;
	}

	.dm-wcag-menu--animate-stagger .dm-wcag-menu__item:nth-child(4) {
		animation-delay: 0.2s;
	}

	.dm-wcag-menu--animate-stagger .dm-wcag-menu__item:nth-child(5) {
		animation-delay: 0.25s;
	}

	.dm-wcag-menu--animate-stagger .dm-wcag-menu__item:nth-child(6) {
		animation-delay: 0.3s;
	}

	.dm-wcag-menu--animate-stagger .dm-wcag-menu__item:nth-child(7) {
		animation-delay: 0.35s;
	}

	.dm-wcag-menu--animate-stagger .dm-wcag-menu__item:nth-child(8) {
		animation-delay: 0.4s;
	}

	.dm-wcag-menu--animate-stagger .dm-wcag-menu__item:nth-child(9) {
		animation-delay: 0.45s;
	}

	.dm-wcag-menu--animate-stagger .dm-wcag-menu__item:nth-child(10) {
		animation-delay: 0.5s;
	}
}

/* ====================================
   CONTACT ACTIONS (Floating Buttons)
   ==================================== */
.contact-actions-wrapper {
	flex-shrink: 0;
	margin-left: auto;
	display: flex;
	gap: 10px;
	align-items: center;
}

/* Parent Alignment Fix - Desktop Centering */
@media (min-width: 1025px) {
	.contact-actions-wrapper {
		position: absolute;
		right: 0;
		top: 50%;
		transform: translateY(-50%);
		/* Moves it up by half its height -> True Center */
		display: flex;
		align-items: center;
		/* Ensures children are centered in the flex line */
		justify-content: flex-end;
		z-index: 100;
	}
}

.expandable-btn {
	display: flex;
	align-items: center;
	/* Vertically center text relative to icon */
	background-color: var(--btn-bg, var(--cta-color, #28a745));
	/* Fallback green */
	border-radius: 50px;
	/* Pill shape */
	overflow: hidden;
	/* Hide text when closed */

	/* Initial State (Circle) */
	width: auto;
	/* Allow auto width */
	max-width: 50px;
	/* Constrain to circle size */
	height: 50px;
	min-width: 50px;
	/* Prevent crushing */

	/* Animation Physics - Hydraulic Luxury Feel */
	transition: max-width 0.8s cubic-bezier(0.19, 1, 0.22, 1), background-color 0.3s ease;
	will-change: max-width;
	/* Optimize performance */

	text-decoration: none;
	padding: 0;
	position: relative;
	border: none;
	outline: none;
	color: #FFFFFF !important;
}

.expandable-btn:hover,
.expandable-btn:focus {
	background-color: var(--btn-bg, var(--cta-color, #28a745));
	color: var(--btn-color, white);
}

/* Safe Zone (Anti-Jitter) */
.expandable-btn::before {
	content: '';
	position: absolute;
	top: -15px;
	bottom: -15px;
	left: -10px;
	right: -10px;
	z-index: -1;
}

/* Icon Centering Fix */
.expandable-btn .icon-wrapper {
	display: flex;
	/* Enable Flexbox */
	justify-content: center;
	/* Center Horizontally */
	align-items: center;
	/* Center Vertically */
	width: 50px;
	/* Fixed Width of the circle */
	height: 50px;
	/* Fixed Height of the circle */
	min-width: 50px;
	/* Prevent crushing */
	border-radius: 50%;
	/* Ensure it's a perfect circle */
	margin: 0;
	/* Reset margins */
	padding: 0;
	/* Reset padding */
	line-height: 0;
	/* Kill line-height issues */
	flex-shrink: 0;
}

.expandable-btn i,
.expandable-btn svg {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
	color: inherit;
	fill: currentColor;
	display: block;
	z-index: 1;
}

.expandable-btn .btn-text {
	white-space: nowrap;
	/* Never wrap text */
	opacity: 0;
	visibility: hidden;
	/* Delay appearance so it fades in gracefully as space opens */
	transition: opacity 0.3s ease, visibility 0s linear 0.3s;
	margin-left: 5px;
	font-weight: 600;
	font-size: 15px;
	color: inherit;
	z-index: 1;
	line-height: 1.2;
}

/* Hover State - Desktop Only */
@media (min-width: 1024px) {

	.expandable-btn:hover,
	.expandable-btn.is-active {
		max-width: 400px;
		/* Allow expansion to fit content */
		padding-right: 20px;
		/* Add breathing room at the end */
	}

	.expandable-btn:hover .btn-text,
	.expandable-btn.is-active .btn-text {
		opacity: 1;
		visibility: visible;
		transition: opacity 0.3s ease, visibility 0s linear 0s;
		margin-left: 5px;
		/* Small gap between icon and text */
	}
}

/* Hide default WordPress skip links to avoid duplication */
.skip-link:not(.dm-wcag-skip-link),
a[href="#content"]:not(.dm-wcag-skip-link),
.screen-reader-shortcut:not(.dm-wcag-skip-link) {
	display: none !important;
}

/* Mobile/Tablet Layout (Floating Action Buttons) */
@media screen and (max-width: 1023px) {
	.contact-actions-wrapper {
		position: fixed;
		bottom: 20px;
		right: 20px;
		z-index: 9999;
		display: flex;
		flex-direction: column-reverse;
		/* Stack from bottom up */
		align-items: flex-end;
		/* CRITICAL: Anchor to Right Edge */
		gap: 15px;
		margin: 0;
		padding: 0;
		pointer-events: none;
		/* Let clicks pass through empty space */
	}

	.expandable-btn {
		width: auto;
		/* Allow max-width to control size */
		height: 50px;
		min-width: 50px;
		max-width: 50px;
		padding: 0;
		box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
		pointer-events: auto;
		/* Re-enable clicks on buttons */
	}

	/* Disable hover expansion on mobile */
	.expandable-btn:hover {
		max-width: 50px;
		padding: 0;
	}

	.expandable-btn .btn-text {
		display: inline-block;
		/* Ensure it exists but is hidden by opacity/overflow */
	}

	/* Ensure icons are centered */
	.expandable-btn i,
	.expandable-btn svg {
		margin: 0;
	}

	/* Smart Scroll - Hidden State */
	.contact-actions-wrapper.fab-hidden {
		transform: translateY(150px);
	}

	/* Smooth Transition for Smart Scroll */
	.contact-actions-wrapper {
		transition: transform 0.4s ease;
	}

	/* 2-Step Click Logic - Active State (Expanded) */
	.expandable-btn.is-active {
		max-width: calc(100vw - 80px) !important;
		/* Allow growth but cap it at screen width minus safety margin */
		padding-right: 15px;
		/* Add breathing room */
	}

	.expandable-btn.is-active .btn-text {
		opacity: 1;
		visibility: visible;
		transition: opacity 0.3s ease, visibility 0s linear 0s;
		margin-left: 5px;
	}

	.expandable-btn .btn-text {
		white-space: nowrap;
		/* Keep on one line */
		overflow: hidden;
		/* Cut off excess */
		text-overflow: ellipsis;
		/* Add "..." if too long */
		display: block;
		/* Needed for ellipsis */
	}

	.expandable-btn.is-active i,
	.expandable-btn.is-active svg {
		margin: 0;
	}
}

/* ====================================
   DESKTOP LAYOUT FIX (Absolute Position CTA)
   ==================================== */
@media screen and (min-width: 1024px) {

	/* Make the main widget container relative so absolute children stay inside */
	.elementor-widget-container,
	.mobile-menu-main-bar {
		position: relative;
	}

	/* Float the CTA to the right */
	.contact-actions-wrapper {
		position: absolute;
		right: 0;
		top: 50%;
		transform: translateY(-50%);
		z-index: 10;
		margin: 0;
	}

	/* Ensure Menu Links are centered or positioned independently */
	.mobile-menu-items-wrapper {
		justify-content: center;
		width: 100%;
		padding-right: 120px;
		/* Reserve space for CTA */
	}

	/* If standard list logic is used */
	.dm-wcag-menu__list {
		justify-content: center;
		width: 100%;
	}
}