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

@import './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 tabSlideIn {
  from {
    width: 0;
  }
  to {
    width: 8.5em;
  }
}

body:not([style*='--theme']):not(.error) > * {
  opacity: 0;
}
body:not([style*='--theme']):not(.error)::after {
  content: '';
  position: absolute;
  left: calc(50% - 15px);
  top: calc(50% + 10px);
  width: 18px;
  height: 18px;
  border: 4px solid rgb(34, 34, 34, 0.5);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
body[style*='--theme']::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;
}

#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-color: 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;
}
#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: 4px solid var(--theme--table-border);
  opacity: 0.8;
}
#tabs .tab:first-child {
  margin-top: 0.5em;
}
#tabs .tab:not(.new) span:not(.close) {
  width: 8.5em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#tabs .tab.slideIn span:not(.close) {
  animation: tabSlideIn 100ms ease-in-out;
}
#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: 4px solid var(--theme--option_active-background);
}
#tabs .tab.new {
  background: none;
  border: none;
  margin-left: -0.1em;
}
#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 {
  background: var(--theme--table-border);
  border-radius: 5px;
}
#tabs .tab.dragged-over {
  box-shadow: inset 4px 0 0 0 var(--theme--selected);
}

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