/**
 * Mega Menu — Shared Base Styles
 *
 * Styles used by both desktop and mobile menus:
 * toggle button, utility items, chevron, back icon, responsive visibility.
 */

/* =========================================================
   TOGGLE BUTTON (shared)
========================================================= */

.mega-toggle {
  height: 25px;
  margin: 0;
  padding: 20px 15px 20px 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: #f7f7f7;
  border: 1px solid #ddd;
  border-radius: 15px;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.mega-toggle:hover {
  background-color: var(--theme-palette-color-1);
}

.mega-toggle-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--theme-palette-color-2);
  white-space: nowrap;
  text-transform: uppercase;
  line-height: 22px;
}

.mega-toggle:hover .mega-toggle-text {
  color: var(--theme-palette-color-8);
}

/* Auto-added toggle (fixed position) */
.mega-toggle-auto {
  position: fixed;
  top: 17.5px;
  left: 20px;
  z-index: 10001;
}

/* Shortcode toggle (inline) */
.mega-toggle-shortcode {
  position: relative;
}

.mega-toggle .icon {
  position: relative;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mega-toggle:hover .icon {
    animation: vibrate 0.3s linear;
}
@keyframes vibrate {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-2px); }
    40% { transform: translateX(2px); }
    60% { transform: translateX(-2px); }
    80% { transform: translateX(2px); }
}

.mega-toggle .icon svg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: opacity 0.25s ease;
  stroke: var(--theme-palette-color-2);
  fill: none;
  stroke-width: 2;
}

.mega-toggle:hover .icon svg {
  stroke: var(--theme-palette-color-8);
}

.mega-toggle .icon-menu {
  opacity: 1;
}

.mega-toggle .icon-close {
  opacity: 0;
}

.mega-toggle.active .icon-menu {
  opacity: 0;
}

.mega-toggle.active .icon-close {
  opacity: 1;
}

/* =========================================================
   UTILITY ITEMS (shared base)
========================================================= */

.mega-utility-item {
  display: flex;
  align-items: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.mega-utility-item .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mega-utility-item .icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* =========================================================
   CHEVRON + ICON (shared base)
========================================================= */

.menu-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.mega-menu li {
  display: flex;
  align-items: center;
  justify-content: flex-start; /* ei center */
}

.mega-icon {
  font-size: 16px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.mega-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 1;            /* vie tilan, työntää chevronin oikealle */
  min-width: 0;
}

.mega-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: var(--theme-palette-color-1, #2196f3);
  color: #fff;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

.mega-menu li > svg:last-child,
.mega-menu li .chevron {
  flex-shrink: 0;
  margin-left: auto;
}

.mega-menu .ct-icon-container svg {
  width: 18px;
  height: 18px;
}

.mega-menu li.mega-level3-meta {
  justify-content: space-between;
  gap: 12px;
}

/* =========================================================
   BACK ICON (shared base)
========================================================= */

.mega-back-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* =========================================================
   RESPONSIVE VISIBILITY
========================================================= */

@media (max-width: 991px) {
  .mega-menu:not(.mobile-menu) {
    display: none !important;
  }
}

@media (min-width: 992px) {
  .mobile-menu {
    display: none !important;
  }
}
