/**
 * Fix for dropdown bounding box alignment issues
 * Removes the white line/gap between dropdown container and content
 */

/* Reset all padding/margin on dropdown containers */
.sp-dropdown,
.sp-megamenu-wrapper .sp-dropdown,
#sp-menu .sp-dropdown {
    padding: 0 !important;
    margin: 0 !important;
    border: 1px solid #ddd !important;
    background: #ffffff !important;
    overflow: hidden !important; /* Clip any overflow to prevent gaps */
}

/* Remove padding from inner containers */
.sp-dropdown .sp-dropdown-inner,
.sp-dropdown .sp-dropdown-items,
.sp-dropdown > ul {
    padding: 0 !important;
    margin: 0 !important;
    background: #ffffff !important;
}

/* Ensure first and last items fill the container properly */
.sp-dropdown li:first-child,
.sp-dropdown li:first-child a,
.sp-dropdown-items > li:first-child,
.sp-dropdown-items > li:first-child > a {
    margin-top: 0 !important;
    border-top: none !important;
}

.sp-dropdown li:last-child,
.sp-dropdown li:last-child a,
.sp-dropdown-items > li:last-child,
.sp-dropdown-items > li:last-child > a {
    margin-bottom: 0 !important;
    border-bottom: none !important;
}

/* Adjust link styling to fill container properly */
.sp-dropdown a,
.sp-dropdown-items a,
.sp-dropdown li a,
.sp-dropdown ul li a {
    display: block !important;
    padding: 12px 20px !important;
    margin: 0 !important;
    color: #333 !important;
    background: #ffffff !important;
    text-decoration: none !important;
    border: none !important;
    border-bottom: 1px solid #f0f0f0 !important;
    box-sizing: border-box !important;
}

/* Remove border from last item */
.sp-dropdown li:last-child a,
.sp-dropdown-items > li:last-child > a,
.sp-dropdown ul li:last-child a {
    border-bottom: none !important;
}

/* Hover state */
.sp-dropdown a:hover,
.sp-dropdown-items a:hover {
    background-color: #f5f5f5 !important;
    color: #000 !important;
}

/* Fix any nested ul/li structure */
.sp-dropdown ul,
.sp-dropdown-items {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
}

.sp-dropdown li,
.sp-dropdown-items li {
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
}

/* Ensure dropdown positioning doesn't create gaps */
.sp-megamenu-parent > li > .sp-dropdown {
    top: 100% !important;
    margin-top: -1px !important; /* Overlap the parent border slightly */
}

/* Fix box model for all dropdown elements */
.sp-dropdown,
.sp-dropdown *,
.sp-dropdown-inner,
.sp-dropdown-inner *,
.sp-dropdown-items,
.sp-dropdown-items * {
    box-sizing: border-box !important;
}

/* Remove any default styles that might cause gaps */
.sp-dropdown::before,
.sp-dropdown::after,
.sp-dropdown-inner::before,
.sp-dropdown-inner::after {
    display: none !important;
}

/* Specific fix for the Tools dropdown */
#sp-menu .sp-megamenu-parent > li.item-437 > .sp-dropdown {
    padding: 0 !important;
}

/* Ensure clean edges with border-radius */
.sp-dropdown {
    border-radius: 4px !important;
    overflow: hidden !important;
}

/* First item should have top border radius */
.sp-dropdown li:first-child a,
.sp-dropdown-items > li:first-child > a {
    border-top-left-radius: 3px !important;
    border-top-right-radius: 3px !important;
}

/* Last item should have bottom border radius */
.sp-dropdown li:last-child a,
.sp-dropdown-items > li:last-child > a {
    border-bottom-left-radius: 3px !important;
    border-bottom-right-radius: 3px !important;
}

/* Remove any line-height issues */
.sp-dropdown a {
    line-height: 1.5 !important;
}

/* Fix for any wrapper divs that might add spacing */
.sp-dropdown > div {
    padding: 0 !important;
    margin: 0 !important;
}

/* Ensure the dropdown shadow doesn't create visual gaps */
.sp-dropdown {
    box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
}