/* 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 url("chrome://messenger/skin/shared/tabmail.css");

/**
 * Tabmail Tabs
 */

#tabpanelcontainer:-moz-lwtheme {
  color: inherit;
}

.tabmail-arrowscrollbox {
  margin-bottom: -1px;
}

/**
 * Tab
 */

@media (-moz-windows-default-theme) and (-moz-os-version: windows-vista),
       (-moz-windows-default-theme) and (-moz-os-version: windows-win7) {
  .tab-background-middle[selected=true]:not(:-moz-lwtheme) {
    background-color: var(--customToolbarColor);
  }
}

@media (-moz-os-version: windows-win8),
       (-moz-os-version: windows-win10) {
  @media not all and (-moz-windows-default-theme) {
    #tabs-toolbar:not(:-moz-lwtheme) {
      color: CaptionText;
    }

    #tabs-toolbar:not(:-moz-lwtheme):-moz-window-inactive,
    #messengerWindow:not([tabsintitlebar])
      .tabmail-tab:not([selected]):not(:-moz-lwtheme):-moz-window-inactive {
      color: InactiveCaptionText;
    }
  }
}

@media (min-resolution: 1.1dppx) {
  #tabs-toolbar {
    --tabBackgroundImage: url(chrome://messenger/skin/tabs/background-start@2x.png),
                          url(chrome://messenger/skin/tabs/background-middle@2x.png),
                          url(chrome://messenger/skin/tabs/background-end@2x.png);
  }

  .tabmail-tab:hover > .tab-stack > .tab-background:not([selected=true]) {
    background-image: var(--tabBackgroundImage);
  }

  .tab-background-middle[selected=true] {
    background-image: url(tabs/active-middle@2x.png),
                      var(--fgTabTexture),
                      none;
  }

  .tab-background-start[selected=true]:-moz-locale-dir(ltr)::after,
  .tab-background-end[selected=true]:-moz-locale-dir(rtl)::after {
    background-image: url(tabs/stroke-start@2x.png);
  }

  .tab-background-end[selected=true]:-moz-locale-dir(ltr)::after,
  .tab-background-start[selected=true]:-moz-locale-dir(rtl)::after {
    background-image: url(tabs/stroke-end@2x.png);
  }
}

#messengerWindow[tabsintitlebar]
.tabmail-tab:not([selected]):not(:-moz-lwtheme) {
  color: CaptionText;
}

#messengerWindow[tabsintitlebar]
.tabmail-tab:not([selected]):not(:-moz-lwtheme):-moz-window-inactive {
  color: InactiveCaptionText;
}

.tabmail-tab[busy],
.tabmail-tab[thinking] {
  list-style-image: url("chrome://messenger/skin/icons/loading.png") !important;
  -moz-image-region: auto !important;
}

.tabmail-tab[type="glodaSearch"] {
  list-style-image: url("chrome://global/skin/icons/Search-glass.png");
}

@media (-moz-os-version: windows-xp) {
  .tabmail-tab[selected] > .tab-stack > .tab-content > .tab-text {
    opacity: 1.0 !important;
  }

  .tabmail-arrowscrollbox > .scrollbutton-up:-moz-lwtheme-brighttext,
  .tabmail-arrowscrollbox > .scrollbutton-down:-moz-lwtheme-brighttext,
  .tabs-alltabs-button:-moz-lwtheme-brighttext,
  .tabs-closebutton:-moz-lwtheme-brighttext {
    background-color: rgba(0,0,0,.5);
  }

  .tabmail-arrowscrollbox > .scrollbutton-up:-moz-lwtheme-darktext,
  .tabmail-arrowscrollbox > .scrollbutton-down:-moz-lwtheme-darktext,
  .tabs-alltabs-button:-moz-lwtheme-darktext,
  .tabs-closebutton:-moz-lwtheme-darktext {
    background-color: rgba(255,255,255,.5);
  }

  .tabmail-tabs:-moz-lwtheme {
    padding-top: 1px;
    background-color: transparent;
    background-image: none;
  }

  .tabmail-tab:not([selected]):not(:hover) +
  .tabmail-tab:not([selected]):not(:hover)::before {
    background-image: url("chrome://messenger/skin/tabs/separator-XP.png");
  }
}

@media (-moz-os-version: windows-win10) {
  #tabs-toolbar {
    --tabBackgroundImage: url(chrome://messenger/skin/tabs/background-start-win10.png),
                          url(chrome://messenger/skin/tabs/background-middle-win10.png),
                          url(chrome://messenger/skin/tabs/background-end-win10.png);
    --tab-stroke-background-size: 0 0;
  }

  @media (min-resolution: 1.1dppx) {
    #tabs-toolbar {
      --tabBackgroundImage: url(chrome://messenger/skin/tabs/background-start-win10@2x.png),
                            url(chrome://messenger/skin/tabs/background-middle-win10@2x.png),
                            url(chrome://messenger/skin/tabs/background-end-win10@2x.png);
    }
  }

  /* Remove border between tab strip and navigation toolbar on Windows 10+ */
  .tab-background-end[selected=true]::after,
  .tab-background-start[selected=true]::after {
    content: none;
  }

  .tab-background-middle[selected=true] {
    /* Setting background-size to "0 0" for the first
    background-image to remove the stroke. */
    background-size: 0 0, auto 100%, auto 100%;
  }
}

.tabmail-tab {
  list-style-image: url("chrome://global/skin/icons/folder-item.png");
  -moz-image-region: rect(0px, 16px, 16px, 0px);
}

tabpanels {
  -moz-appearance: none;
  background-color: transparent;
}

/* tabmail-tab focus ring */
.tabmail-tab > .tab-stack > .tab-content > .tab-text {
  border: 1px dotted transparent;
}

.tabmail-tab:focus > .tab-stack > .tab-content > .tab-text {
  border: 1px dotted -moz-DialogText;
}

/* Tab DnD indicator */
.tab-drop-indicator {
  list-style-image: url(tabs/dragIndicator.png);
  margin-bottom: -11px;
}

/**
 * close buttons
 */

.tabs-closebutton,
.tab-close-button {
  -moz-appearance: none;
  border: none;
}

/* Invert the unhovered close tab icons on bright-text tabs */
@media not all and (min-resolution: 1.1dppx) {
  #tabs-toolbar[brighttext] .tabs-closebutton,
  #tabs-toolbar[brighttext] .tab-close-button:not([selected=true]) {
    list-style-image: url("chrome://global/skin/icons/close-inverted.png");
  }
}

@media (min-resolution: 1.1dppx) {
  #tabs-toolbar[brighttext] .tabs-closebutton,
  #tabs-toolbar[brighttext] .tab-close-button:not([selected=true]) {
    list-style-image: url("chrome://global/skin/icons/close-inverted@2x.png");
  }
}

@media (-moz-os-version: windows-xp) {
  .tabs-closebutton-box {
    margin-top: 2px;
    margin-bottom: 4px;
  }
}

.tabs-closebutton-box > .tabs-closebutton {
  margin-top: 1px;
  padding: 0 2px;
}

.tabs-closebutton:focus {
  outline: none !important;
}

/**
 * Tab Scrollbox Arrow Buttons
 */

.tabs-left {
  display: none;
}

.tabmail-arrowscrollbox > .scrollbutton-up,
.tabmail-arrowscrollbox > stack > .scrollbutton-down {
  list-style-image: url(tabs/arrow-left.png);
}

#tabs-toolbar[brighttext] .tabmail-arrowscrollbox > .scrollbutton-up,
#tabs-toolbar[brighttext] .tabmail-arrowscrollbox > stack > .scrollbutton-down {
  list-style-image: url(tabs/arrow-left-inverted.png);
}


@media (min-resolution: 1.1dppx) {
  .tabmail-arrowscrollbox > .scrollbutton-up,
  .tabmail-arrowscrollbox > stack > .scrollbutton-down {
    list-style-image: url(tabs/arrow-left@2x.png);
  }

  .tabmail-arrowscrollbox > .scrollbutton-up > .toolbarbutton-icon,
  .tabmail-arrowscrollbox > stack > .scrollbutton-down > .toolbarbutton-icon {
    width: 15px;
  }

  #tabs-toolbar[brighttext] .tabmail-arrowscrollbox > .scrollbutton-up,
  #tabs-toolbar[brighttext] .tabmail-arrowscrollbox > stack > .scrollbutton-down {
    list-style-image: url(tabs/arrow-left-inverted@2x.png);
  }
}

.tabmail-arrowscrollbox > .scrollbutton-up[disabled],
.tabmail-arrowscrollbox > stack > .scrollbutton-down[disabled] {
  opacity: .4;
}

.tabmail-arrowscrollbox > .scrollbutton-up:-moz-locale-dir(rtl),
.tabmail-arrowscrollbox > stack > .scrollbutton-down:-moz-locale-dir(ltr) {
  transform: scaleX(-1);
}

@media (-moz-os-version: windows-xp) {
  .tabmail-arrowscrollbox > .scrollbutton-up {
    margin-top: 1px;
    margin-bottom: 1px;
    padding: 0 0 3px;
    width: 18px;
    height: 23px;
    -moz-margin-start: 0;
    -moz-margin-end: 2px;
  }

  .tabmail-arrowscrollbox > .scrollbutton-up > .toolbarbutton-icon {
    margin: 2px 0px 0px;
  }

  .tabmail-arrowscrollbox > .scrollbutton-down-stack {
    height: 23px;
    margin-top: 1px;
    margin-bottom: 1px;
    -moz-margin-start: 2px;
  }

  .tabmail-arrowscrollbox > stack > .scrollbutton-down-box {
    width: 18px;
  }

  .tabmail-arrowscrollbox > stack > .scrollbutton-down {
    width: 18px;
    margin: 0px;
    padding: 0 0 3px;
  }

  .tabmail-arrowscrollbox > stack > .scrollbutton-down > .toolbarbutton-icon {
    margin-top: 2px;
    margin-bottom: 0px;
    -moz-margin-start: 1px;
    -moz-margin-end: 0px;
  }
}

@media not all and (-moz-os-version: windows-xp) {
  .tabmail-arrowscrollbox > .scrollbutton-up,
  .tabmail-arrowscrollbox > stack > .scrollbutton-down {
    margin: 0;
    -moz-margin-end: 1px;
    list-style-image: url(tabs/arrow-left.png);
    border-radius: 0;
  }

  .tabmail-arrowscrollbox > .scrollbutton-up:-moz-locale-dir(rtl),
  .tabmail-arrowscrollbox > stack > .scrollbutton-down:-moz-locale-dir(ltr) {
    -moz-margin-start: 1px;
    -moz-margin-end: 0;
  }
}

/**
 * All Tabs Button
 */

@media (-moz-os-version: windows-xp) {
  .tabs-alltabs-button {
    margin-top: 1px;
    margin-bottom: 1px;
    width: 18px !important;
    height: 23px !important;
    -moz-padding-start: 4px !important;
    -moz-padding-end: 4px !important;
    padding: 0px;
  }

  .tabs-alltabs-button > .toolbarbutton-icon {
    -moz-margin-end: 0;
  }

  .tabs-alltabs-button > .toolbarbutton-menu-dropmarker {
    -moz-margin-end: 3px !important;
    list-style-image: url(chrome://messenger/skin/icons/mainwindow-dropdown-arrow.png);
    -moz-image-region: rect(0, 13px, 11px, 0);
  }

  #tabs-toolbar[brighttext] .tabs-alltabs-button > .toolbarbutton-menu-dropmarker {
    list-style-image: url(chrome://messenger/skin/icons/mainwindow-dropdown-arrow-inverted.png);
  }
}

@media not all and (-moz-os-version: windows-xp) {
  .tabs-alltabs-button,
  .tabmail-tabs toolbarbutton {
    -moz-appearance: none;
    border-style: none;
    padding: 0 3px;
  }

  .tabs-alltabs-button:hover,
  .tabs-alltabs-button[open],
  .tabs-alltabs-button:hover:active,
  .tabmail-arrowscrollbox > .scrollbutton-up:not([disabled]):hover,
  .tabmail-arrowscrollbox > stack > .scrollbutton-down:not([disabled]):hover {
    background-image: linear-gradient(rgba(255, 255, 255, 0),
                      rgba(255, 255, 255, .5)),
                      linear-gradient(transparent, rgba(0, 0, 0, .25) 30%),
                      linear-gradient(transparent, rgba(0, 0, 0, .25) 30%);
    background-position: 1px -1px, 0 -1px, 100% -1px;
    background-size: calc(100% - 2px) 100%, 1px 100%, 1px 100%;
    background-repeat: no-repeat;
  }

  .tabs-alltabs-button {
    margin-bottom: -1px;
    width: 18px;
    list-style-image: url(icons/dropmarker.svg#win);
  }

  #tabs-toolbar[brighttext] .tabs-alltabs-button {
    list-style-image: url(icons/dropmarker.svg#win-inverted);
  }

  .tabs-alltabs-button > .toolbarbutton-icon {
    width: 9px;
    height: 7px;
    margin: 3px 0;
  }

  .tabs-alltabs-button > .toolbarbutton-menu-dropmarker {
    display: none;
  }
}

@media (-moz-os-version: windows-win8),
       (-moz-os-version: windows-win10) {
  #tabs-toolbar:not([brighttext]) {
    --tab-separator-image: linear-gradient(transparent 0%, transparent 15%,
                           currentColor 15%, currentColor 90%, transparent 90%);
    --tab-separator-size: 1px 100%;
    --tab-separator-opacity: 0.2;
  }

  .tabs-alltabs-button {
    list-style-image: url(icons/dropmarker.svg#win8);
  }

  #tabs-toolbar[brighttext] .tabs-alltabs-button {
    list-style-image: url(icons/dropmarker.svg#win8-inverted);
  }

  .tabs-closebutton > .toolbarbutton-icon,
  .tab-close-button > .toolbarbutton-icon {
    width: 20px;
  }
}

@media (-moz-windows-default-theme) and (-moz-os-version: windows-win8) {
  #messengerWindow[darkwindowframe="true"]
  #tabs-toolbar:not(:-moz-lwtheme):not(:-moz-window-inactive),
  #messengerWindow[darkwindowframe="true"]
  .tabmail-tab:not([selected="true"]):not(:-moz-lwtheme):not(:-moz-window-inactive) {
    color: white;
  }

  #messengerWindow[darkwindowframe="true"]
  .tabs-alltabs-button:not(:-moz-lwtheme):-moz-window-inactive {
    -moz-padding-start: 5px;
    -moz-padding-end: 5px;
  }

  .tabs-alltabs-button > .toolbarbutton-icon {
    margin: 4px 0 0;
  }
}

.tabs-alltabs-button > .toolbarbutton-text {
  display: none;
}

/**
 * All Tabs Menupopup
 */

.alltabs-item {
  list-style-image: url("chrome://global/skin/icons/folder-item.png");
  -moz-image-region: rect(0px, 16px, 16px, 0px);
}

.alltabs-item[selected="true"] {
  font-weight: bold;
}

.alltabs-item[busy] {
  list-style-image: url("chrome://messenger/skin/icons/loading.png") !important;
}
