/**
 * notion-enhancer: tabs
 * (c) 2021 dragonwocky <thedragonring.bod@gmail.com> (https://dragonwocky.me/)
 * (https://notion-enhancer.github.io/) under the MIT license
 */

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  background: var(--theme--bg) !important;
  overflow: hidden;
}

body {
  display: flex !important;
  flex-direction: column;
}

header {
  display: flex;
  background: var(--theme--bg_secondary);
  border-bottom: 1px solid var(--theme--ui_divider);
  width: 100%;
  padding: 0.5em;
  user-select: none;
  -webkit-app-region: drag;
  z-index: 3;
  font-size: 16px;
}

#tabs {
  display: flex;
  overflow: hidden;
}
.tab {
  display: flex;
  flex-grow: 1;
  flex-shrink: 1;
  width: 14em;
  max-width: 14em;
  overflow: hidden;
  padding: 0.4em 0.6em;

  color: var(--theme--text_secondary);
  background: var(--theme--bg);
  font-family: var(--theme--font_sans);
  font-weight: 500;
  border: none;
  -webkit-app-region: no-drag;
}
.tab:hover {
  background: var(--theme--ui_interactive-hover);
}
.tab.current {
  background: var(--theme--ui_interactive-active);
}

.drag-indicator {
  z-index: 1;
  width: 0.125em;
  margin: 0 -0.0625em;
  background: var(--theme--accent_blue-selection);
}

.tab-title {
  white-space: nowrap;
  overflow: hidden;
  margin-right: 0.25em;
}
.tab-icon {
  margin-right: 0.375em;
  flex-shrink: 0;
}
.tab-icon[style*='background'] {
  width: 0.875em;
  height: 0.875em;
  align-self: center;
  margin-right: 0.5em;
}
.tab-icon:not([style*='background']):empty,
.tab-icon + svg {
  display: none;
}
.tab-icon:not([style*='background']):empty + svg {
  /* placeholder icon */
  flex-shrink: 0;
  display: inline-block;
  margin: 1px 0.5em 0 0;
  width: 1.125em;
  height: 1.125em;
  display: block;
  backface-visibility: hidden;
  fill: var(--theme--icon_secondary);
}

.new-tab,
.tab-close {
  transition: background 20ms ease-in 0s;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 0.1875em;
  height: 1.25em;
  width: 1.25em;
  padding: 0 0.25px 0 0;

  align-self: center;
  border: none;
  background: transparent;
  -webkit-app-region: no-drag;
}
.new-tab svg,
.tab-close svg {
  width: 0.875em;
  height: 0.875em;
  fill: var(--theme--icon_secondary);
  color: var(--theme--icon_secondary);
}
.new-tab:focus,
.new-tab:hover,
.tab-close:focus,
.tab-close:hover {
  background: var(--theme--ui_interactive-hover);
}
.new-tab:active,
.tab-close:active {
  background: var(--theme--ui_interactive-active);
}

.new-tab {
  margin: 0 3em 0 0.375em;
}
.tab-close {
  margin-left: auto;
}

#window-actions {
  display: flex;
  align-items: center;
  margin-left: auto;
}
#window-actions > * {
  -webkit-app-region: no-drag;
}

[data-tab-labels='page title only'] .tab-icon {
  display: none;
}
[data-tab-labels='page icon only'] .tab {
  width: 4em;
  max-width: 4em;
}
[data-tab-labels='page icon only'] .tab-title {
  display: none;
}

[data-tab-style='rectangular'] .new-tab,
[data-tab-style='traditional tabbed'] .new-tab {
  margin-bottom: -0.25em;
}
[data-tab-style='rectangular'] .tab-close,
[data-tab-style='traditional tabbed'] .tab-close {
  align-self: auto;
}
[data-tab-style='rectangular'] .drag-indicator,
[data-tab-style='traditional tabbed'] .drag-indicator,
[data-tab-style='rectangular'] #tabs {
  margin-bottom: -0.5em;
}
[data-tab-style='rectangular'] .tab {
  padding: 0.6em 0.6em 0.8em 0.6em;
}
[data-tab-style='traditional tabbed'] header {
  padding-top: 0.6875em;
}
[data-tab-style='traditional tabbed'] #tabs {
  margin: -0.1875em 0 -0.5em 0;
}
[data-tab-style='traditional tabbed'] .tab {
  border-top-left-radius: 0.875em;
  border-top-right-radius: 0.875em;
  padding: 0.6em;
}
[data-tab-style='bubble'] .tab {
  border-radius: 0.375em;
}
[data-tab-style='bubble'] .tab:not(:first-child) {
  margin-left: 0.5em;
}
[data-tab-style='bubble'] .drag-indicator {
  margin: 0 -0.3125em 0 0.1875em;
}
[data-tab-style='bubble'] .drag-indicator:first-child {
  margin: 0 0.187em 0 -0.312em;
}
[data-tab-style='compact'] header {
  padding: 0;
  font-size: 14px;
}
[data-tab-style='compact'] #window-actions {
  transform: scale(0.8);
  margin-right: -0.35em;
}

#root {
  flex-grow: 1;
}
.notion-webview {
  width: 100%;
  height: 100%;
  display: none;
}
.search-webview {
  width: 100%;
  height: 60px;
  display: none;
  transition: transform 70ms ease-in;
  transform: translateY(-100%);
  pointer-events: none;
  position: absolute;
  z-index: 2;
}
.search-webview.search-active {
  transition: transform 70ms ease-out;
  transform: translateY(0%);
  pointer-events: auto;
}
