Investments - Aging of Unrealized Losses (Details)
$ in Thousands
Jun. 30, 2018
USD ($)
security
Dec. 31, 2017
USD ($)
security
Schedule of Available-for-sale Securities [Line Items]    
Number of securities, less than 12 months | security 292 153
Fair value, less than 12 months $ 524,737 $ 224,694
Unrealized losses, less than 12 months $ (10,199) $ (1,550)
Number of securities,12 months or greater | security 41 64
Fair value, 12 months or greater $ 83,597 $ 114,243
Unrealized losses, 12 months or greater $ (4,707) $ (2,173)
Number of securities, total | security 333 217
Fair value $ 608,334 $ 338,937
Unrealized Losses $ (14,906) $ (3,723)
U.S. Treasury securities and obligations of U.S. government agencies    
Schedule of Available-for-sale Securities [Line Items]    
Number of securities, less than 12 months | security 14 16
Fair value, less than 12 months $ 29,453 $ 29,806
Unrealized losses, less than 12 months $ (1,187) $ (394)
Number of securities,12 months or greater | security 8 26
Fair value, 12 months or greater $ 14,657 $ 34,882
Unrealized losses, 12 months or greater $ (873) $ (587)
Number of securities, total | security 22 42
Fair value $ 44,110 $ 64,688
Unrealized Losses $ (2,060) $ (981)
Municipal debt securities    
Schedule of Available-for-sale Securities [Line Items]    
Number of securities, less than 12 months | security 27 21
Fair value, less than 12 months $ 52,276 $ 38,628
Unrealized losses, less than 12 months $ (811) $ (264)
Number of securities,12 months or greater | security 10 10
Fair value, 12 months or greater $ 17,670 $ 17,945
Unrealized losses, 12 months or greater $ (671) $ (395)
Number of securities, total | security 37 31
Fair value $ 69,946 $ 56,573
Unrealized Losses $ (1,482) $ (659)
Corporate debt securities    
Schedule of Available-for-sale Securities [Line Items]    
Number of securities, less than 12 months | security 209 94
Fair value, less than 12 months $ 363,399 $ 128,313
Unrealized losses, less than 12 months $ (7,575) $ (829)
Number of securities,12 months or greater | security 19 23
Fair value, 12 months or greater $ 45,034 $ 48,978
Unrealized losses, 12 months or greater $ (3,125) $ (1,129)
Number of securities, total | security 228 117
Fair value $ 408,433 $ 177,291
Unrealized Losses $ (10,700) $ (1,958)
Asset-backed securities    
Schedule of Available-for-sale Securities [Line Items]    
Number of securities, less than 12 months | security 42 22
Fair value, less than 12 months $ 79,609 $ 27,947
Unrealized losses, less than 12 months $ (626) $ (63)
Number of securities,12 months or greater | security 4 5
Fair value, 12 months or greater $ 6,236 $ 12,438
Unrealized losses, 12 months or greater $ (38) $ (62)
Number of securities, total | security 46 27
Fair value $ 85,845 $ 40,385
Unrealized Losses $ (664) $ (125)
Short-term investments    
Schedule of Available-for-sale Securities [Line Items]    
Number of securities, less than 12 months | security 0  
Fair value, less than 12 months $ 0  
Unrealized losses, less than 12 months $ 0  
Number of securities,12 months or greater | security 0  
Fair value, 12 months or greater $ 0  
Unrealized losses, 12 months or greater $ 0  
Number of securities, total | security 0  
Fair value $ 0  
Unrealized Losses $ 0