/* ========================================
   NAVBAR DROPDOWN FIX
   Fix broken navbar dropdowns (Features, Resources, Company)
   ======================================== */

/* Ensure dropdown wrapper has dropdown class */
.nav-dropdown-wrapper.dropdown {
    position: relative;
}

/* Ensure modern-dropdown works with Bootstrap dropdown-menu */
.modern-dropdown.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    min-width: 280px;
    padding: 0.75rem 0;
    margin: 0.5rem 0 0;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    /* Instant close, smooth open */
    transition: opacity 0.1s ease, transform 0.1s ease, visibility 0s linear 0.1s;
}

/* Show dropdown when Bootstrap adds .show class */
.modern-dropdown.dropdown-menu.show {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
    /* Smooth open transition */
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0s;
}

/* Ensure dropdown is visible on hover (desktop) - instant close when mouse leaves */
@media (min-width: 992px) {
    .nav-dropdown-wrapper.dropdown:hover .modern-dropdown.dropdown-menu {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0) !important;
        transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0s;
    }
    
    /* Instant close when not hovering */
    .nav-dropdown-wrapper.dropdown:not(:hover) .modern-dropdown.dropdown-menu {
        opacity: 0 !important;
        visibility: hidden !important;
        transform: translateY(-10px) !important;
        transition: opacity 0s ease, transform 0s ease, visibility 0s linear 0s !important;
    }
}

/* Fix for Features dropdown - ensure it displays correctly */
#featuresDropdown + .modern-dropdown.dropdown-menu,
#resourcesDropdown + .modern-dropdown.dropdown-menu,
#companyDropdown + .modern-dropdown.dropdown-menu {
    display: none;
}

#featuresDropdown[aria-expanded="true"] + .modern-dropdown.dropdown-menu,
#resourcesDropdown[aria-expanded="true"] + .modern-dropdown.dropdown-menu,
#companyDropdown[aria-expanded="true"] + .modern-dropdown.dropdown-menu,
.modern-dropdown.dropdown-menu.show {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
}

/* Ensure dropdown items are properly styled */
.modern-dropdown.dropdown-menu li {
    list-style: none;
    margin: 0;
    padding: 0;
}

.modern-dropdown.dropdown-menu .dropdown-item-modern {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    color: #1e293b;
    text-decoration: none;
    transition: all 0.15s ease;
    border: none;
    background: transparent;
}

.modern-dropdown.dropdown-menu .dropdown-item-modern:hover {
    background: #f8fafc;
    color: #1E5CAA;
}

/* Fix dropdown icon and content alignment */
.modern-dropdown.dropdown-menu .dropdown-icon {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eff6ff;
    border-radius: 0.5rem;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.modern-dropdown.dropdown-menu .dropdown-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.modern-dropdown.dropdown-menu .dropdown-title {
    font-weight: 600;
    font-size: 0.9375rem;
    color: #1e293b;
    margin-bottom: 0.25rem;
    display: block;
}

.modern-dropdown.dropdown-menu .dropdown-desc {
    font-size: 0.8125rem;
    color: #64748b;
    line-height: 1.4;
    display: block;
}

/* Company dropdown - right aligned */
.modern-dropdown.dropdown-menu.text-start[style*="right: 0"] {
    left: auto !important;
    right: 0 !important;
    transform: translateX(0) translateY(-10px) !important;
}

.modern-dropdown.dropdown-menu.text-start[style*="right: 0"].show {
    transform: translateX(0) translateY(0) !important;
}

/* Ensure dropdown arrow rotates on open */
.nav-dropdown-wrapper.dropdown .nav-link-modern[aria-expanded="true"] .dropdown-arrow {
    transform: rotate(180deg);
}

/* Fix z-index to ensure dropdowns appear above other content */
.modern-dropdown.dropdown-menu {
    z-index: 1050 !important;
}

/* Instant close when dropdown loses show class */
.modern-dropdown.dropdown-menu:not(.show) {
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(-10px) !important;
    transition: opacity 0s ease, transform 0s ease, visibility 0s linear 0s !important;
    pointer-events: none !important;
}

/* Mobile fixes */
@media (max-width: 991.98px) {
    .modern-dropdown.dropdown-menu {
        position: static;
        display: none;
        box-shadow: none;
        border: none;
        background: transparent;
        padding: 0;
        margin: 0;
    }
    
    .modern-dropdown.dropdown-menu.show {
        display: block !important;
    }
    
    .modern-dropdown.dropdown-menu:not(.show) {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        transition: none !important;
    }
}

