:root {
    --pwl-menu-height: auto;
    --pwl-menu-bg: transparent;
    --pwl-menu-text: #fff;
    --pwl-menu-hover: #658B82;
    --pwl-dropdown-bg: #fff;
    --pwl-dropdown-border: #eeeeee;
    --pwl-category-active-bg: #f0f0f0;
    --pwl-breakpoint: 800px;
}
:root .single-product,
:root .archive,
:root .blog,
:root .single-post,
:root .dark-menu,
:root .open-mega-menu,
:root .scrolled {
    --pwl-menu-text: #1b1b1b;
    --pwl-menu-hover: #658B82;
}

.pwl-mega-menu-container {
    width: 100%;
}

.pwl-mega-menu-container a:hover {
    color: var(--pwl-menu-hover) !important;
    opacity: 1 !important;
}

.pwl-mega-menu {
    position: relative;
    width: 100%;
}

.pwl-mega-menu__container {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    height: var(--pwl-menu-height);
    margin: 0 auto;
    padding: 0 15px;
    position: relative;
}

.pwl-mega-menu__toggle {
    display: none;
    position: relative;
    width: 30px;
    height: 21px;
    cursor: pointer;
    z-index: 100;
    background: transparent;
    border: none;
    padding: 0;
}

/* Separata stilar för fristående toggle-knapp */
.pwl-mega-menu-toggle-container {
    display: inline-block;
}

.pwl-mega-menu-toggle-container .pwl-mega-menu__toggle {
    display: block;
}

.pwl-mega-menu__toggle span {
    display: block;
    position: absolute;
    width: 100%;
    height: 2px;
    background-color: var(--toggle-color, #1b1b1b);
    transition: all 0.1s ease;
}

.pwl-mega-menu__toggle span:nth-child(1) {
    top: 0;
}

.pwl-mega-menu__toggle span:nth-child(2) {
    top: 7px;
}

.pwl-mega-menu__toggle span:nth-child(3) {
    bottom: 0;
}

.pwl-mega-menu__toggle.active span:nth-child(1) {
    transform: rotate(45deg);
    top: 5px;
}

.pwl-mega-menu__toggle.active span:nth-child(2) {
    opacity: 0;
}

.pwl-mega-menu__toggle.active span:nth-child(3) {
    transform: rotate(-45deg);
    bottom: 9px;
}

.pwl-mega-menu__nav {
    display: block;
    width: 100%;
}

.pwl-mega-menu__items {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

.pwl-mega-menu__item {
    position: relative;
    margin: 0 10px 0 10px;
}

.pwl-mega-menu__link {
    display: block;
    padding: 10px 0;
    color: var(--pwl-menu-text);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.1s ease;
}

.top .pwl-mega-menu__dropdown {
    margin-top: 20px;
}
/* Mega Menu Dropdown */
.pwl-mega-menu__dropdown {
    position: fixed;
    top: var(--pwl-menu-height);
    margin-top: 5px;
    left: 0;
    width: 100vw;
    background-color: var(--pwl-dropdown-bg);
    border-top: 1px solid var(--pwl-dropdown-border);
    
    opacity: 0;
    visibility: hidden;
    transform: translateY(0px);
    transition: opacity 0.1s ease, visibility 0.1s ease, transform 0.1s ease, margin-top .2s ease;
    z-index: 100;
}

.pwl-mega-menu__item.open .pwl-mega-menu__dropdown,
.pwl-mega-menu__item:hover .pwl-mega-menu__dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.pwl-mega-menu__dropdown-inner {
    display: grid;
    margin: 0 auto;
    padding: var(--wp--preset--spacing--40);
 
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    max-width: 1200px;
    --pwl-menu-text: #1b1b1b;
    --pwl-menu-hover: #658B82;
}

.pwl-mega-menu__dropdown-inner.column-layout{
    padding-bottom: calc(var(--wp--preset--spacing--40) * 2);
}

/* Column-based layout for categorized mega menu */
.pwl-mega-menu__dropdown-inner.column-layout {
    grid-template-columns: repeat(auto-fit, minmax(100px, 150px));
    gap: 30px;
    max-width: 1000px;
    justify-content: center;
}

/* Simple layout - also centered */
.pwl-mega-menu__dropdown-inner.simple-layout {
    max-width: 1000px;
    justify-content: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* Center the link list in simple layout */
.pwl-mega-menu__dropdown-inner.simple-layout .pwl-mega-menu__link-list {
    text-align: center;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

@media (min-width: 801px) {
    .pwl-mega-menu__dropdown-inner::after{
        content: '';
        display: block;
        width: 100%;
        height: 40px;
        position: absolute;
        top: -25px;
        left: 0;
    }
}

/* Categories - Column Layout */
.pwl-mega-menu__categories {
    display: none; /* Hide categories in column layout */
}

/* Column Layout - Categories as columns */
.pwl-mega-menu__dropdown-inner.column-layout .pwl-mega-menu__category-column {
    display: block;
    border-right: 1px solid rgba(0, 0, 0, 0.15);
    padding-right: 0;
    margin-right: 0;
}

.pwl-mega-menu__dropdown-inner.column-layout .pwl-mega-menu__category-column:last-child {
    border-right: none;
    padding-right: 0;
    margin-right: 0;
}

/* Remove border when category column is next to features */
.pwl-mega-menu__dropdown-inner.column-layout .pwl-mega-menu__category-column:has(+ .pwl-mega-menu__features),
.pwl-mega-menu__dropdown-inner.column-layout .pwl-mega-menu__category-column:last-of-type:not(:last-child) {
    border-right: none;
    padding-right: 0;
    margin-right: 0;
}

/* Category Column Styles */
.pwl-mega-menu__category-column {
    display: none;
}

.pwl-mega-menu__category-column .pwl-mega-menu__category-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--pwl-menu-text);
    margin: 0 0 5px 0;
    padding: 0;
    border: none;
}

.pwl-mega-menu__category-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.pwl-mega-menu__category {
    padding: 0px 0px;
    font-weight: 600;
    margin-bottom: 5px;
    cursor: pointer;
    color: var(--pwl-menu-text);
    position: relative;
    line-height: 1.4;
    width: fit-content;
    padding-right: 15px;
}


.pwl-mega-menu__category:hover {
    color: var(--pwl-menu-hover) !important;
}

.pwl-mega-menu__category.active::after {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    border-right: 2.5px solid #ccc;
    border-bottom: 2.5px solid #ccc;
    transform: rotate(-225deg);
    position: absolute;
    right: 0;
    top: 58%;
    margin-top: -4px;
    animation: slideInFromLeft 0.1s ease-out forwards;
}

@keyframes slideInFromLeft {
    0% {
        opacity: 0;
        transform: translateX(-5px) rotate(-225deg);
    }
    100% {
        opacity: 1;
        transform: translateX(0) rotate(-225deg);
    }
}

/* Links - Column Layout */
.pwl-mega-menu__links {
    display: none; /* Hide old links structure in column layout */
}

.pwl-mega-menu__link-group {
    display: none;
}

.pwl-mega-menu__link-group.active {
    display: block;
    animation: slideDownFade 0.2s ease-out forwards;
}

/* Column Layout - Links within category columns */
.pwl-mega-menu__category-column .pwl-mega-menu__link-list {
    column-count: 1;
    column-gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
}

/* Double column layout within category */
.pwl-mega-menu__category-column.double-column {
    grid-column: span 2;
}

.pwl-mega-menu__category-column.double-column .pwl-mega-menu__link-list {
    column-count: 2;
    column-gap: 15px;
}

.pwl-mega-menu__link-list {
    column-count: 2;
    column-gap: 30px;
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
}

/* Animation for link list when category is clicked */
@keyframes slideDownFade {
    0% {
        opacity: 0;
        transform: translateY(-5px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.pwl-mega-menu__link-item {
    display: inline-block;
    width: 100%;
    max-width: 150px;
    margin: 0;
    text-align: left;
    break-inside: avoid;
}

/* Column Layout - Link items */
.pwl-mega-menu__category-column .pwl-mega-menu__link-item {
    display: block;
    width: 100%;
    max-width: none;
    margin: 0 0 5px 0;
    text-align: left;
}

.pwl-mega-menu__sublink {
    display: block;
    padding: 2px 0;
    color: var(--pwl-menu-text);
    text-decoration: none;
    transition: color 0.1s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    font-weight: 400;
    font-size: 14px;
}

/* Feature Boxes */
.pwl-mega-menu__features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    vertical-align: top;
    margin-left: 50px;
}

/* Column Layout - Feature boxes */
.pwl-mega-menu__dropdown-inner.column-layout .pwl-mega-menu__features {
    grid-column: auto;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    margin-left: 0;
    margin-top: 0;
    padding-top: 0;
    padding-left: 0;
    border-top: none;
    align-self: start;
}

/* Double width feature boxes */
.pwl-mega-menu__feature.double-width {
    grid-column: span 2;
}
@media (max-width: 1100px) {
    .pwl-mega-menu__features {
        grid-template-columns: minmax(200px, 300px);
    }
    .pwl-mega-menu__features > :nth-child(2) {
        display: none;
    }
}

.pwl-mega-menu__feature {
    position: relative;
    background-size: cover;
    background-position: center;
    overflow: hidden;
    aspect-ratio: 4/3;
}

.pwl-mega-menu__feature-link {
    display: grid;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    background-color: rgba(0, 0, 0, 0.3);
    align-items: center;
    justify-content: center;
    transition: background-color 0.1s ease;
}
.pwl-mega-menu__feature-link:hover {
    background-color: rgba(0, 0, 0, 0);
    opacity: 1;
}
.pwl-mega-menu__feature-link:hover .pwl-mega-menu__feature-title {
    color: #fff !important;
    opacity: 1 !important;
}
.pwl-mega-menu__feature-title {
    text-align: center;
    color: #fff;
    margin: 0;
    font-size: var(--wp--preset--font-size--body-lg);
}

/* Simple Mega Menu */
.pwl-mega-menu__dropdown-inner.simple-layout {
    display: block;
}

.pwl-mega-menu__simple-links {
    display: inline-block;
    width: 100%;

}

.pwl-mega-menu__simple-links .pwl-mega-menu__link-list {
    column-count: 2;
    column-gap: 30px;
}

.pwl-mega-menu__simple-links .pwl-mega-menu__link-item {
    display: inline-block;
    width: 100%;
    max-width: 250px;
    width: fit-content;
    margin: 0;
    margin-right: 20px;
    text-align: left;
}

@media (max-width: 800px) {


    /* Göm mobilnavigeringen helt till att börja med */
    .pwl-mega-menu__nav {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: white;
        padding: 60px 20px 20px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
        z-index: 9999;
        opacity: 0;
        visibility: hidden;
    }
    
    /* Visa mobilmenyn med korrekt timing */
    .pwl-mega-menu.mobile-open .pwl-mega-menu__nav {
        transform: translateX(0);
        opacity: 1;
        visibility: visible;
        transition-delay: 0s;
    }
    
    /* Se till att toggle-knappen är synlig */
    .pwl-mega-menu__toggle {
        display: block;
    }
    
    /* Column layout responsive */
    .pwl-mega-menu__dropdown-inner.column-layout {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .pwl-mega-menu__dropdown-inner.column-layout .pwl-mega-menu__features {
        grid-template-columns: 1fr;
        margin-top: 30px;
        padding-top: 30px;
        border-top: 1px solid var(--pwl-dropdown-border);
    }
    
    /* Force single column on mobile even for double column categories */
    .pwl-mega-menu__category-column.double-column {
        grid-column: span 1; /* Reset to single column span on mobile */
    }
    
    .pwl-mega-menu__category-column.double-column .pwl-mega-menu__link-list {
        column-count: 1;
        column-gap: 0;
    }
    
    /* Reset double width feature boxes to single width on mobile */
    .pwl-mega-menu__feature.double-width {
        grid-column: span 1;
    }
}

/* Add this to your existing CSS */
.pwl-mega-menu__sublink[style*="color"] {
    /* This ensures that links with inline color styles keep their color */
    color: inherit !important;
}

.pwl-mega-menu__sublink[style*="color"]:hover {
    /* Lighten the text slightly on hover while keeping its custom color */
    opacity: 0.8 !important;
}
