/**
 * Dropdown Fix CSS - Resolves dropdown styling and behavior issues
 * Overrides hover-based dropdowns with proper click-based functionality
 */

/* Override hover-based dropdown behavior */
.dropdown .dropdown-menu {
    /* Remove hover dependency */
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(-10px) !important;
    transition: all 0.3s ease !important;
    display: none !important;
}

/* Show dropdown when open class is present */
.dropdown.dropdown-open .dropdown-menu {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
    display: block !important;
}

/* Ensure proper positioning */
.dropdown {
    position: relative !important;
}

.dropdown-menu {
    position: absolute !important;
    top: 100% !important;
    right: 0 !important;
    z-index: 1001 !important;
    min-width: 160px !important;
    padding: 0.5rem 0 !important;
    background: rgba(24, 32, 54, 0.95) !important;
    backdrop-filter: blur(15px) !important;
    -webkit-backdrop-filter: blur(15px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0.25rem !important;
}

/* Dropdown items styling */
.dropdown-item {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    padding: 0.75rem 1rem !important;
    color: #e0f7fa !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
    border: none !important;
    background: transparent !important;
    width: 100% !important;
    text-align: left !important;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
    transform: translateX(5px) !important;
}

.dropdown-item i {
    width: 16px !important;
    text-align: center !important;
}

/* Profile item styling */
.dropdown-item[href*="profile"] i {
    color: #1fd47b !important;
}

/* Logout item styling */
.dropdown-item[href*="logout"] {
    color: #ff6b6b !important;
}

.dropdown-item[href*="logout"]:hover {
    background: rgba(255, 107, 107, 0.1) !important;
    color: #ff6b6b !important;
}

/* Toggle button styling */
.dropdown-toggle {
    cursor: pointer !important;
    user-select: none !important;
}

/* Ensure proper spacing */
.dropdown-menu-right {
    right: 0 !important;
    left: auto !important;
}

/* Mobile dropdown fixes */
@media (max-width: 768px) {
    .dropdown-menu {
        position: fixed !important;
        top: 70px !important;
        right: 10px !important;
        left: 10px !important;
        width: auto !important;
        max-width: 300px !important;
        margin: 0 auto !important;
    }
    
    .dropdown-menu-right {
        right: 10px !important;
        left: auto !important;
        width: 200px !important;
    }
}

/* Animation improvements */
.dropdown-menu {
    transform-origin: top center !important;
}

.dropdown.dropdown-open .dropdown-menu {
    animation: dropdownSlideIn 0.3s ease forwards !important;
}

@keyframes dropdownSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Focus states for accessibility */
.dropdown-toggle:focus {
    outline: 2px solid #1fd47b !important;
    outline-offset: 2px !important;
}

.dropdown-item:focus {
    outline: 2px solid #1fd47b !important;
    outline-offset: -2px !important;
    background: rgba(29, 212, 123, 0.1) !important;
}

/* Ensure dropdown doesn't interfere with other elements */
.dropdown-menu {
    pointer-events: auto !important;
}

/* Fix for nested dropdowns */
.dropdown .dropdown .dropdown-menu {
    position: absolute !important;
    left: 100% !important;
    top: 0 !important;
    margin-left: 2px !important;
}

/* Hover effects for better UX */
.dropdown-toggle:hover {
    background: rgba(255, 255, 255, 0.15) !important;
}

/* Ensure proper z-index stacking */
.dropdown-menu {
    z-index: 1001 !important;
}

/* Fix for backdrop blur issues */
@supports not (backdrop-filter: blur(15px)) {
    .dropdown-menu {
        background: rgba(24, 32, 54, 0.98) !important;
    }
}

