/* ==============================================
   USER DROPDOWN MENU - Optimized Styles
   ============================================== */

/* Container */
.user-menu {
    position: relative;
    display: inline-block;
}

/* Menu Button */
#user-menu-button {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

/* Dropdown Panel */
#user-dropdown {
    position: absolute;
    right: 0;
    margin-top: 0.5rem;
    width: 14rem;
    z-index: 9999;
    transform-origin: top right;
}

/* Show/Hide Animation */
#user-dropdown:not(.hidden) {
    animation: dropdownSlideIn 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Menu Items */
#user-dropdown a,
#user-dropdown button {
    display: flex;
    align-items: center;
    width: 100%;
    text-align: left;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Icon Colors */
#user-dropdown i {
    flex-shrink: 0;
}

/* Prevent text overflow */
#user-dropdown span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Focus styles for accessibility */
#user-dropdown a:focus,
#user-dropdown button:focus {
    outline: 2px solid rgba(59, 130, 246, 0.5);
    outline-offset: -2px;
}

/* Active state */
#user-dropdown a:active,
#user-dropdown button:active {
    transform: scale(0.98);
}

/* Mobile optimizations */
@media (max-width: 768px) {
    #user-dropdown {
        width: 13rem;
        font-size: 0.875rem;
    }
    
    #user-menu-button span {
        display: none;
    }
}

/* Prevent layout shift */
#user-menu-button,
#user-dropdown {
    will-change: auto;
    contain: layout style;
}
