/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/. */

@import "variables.less";

// Windows specific styles
.platform--win32 {
  .tab {
    color: #555;

    .tabTitle {
      font-weight: 500;
      font-size: 12px;
      height: 18px;
    }
  }
}

.tabs {
  box-sizing: border-box;
  background: none;
  display: flex;
  flex: 1;
  overflow: auto;
  padding: 0 4px 0 0;
  height: @tabsToolbarHeight;
  margin-top: 2px;
  position: relative;
  white-space: nowrap;
  z-index: @zindexTabs;
}

.tabStripContainer {
  display: flex;
  flex: 1;
  z-index: @zindexTabs;
  overflow-x: hidden;
  overflow-y: hidden;

  &.allowDragging {
    -webkit-app-region: drag;
    >* {
      -webkit-app-region: no-drag;
    }
  }

  &.isPreview {
    opacity: 0.5;
    animation: tabFadeIn 0.75s ease-in-out;
    animation-fill-mode: forwards;
  }

  .newFrameButton {
    background: @buttonColor;
    min-width: 25px;
    min-height: 25px;
    -webkit-mask-image: url('../img/toolbar/newtab_btn.svg');
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: 12px 12px;
    -webkit-mask-origin: border;
    border: 3px solid @tabsBackground;
    &:hover {
      opacity: 1.0;
      background-color: black;
    }
  }
}

.tab {
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.1));
  border-radius: @borderRadiusTabs @borderRadiusTabs 0px 0px;
  border-width: 1px 1px 0;
  box-sizing: border-box;
  color: #3B3B3B;
  display: flex;
  height: 23px;
  margin-top: 2px;
  transition: transform 200ms ease;
  left: 0;
  opacity: 1.0;
  padding: 0;
  width: 100%;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 0, 0, 0.0);
  border-bottom: 1px;

  .tabTitle {
    -webkit-user-select: none;
    box-sizing: border-box;
    display: inline-block;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 16px;
    white-space: nowrap;
    vertical-align: middle;
    width: calc(~'100% - 40px');
    height: 15px;
    margin-left: 7px;
  }
  .tabIcon {
    background-position: center;
    background-repeat: no-repeat;
    display: inline-block;
    font-size: 12px;
    text-align: center;
    margin-left: 7px;
  }

  .thumbnail {
    display: none;
    position: absolute;
    top: 32px;
    left: 0;
    border: 1px solid #000;
    padding: 10px;
    background: #fff;
    pointer-events: none;
    z-index: @zindexTabsThumbnail;
  }

  &.active {
      background: linear-gradient(to bottom, white, @chromePrimary, );
      height: 25px;
      margin-top: 1px;
      box-shadow: inset 1px 1px 2px 0px white;
      box-shadow: 0px -1px 4px 0px rgba(51, 51, 51, 0.12);
      border: 1px solid #bbb;
      border-bottom: 1px;
  }

  &.private {
    background: @privateTabBackground;
    color: #fff;
    &:not(.active) {
      background: lighten(@privateTabBackground, 40%);
    }
  }

  &:hover {
    .closeTab {
      opacity: 0.5;
    }

    .thumbnail {
      display: block;
    }
  }

  &:not(.active):hover {
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.8), rgba(250, 250, 250, 0.4));
    &.private {
      background: lighten(@privateTabBackground, 20%);
    }
  }

  &.dragging {
    &:hover {
      .closeTab {
        opacity: 0;
      }
    }
  }

  .closeTab {
    opacity: 0;
    text-align: center;
    width: 16px;
    height: 16px;
    margin-left: 4px;
    margin-right: 4px;

    &:hover {
      opacity: 1;
    }

    border: 0px solid white;
    border-radius: 50%;
    z-index: @zindexTabs;
  }
}

.tabArea {
  box-sizing: border-box;
  display: inline-block;
  padding: 0 4px 0 0;
  position: relative;
  vertical-align: top;
  overflow: hidden;
  // There's a special case that tabs should span the full width
  // if there are a full set of them.
  &:not(.partOfFullPageSet) {
    max-width: 184px;
  }

  &:not(.isPinned) {
    flex: 1;
    &:first-child {
      padding-left: 6px;
    }
  }

  &.isPinned {
    &:last-child {
      padding-right: 6px;
    }
    .tabIcon {
      margin: 0;
      padding: 0 4px;
    }
  }

  &.draggingOverLeft {
    &:not(.isDragging) {
      margin-left: @dragSpacing;
    }
  }

  &.draggingOverRight {
    &:not(.isDragging) {
      margin-right: @dragSpacing;
    }
  }

  &.isDragging {
    opacity: 0.2;
  }

  hr.dragIndicator {
    position: absolute;
    top: 0;
    left: -1px;
    z-index: @zindexTabsDragIndicator;
    height: 100%;
    width: 1px;

    &.dragIndicatorEnd {
      bottom: -5px;
      top: 0;
      right: -3px;
      left: unset;
    }

    display: none;
    &.dragActive {
      display: block;
      color: @highlightBlue;
    }
  }
}

.tabsToolbar {
  background: @tabsBackground;
  display: flex;
  height: @tabsToolbarHeight;
//  margin-top: 2px;
  -webkit-user-select: none;
}

.tabsToolbarButtons {
  background: @tabsBackground;
  padding-right: 2px;
  .browserButton {
    display: inline-block;
    line-height: 26px;
  }
}

.tabPages {
  background: @tabsBackground;
  display: flex;
  height: @tabPagesHeight;
  justify-content: center;
  position: relative;
  text-align: center;
  z-index: @zindexTabs;
  &.allowDragging {
    -webkit-app-region: drag;
    >* {
      -webkit-app-region: no-drag;
    }
  }

  &.singlePage {
    height: 1px;
  }

  >div {
    display: flex
//    margin-top: 4px;
  }
}

.tabPage {
  align-items: center;
  background-color: #aaaaaa;
  border-radius: @borderRadius;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.2);
  box-sizing: border-box;
  display: inline-block;
  margin: auto 2.5px;
  margin-top: 3px;
  height: 6px;
  width: 36px;
  vertical-align: middle;

  &:hover {
    background-color: #f0f0f0;
    border: 2px solid white;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.0);
  }

  &.audioPlaybackActive {
    border: 1px solid @audioColor;
  }

  &.active {
    background-color: @chromePrimary;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.0);

  }
}

.prevTab,
.nextTab {
    display: none;
    color: #a0a0a0;
    font-size: 21px !important;
    height: 20px;
    line-height: 19px !important;
    text-align: center;
    vertical-align: top;
    margin-top: 4px;
    margin-left: -5px;
    margin-right: -5px;
    width: 30px;

  &:not([disabled]) {
    display: block;
    background: @tabsBackground;

    &:hover {
  //    background: lighten(#eeeeee, 10%);
            color: white;
    }
  }
}

.prevTab {
  background: linear-gradient(to right, @chromeControlsBackground2, @tabsBackground);
  border-bottom-left-radius: 0;
  border-top-left-radius: @borderRadius;
}

.nextTab {
  background: linear-gradient(to left, #afb0b4, #cccccc);
  border-bottom-right-radius: 0;
  border-top-right-radius: @borderRadius;
}

.pinnedTabs {
  margin-left: 9px;
  margin-top: 2px;
}

.segmentedControl {
  width: 30%;
  border: solid 1px @braveOrange;
  border-radius: @borderRadius;
  margin: 0 auto 20px;
  height: 2em;
}

.segmentedControl > div {
  color: @braveOrange;
  text-align: center;
  display: inline-block;
  width: 50%;
  height: 2em;
  line-height: 2em;
  cursor: pointer;
}

.segmentedControl > div.selected {
  color: white;
  background: @braveOrange;
}
