.td-header-menu-wrap {
  position: relative;

  &:before,
  &:after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: #000;
    .opacity(0.08);
  }

  &:before {
    top: 0;
  }

  &:after {
    bottom: 0;
  }

  &.td-affix:after {
    display: block;
    bottom: -12px;
    background: transparent url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAMBAMAAABRpcpkAAAAD1BMVEUAAAAAAAAAAAAAAAAAAABPDueNAAAABXRSTlMGAhQQCyEd++8AAAAUSURBVAjXY1AAQgMgdABCCBAAQQAT6AFRBPHcWgAAAABJRU5ErkJggg==');
    height: 12px;
    opacity: 1;
  }

  /* responsive portrait phone */
  @media (max-width: @responsive_p_phone_max) {
    background-color: #222 !important;
    border: none;

    &:after {
      display: block !important;
      bottom: -12px;
      background: transparent url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAMBAMAAABRpcpkAAAAD1BMVEUAAAAAAAAAAAAAAAAAAABPDueNAAAABXRSTlMGAhQQCyEd++8AAAAUSURBVAjXY1AAQgMgdABCCBAAQQAT6AFRBPHcWgAAAABJRU5ErkJggg==');
      height: 12px;
      opacity: 1;
    }
  }
}

.td-header-main-menu {
  position: relative;
  z-index: 999;
  padding-right: 35px;
  font-family: @font2;

  @media (max-width: @responsive_p_phone_max) {
    padding-right: 64px;
    padding-left: 0;
  }

  .td-search-box-wrap {
    margin-top: -1px; // fix the alignment when the menu have borders
  }
}
/*  ----------------------------------------------------------------------------
    SF menu
*/
.sf-menu, .sf-menu ul, .sf-menu li {
  margin: 0;
  list-style: none;
  text-align: left;
}

/* responsive phone */
@media (max-width: @responsive_p_phone_max) {
  .sf-menu {
    display: none;
  }
}

.sf-menu li:hover {
  visibility: inherit; /* fixes IE7 'sticky bug' */
}

.sf-menu li {
  float: left;
  position: relative;

  // font awesome in menu
  .fa {
    margin-right: 10px;
    font-size: 1.4em;
    vertical-align: middle;
    position: relative;
    top: -1px;
  }

  .td-only-icon {
    margin-right: 0;
  }
}

.sf-menu .menu-item > a {
  display: block;
  position: relative;
}

.sf-menu li:hover ul,
.sf-menu li.sfHover ul {
  left: 0;
  top: auto; //@td_menu_height ; /* match top ul list item height */
  z-index: 99;
}

ul.sf-menu li:hover li ul,
ul.sf-menu li.sfHover li ul {
  top: -999em;
}

ul.sf-menu li li:hover ul,
ul.sf-menu li li.sfHover ul {
  left:	10em; /* match ul width */
  top: 0 !important;
}
ul.sf-menu li li:hover li ul,
ul.sf-menu li li.sfHover li ul {
  top: -999em;
}

// fix the z-index when menu is o 2 lines
.sf-menu > .current-menu-ancestor,
.sf-menu > .current-category-ancestor,
.sf-menu > .current-menu-item {
  z-index: 0;
}

.sf-menu > li:last-child > a {
  padding-right: 0;
}

/*  ----------------------------------------------------------------------------
    All the links
*/

/* remove the down arrow on links with  (icons menus) */
.td-no-down-arrow > a {
  .sf-sub-indicator {
    display: none;
  }
}

// top links
.sf-menu > li > a {
  padding-right: 30px;
  font-weight: 500;
  line-height: 55px;
  font-size: 13px;
  color: #000;
  text-transform: uppercase;
  -webkit-backface-visibility: hidden; // fix chrome 1px issue

  @media (min-width: @responsive_p_tablet_min) and (max-width: @responsive_p_tablet_max) {
    padding-right: 17px;
    font-size: 11px;
  }
}


/* menu icons */
.sf-menu .menu_icon {
  position: relative;
  top: 13px;
  float: left;
}

.sf-menu .sub-menu .menu_icon {
  top:0;
}

.sf-menu .menu_hidden {
  display: none !important;
}


/* hover and current menu */
.sf-menu > .current-menu-item > a, // current top menu
.sf-menu > .current-menu-ancestor > a, //current menu parent (top)
.sf-menu > .current-category-ancestor > a,
.sf-menu > li > a:hover, //normal hover
.sf-menu > .sfHover > a //when the submenu is opend
{
  background-color: transparent;
  color: @td_theme_color;
  z-index: 999;
}

#td-header-menu {
  display: inline-block;
  vertical-align: top;
}


/*  ----------------------------------------------------------------------------
    submenu
*/
.sf-menu li > ul { // submenu 1px up
  margin-top: -1px;
}

.sf-menu ul {
  position: absolute;
  top: -999em;
  min-width: 173px;
  margin-left: -30px;
  padding: 16px 0;
  background-color: #fff;
  .box-shadow(inset 0 0 1px 0 rgba(0, 0, 0, 0.25));

  li {
    width: 100%;
  }

  &:after {
    position: absolute;
    top: -3px;
    display: block;
    content: '';
    width: 100%;
    height: 4px;
    background-color: #000;
  }

  .menu-item > a {
    display: block;
    padding: 3px 30px 3px 30px;
    font-size: 12px;
    color: #000;

    // font awesome in menu
    .fa {
      font-size: 1em;
      position: relative;
      top: -1px;
      width: 20px;
      margin-right: 5px;
      text-align: center;
    }


    &:hover {
      color: @td_theme_color;
    }
  }

  ul {
    margin: -16px 0 0 -1px;
    border-top-width: 1px;

    &:after {
      display: none;
    }
  }

  .td-icon-menu-down {
    float: right;
    top: 0;
    font-size: 6px;
  }
}

.sf-menu ul .menu-item > a:hover, //normal hover
.sf-menu ul .sfHover > a, //current opend menu
.sf-menu ul .current-menu-ancestor > a, //current ancestor
.sf-menu ul .current-category-ancestor > a, //current ancestor
.sf-menu ul .current-menu-item > a //current menu
{
  color: @td_theme_color;
}

.sf-menu li:hover, .sf-menu li.sfHover,
.sf-menu a:focus, .sf-menu a:hover, .sf-menu a:active {
  outline: 0;
}


/*  ----------------------------------------------------------------------------
    arrows
*/
.sf-menu {
  .td-icon-menu-down {
    vertical-align: top;
    padding-left: 10px;
    font-size: 7px;
    line-height: inherit;

    @media (min-width: @responsive_p_tablet_min) and (max-width: @responsive_p_tablet_max) {
      padding-left: 6px;
    }
  }

  .sub-menu {
    -webkit-backface-visibility: hidden; // fix chrome 1px issue

    .td-icon-menu-down {
      position: absolute;
      top: 50%;
      right: 24px;
      margin-top: -9px;
      line-height: 19px;
    }
  }

  .td-menu-badge {
    font-size: 10px;
    background-color: #222;
    color: #fff;
    border-radius: 2px;
    padding: 0 4px 1px;
    margin-left: 6px;
    line-height: 1;
    position: relative;
    top: -1px;
  }
}
.td-menu-badge {
  /* responsive portrait phone */
  @media (max-width: @responsive_p_phone_max) {
    display: none;
  }
}

/* arrow for all items in the menues */
a.sf-with-ul i.td-icon-menu-down:before {
  content: '\e808';
}
/* arrow for all items in the menues AT FIRST LEVEL*/
ul.sf-js-enabled > li > a > i.td-icon-menu-down:before {
  content: '\e806' !important;
}



/*  ----------------------------------------------------------------------------
    Mega Menu
*/
.td-mega-menu {
  position: static !important;

  ul {
    position: absolute;
    width: 100% !important;
    height: auto;
    margin-left: 0;
    padding: 0;
    display: none;

    /* responsive portrait tablet */
    @media (min-width: @responsive_p_tablet_min) and (max-width: @responsive_p_tablet_max) {
      width: 732px !important;
    }
  }

  // next-prev
  .td_block_mega_menu  .td-next-prev-wrap {
    margin-right: 22px;
  }
}

/*
  page in mega menu mega-menu-page
  */
.td-mega-menu-page {
  .wpb_content_element {
    clear: both;

    // fix hide block pulldown on blocks
    .td_block_wrap {
      .td-pulldown-filter-display-option {
        display: none;
      }
    }

    // widgets line header
    .widgettitle:after {
      width: 1200px;
    }

    // default lists
    ul {
      display: inline-block !important;
      position: relative !important;
      width: 100% !important;
      border: none !important;
      left: 0 !important;
      top: 0 !important;
      margin-left: 0 !important;
      -webkit-box-shadow: none !important;
      -moz-box-shadow: none !important;
      box-shadow: none !important;

      li {
        -webkit-box-shadow: none !important;
        -moz-box-shadow: none !important;
        box-shadow: none !important;
        float: none !important;
        width: auto !important;
        line-height: 30px !important;
        margin-left: 0;
        padding: 0 !important;
        list-style-type: disc !important;
        list-style-position: inside;

        ul {
          opacity: 1 !important;
          margin-top: 4px !important;
          margin-left: 21px !important;
          padding-bottom: 0 !important;

          li:last-child {
            border-bottom: 0 !important;
            padding-bottom: 0 !important;
          }
        }

        a {
          background-color: transparent !important;
          line-height: 26px !important;
          padding: 0 !important;
          margin: 0 !important;
          color: #222222 !important;

          i {
            display: none;
          }

          &:hover {
            background-color: transparent !important;
            color: @td_theme_color !important;
          }
        }
      }
    }
  }

  // menu from vc in page
  .vc_wp_custommenu {
    ul li {
      padding: 5px 0 !important;
      border-top: 1px dashed #EDEDED;
      list-style-type: none !important;

      &:first-child {
        border: none;
      }

      &:last-child {
        border-bottom: 1px dashed #EDEDED;
      }

      li {
        border-top: 1px dashed #EDEDED !important;
      }
    }
  }
}
/*
  end fix mega menu with page
*/

.td_block_mega_menu {
  display: table;
  width: 100%;
  padding-bottom: 0 !important;
  margin-bottom: 0 !important;
  min-height: 286px;

  /* responsive portrait tablet */
  @media (min-width: @responsive_p_tablet_min) and (max-width: @responsive_p_tablet_max) {
    min-height: 225px;
  }

  .td_block_inner {
    margin-left: 200px;
    position: relative;

    /* responsive portrait tablet */
    @media (min-width: @responsive_p_tablet_min) and (max-width: @responsive_p_tablet_max) {
      margin-left: 165px;
    }
  }
}

// sub-categories
.td_mega_menu_sub_cats {
  position: absolute;
  top: 0;
  left: 0;
  width: 200px;
  max-width: 200px;
  display: table-cell;
  height: 100%;
  vertical-align: top;
  padding: 22px 0;
  line-height: 1;

  /* responsive portrait tablet */
  @media (min-width: @responsive_p_tablet_min) and (max-width: @responsive_p_tablet_max) {
    width: 165px;
    max-width: 165px;
    padding: 10px 0;
  }

  a {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 500;
    color: #000;
    padding: 7px 10px 7px 32px;
    position: relative;
    vertical-align: middle;

    /* responsive portrait tablet */
    @media (min-width: @responsive_p_tablet_min) and (max-width: @responsive_p_tablet_max) {
      padding: 7px 10px 7px 17px;
      font-size: 10px;
    }
  }

  .mega-menu-cat-all {
    margin-top: 17px;
    padding-top: 25px;
    line-height: 1;

    /* responsive portrait tablet */
    @media (min-width: @responsive_p_tablet_min) and (max-width: @responsive_p_tablet_max) {
      margin-top: 8px;
      padding-top: 14px;
    }

    &:before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      width: 95px;
      height: 1px;
      background-color: #f2f2f2;
    }
  }

  .cur-sub-cat {
    color: @td_theme_color;
  }
}

.block-mega-child-cats {
  overflow-x: hidden;
  overflow-y: auto;
  max-height: 252px;
  -webkit-overflow-scrolling: touch;
}

.td-mega-row {
  //display: table-cell;
  width: 100%;
}

.td-mega-span {
  width: 33.33333%;
  min-width: 260px;
  float: left;
  text-align: center;

  /* responsive portrait tablet */
  @media (min-width: @responsive_p_tablet_min) and (max-width: @responsive_p_tablet_max) {
    min-width: 189px;
  }

  .td-item-details {
    display: block;
    margin-bottom: 16px;

    /* responsive portrait tablet */
    @media (min-width: @responsive_p_tablet_min) and (max-width: @responsive_p_tablet_max) {
      margin-bottom: 8px;
    }

    & > span,
    & > div {
      margin: 0;
      padding: 0;

      &:after {
        display: none;
      }
    }
  }

  .td-post-category-wrap {
    bottom: -4px;
  }

  .entry-title {
    font-weight: 500;
    font-size: 14px;
    line-height: 18px;
    margin: 7px 6px 0;
    padding-bottom: 0;

    /* responsive portrait tablet */
    @media (min-width: @responsive_p_tablet_min) and (max-width: @responsive_p_tablet_max) {
      font-size: 12px;
      line-height: 14px;
    }

    a {
      color: #000;
      display: block;
    }

    &:after {
      display: none;
    }
  }

  .entry-review-stars {
    font-size: 12px;
  }

  .td-post-date {
    font-size: 12px;
    display: block;
  }

  .td-module-image {
    margin-bottom: 8px;
  }
}

.td-no-subcats {
  .td_block_inner {
    margin-left: 0;
  }

  .td-mega-span {
    width: 25%;
    min-width: 0;
  }
}

.td_module_mega_menu:hover .entry-title a {
  color: @td_theme_color;
}


/*  ----------------------------------------------------------------------------
    Search
*/
.td-header-menu-search {
  position: absolute;
  top: 0;
  right: 0;

  .td-search-btns-wrap {
    text-align: center;

    &:hover .td-icon-search {
      color: @td_theme_color;
    }
  }

  #td-header-search-button {
    .td-icon-search {
      font-size: 15px;
      line-height: 55px;
      width: 55px;
      color: #000;

      &:before {
        position: relative;
        top: 2px;
      }
    }
  }

  #td-header-search-button-mob {
    .td-icon-search {
      font-size: 20px;
      line-height: 58px;
      width: 58px;
      color: #fff;

      &:before {
        position: relative;
        top: 2px;
      }
    }
  }
}