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

:root {
  --component--panel-width: 260px;
}

#enhancer--panel-hover-trigger {
  height: 100vh;
  width: 2.5rem;
  max-height: 100%;
  z-index: 999;
  position: absolute;
  top: 45px;
  right: 0;
  flex-grow: 0;
  flex-shrink: 0;
  transition: width 300ms ease-in-out;
}
#enhancer--panel-hover-trigger[data-enhancer-panel-pinned] {
  /* taking up the physical space of the panel to move topbar buttons */
  top: 0;
  position: relative;
  width: var(--component--panel-width);
}

.notion-frame {
  transition: padding-right 300ms ease-in-out;
}
.notion-frame[data-enhancer-panel-pinned] {
  padding-right: var(--component--panel-width);
}
.notion-cursor-listener > div[style*='flex-end'] {
  transition: margin-right 300ms ease-in-out;
}
.notion-cursor-listener > div[style*='flex-end'][data-enhancer-panel-pinned],
#enhancer--panel[data-enhancer-panel-pinned] + div[style*='flex-end'] {
  margin-right: var(--component--panel-width);
}

#enhancer--panel {
  z-index: 999;
  position: absolute;
  background: var(--theme--bg_secondary);
  width: var(--component--panel-width);
  right: calc(-1 * var(--component--panel-width));
  opacity: 0;
  height: 100vh;
  flex-grow: 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  transition: 300ms ease-in;

  margin-top: 5rem;
  max-height: calc(100vh - 10rem);
}
#enhancer--panel-hover-trigger:hover + #enhancer--panel:not([data-enhancer-panel-pinned]),
#enhancer--panel:not([data-enhancer-panel-pinned]):hover {
  opacity: 1;
  transform: translateX(calc(-1 * var(--component--panel-width)));
  box-shadow: var(--theme--ui_shadow, rgba(15, 15, 15, 0.05)) 0px 0px 0px 1px,
    var(--theme--ui_shadow, rgba(15, 15, 15, 0.1)) 0px 3px 6px,
    var(--theme--ui_shadow, rgba(15, 15, 15, 0.2)) 0px 9px 24px !important;
}
#enhancer--panel[data-enhancer-panel-pinned] {
  opacity: 1;
  max-height: 100%;
  margin-top: 0;
  transform: translateX(calc(-1 * var(--component--panel-width)));
}

.enhancer--panel-view-title {
  margin: 0;
  height: 1em;
  display: flex;
  align-items: center;
  font-size: 1.1rem;
  font-weight: 600;
}
.enhancer--panel-view-title svg,
.enhancer--panel-view-title img {
  height: 1em;
  width: 1em;
}
.enhancer--panel-view-icon {
  margin-bottom: -2px;
}
.enhancer--panel-view-title .enhancer--panel-view-title-text {
  font-size: 0.9em;
  margin: 0 0 0 0.75em;
  padding-bottom: 0.3em;
  white-space: nowrap;
  overflow: hidden;
}

#enhancer--panel-header {
  font-size: 1.2rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  padding: 0.75rem 0 0.75rem 1rem;
  background: var(--theme--bg_secondary);
}
#enhancer--panel-header-title {
  max-width: calc(100% - 4.25rem);
}
#enhancer--panel-header-title .enhancer--panel-view-title {
  font-size: 1.2rem;
}
#enhancer--panel-header-title .enhancer--panel-view-title-text {
  max-width: calc(100% - 1.75em);
  position: relative;
}

#enhancer--panel-switcher-overlay-container {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 999;
  overflow: hidden;
}
#enhancer--panel-switcher {
  max-width: 320px;
  position: relative;
  right: 14px;
  border-radius: 3px;
  padding: 8px 0;
  background: var(--theme--bg_card);
  box-shadow: var(--theme--ui_shadow, rgba(15, 15, 15, 0.05)) 0px 0px 0px 1px,
    var(--theme--ui_shadow, rgba(15, 15, 15, 0.1)) 0px 3px 6px,
    var(--theme--ui_shadow, rgba(15, 15, 15, 0.2)) 0px 9px 24px !important;
  overflow: hidden;
}
.enhancer--panel-switcher-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 8px 14px;
  user-select: none;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  background: var(--theme--bg_card);
}
#enhancer--panel-header:hover,
#enhancer--panel-header:focus-within,
.enhancer--panel-switcher-item:hover,
.enhancer--panel-switcher-item:focus {
  background: var(--theme--ui_interactive-hover);
}
#enhancer--panel-header:active,
.enhancer--panel-switcher-item:active {
  background: var(--theme--ui_interactive-active);
}

#enhancer--panel-content {
  margin: 0.75rem 1rem;
  font-size: 1rem;
}
#enhancer--panel-header-switcher {
  padding: 4px;
}
#enhancer--panel-header-toggle {
  margin-left: auto;
  padding-right: 1rem;
  height: 100%;
  width: 2.5em;
  opacity: 0;
  display: flex;
}
#enhancer--panel-header-toggle > div {
  margin: auto 0 auto auto;
}
#enhancer--panel-header-switcher,
#enhancer--panel-header-toggle > div {
  color: var(--theme--icon_secondary);
  height: 1em;
  width: 1em;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: 300ms ease-in-out;
}
#enhancer--panel #enhancer--panel-header-toggle svg {
  transition: 300ms ease-in-out;
}
#enhancer--panel:not([data-enhancer-panel-pinned]) #enhancer--panel-header-toggle svg {
  transform: rotateZ(-180deg);
}
#enhancer--panel:hover #enhancer--panel-header-toggle {
  opacity: 1;
}

#enhancer--panel-resize {
  position: absolute;
  left: -5px;
  height: 100%;
  width: 10px;
}
#enhancer--panel[data-enhancer-panel-pinned] #enhancer--panel-resize {
  cursor: col-resize;
}
#enhancer--panel-resize div {
  transition: background 150ms ease-in-out;
  background: transparent;
  width: 2px;
  margin-left: 4px;
  height: 100%;
}
#enhancer--panel[data-enhancer-panel-pinned] #enhancer--panel-resize:hover div {
  background: var(--theme--ui_divider);
}