/* 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/. */

/* ::::: tabmail ::::: */

.tabmail-tabs > .tabmail-tab:first-child > .tab-stack > .tab-content >
.tab-close-button {
  visibility: collapse;
}

.tab-icon-image,
.tab-throbber {
  width: 16px;
  height: 16px;
}

.tabmail-tab {
  list-style-image: url("chrome://messenger/skin/icons/item.png");
}

.tab-throbber {
  list-style-image: url("chrome://messenger/skin/icons/loading.png") !important;
  -moz-image-region: auto !important;
}

.tabmail-tab:not(:hover):not([selected="true"]) > .tab-stack > .tab-content > .tab-icon-image {
  opacity: .6;
}

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

.tab-text {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  font: message-box;
  font-weight: bold;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

.tabmail-tab {
  -moz-appearance: none;
  color: -moz-DialogText;
  margin: 0 0 -1px;
  padding: 0;
  border-radius: 0;
  border-width: 0;
  background: none;
}

.tabmail-tab[selected] {
  position: relative;
  text-shadow: none;
}

.tabmail-tab:-moz-lwtheme {
  color: inherit;
  text-shadow: inherit;
}

.tab-stack {
  height: 31px;
}

.tabmail-tab:hover > .tab-stack > .tab-background:not([selected=true]),
.tab-background[selected=true] {
  background-repeat: no-repeat,
                     no-repeat,
                     no-repeat;
  background-position: left 0,
                       30px 0,
                       right 0;
  background-size: 30px 100%,
                   calc(100% - 60px) 100%,
                   30px 100%;
}

.tab-background[selected=true] {
  background-size: 30px 100%,
                   calc(100% - 59px) 100%,
                   30px 100%;
}

.tabmail-tab:hover > .tab-stack > .tab-background:not([selected=true]) {
  background-image: url(tabs/tabHoverStart.png),
                    url(tabs/tabHoverMiddle.png),
                    url(tabs/tabHoverEnd.png);
}

.tab-background[selected=true] {
  background-image: url(tabs/tabActiveStart.png),
                    url(tabs/tabActiveMiddle.png),
                    url(tabs/tabActiveEnd.png);
}

.tab-background[selected=true]:-moz-window-inactive {
  background-image: url(tabs/tabInactiveStart.png),
                    url(tabs/tabInactiveMiddle.png),
                    url(tabs/tabInactiveEnd.png);
}

.tab-background[selected=true]:-moz-lwtheme {
  opacity: .5;
}

@media (min-resolution: 2dppx) {
  .tab-throbber {
    list-style-image: url("chrome://messenger/skin/icons/loading@2x.png") !important;
  }
  
  .tabmail-tab:hover > .tab-stack > .tab-background:not([selected=true]) {
    background-image: url(tabs/tabHoverStart@2x.png),
                      url(tabs/tabHoverMiddle@2x.png),
                      url(tabs/tabHoverEnd@2x.png);
  }

  .tab-background[selected=true] {
    background-image: url(tabs/tabActiveStart@2x.png),
                      url(tabs/tabActiveMiddle@2x.png),
                      url(tabs/tabActiveEnd@2x.png);
  }

  .tab-background[selected=true]:-moz-window-inactive {
    background-image: url(tabs/tabInactiveStart@2x.png),
                      url(tabs/tabInactiveMiddle@2x.png),
                      url(tabs/tabInactiveEnd@2x.png);
  }

  .tabmail-tab[type="glodaSearch"] {
    list-style-image: url("chrome://messenger/skin/icons/search-tab@2x.png");
  }
}

.tabmail-tab:not([selected]):not(:hover) +
.tabmail-tab:not([selected]):not(:hover)::before {
  content: '';
  display: -moz-box;
  width: 2px;
  height: 28px;
  -moz-margin-start: -2px;
  -moz-margin-end: 0;
  background: linear-gradient(to top, hsla(210, 23%, 10%, .4),
              hsla(210, 23%, 10%, .1) 80%, transparent),
              linear-gradient(to top, hsla(0, 0%, 100%, .4),
              hsla(0, 0%, 100%, .1) 80%, transparent);
  background-position: 0 0, 1px 0;
  background-size: 1px 100%;
  background-repeat: no-repeat;
}

.tab-content {
  -moz-padding-start: 10px;
  -moz-padding-end: 10px;
}

.tab-background {
  -moz-margin-start: -14px;
  -moz-margin-end: -14px;
}

.tab-background-start,
.tab-background-end {
  width: 30px;
  clip-path: url(chrome://messenger/content/messenger.xul#tab-curve-clip-path);
}

.tab-background-end:-moz-locale-dir(ltr),
.tab-background-start:-moz-locale-dir(rtl) {
  transform: scaleX(-1);
}

.tab-background-middle {
  -moz-box-flex: 1;
}

.tabmail-tab,
.tab-background,
.tab-content {
  pointer-events: none;
}

.tab-background-start,
.tab-background-middle,
.tab-background-end,
.tab-close-button {
  pointer-events: auto;
}

.tabmail-arrowscrollbox > scrollbox {
  -moz-padding-start: 14px;
  -moz-padding-end: 14px;
}

/* preloading hack: the images used for tab borders need to be
preloaded to avoid flickering the first time a non-selected tab is
opened / hovered. */
#tabs-toolbar::after {
  content: '';
  display: block;
  background-image: url(tabs/tabHoverStart.png),
                    url(tabs/tabHoverMiddle.png),
                    url(tabs/tabHoverEnd.png),
                    url(tabs/tabActiveStart.png),
                    url(tabs/tabActiveMiddle.png),
                    url(tabs/tabActiveEnd.png),
                    url(tabs/tabInactiveStart.png),
                    url(tabs/tabInactiveMiddle.png),
                    url(tabs/tabInactiveEnd.png);
}

.tabmail-tab:-moz-lwtheme:not([selected="true"]):not(:hover) > .tab-text {
  opacity: .8;
}

.tabmail-arrowscrollbox:-moz-lwtheme > .tabs-newtab-button {
  width: auto;
  -moz-box-flex: 1;
  -moz-box-pack: start;
  border-style: none;
  background: none;
}

.tabmail-tab[selected="true"]:focus > .tab-text {
  outline: 2px solid #4F8EC9;
  outline-offset: -2px;
  -moz-outline-radius: 3px;
}

.tabmail-tab[selected="true"],
.tabmail-tab:hover {
  color: #000000;
}

.tabmail-tabs {
  border: none;
  -moz-box-pack: center;
  -moz-box-align: center;
  height: 23px;
  margin-bottom: 0;
}

tabmail > tabbox > tabpanels {
  -moz-appearance: none !important;
}


/**
 * Tab Drag and Drop
 */

.tab-drop-indicator {
  list-style-image: url(chrome://messenger/skin/tabs/tabDragIndicator.png);
  margin-bottom: -3px;
  -moz-padding-start: 26px;
}

/**
 * In-tab close button
 */

.tab-close-button > .toolbarbutton-icon {
  -moz-margin-end: 0px !important;
  padding-top: 1px;
}

.tab-close-button {
  list-style-image: url("chrome://global/skin/icons/close.png");
  -moz-appearance: none;
  -moz-image-region: rect(0, 16px, 16px, 0);
  border: none !important;
  height: 30px;
  padding: 0;
  margin: 0;
  position: relative;
  z-index: 2;
  background: none;
  cursor: default;
}

.tab-close-button:hover,
.tabs-closebutton:hover {
  -moz-image-region: rect(0, 32px, 16px, 16px);
}

.tab-close-button:hover:active,
.tabs-closebutton:hover:active {
  -moz-image-region: rect(0, 48px, 16px, 32px);
}

.tabmail-tab[selected] > .tab-stack > .tab-content > .tab-close-button {
  /* Make this button focusable so clicking on it will not focus the tab while
     it's getting closed */
  -moz-user-focus: normal;
}

.tabmail-arrowscrollbox > .scrollbutton-up,
.tabmail-arrowscrollbox > .scrollbutton-down-stack > .scrollbutton-down {
  border: 0;
  border-right: 2px solid;
  -moz-border-right-colors: rgba(0,0,0,0.25) rgba(255,255,255,0.15);
  list-style-image: url("chrome://messenger/skin/tabs/tab-arrow.png");
  -moz-image-region: rect(0, 13px, 20px, 0);
  padding: 0;
  width: 16px;
  margin: 0;
}

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

.tabmail-arrowscrollbox > .scrollbutton-up:hover,
.tabmail-arrowscrollbox > .scrollbutton-down-stack > .scrollbutton-down:hover {
  -moz-image-region: rect(0, 26px, 20px, 13px);
  background-image: linear-gradient(transparent, rgba(0,0,0,0.15));
}

.tabmail-arrowscrollbox > .scrollbutton-up:hover:active,
.tabmail-arrowscrollbox > .scrollbutton-down-stack > .scrollbutton-down:hover:active {
  -moz-image-region: rect(0, 39px, 20px, 26px);
  background-image: linear-gradient(transparent, rgba(0,0,0,0.3));
}

.tabmail-arrowscrollbox > .scrollbutton-up[disabled="true"],
.tabmail-arrowscrollbox > .scrollbutton-down-stack > .scrollbutton-down[disabled="true"] {
  -moz-image-region: rect(0, 13px, 20px, 0) !important;
  opacity: .5;
  background-image: none !important;
}

@media (min-resolution: 2dppx) {
  .tabmail-arrowscrollbox > .scrollbutton-up,
  .tabmail-arrowscrollbox > .scrollbutton-down-stack > .scrollbutton-down {
    list-style-image: url("chrome://messenger/skin/tabs/tab-arrow@2x.png");
    -moz-image-region: rect(0, 26px, 40px, 0);
  }

  .tabmail-arrowscrollbox > .scrollbutton-up:hover,
  .tabmail-arrowscrollbox > .scrollbutton-down-stack > .scrollbutton-down:hover {
    -moz-image-region: rect(0, 52px, 40px, 26px);
  }

  .tabmail-arrowscrollbox > .scrollbutton-up:hover:active,
  .tabmail-arrowscrollbox > .scrollbutton-down-stack > .scrollbutton-down:hover:active {
    -moz-image-region: rect(0, 78px, 40px, 52px);
  }

  .tabmail-arrowscrollbox > .scrollbutton-up[disabled="true"],
  .tabmail-arrowscrollbox > .scrollbutton-down-stack > .scrollbutton-down[disabled="true"] {
    -moz-image-region: rect(0, 26px, 40px, 0) !important;
  }

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

/**
 * New Tab & All Tabs Buttons
 */

.tabs-alltabs-box {
  margin: 0;
}

.tabs-newtab-button,
.tabs-alltabs-button {
  margin: 0;
  padding: 0 4px;
}

.tabs-newtab-button {
  list-style-image: url(chrome://messenger/skin/tabs/newtab.png);
}

.tabs-alltabs-button {
  padding-top: 2px;
  list-style-image: url(chrome://messenger/skin/tabs/alltabs-box-bkgnd-icon.png);
  -moz-image-region: rect(0, 16px, 16px, 0);
}

.tabs-alltabs-button[open] {
  -moz-image-region: rect(16px, 16px, 32px, 0);
}

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

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

.tabs-alltabs-box-animate {
  margin: 1px 0px 0px;
  width: 25px;
  background-image: url("chrome://messenger/skin/tabs/alltabs-box-overflow-bkgnd-animate.png");
  background-repeat: no-repeat;
  opacity: 0.0;
}

/**
 * All Tabs Menupopup 
 */

.alltabs-item {
  list-style-image: url("chrome://messenger/skin/icons/item.png");
}

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

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

.tabs-closebutton {
  -moz-padding-end: 4px;
  list-style-image: url("chrome://global/skin/icons/close.png") !important;
  border: none;
  -moz-box-align: stretch;
  -moz-image-region: rect(0, 16px, 16px, 0);
}

.tabs-closebutton:hover > .toolbarbutton-icon {
  background-image: none !important;
}

@media (min-resolution: 2dppx) {
  .tabs-alltabs-button {
    list-style-image: url(chrome://messenger/skin/tabs/alltabs-box-bkgnd-icon@2x.png);
    -moz-image-region: rect(0, 32px, 32px, 0);
  }

  .tabs-alltabs-button[open] {
    -moz-image-region: rect(32px, 32px, 64px, 0);
  }

  .tabs-alltabs-button > .toolbarbutton-icon {
    width: 16px;
    height: 16px;
  }

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

  .tab-close-button,
  .tabs-closebutton {
    list-style-image: url("chrome://global/skin/icons/close@2x.png") !important;
    -moz-image-region: rect(0, 32px, 32px, 0);
  }

  .tab-close-button:hover,
  .tabs-closebutton:hover {
    -moz-image-region: rect(0, 64px, 32px, 32px);
  }

  .tab-close-button:hover:active,
  .tabs-closebutton:hover:active {
    -moz-image-region: rect(0, 96px, 32px, 64px);
  }

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

tabpanels.plain {
  background-color: transparent;
}

/* Content Tabs */

.contentTabToolbox {
  -moz-appearance: none;
  border: 0;
}

.contentTabInstance[disablechrome] .contentTabToolbox {
  display: none;
}

.contentTabToolbox:not(:-moz-lwtheme) {
  border-bottom: 1px solid rgb(105, 105, 105);
}

.contentTabToolbox:-moz-lwtheme {
  background-image: linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.5) 50%);
  background-color: rgba(255, 255, 255, 0.3);
}

.contentTabToolbar {
  -moz-appearance: none !important;
  min-height: 0px;
  padding: 0;
}
