/* SFlix mobile header + player tools polish v3 */

/* Logged-in header: keep the username usable on desktop/tablet. */
#header_login.user_logged {
  float: right;
}

#header_login.user_logged .header-user-button {
  height: 34px;
  max-width: 190px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  white-space: nowrap;
}

#header_login.user_logged .header-user-icon {
  display: none;
  flex: 0 0 auto;
  font-size: 17px;
}

#header_login.user_logged .header-user-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#header_login.user_logged .header-user-chevron {
  flex: 0 0 auto;
  font-size: 10px;
}

#header_login.user_logged .dropdown-menu-model {
  min-width: 250px;
  max-width: min(330px, calc(100vw - 24px));
  margin-top: 7px;
}

#header_login.user_logged .profile-info {
  min-width: 0;
}

#header_login.user_logged .pi-name,
#header_login.user_logged .pi-mail {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media screen and (max-width: 1299px) {
  /* The stock mobile header makes #header_right static. Pin it instead so a
     logged-in username can never push the search/logo off-screen. */
  #header .container {
    min-height: 60px;
  }

  #header_right {
    position: absolute !important;
    top: 0 !important;
    right: 10px !important;
    bottom: auto !important;
    height: 60px !important;
    z-index: 7;
    display: flex;
    align-items: center;
  }

  #header_login.user_logged {
    width: auto !important;
    height: 60px !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex;
    align-items: center;
  }

  #header_login.user_logged .dropdown {
    position: relative;
  }

  #header_login.user_logged .header-user-button {
    height: 36px;
    max-width: 150px;
    padding: 0 11px;
  }

  #header_login.user_logged .dropdown-menu-model {
    right: 0 !important;
    left: auto !important;
    transform: none !important;
  }
}

@media screen and (max-width: 639px) {
  #header .container {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  #header_browser {
    margin-left: 0;
  }

  #header #logo {
    left: 60px !important;
  }

  /* Reserve fixed areas for Search and Account so neither can overlap. */
  #mobile_search {
    right: 58px !important;
    width: 44px !important;
  }

  #header_right {
    right: 8px !important;
    width: 44px;
  }

  #header_login.user_logged,
  #header_login.user_logged .dropdown {
    width: 44px !important;
  }

  #header_login.user_logged .header-user-button {
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    height: 40px;
    padding: 0 !important;
    border-radius: 12px !important;
    justify-content: center;
    background: rgba(0, 172, 193, 0.14) !important;
    border: 1px solid rgba(100, 217, 231, 0.22) !important;
    color: #8fe8f2 !important;
    box-shadow: none !important;
  }

  #header_login.user_logged .header-user-icon {
    display: inline-block;
    margin: 0 !important;
    font-size: 19px;
  }

  #header_login.user_logged .header-user-name,
  #header_login.user_logged .header-user-chevron {
    display: none;
  }

  #header_login.user_logged .dropdown-menu-model {
    position: absolute !important;
    top: calc(100% + 6px) !important;
    right: 0 !important;
    left: auto !important;
    width: min(290px, calc(100vw - 24px));
    min-width: 0;
    margin: 0 !important;
    transform: none !important;
    border-radius: 12px;
    overflow: hidden;
  }

  #header_login.user_logged .pi-name,
  #header_login.user_logged .pi-mail {
    max-width: 185px;
  }

  /* Keep the converted player sidebar above the video, but give it real
     breathing room and prevent it from sitting on top of player content. */
  .detail_page-watch > .detail-tools {
    box-sizing: border-box;
    width: calc(100% - 24px) !important;
    margin: 14px 12px 12px !important;
    padding: 8px !important;
    position: relative !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    transform: none !important;
    z-index: 5 !important;
    border-radius: 14px !important;
  }

  .detail_page-watch > .detail-tools .dt-content {
    gap: 6px !important;
    padding: 0 1px 2px;
    scroll-padding-inline: 4px;
  }

  .detail_page-watch > .detail-tools .dt-content > div,
  .detail_page-watch > .detail-tools #wl-content,
  .detail_page-watch > .detail-tools #wl-content-login,
  .detail_page-watch > .detail-tools #vote-info {
    flex-basis: 74px !important;
    width: 74px !important;
  }

  .detail_page-watch > .detail-tools .dtc-item .btn-item,
  .detail_page-watch > .detail-tools .m2w-report-trigger {
    min-height: 60px !important;
    padding-top: 8px !important;
    padding-bottom: 8px !important;
  }

  /* Player itself gets matching mobile gutters below the tools bar. */
  .detail_page-watch > .container {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
}

@media screen and (max-width: 380px) {
  #header #logo {
    left: 56px !important;
  }

  #mobile_search {
    right: 54px !important;
  }

  #header_right {
    right: 6px !important;
  }

  .detail_page-watch > .detail-tools {
    width: calc(100% - 16px) !important;
    margin-left: 8px !important;
    margin-right: 8px !important;
  }

  .detail_page-watch > .container {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }
}
