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

@import './css/buttons.css';

* {
  box-sizing: border-box;
  word-break: break-word;
  text-decoration: none;
  text-size-adjust: 100%;
  font-family: var(--theme--font_sans) !important;
  outline-color: var(--theme--table-border);
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
@keyframes tabSlide {
  from {
    width: 0;
  }
  to {
    width: 8.5em;
  }
}

body:not(.error)::after {
  z-index: 1;
  content: '';
  position: absolute;
  left: calc(50% - 15px);
  top: calc(50% + 10px);
  width: 18px;
  height: 18px;
  opacity: 0.5;
  border: 4px solid var(--theme--text);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

html,
body,
#root {
  background: var(--theme--main) !important;
  position: relative;
  height: 100%;
  margin: 0;
}
#root {
  display: flex;
  flex-direction: column;
}

[data-platform='darwin'] #titlebar {
  padding-left: 4em;
}
#titlebar::before {
  content: '';
  position: absolute;
  width: 100%;
  -webkit-app-region: no-drag;
  top: 0;
  left: 0;
  height: 2px;
}
#titlebar {
  display: flex;
  flex-shrink: 1;
  user-select: none;
  -webkit-app-region: drag;
  background: var(--theme--dragarea);
}
#titlebar button {
  color: var(--theme--text);
  -webkit-app-region: no-drag;
  border: none;
  background: transparent;
}
#titlebar .window-buttons-area {
  margin: 0.5em 0.55em 0.5em auto;
}
#titlebar .window-buttons-area:empty {
  display: none;
}

#open-enhancer-menu::before {
  content: '';
  height: 1.25em;
  width: 1.25em;
  display: inline-block;
  margin: auto 1em -0.25em 1em;
  background-size: contain;
  background-image: url('enhancement://core/icons/mac+linux.png');
  background-repeat: no-repeat;
}
#tabs {
  margin-top: auto;
  flex-wrap: wrap;
  display: flex;
  align-items: center;
}
#tabs .tab:not(.new):not(.current) {
  flex: 1 1 30px;
  min-width: 30px;
}
#tabs button:nth-child(16) {
  display: none;
  opacity: 0;
}
#tabs .tab {
  display: inline-flex;
  background: var(--theme--main);
  border: none;
  font-size: 1.15em;
  padding: 0.2em 0.4em;
  text-align: left;
  border-bottom: 0.22em solid var(--theme--table-border);
  opacity: 0.8;
}
#tabs .tab img {
  object-fit: cover;
  height: 1em;
  width: 1em;
  border-radius: 3px;
  margin: 0 0.5em -0.16em 0.1em;
}
#tabs .tab:not(.new) {
  margin-top: 0.5em;
}
#tabs .tab:not(.new) span:not(.close) {
  width: 8.5em;
  margin-right: 0.22em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#tabs .tab.slideIn span:not(.close) {
  animation: tabSlide 100ms ease-in-out;
}
#tabs .tab.slideOut {
  width: 0;
  animation: tabSlide 100ms ease-in-out reverse;
}
#tabs .tab .close {
  padding: 0 0.35em 0.1em 0.3em;
  margin-left: auto;
  font-weight: bold;
}
#tabs .tab.current {
  opacity: 1;
  background: var(--theme--selected);
  border-bottom: 0.22em solid var(--theme--option_active-background);
}
#tabs .tab.new {
  background: none;
  border: none;
  margin-left: -0.1em;
  margin-top: 0.3em;
}
#tabs .tab.new span {
  padding: 0 0.35em 0.1em 0.3em;
  font-weight: bold;
}
#tabs .tab:hover {
  opacity: 1;
}
#tabs .tab .close:hover,
#tabs .tab.new span:hover,
#titlebar .window-button:hover {
  border-radius: 0.22em;
  background: var(--theme--table-border);
  box-shadow: 0 0 0 0.5px var(--theme--interactive_hover-border);
}
#titlebar .window-button.btn-close:hover {
  background: var(--theme--button_close);
  color: var(--theme--button_close-fill);
}
#tabs .tab.dragged-over {
  box-shadow: inset 0.22em 0 0 0 var(--theme--selected);
}

.notion {
  z-index: 2;
  width: 100%;
  height: 100%;
  display: none;
}