/* WooCommerce Mega Menu Styles - Fixed Version */

@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@200..700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap');
/* Base menu structure */
.wc-mega-menu-container {
    position: relative;
    z-index: 999;
    width: 100%;
    max-width: 100%; /* Forhindrer container i at gå ud over parent */
    overflow: hidden; /* Sikrer at intet går uden for container */
    box-sizing: border-box; /* Inkluderer padding i width beregning */
}

.wc-mega-menu {
    display: flex;
    list-style: none;
    margin: 0;
    font-family: "korolev", sans-serif;
    padding: 0;
    align-items: center;
    justify-content: space-between;
    gap: 3px; /* Reduceret gap */
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.wc-mega-menu > li {
    position: relative;
    margin: 0;
    padding: 0;
    flex: 0 1 auto; /* Flex-grow: 0, flex-shrink: 1, flex-basis: auto */
    min-width: 0; /* Vigtig for at flex-shrink virker med text overflow */
    overflow: hidden; /* Forhindrer overflow fra li elementer */
}

.wc-mega-menu > li > a {
    display: inline-flex;
    align-items: center;
    padding: 4px 6px; /* Reduceret padding */
    font-size: 16px; /* Lidt mindre standard størrelse */
    color: #000;
    text-decoration: none;
    font-weight: 600;
    transition: font-size 0.2s ease, color 0.2s ease;
    text-transform: uppercase;
    letter-spacing: -0.2px; /* Lidt tættere bogstavafstand */
    white-space: nowrap;
    overflow: hidden; /* Forhindrer tekst overflow */
    text-overflow: ellipsis; /* Tilføjer ... hvis teksten er for lang */
}

/* Media queries for mere kontrol */
@media (max-width: 1400px) {
    .wc-mega-menu > li > a {
        font-size: 15px;
        padding: 4px 6px;
    }
}

@media (max-width: 1200px) {
    .wc-mega-menu > li > a {
        font-size: 14px;
        padding: 4px 5px;
    }
}

@media (max-width: 992px) {
    .wc-mega-menu > li > a {
        font-size: 13px;
        padding: 3px 4px;
        letter-spacing: -0.3px;
    }
}

@media (max-width: 768px) {
    .wc-mega-menu > li > a {
        font-size: 12px;
        padding: 3px 3px;
        letter-spacing: -0.4px;
    }
    .wc-mega-menu {
        gap: 2px; /* Endnu mindre gap på mobile */
    }
}

@media (max-width: 576px) {
    .wc-mega-menu > li > a {
        font-size: 11px;
        padding: 2px 2px;
        letter-spacing: -0.5px;
    }
    .wc-mega-menu {
        gap: 1px;
    }
}

.wc-mega-menu > li:hover > a {
    border-radius: 12px;
    color: #8c7131;
}

/* Active state for dropdown */
.wc-mega-menu > li.active-dropdown > a {
    border-radius: 12px;
    color: #8c7131;
    position: relative;
}

/* Arrow indicator for active menu */
.wc-mega-menu > li.active-dropdown > a:after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    margin-left: -8px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid #fff;
    z-index: 1000;
}

/* DROPDOWN ENTRANCE ANIMATION - Only on first open */
.wc-mega-menu-dropdown,
.wc-dropdown-menu {
    display: block;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    
    transform: translateY(-10px);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    
    transition: opacity 0.25s ease, visibility 0s linear 0.25s, transform 0.25s ease, min-height 0.3s ease, max-height 0.3s ease;
    
    background-color: #fff !important;
}

/* Active/Open states - ENTRANCE ANIMATION */
.wc-menu-type-mega.active-dropdown .wc-mega-menu-dropdown,
.wc-menu-type-dropdown.active-dropdown .wc-dropdown-menu {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    
    transition: opacity 0.25s ease, visibility 0s, transform 0.25s ease, min-height 0.3s ease, max-height 0.3s ease;
    
    background-color: #fff !important;
}

/* Hot zone to prevent dropdown closing */
.wc-mega-menu-hot-zone {
    position: absolute;
    left: 0;
    right: 0;
    height: 30px;
    bottom: -30px;
    z-index: 999;
}

/* Mega Menu Dropdown - Auto Height with CSS Flexbox */
.wc-mega-menu-dropdown {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    width: 100%;
    background-color: #fff;
    padding: 50px 0px 30px 0px;
    z-index: 998;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: auto;
    
    /* AUTO HEIGHT - Let content determine height naturally */
    min-height: 500px;
    height: auto; /* Auto height based on content */
    overflow: visible; /* Allow content to expand naturally */
}

/* Inner container - Auto sizing */
.wc-mega-menu-dropdown-inner {
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    padding: 20px 20px 0px 20px;
    
    /* AUTO HEIGHT */
    min-height: 420px;
    height: auto; /* Let content determine height */
    position: relative;
    overflow: visible; /* Allow content expansion */
}

/* Main content layout - Flexbox auto sizing */
.wc-mega-menu-content {
    display: flex;
    width: 100%;
    gap: 30px;
    
    /* AUTO HEIGHT with flexbox */
    min-height: 420px;
    height: auto; /* Let content determine height */
    align-items: stretch;
}

/* Left sidebar category section - NO SCROLLBAR */
.wc-mega-menu-categories {
    width: 35%;
    min-width: 300px;
    max-width: 400px;
    border-right: 1px solid #f0f0f0;
    padding-right: 25px;
    
    height: 100%;
    overflow: visible; /* NO SCROLLBAR - content expands dropdown instead */
}

.wc-mega-menu-categories-title h3 {
    font-family: "korolev", sans-serif;
    font-size: 20px;
    margin: 0 0 20px;
    color: #000;
    font-weight: 600;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wc-mega-menu-category-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.wc-mega-menu-category {
    margin-bottom: 8px !important; /* Force consistent spacing */
    position: relative;
    border-radius: 4px;
    cursor: pointer;
    
    /* REMOVE ALL TRANSFORMS */
    transform: none !important;
    transition: background-color 0.2s ease;
}

.wc-mega-menu-category:hover {
    transform: none !important;
    margin-bottom: 8px !important; /* Maintain spacing on hover */
}

.wc-mega-menu-category.active {
    margin-bottom: 8px !important; /* Maintain spacing when active */
}

.wc-mega-menu-category a {
    text-decoration: none;
}

.wc-mega-menu-category h4 {
    margin: 0;
    font-family: "Poppins", sans-serif;
    font-size: 15px;
    position: relative;
    
    transform: none !important;
    transition: none;
}
    /* Pil-ikon styling */
    .wc-menu-arrow {
        display: inline-flex;
        align-items: center;
        margin-left: 9px;
    }
    
    .wc-menu-arrow-icon {
        width: 12px;
        height: 8px;
        transition: transform 0.3s ease;
    }
    
    /* Når man hover over menupunktet, roter pilen */
    .menu-item-has-children:hover > a .wc-menu-arrow-icon {
        transform: rotate(180deg);
    }
    
    /* Styling for at placere pilen korrekt */
    .menu-item-has-children > a {
        display: inline-flex;
        align-items: center;
        position: relative;
    }
    
    /* Hvis du også bruger klassen menu-open */
    .menu-item-has-children.menu-open > a .wc-menu-arrow-icon {
        transform: rotate(180deg);
    }
.wc-mega-menu-category h4 a {
    color: #000;
    display: block;
    padding: 10px 22px;
    border-radius: 12px;
    position: relative;
    
    transform: none !important;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.wc-mega-menu-category h4 a:after {
    content: "";
    position: absolute;
    top: 50%;
    right: 12px;
    width: 6px;
    height: 6px;
    border-top: 2px solid #aaa;
    border-right: 2px solid #aaa;
    transform: rotate(45deg);
    transition: border-color 0.2s ease;
}

.wc-mega-menu-category:hover h4 a {
    color: #000;
    background-color: #f5f5f5;
    transform: none !important;
}

.wc-mega-menu-category:hover h4 a:after {
    border-color: #000;
}

.wc-mega-menu-category.active h4 a {
    color: #000;
    background-color: #f0f0f0;
    font-weight: 500;
    transform: none !important;
}

.wc-mega-menu-category.active h4 a:after {
    border-color: #000;
}

/* Third level categories - PURE CSS ANIMATIONS */
.wc-mega-menu-third-level {
    list-style: none;
    margin: 4px 0 0px 20px;
    padding: 0;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    
    /* FAST CSS ANIMATIONS - Much better performance than JS */
    transition: max-height 0.25s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), 
                margin-bottom 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: max-height, opacity, margin-bottom;
}

.wc-mega-menu-category.active .wc-mega-menu-third-level {
    max-height: 500px; /* Increased for more subcategories */
    margin-bottom: 10px;
    opacity: 1;
    
    /* FAST CSS ANIMATIONS */
    transition: max-height 0.25s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), 
                margin-bottom 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.wc-mega-menu-third-level li {
    margin: 0;
    padding: 0;
}

.wc-mega-menu-third-level li a {
    display: block;
    padding: 6px 10px;
    font-size: 13px;
    color: #333;
    text-decoration: none;
    position: relative;
    border-radius: 3px;
    
    transform: none !important;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.wc-mega-menu-third-level li a:before {
    content: "";
    display: inline-block;
    width: 5px;
    height: 1px;
    background-color: #aaa;
    margin-right: 8px;
    vertical-align: middle;
    transition: width 0.2s ease, background-color 0.2s ease;
}

.wc-mega-menu-third-level li a:hover {
    color: #000;
    background-color: rgba(240, 240, 240, 0.5);
    transform: none !important;
}

.wc-mega-menu-third-level li a:hover:before {
    width: 8px;
    background-color: #000;
}

/* Content container - FAST CSS fade animation */
.wc-mega-menu-content-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 25px;
    
    /* FAST CSS FADE for content switching */
    transition: opacity 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: opacity;
}

/* Fading state for smooth content transitions */
.wc-mega-menu-content-container.fading {
    opacity: 0.3;
}

/* Featured container with overlay */
.wc-mega-menu-featured-container {
    position: relative;
    width: 100%;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    margin-bottom: 25px;
}
/* Optional: Tilføj hover effekt på hele containeren */
a.wc-mega-menu-featured-container:hover .wc-mega-menu-overlay {
   border: 4px solid #8c7131;
}


/* INSTANT image changes */
.wc-mega-menu-featured-image img {
    width: 100%;
    min-height: 400px;
    max-height: 400px;
    max-width: 100%;
    display: block;
    object-fit: cover;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* No-image fallback */
.wc-mega-menu-featured-image.no-image {
    background: linear-gradient(135deg, #3494E6, #EC6EAD);
    min-height: 400px;
}

/* Overlay styling */
.wc-mega-menu-overlay {
    position: absolute;
	    text-align: center;

    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0) 100%);
    color: #fff;
    padding: 120px 30px 30px;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.wc-mega-menu-overlay-content {
    max-width: 100%;
    position: relative;
    z-index: 3;
    
    transition: opacity 0.2s ease;
}
/* Title and description in overlay */
.wc-mega-menu-overlay .wc-mega-menu-title {
    font-family: "korolev", sans-serif;
    margin: 0px;
    font-size: 32px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #fff;
    text-shadow: 
        2px 2px 4px rgba(0,0,0,0.8),
        0px 0px 8px rgba(0,0,0,0.6),
        0px 0px 20px rgba(0,0,0,0.4);
    
    transform: none !important;
    transition: none;
}

.wc-mega-menu-overlay .wc-mega-menu-desc {
    color: rgba(255,255,255,0.9);
    margin: 0 auto 25px; /* Tilføj auto til venstre/højre margin */
    font-size: 15px;
    line-height: 1.6;
    font-family: 'Poppins', sans-serif;
    max-width: 650px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    
    transform: none !important;
    transition: none;
}

/* CTA button in overlay */
.wc-mega-menu-overlay .wc-mega-menu-button {
    display: inline-block;
    padding: 12px 28px;
    background-color: #8C7131;
    color: #fff !important;
    text-decoration: none;
    border-radius: 12px;
    font-family: "korolev", sans-serif;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: none;
    cursor: pointer;
    opacity: 0.95;
    
    transform: none !important;
    transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.wc-mega-menu-featured-container:hover .wc-mega-menu-button {
    opacity: 1;
    color: black;
    transform: none !important;
}


/* Badges overlay on image */
.wc-mega-menu-badges-overlay {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 8px;
    
    transform: none !important;
    transition: none;
}

/* Badge styling */
.nordthy-badge {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    
    transform: none !important;
    transition: none;
}

/* Info section styling */
.wc-mega-menu-info-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Header styles */
.wc-mega-menu-header {
    margin-bottom: 10px;
}

.wc-mega-menu-title {
    font-family: "korolev", sans-serif;
    margin: 0 0 12px;
    font-size: 26px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wc-mega-menu-desc {
    color: #666;
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    font-family: 'Poppins', sans-serif;
}

/* Subcategories grid - FAST fade */
.wc-mega-menu-popular {
    margin-bottom: 20px;
    
    /* FAST CSS fade */
    transition: opacity 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: opacity;
}

.wc-mega-menu-subtitle {
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    font-weight: 500;
    margin: 0 0 15px;
    color: #000;
    position: relative;
    padding-bottom: 8px;
}

.wc-mega-menu-subtitle:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 2px;
    background-color: #f0f0f0;
}

.wc-mega-menu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

/* Grid items - NO TRANSFORMS */
.wc-mega-menu-grid-item {
    transform: none !important;
    transition: none;
}

.wc-mega-menu-grid-item a {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    padding: 15px 10px;
    background-color: #f8f8f8;
    border-radius: 6px;
    height: 100%;
    
    transform: none !important;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.wc-mega-menu-grid-item a:hover {
    background-color: #f0f0f0;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transform: none !important;
}

/* Image or letter circle */
.wc-mega-menu-item-image {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 10px;
}

.wc-mega-menu-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wc-mega-menu-item-letter {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #e9e9e9;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.wc-mega-menu-item-letter span {
    font-size: 18px;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
}

.wc-mega-menu-item-name {
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    color: #444;
    margin-top: 5px;
    
    transform: none !important;
    transition: color 0.2s ease;
}

.wc-mega-menu-grid-item a:hover .wc-mega-menu-item-name {
    color: #000;
}

/* CTA button styling */
.wc-mega-menu-cta {
    margin-top: 10px;
}

.wc-mega-menu-button {
    display: inline-block;
    padding: 12px 28px;
    background-color: #333;
    color: #fff !important;
    text-decoration: none;
    border-radius: 12px;
    font-family: "korolev", sans-serif;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: none;
    cursor: pointer;
    
    transform: none !important;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.wc-mega-menu-button:hover {
    background-color: #000 !important;
	color: white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    text-decoration: none !important;
    transform: none !important;
}
@media (max-width: 1366px) {
	    .wc-mega-menu-categories {
width: 25%;
	}
}
/* Responsive styling */
@media (max-width: 1200px) {
    .wc-mega-menu-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .wc-mega-menu-featured-image img {
        min-height: 350px;
    }
    
    .wc-mega-menu-overlay .wc-mega-menu-title {
        font-size: 28px;
    }
}

@media (max-width: 991px) {
    .wc-mega-menu-content {
        flex-direction: column;
        height: auto;
    }
    
    .wc-mega-menu-categories {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #f0f0f0;
        padding-right: 0;
        padding-bottom: 20px;
        margin-bottom: 20px;
        overflow: visible;
    }

    .wc-mega-menu-featured-image img {
        min-height: 300px;
    }
    
    .wc-mega-menu-overlay {
        padding: 100px 25px 25px;
    }
    
    .wc-mega-menu-overlay .wc-mega-menu-title {
        font-size: 24px;
    }
    
    .wc-mega-menu-overlay .wc-mega-menu-desc {
        font-size: 14px;
        margin-bottom: 20px;
    }
    
    .wc-mega-menu-dropdown {
        position: absolute;
        min-height: auto;
        max-height: none;
    }
    
    .wc-mega-menu-dropdown-inner {
        padding: 20px 15px;
        min-height: auto;
    }
    
    .wc-mega-menu-content {
        height: auto;
    }
}

@media (max-width: 768px) {
    .wc-mega-menu-grid {
        grid-template-columns: 1fr;
    }
    
    .wc-mega-menu-featured-image img {
        min-height: 250px;
    }
    
    .wc-mega-menu-overlay {
        padding: 80px 20px 20px;
    }
    
    .wc-mega-menu-overlay .wc-mega-menu-title {
        font-size: 20px;
        margin-bottom: 10px;
    }
    
    .wc-mega-menu-overlay .wc-mega-menu-desc {
        font-size: 13px;
        margin-bottom: 15px;
    }
    
    .wc-mega-menu-overlay .wc-mega-menu-button {
        padding: 10px 20px;
        font-size: 13px;
    }
    
    .wc-mega-menu-badges-overlay {
        top: 15px;
        right: 15px;
        gap: 5px;
    }
    
    .nordthy-badge {
        padding: 6px 10px;
        font-size: 10px;
    }
    
    .wc-mega-menu-dropdown-inner {
        padding: 20px 15px 15px;
    }
}