.rdn-widget-wrapper {
    position: relative;
    width: 100%;
    /* Default animation durations */
    --submenu-anim-duration: 350ms;
    --panel-anim-duration: 450ms;
}

.rdn-main-nav {
    position: relative;
    z-index: 10;
    width: 100%;
}

.rdn-main-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    /* FIX 1: Remove gap, as we are now using margin-right on li elements to handle spacing (including negative) */
    /* gap property removed */
}

.rdn-main-nav-item {
    background: transparent !important;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.3s ease;
}

.rdn-main-nav-item:hover,
.rdn-main-nav-item:active,
.rdn-main-nav-item.is-active {
    background: transparent !important;
}

.rdn-overlays-container {
    position: absolute;
    bottom: 100%; /* Sits exactly on top of main nav */
    left: 0;
    width: 100%;
    z-index: 5;
    pointer-events: none; /* Let clicks pass through empty space */
}

/* Base state for submenu */
.rdn-submenu-container {
    position: absolute;
    bottom: 0;
    pointer-events: none;
    display: none;
    
    /* Animation base state */
    opacity: 0;
    /* Translate down by 15px so it moves up when active */
    margin-bottom: -15px;
    transition: opacity var(--submenu-anim-duration) ease-out, margin-bottom var(--submenu-anim-duration) ease-out;
}

/* Logical class for JS display vs active */
.rdn-submenu-container.is-visible {
    /* Required to be in DOM for CSS transitions */
    display: block; 
}

/* Visible animated state for submenu */
.rdn-submenu-container.is-active {
    opacity: 1;
    margin-bottom: 0;
    pointer-events: auto; /* Re-enable clicks */
}

.rdn-submenu-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.rdn-submenu-item {
    text-decoration: none;
    display: block;
    transition: color 0.3s ease;
}

/* The panel container handles positioning and strict width */
.rdn-panel-container {
    position: absolute;
    bottom: 0;
    left: 0;
    pointer-events: none;
    box-sizing: border-box;
    display: none;
    
    /* Animation base state */
    opacity: 0;
    margin-bottom: -20px;
    transition: opacity var(--panel-anim-duration) ease-out, margin-bottom var(--panel-anim-duration) ease-out;
    
    /* Width and Height are injected strictly via Elementor inline styles (!important) */
}

.rdn-panel-container.is-visible {
    display: block;
}


.rdn-panel-container.is-active {
    opacity: 1;
    margin-bottom: 0;
    pointer-events: auto;
}

.rdn-panel-bg {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: -1;
}

/* This is the scrollable area that gets max-height applied via Elementor Height Control */
.rdn-panel-content {
    position: relative;
    z-index: 1;
    /* Allow native vertical scrolling if content is taller than the container's height */
    overflow-y: auto; 
    /* Disable horizontal scroll entirely to prevent clipping due to word wraps */
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
    /* Force proper height calculation and remove inline max-height bugs */
    height: 100%;
    /* FIX: Explicitly setup column flex layout to properly contain children */
    display: flex;
    flex-direction: column;
}

/* Hide scrollbar for webkit but keep functionality */
.rdn-panel-content::-webkit-scrollbar {
    width: 0;
    background: transparent;
}
.rdn-panel-content {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.rdn-panel-content-inner {
    width: 100%;
    box-sizing: border-box;
    /* Ensure long text lines wrap instead of expanding the panel horizontally */
    word-wrap: break-word;
    overflow-wrap: break-word;
    /* Reset line-height clipping issues */
    height: auto;
    min-height: 100%;
    /* FIX: Force white-space wrapping */
    white-space: normal !important;
}

/* Make sure text elements inside the inner container don't force overflow incorrectly */
.rdn-panel-content-inner h2,
.rdn-panel-content-inner h3,
.rdn-panel-content-inner div,
.rdn-panel-content-inner p,
.rdn-panel-content-inner span {
    /* Prevent line-height from clipping text blocks */
    overflow: visible;
    /* FIX: Force child elements to wrap */
    white-space: normal !important;
}

.rdn-panel-content-body {
    max-width: 100%;
    display: block;
}


/* Add padding on the right to prevent text from overlapping the scroll controls */
.rdn-panel-container.has-overflow .rdn-panel-content-inner {
    padding-right: 40px !important;
}

/* Custom Scroll Controls Visibility and Positioning */
.rdn-scroll-controls {
    /* Position them absolutely inside the panel container, above everything else */
    position: absolute;
    top: 50%;
    transform: translateY(-50%); /* Vertically centered */
    right: 12px; /* Far right inside edge */
    display: none;
    flex-direction: column;
    gap: 15px; 
    z-index: 50; /* Ensure they are above the background AND text */
    align-items: center; /* Ensure both arrows share exact horizontal alignment */
}

/* Only show controls when JS detects overflow */
.rdn-panel-container.has-overflow .rdn-scroll-controls {
    display: flex;
}

.rdn-scroll-btn {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    width: 24px;
    height: 24px;
    padding: 0; /* Remove padding to keep it compact */
    border-radius: 50%; /* Make background circular on hover */
    cursor: pointer;
    line-height: 1;
    color: inherit;
    transition: color 0.3s ease, background-color 0.3s ease, opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rdn-scroll-btn:focus,
.rdn-scroll-btn:active {
    outline: none;
}

/* Optional subtle dark semi-transparent circular background on hover */
.rdn-scroll-btn:not(.is-disabled):hover {
    background-color: rgba(0, 0, 0, 0.2) !important;
}

.rdn-scroll-btn.is-disabled {
    opacity: 0.2;
    cursor: default;
    pointer-events: none;
}