/* 
 * JVR Mega Menu Styles
 * Version: 0.0.9
 */

/* --- ANIMATIONS --- */
@keyframes jvrSlideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(10px);
        /* Final state for centered */
    }
}

@keyframes jvrSlideUpFull {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
        /* Final state for full width */
    }
}

/* Base wrapper */
.jvr-megamenu-wrapper {
    position: relative;
    width: 100%;
}

/* STICKY MENU */
.jvr-sticky {
    position: sticky;
    top: 0;
    z-index: 9999;
    background-color: var(--jvr-bg-color, #ffffff);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    /* Subtle shadow when sticky */
}

/* Mobile Toggle Button (Hidden on Desktop) */
.jvr-mobile-toggle {
    display: none;
    cursor: pointer;
    padding: 10px;
    background: none;
    border: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 30px;
}

.jvr-mobile-toggle span {
    width: 100%;
    height: 3px;
    background-color: var(--jvr-link-color, #333333);
    transition: all 0.3s;
}

.jvr-megamenu-nav {
    display: flex;
    gap: 2rem;
    align-items: center;
    flex-wrap: wrap;
    position: relative;
    justify-content: center;
    width: 100%;
}

/* Top level links */
.jvr-megamenu-nav .jvr-megamenu-link {
    text-decoration: none;
    color: var(--jvr-link-color, #333333) !important;
    font-family: var(--e-global-typography-primary-font-family, inherit);
    font-weight: var(--e-global-typography-primary-font-weight, 500);
    padding: 10px 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.3s ease;
}

.jvr-megamenu-nav .jvr-megamenu-link:hover,
.jvr-megamenu-item:hover>.jvr-megamenu-link {
    color: var(--jvr-hover-color, #0073aa) !important;
}

.jvr-caret {
    font-size: 0.8em;
    margin-left: 2px;
}

/* --- ICONS --- */
.jvr-megamenu-link .dashicons {
    font-size: 1.2em;
    /* Slightly larger icon */
    width: auto;
    height: auto;
    position: relative;
    top: 1px;
    /* Visual tweak adjustment */
}


/* --- Shared Dropdown Logic --- */
.jvr-dropdown-base {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    background-color: var(--jvr-bg-color, #ffffff);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    z-index: 999;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    cursor: default;
    border-radius: 4px;
    text-align: left;
    top: 100% !important;
}

/* Reveal on hover */
.jvr-megamenu-item:hover .jvr-dropdown-base,
.jvr-megamenu-item:focus-within .jvr-dropdown-base {
    visibility: visible;
    opacity: 1;
    /* Animations trigger here via specific classes below */
}

/* --- MEGA MENU (Grid) --- */
.jvr-megamenu-item.jvr-is-mega {
    position: static;
}

.jvr-megamenu-dropdown {
    left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    transform: none !important;
    margin: 0 !important;
    padding: 30px;
}

.jvr-megamenu-item.jvr-is-mega:hover .jvr-megamenu-dropdown {
    animation: jvrSlideUpFull 0.4s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}

.jvr-megamenu-grid {
    display: grid;
    gap: 30px;
    margin: 0 auto;
    max-width: 1200px;
}

/* --- SIMPLE DROPDOWN (List) --- */
.jvr-megamenu-item.jvr-is-simple {
    position: relative;
}

.jvr-simple-dropdown {
    min-width: 220px;
    width: max-content;
    left: 50% !important;
    transform: translateX(-50%) translateY(20px) !important;
    /* Start slightly lower for animation */
    margin: 0 !important;
    padding: 15px 0;
}

.jvr-megamenu-item.jvr-is-simple:hover .jvr-simple-dropdown {
    animation: jvrSlideUp 0.3s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}

.jvr-simple-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.jvr-simple-list li a {
    display: block;
    padding: 8px 25px;
    color: var(--jvr-link-color, #333333);
    text-decoration: none;
    transition: all 0.2s;
    font-family: var(--e-global-typography-primary-font-family, inherit);
    white-space: nowrap;
    text-align: left;
}

.jvr-simple-list li a:hover {
    background-color: rgba(0, 0, 0, 0.03);
    color: var(--jvr-hover-color, #0073aa);
}

/* --- Mega Menu Column Contents --- */
.jvr-megamenu-col-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.jvr-megamenu-col-list li {
    margin-bottom: 8px;
}

.jvr-megamenu-heading {
    margin-top: 20px;
    margin-bottom: 12px;
    display: block;
}

.jvr-megamenu-col-list li:first-child .jvr-megamenu-heading {
    margin-top: 0;
}

.jvr-megamenu-heading a {
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--jvr-link-color, #333333);
    text-decoration: none;
    font-family: var(--e-global-typography-primary-font-family, inherit);
}

.jvr-megamenu-heading a:hover {
    color: var(--jvr-hover-color, #0073aa);
}

.jvr-megamenu-sublink a {
    color: var(--jvr-link-color, #333333) !important;
    text-decoration: none;
    font-size: 0.95em;
    transition: color 0.2s;
    opacity: 0.85;
}

.jvr-megamenu-sublink a:hover {
    opacity: 1;
    color: var(--jvr-hover-color, #0073aa) !important;
    text-decoration: underline;
}

/* --- MOBILE / RESPONSIVE --- */
@media (max-width: 1024px) {
    .jvr-sticky {
        position: relative;
        /* Disable sticky on mobile usually preferred, or keep if desired */
    }

    .jvr-mobile-toggle {
        display: flex;
        margin: 10px auto;
    }

    .jvr-megamenu-nav {
        display: none;
        /* Hidden by default on mobile */
        flex-direction: column;
        width: 100%;
        background-color: var(--jvr-bg-color, #ffffff);
        padding: 20px;
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
        border-radius: 8px;
        position: absolute;
        top: 100%;
        left: 0;
        z-index: 1000;
    }

    .jvr-megamenu-nav.is-active {
        display: flex;
        /* Show when toggled */
    }

    .jvr-megamenu-item {
        width: 100%;
        text-align: left;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        position: relative !important;
    }

    .jvr-megamenu-nav .jvr-megamenu-link {
        display: flex;
        width: 100%;
        padding: 15px 0;
    }

    /* Reset Dropdown Styles for Mobile Accordion-like behavior */
    .jvr-dropdown-base {
        position: static !important;
        /* Stack naturally */
        visibility: visible !important;
        opacity: 1 !important;
        transform: none !important;
        box-shadow: none !important;
        padding: 0 0 0 20px !important;
        /* Indent */
        display: none;
        /* JS will toggle this or hover */
        width: 100% !important;
        background: transparent !important;
        animation: none !important;
    }

    /* Interaction: Show on hover or when class is added by JS */
    .jvr-megamenu-item:hover .jvr-dropdown-base,
    .jvr-megamenu-item.is-open .jvr-dropdown-base {
        display: block;
    }

    .jvr-megamenu-grid {
        grid-template-columns: 1fr !important;
        gap: 0 !important;
    }

    .jvr-megamenu-dropdown {
        padding: 0 !important;
    }

    .jvr-megamenu-heading {
        margin-top: 15px;
    }

    .jvr-simple-dropdown {
        min-width: unset;
        width: 100%;
    }
}