/* Daddy Market - Mega Menu Frontend Styles */

/* Fix merchant theme*/
.header-center-items.header-items.has-logo,
.header-right-items.header-items.has-logo {
    z-index: 998 !important;
}
.header-left-items.header-items.has-logo .site-branding {
    z-index: 999999;
}

/* Ensure no conflicts with Elementor */
.dmk-mega-menu,
.dmk-mega-menu * {
    box-sizing: border-box;
}

.dmk-mega-menu {
    position: relative;
    display: inline-block;
    z-index: 999999;
    /* Default icon size for category items */
    --dmk-icon-size: 20px;
}

.dmk-mega-menu__trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0px 7px;
    background: #f7f7f7;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    color: #263238;
    cursor: pointer;
    transition: background 0.2s;
    margin-left: 10px;
    z-index: 999999;
    border-bottom: 2px solid #a0d654;
}

.dmk-mega-menu__trigger:hover {
    background: #a0d654;
}

.dmk-mega-menu__trigger[aria-expanded="true"] {
    background: #a0d654;
}

.dmk-mega-menu__trigger:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.dmk-mega-menu__icon {
  flex-shrink: 0;
}

/* Animated hamburger icon for the trigger button */
.dmk-icon-hamburger {
  position: relative;
  width: 20px;
  height: 16px;
  display: inline-block;
}

.dmk-icon-hamburger__bar {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease, top 0.2s ease;
}

.dmk-icon-hamburger__bar:nth-child(1) { top: 2px; }
.dmk-icon-hamburger__bar:nth-child(2) { top: 8px; }
.dmk-icon-hamburger__bar:nth-child(3) { top: 14px; }

/* Morph hamburger to close (X) when menu is open */
.dmk-mega-menu--open .dmk-icon-hamburger__bar:nth-child(1) {
  top: 7px;
  transform: rotate(45deg);
}

.dmk-mega-menu--open .dmk-icon-hamburger__bar:nth-child(2) {
  opacity: 0;
}

.dmk-mega-menu--open .dmk-icon-hamburger__bar:nth-child(3) {
  top: 7px;
  transform: rotate(-45deg);
}


.dmk-mega-menu__dropdown {
    /* Fullscreen overlay to blur and dim background */
    position: fixed;
    inset: 0;
    margin: 0;
    background: rgba(17, 24, 39, 0.45); /* dim background */
    backdrop-filter: saturate(100%) blur(4px);
    -webkit-backdrop-filter: saturate(100%) blur(4px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 24px 16px; /* Top spacing from header */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 9999;
}

.dmk-mega-menu__dropdown[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
}

/* Centered, fixed-width inner container */
.dmk-mega-menu__container {
    width: 100%;
    max-width: 1200px; /* constraint per requirements */
    margin-top: 90px;
}

/* Card that holds the actual menu */
.dmk-mega-menu__content {
    display: flex;
    width: 100%;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

.dmk-mega-menu__left {
    flex-shrink: 0;
    width: 250px;
    border-right: 1px solid #e5e7eb;
    padding: 16px 0;
}

.dmk-mega-menu__item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.15s;
}

.dmk-mega-menu__item:hover,
.dmk-mega-menu__item--active {
    background: #f9fafb;
}

.dmk-mega-menu__item-icon {
    flex-shrink: 0;
    color: #6b7280;
    width: var(--dmk-icon-size);
    height: var(--dmk-icon-size);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.dmk-mega-menu__item-icon svg {
    width: 100% !important;
    height: 100% !important;
}

.dmk-mega-menu__item span {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
}

.dmk-mega-menu__right {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    max-height: 500px;
}

.dmk-mega-menu__panel {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
}

.dmk-mega-menu__panel--active {
    display: grid;
}

.dmk-mega-menu__group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dmk-mega-menu__group-title {
    margin: 0 0 4px 0;
    font-size: 15px;
    font-weight: 600;
}

.dmk-mega-menu__group-title a {
    color: #6b7280;
    text-decoration: none;
    transition: color 0.15s;
}

.dmk-mega-menu__group-title a:hover {
    color: #111827;
}

.dmk-mega-menu__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dmk-mega-menu__list-item {
    font-size: 14px;
}

.dmk-mega-menu__list-item--hidden {
    display: none;
}

.dmk-mega-menu__list-item a {
    color: #6b7280;
    text-decoration: none;
    transition: color 0.15s;
}

.dmk-mega-menu__list-item a:hover {
    color: #111827;
}

.dmk-mega-menu__more {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: #777;
    font-size: 14px;
    font-weight: 500;
}
.dmk-mega-menu__more .dmk-more-text { border-bottom: 1px dotted currentColor; line-height: 1; }
.dmk-mega-menu__more .dmk-more-arrow { display: inline-flex; align-items: center; justify-content: center; }
.dmk-mega-menu__more .dmk-more-arrow svg { width: 14px; height: 14px; display: block; }
.dmk-mega-menu__more:hover { color: #111827; }

/* Mobile responsive */
@media (max-width: 768px) {
    .dmk-mega-menu__content {
        flex-direction: column;
    }

    .dmk-mega-menu__left {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
    }

    .dmk-mega-menu__panel {
        grid-template-columns: 1fr;
    }

    .dmk-mega-menu__dropdown {
        /* already full-viewport; keep padding for mobile */
        padding: 12px;
    }
}

/* Prevent page scroll when mega menu is open */
body.dmk-mega-open {
    overflow: hidden;
    overflow-y: scroll;
}
