/**
 * ZSMH Mega Menu — CSS
 * Namespace: .zsmh-mega-nav, .mm-*
 * Based on mockup v5.3
 *
 * @version 1.2
 * @since Session 65
 * @updated Session 170 — current page, focus, SVG chevron, panel footer, keyboard nav
 */

/* ============================================================
   DIVI HEADER FIX — restore proper height when hiding Divi nav
   Divi sets header height based on nav items; hiding #top-menu-nav
   collapses it from 85px to ~46px. We force the correct height.
   Values come from CSS custom properties set by megamenu.php
   (reads Divi Customizer settings dynamically).
   ============================================================ */
@media (min-width: 981px) {
	#main-header {
		min-height: var(--mm-header-h, 85px) !important;
	}
	#main-header .container {
		min-height: var(--mm-header-h, 85px) !important;
		position: relative;
	}
	/* Logo container needs to match new height for proper vertical centering.
	   Do NOT override display — Divi's inline-block + helper span handles logo
	   sizing via max-height percentage. display:flex breaks that calculation. */
	.logo_container {
		min-height: var(--mm-header-h, 85px) !important;
	}
}

/* ============================================================
   NAV BAR — sits inside #main-header .container
   Absolutely positioned to vertically center with logo.
   NOTE: we use negative margin instead of transform for centering
   because transform creates a new containing block for position:fixed
   descendants (panels), breaking their viewport-relative width.
   ============================================================ */
.zsmh-mega-nav {
	display: flex;
	align-items: center;
	position: absolute;
	top: 50%;
	margin-top: -21px; /* half of nav height (~43px) — no transform needed */
	right: 50px; /* space for search icon on the right */
	z-index: 200;
}

.mm-nav-inner {
	display: flex;
	align-items: center;
}

.mm-nav-list {
	display: flex;
	align-items: center;
	list-style: none;
	margin: 0;
	padding: 0;
	gap: 0;
}

/* ============================================================
   NAV ITEMS — top level buttons
   ============================================================ */
.mm-nav-item {
	position: relative;
	list-style: none;
	margin: 0;
	padding: 0;
}

.mm-nav-link {
	font-family: var(--font-heading);
	font-size: 14px;
	font-weight: 500;
	color: #666 !important;
	padding: 10px 14px;
	cursor: pointer;
	position: relative;
	transition: color 0.15s ease;
	user-select: none;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	text-decoration: none !important;
	white-space: nowrap;
	letter-spacing: 0.2px;
}

.mm-nav-link::after {
	content: '';
	position: absolute;
	bottom: 2px;
	left: 14px;
	right: 14px;
	height: 2px;
	background: var(--orange, #f19e00);
	transform: scaleX(0);
	transition: transform 0.2s ease;
}

.mm-nav-link:hover,
.mm-nav-item.is-active .mm-nav-link {
	color: #1a1a1a !important;
	font-weight: 700;
	text-decoration: none !important;
}

.mm-nav-link:hover::after,
.mm-nav-item.is-active .mm-nav-link::after {
	transform: scaleX(1);
}

/* Chevron arrow (SVG) */
.mm-nav-chevron {
	width: 10px;
	height: 6px;
	opacity: 0.4;
	transition: transform 0.2s ease, opacity 0.2s ease;
	flex-shrink: 0;
}

.mm-nav-item.is-active .mm-nav-chevron {
	transform: rotate(180deg);
	opacity: 1;
}

/* ============================================================
   FOCUS INDICATORS — WCAG 2.1 keyboard accessibility
   ============================================================ */
.mm-nav-link:focus-visible {
	outline: 2px solid var(--orange, #f19e00);
	outline-offset: 2px;
	border-radius: 4px;
}

.mm-link:focus-visible {
	outline: 2px solid var(--orange, #f19e00);
	outline-offset: 1px;
	background: #f8f8fa;
}

.mm-action-btn:focus-visible {
	outline: 2px solid var(--orange, #f19e00);
	outline-offset: 2px;
}

.mm-contact-line a:focus-visible {
	outline: 2px solid var(--orange, #f19e00);
	outline-offset: 1px;
	border-radius: 3px;
}

/* ============================================================
   CURRENT PAGE INDICATOR — highlights active menu item
   ============================================================ */
.mm-link.is-current {
	background: #fff8ee;
	border-left: 3px solid var(--orange, #f19e00);
	margin-left: -3px;
}

.mm-link.is-current .mm-link-title {
	color: var(--orange, #f19e00);
}

.mm-link.is-current .mm-link-icon {
	transform: scale(1.06);
}

/* MŠ column: green current indicator */
.mm-col-ms .mm-link.is-current {
	background: #f0faf4;
	border-left-color: #27ae60;
}

.mm-col-ms .mm-link.is-current .mm-link-title {
	color: #27ae60;
}

/* ============================================================
   MEGA PANELS — dropdown containers
   ============================================================ */
.mm-panel {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 200;
	background: #fff;
	border-top: 2px solid var(--orange, #f19e00);
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

/* Position panels relative to viewport (full width dropdown)
   Now that .zsmh-mega-nav has no transform, position:fixed
   works correctly relative to the viewport. */
.mm-nav-item .mm-panel {
	position: fixed;
	left: 0;
	right: 0;
	top: auto;
	width: 100%;
}

.mm-panel.is-visible {
	display: block;
	animation: mmFadeIn 0.18s ease forwards;
}

@keyframes mmFadeIn {
	from {
		opacity: 0;
		transform: translateY(-6px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ============================================================
   COLUMN STAGGER ANIMATION
   ============================================================ */
@keyframes mmColFadeIn {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.mm-panel.is-visible .mm-col {
	opacity: 0;
	animation: mmColFadeIn 0.25s ease forwards;
}

.mm-panel.is-visible .mm-col:nth-child(1) { animation-delay: 0ms; }
.mm-panel.is-visible .mm-col:nth-child(2) { animation-delay: 50ms; }
.mm-panel.is-visible .mm-col:nth-child(3) { animation-delay: 100ms; }
.mm-panel.is-visible .mm-col:nth-child(4) { animation-delay: 150ms; }

/* ============================================================
   PANEL INNER — grid container
   ============================================================ */
.mm-inner {
	width: 80%;
	max-width: 1080px;
	margin: 0 auto;
	padding: 24px 0 28px;
	display: grid;
	gap: 0;
}

.mm-inner.cols-3 {
	grid-template-columns: 1fr 1fr 1fr;
}

.mm-inner.cols-4 {
	grid-template-columns: 1fr 1fr 1fr 1fr;
}

/* ============================================================
   COLUMNS
   ============================================================ */
.mm-col {
	padding: 0 24px;
	border-right: 1px solid #ededf0;
}

.mm-col:first-child {
	padding-left: 0;
}

.mm-col:last-child {
	border-right: none;
	padding-right: 0;
}

/* ============================================================
   COLUMN HEADER
   ============================================================ */
.mm-col-header {
	font-family: var(--font-heading);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 1px;
	text-transform: uppercase;
	color: #999;
	padding-bottom: 12px;
	margin-bottom: 2px;
	border-bottom: 1px solid #ededf0;
	display: flex;
	align-items: center;
	gap: 7px;
}

.mm-col-icon {
	font-size: 13px;
	line-height: 1;
}

/* ============================================================
   MŠ COLUMN — subtle green accents
   ============================================================ */
.mm-col-ms .mm-col-header {
	color: #27ae60;
	border-bottom-color: rgba(39, 174, 96, 0.18);
}

.mm-col-ms .mm-link:hover .mm-link-title {
	color: #27ae60;
}

.mm-col-ms .mm-link-icon.green {
	background: rgba(39, 174, 96, 0.12);
}

/* ============================================================
   MENU LINK ITEMS
   ============================================================ */
.mm-link {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 8px 6px;
	border-radius: 6px;
	transition: all 0.15s ease;
	cursor: pointer;
	text-decoration: none;
	color: inherit;
}

.mm-link:hover {
	background: #f8f8fa;
	text-decoration: none;
}

.mm-link:hover .mm-link-icon {
	transform: scale(1.06);
}

.mm-link:hover .mm-link-title {
	color: var(--orange, #f19e00);
}

/* ============================================================
   ITEM ICON
   ============================================================ */
.mm-link-icon {
	width: 26px;
	height: 26px;
	border-radius: 6px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 13px;
	flex-shrink: 0;
	transition: transform 0.15s ease;
	line-height: 1;
	margin-top: 1px;
}

.mm-link-icon.orange { background: #fdf2e1; }
.mm-link-icon.green  { background: #e8f5e9; }
.mm-link-icon.blue   { background: #e8f0fe; }
.mm-link-icon.gray   { background: #f8f8fa; border: 1px solid #ededf0; }
.mm-link-icon.amber  { background: #fef3c7; }
.mm-link-icon.red    { background: #fee2e2; }
.mm-link-icon.warm   { background: #fef5e7; }
.mm-link-icon.purple { background: #f3e8ff; }

/* ============================================================
   ITEM TEXT
   ============================================================ */
.mm-link-text {
	flex: 1;
	min-width: 0;
}

.mm-link-title {
	font-family: var(--font-heading);
	font-size: 13px;
	font-weight: 700;
	color: #1a1a1a;
	line-height: 1.3;
	transition: color 0.12s ease;
	display: flex;
	align-items: center;
	gap: 6px;
}

.mm-link-desc {
	font-size: 11px;
	color: #999;
	margin-top: 1px;
	line-height: 1.4;
	font-family: var(--font-body);
}

/* ============================================================
   SEPARATOR & SUB-HEADER
   ============================================================ */
.mm-sep {
	border: none;
	border-top: 1px solid #ededf0;
	margin: 10px 0;
}

.mm-sub-header {
	font-family: var(--font-heading);
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.8px;
	text-transform: uppercase;
	color: #c4c4c4;
	padding: 10px 6px 6px;
}

/* ============================================================
   BADGES
   ============================================================ */
.mm-badge {
	display: inline-flex;
	align-items: center;
	font-size: 8px;
	font-weight: 700;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	padding: 2px 7px;
	border-radius: 10px;
	white-space: nowrap;
	flex-shrink: 0;
}

.mm-badge-red   { background: #fee2e2; color: #dc2626; }
.mm-badge-green { background: #e8f5e9; color: #27ae60; }
.mm-badge-amber { background: #fef3c7; color: #d97706; }
.mm-badge-blue  { background: #e8f0fe; color: #3b82f6; }
.mm-badge-ms    { background: #27ae60; color: #fff; }

/* ============================================================
   EXTERNAL LINK ARROW (SVG)
   ============================================================ */
.mm-ext-arrow {
	width: 11px;
	height: 11px;
	flex-shrink: 0;
	opacity: 0.5;
	transition: opacity 0.15s ease;
}

.mm-link:hover .mm-ext-arrow,
.mm-action-btn:hover .mm-ext-arrow {
	opacity: 1;
}

/* ============================================================
   PANEL FOOTER — "Zobraziť všetko →" link
   ============================================================ */
.mm-panel-footer {
	border-top: 1px solid #ededf0;
	padding: 12px 0 4px;
	margin-top: 8px;
	text-align: center;
}

.mm-panel-footer-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-family: var(--font-heading);
	font-size: 12px;
	font-weight: 600;
	color: #999 !important;
	text-decoration: none !important;
	padding: 6px 16px;
	border-radius: 6px;
	transition: all 0.15s ease;
}

.mm-panel-footer-link:hover {
	color: var(--orange, #f19e00) !important;
	background: #fff8ee;
}

.mm-panel-footer-link:focus-visible {
	outline: 2px solid var(--orange, #f19e00);
	outline-offset: 2px;
}

.mm-panel-footer-arrow {
	transition: transform 0.15s ease;
}

.mm-panel-footer-link:hover .mm-panel-footer-arrow {
	transform: translateX(3px);
}

/* ============================================================
   CONTACT INFO BLOCK (Kontakt panel)
   ============================================================ */
.mm-contact-block {
	padding: 4px 6px;
}

.mm-contact-label {
	font-size: 11px;
	font-weight: 600;
	color: #1a1a1a;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin-bottom: 4px;
	font-family: var(--font-heading);
}

.mm-contact-line {
	font-size: 12px;
	color: #666;
	padding: 4px 0;
	line-height: 1.5;
	display: flex;
	align-items: center;
	gap: 8px;
	font-family: var(--font-body);
}

.mm-contact-line .contact-icon {
	font-size: 13px;
	flex-shrink: 0;
	width: 18px;
	text-align: center;
	opacity: 0.7;
}

.mm-contact-line strong {
	color: #1a1a1a;
	font-weight: 600;
}

.mm-contact-line a {
	color: var(--orange, #f19e00);
	font-weight: 500;
	text-decoration: none;
}

.mm-contact-line a:hover {
	text-decoration: underline;
}

/* ============================================================
   CTA ACTION (same style as quick actions, with arrow)
   ============================================================ */
.mm-action-cta {
	margin-bottom: 6px;
}

.mm-cta-arrow {
	font-size: 14px;
	opacity: 0.5;
	transition: transform 0.2s ease;
}

.mm-action-cta:hover .mm-cta-arrow {
	transform: translateX(3px);
	opacity: 1;
}

/* ============================================================
   QUICK ACTIONS COLUMN (Kontakt panel)
   ============================================================ */
.mm-col-actions {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding-top: 0 !important;
}

.mm-action-btn {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	border-radius: 10px;
	background: #f8f9fa;
	border: 1px solid #ededf0;
	color: #1a1a1a !important;
	text-decoration: none !important;
	transition: all 0.2s ease;
}

.mm-action-btn:hover {
	background: #fff5e6;
	border-color: var(--orange, #f19e00);
	transform: translateY(-1px);
	box-shadow: 0 3px 10px rgba(241, 158, 0, 0.12);
}

.mm-action-icon {
	width: 36px;
	height: 36px;
	border-radius: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
	flex-shrink: 0;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.mm-action-text {
	flex: 1;
	min-width: 0;
}

.mm-action-title {
	font-family: var(--font-heading);
	font-size: 13px;
	font-weight: 700;
	color: #1a1a1a;
	line-height: 1.3;
	display: flex;
	align-items: center;
	gap: 4px;
}

.mm-action-desc {
	font-family: var(--font-body);
	font-size: 11px;
	color: #999;
	line-height: 1.3;
	margin-top: 1px;
}

.mm-action-btn:hover .mm-action-title {
	color: var(--orange, #f19e00);
}

/* ============================================================
   DIVI OVERRIDES — ensure mega menu renders correctly
   ============================================================ */

/* Fix Divi search icon — Divi's search icon lives in #et-top-navigation.
   When we hide #top-menu-nav, the search icon gets misaligned because
   Divi's padding-top on #et-top-navigation pushes it down. We position
   the search icon container absolutely so it aligns with our mega nav. */
@media (min-width: 981px) {
	/* Position search icon absolutely within #main-header .container,
	   vertically centered using same method as .zsmh-mega-nav
	   (top:50% + negative margin, NOT transform — transform creates
	   containing block issues for fixed descendants). */
	#et_top_search {
		position: absolute !important;
		top: 50% !important;
		right: 0 !important;
		margin-top: -10px !important; /* half of icon height (20px) */
		transform: none !important;
		padding: 0 !important;
		z-index: 201;
	}
	/* The search icon span is 0×0 because ::before is position:absolute.
	   Give it explicit dimensions so it's clickable and visible. */
	#et_search_icon {
		display: inline-block !important;
		position: relative !important;
		width: 20px !important;
		height: 20px !important;
		cursor: pointer;
		font-size: 17px;
	}
}

/* ============================================================
   Divi search overlay — fix overlay over nav links
   ============================================================ */

/* When search is visible, show full-width white bar over nav */
.et_search_outer:has(.et_pb_search_visible) {
	background: #fff;
	z-index: 210;
	display: flex !important;
	align-items: center;
}

.et_pb_search_visible.et_search_form_container {
	display: flex !important;
	align-items: center;
	height: auto !important;
}

.et_pb_search_visible .et-search-form {
	position: static !important;
	max-width: 100% !important;
	width: 100% !important;
	height: auto !important;
	display: flex !important;
	align-items: center;
	gap: 10px;
}

.et_pb_search_visible .et-search-field {
	position: static !important;
	width: 100% !important;
	height: auto !important;
	padding: 10px 16px !important;
	border: 1px solid #ddd !important;
	border-radius: 8px !important;
	font-family: var(--font-body, Inter, sans-serif) !important;
	font-size: 15px !important;
	background: #f8f9fa !important;
	outline: none !important;
	transition: border-color 0.2s ease;
	color: #333 !important;
}

.et_pb_search_visible .et-search-field:focus {
	border-color: var(--orange, #f19e00) !important;
	background: #fff !important;
}

.et_pb_search_visible .et_close_search_field {
	position: static !important;
	flex-shrink: 0;
	width: 30px;
	height: 30px;
	cursor: pointer;
}

/* Reset Divi list styles on mega menu */
.zsmh-mega-nav ul,
.zsmh-mega-nav li {
	list-style: none !important;
	margin: 0 !important;
	padding: 0 !important;
}

/* Override Divi anchor styles */
.mm-panel a,
.mm-panel a:visited {
	color: inherit;
	text-decoration: none;
}

.mm-panel a:hover {
	text-decoration: none;
}

/* Panels are position:fixed and now correctly reference viewport
   (no transform on parent), so width:100% = viewport width */

/* Reset any Divi text transforms on our elements */
.mm-col-header,
.mm-sub-header {
	text-transform: uppercase !important;
}

.mm-link-title,
.mm-link-desc,
.mm-contact-line {
	text-transform: none !important;
}

/* Divi h-tag overrides */
.mm-panel h1, .mm-panel h2, .mm-panel h3,
.mm-panel h4, .mm-panel h5, .mm-panel h6 {
	font-size: inherit;
	line-height: inherit;
	margin: 0;
	padding: 0;
}

/* ============================================================
   RESPONSIVE — hide on mobile (Divi hamburger handles it)
   ============================================================ */
@media (max-width: 980px) {
	.zsmh-mega-nav {
		display: none !important;
	}
}

/* ============================================================
   PRINT — hide mega menu
   ============================================================ */
@media print {
	.zsmh-mega-nav,
	.mm-panel {
		display: none !important;
	}
}
