/* ==========================================================================
   Custom Menu - style frontendu
   Domyslny stan: bialy pasek (#FFF) + delikatny fioletowy akcent.
   ========================================================================== */

.cm-nav,
.cm-nav *,
.cm-nav *::before,
.cm-nav *::after {
	box-sizing: border-box;
}

.cm-nav {
	--cm-accent: #6C4AB6;
	--cm-bg: #ffffff;
	--cm-text: #2a2a2a;
	--cm-border: rgba(108, 74, 182, 0.12);
	--cm-radius: 10px;
	--cm-maxw: 1200px;

	position: relative;
	width: 100%;
	background: var(--cm-bg);
	border-bottom: 1px solid var(--cm-border);
	font-family: inherit;
	z-index: 999;
}

.cm-container {
	max-width: var(--cm-maxw);
	margin: 0 auto;
	padding: 0 24px;
	min-height: 78px;
	display: flex;
	align-items: center;
	gap: 24px;
}

/* -------------------------------- Logo -------------------------------- */
.cm-logo {
	display: inline-flex;
	align-items: center;
	text-decoration: none;
	flex-shrink: 0;
}
.cm-logo img {
	display: block;
	max-height: 48px;
	width: auto;
}
.cm-logo-text {
	font-size: 24px;
	font-weight: 600;
	letter-spacing: 0.3px;
	color: var(--cm-text);
	white-space: nowrap;
}

/* --------------------------- Panel z linkami --------------------------- */
.cm-panel {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 1;
}

.cm-panel-head { display: none; }

.cm-links {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	align-items: center;
	gap: 6px;
	flex: 1;
	justify-content: center; /* linki na srodku */
}

/* Gdy przycisk jest na koncu linkow, nie rozpychamy calej szerokosci */
.cm-btn-inline .cm-links { flex: 0 1 auto; }

.cm-item { position: relative; }

.cm-item-row {
	display: flex;
	align-items: center;
}

.cm-link {
	display: inline-block;
	padding: 10px 16px;
	color: var(--cm-text);
	text-decoration: none;
	font-size: 15px;
	font-weight: 500;
	letter-spacing: 0.2px;
	border-radius: 8px;
	transition: color 0.2s ease, background 0.2s ease;
	white-space: nowrap;
}
.cm-link:hover,
.cm-item:hover > .cm-item-row > .cm-link,
.cm-item.current-menu-item > .cm-item-row > .cm-link {
	color: var(--cm-accent);
}

/* Podkreslenie akcentem na hover */
.cm-link::after {
	content: "";
	display: block;
	height: 2px;
	width: 0;
	margin-top: 4px;
	background: var(--cm-accent);
	border-radius: 2px;
	transition: width 0.25s ease;
}
.cm-item:hover > .cm-item-row > .cm-link::after { width: 100%; }

/* Strzalka rozwijania (na desktopie ozdobna) */
.cm-sub-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: none;
	border: 0;
	padding: 4px;
	cursor: pointer;
	color: inherit;
}
.cm-chevron {
	width: 8px;
	height: 8px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	transition: transform 0.25s ease;
	margin-bottom: 2px;
	opacity: 0.6;
}
.cm-item:hover .cm-chevron { opacity: 1; }

/* ----------------------------- Sub-menu ------------------------------- */
.cm-sub {
	list-style: none;
	margin: 0;
	padding: 8px;
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%) translateY(8px);
	min-width: 210px;
	background: var(--cm-bg);
	border: 1px solid var(--cm-border);
	border-radius: var(--cm-radius);
	box-shadow: 0 12px 30px rgba(40, 20, 70, 0.12);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
	z-index: 50;
}
/* Maly "mostek", by hover nie gubil sie miedzy linkiem a submenu */
.cm-sub::before {
	content: "";
	position: absolute;
	top: -10px;
	left: 0;
	right: 0;
	height: 10px;
}
.cm-item:hover > .cm-sub {
	opacity: 1;
	visibility: visible;
	transform: translateX(-50%) translateY(0);
}
.cm-sublink {
	display: block;
	padding: 10px 14px;
	color: var(--cm-text);
	text-decoration: none;
	font-size: 14px;
	border-radius: 7px;
	transition: background 0.15s ease, color 0.15s ease;
	white-space: nowrap;
}
.cm-sublink:hover {
	background: rgba(108, 74, 182, 0.08);
	color: var(--cm-accent);
}

/* ---------------------------- Przycisk -------------------------------- */
.cm-btn {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 12px 26px;
	background: var(--cm-accent);
	color: #fff;
	text-decoration: none;
	font-size: 15px;
	font-weight: 600;
	letter-spacing: 0.3px;
	border-radius: 0;
	transition: filter 0.2s ease;
}
.cm-btn:hover {
	filter: brightness(0.93);
	color: #fff;
}

/* Domyslnie przycisk "wypchniety" na prawo */
.cm-btn-right .cm-btn { margin-left: auto; }

/* -------------------------- Hamburger --------------------------------- */
.cm-toggle {
	display: none;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: 44px;
	height: 44px;
	margin-left: auto;
	background: none;
	border: 0;
	cursor: pointer;
	padding: 10px;
}
.cm-toggle span {
	display: block;
	height: 2px;
	width: 100%;
	background: var(--cm-text);
	border-radius: 2px;
	transition: transform 0.3s ease, opacity 0.2s ease;
}

.cm-close { display: none; }
.cm-overlay { display: none; }

/* ======================================================================
   MOBILE  (<= 900px)
   ====================================================================== */
@media (max-width: 900px) {
	.cm-container {
		min-height: 66px;
		padding: 0 18px;
	}
	.cm-logo img { max-height: 40px; }
	.cm-logo-text { font-size: 20px; }

	.cm-toggle { display: flex; }

	/* Panel jako wysuwany drawer z prawej strony */
	.cm-panel {
		position: fixed;
		top: 0;
		right: 0;
		height: 100%;
		height: 100dvh;
		width: min(86vw, 360px);
		background: var(--cm-bg);
		flex-direction: column;
		align-items: stretch;
		justify-content: flex-start;
		gap: 0;
		padding: 0 0 32px;
		transform: translateX(100%);
		transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
		box-shadow: -14px 0 40px rgba(30, 15, 55, 0.18);
		overflow-y: auto;
		z-index: 1001;
	}
	.cm-nav.cm-open .cm-panel { transform: translateX(0); }

	.cm-panel-head {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 20px 22px;
		border-bottom: 1px solid var(--cm-border);
		position: sticky;
		top: 0;
		background: var(--cm-bg);
		z-index: 2;
	}
	.cm-panel-title {
		font-size: 18px;
		font-weight: 600;
		color: var(--cm-text);
	}
	.cm-close {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 40px;
		height: 40px;
		font-size: 30px;
		line-height: 1;
		background: none;
		border: 0;
		color: var(--cm-text);
		cursor: pointer;
		border-radius: 8px;
	}
	.cm-close:hover { color: var(--cm-accent); background: rgba(108,74,182,0.06); }

	.cm-links {
		flex-direction: column;
		align-items: stretch;
		justify-content: flex-start;
		gap: 0;
		flex: 0 0 auto;
		padding: 8px 0;
		width: 100%;
	}

	.cm-item {
		border-bottom: 1px solid var(--cm-border);
	}
	.cm-item-row {
		justify-content: space-between;
	}
	.cm-link {
		flex: 1;
		padding: 16px 22px;
		font-size: 17px;
		border-radius: 0;
	}
	.cm-link::after { display: none; }

	.cm-sub-toggle {
		width: 54px;
		height: 54px;
		flex-shrink: 0;
	}
	.cm-chevron { opacity: 0.55; }
	.cm-item.cm-sub-open .cm-chevron { transform: rotate(-135deg); margin-bottom: -2px; }

	/* Sub-menu jako akordeon (rozwija sie w miejscu) */
	.cm-sub {
		position: static;
		transform: none;
		opacity: 1;
		visibility: visible;
		box-shadow: none;
		border: 0;
		border-radius: 0;
		min-width: 0;
		padding: 0;
		background: rgba(108, 74, 182, 0.04);
		max-height: 0;
		overflow: hidden;
		transition: max-height 0.3s ease;
	}
	.cm-sub::before { display: none; }
	.cm-item.cm-sub-open .cm-sub { max-height: 600px; }
	.cm-sublink {
		padding: 14px 22px 14px 38px;
		font-size: 15px;
		border-radius: 0;
	}

	.cm-btn {
		margin: 22px 22px 0;
		padding: 16px 26px;
		width: calc(100% - 44px);
	}
	.cm-btn-right .cm-btn { margin-left: 22px; }

	/* Przyciemnienie tla */
	.cm-overlay {
		display: block;
		position: fixed;
		inset: 0;
		background: rgba(25, 12, 45, 0.45);
		opacity: 0;
		visibility: hidden;
		transition: opacity 0.3s ease, visibility 0.3s;
		z-index: 1000;
	}
	.cm-nav.cm-open .cm-overlay { opacity: 1; visibility: visible; }

	/* Animacja hamburgera w krzyzyk (opcjonalna) */
	.cm-nav.cm-open .cm-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
	.cm-nav.cm-open .cm-toggle span:nth-child(2) { opacity: 0; }
	.cm-nav.cm-open .cm-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}

/* Blokada scrolla body, gdy menu otwarte */
body.cm-no-scroll { overflow: hidden; }
