@use 'sass:math';

$border-width: 0;
$padding: 5px;

.pwv-popup {
  position: absolute;
  background-color: $popup__BackgroundColor;
  box-shadow: $popup__DropShadow;
  box-sizing: border-box;
  border: solid $border-width transparent;
  z-index: 10;
  opacity: 0.75;
  &:hover {
    opacity: 0.85;
  }
  &.pwv-popup-selected {
    opacity: 1;
    z-index: 12;
  }
  .pwv-mobile-popup & {
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    opacity: 1 !important;
  }
}

.pwv-popup-header {
  .pwv-Toolbar {
    margin: $padding;
  }
}

.pwv-popup-header-info {
  position: absolute;
  box-sizing: border-box;
  left: -$border-width;
  right: -$border-width;
  bottom: -$border-width;
  height: 25px;
  padding: 4px 25px 0 0.3rem;
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 400;
}
.pwv-popup-header-modified {
  margin-right: 5px;
}
.pwv-popup-toolbar {
  background: $popup__BackgroundColor;
  position: absolute;
  top: $padding;
  left: $padding;
  right: $padding;
  height: 40px;
  display: flex;
  justify-content: space-between;
  box-sizing: border-box;
  z-index: 2;

  .pwv-commandbar-item {
    width: 50px;
    height: 40px !important;
  }
}
.pwv-popup-subject {
  position: absolute;
  top: $toolbarItem__height + $padding + 3px;
  left: $padding;
  right: $padding;
  height: 35px;
  z-index: 1;
  input {
    color: $popup__FormFieldTextColor;
    background: $popup__FormFieldBackgroundColor;
    border: $popup__FormFieldBorder;
    padding: 0.3rem;
    box-sizing: border-box;
    font-size: 0.9rem !important;
    width: 100%;
    height: 100%;
  }
  div {
    display: flex;
    align-items: center;
    color: $popup__FormFieldTextColor;
    background-color: $popup__FormFieldBackgroundColor;
    user-select: text;
    border: none;
    font-size: 0.9rem !important;
    padding: 0.3rem;
    box-sizing: border-box;
    height: 100%;
    user-select: text;
    overflow: auto;
  }
}
.pwv-popup-content {
  position: absolute;
  top: $toolbarItem__height + 41px + $padding;
  left: $padding;
  right: $padding;
  bottom: 20px + $padding;
  z-index: 1;
  textarea {
    color: $popup__FormFieldTextColor;
    background: $popup__FormFieldBackgroundColor;
    border: $popup__FormFieldBorder;
    padding: 0.3rem;
    box-sizing: border-box;
    resize: none;
    font-size: 0.9rem !important;
    width: 100%;
    height: 100%;
  }
  div {
    color: $popup__FormFieldTextColor;
    background-color: $popup__FormFieldBackgroundColor;
    user-select: text;
    border: none;
    padding: 0.3rem;
    box-sizing: border-box;
    font-size: 0.9rem !important;
    height: 100%;
    user-select: text;
    overflow: auto;
    white-space: pre-wrap;
  }
}
.pwv-popup-content-no-subject {
  top: 50px + $padding;
}

.pwv-popup-draghandle {
  position: absolute;
  top: 5px;
  right: 55px;
  left: 150px;
  height: 40px;
  z-index: 5;
  cursor: move;
}

.pwv-popup-resizer {
  position: absolute;
  bottom: -$border-width;
  right: -$border-width;
  width: 22px;
  height: 22px;
  cursor: se-resize;
  z-index: 5;
  &::before,
  &::after {
    position: absolute;
    border-top: solid 2px var(--pwv-text-muted-color);
    content: '';
    box-sizing: border-box;
    transform: rotate(-45deg);
  }
  &::before {
    top: 8px;
    left: 8px;
    width: 12px;
    height: 12px;
  }
  &::after {
    top: 12px;
    left: 12px;
    width: 6px;
    height: 6px;
  }
}

.pwv-popup-view-only {
  .pwv-Toolbar {
    background: transparent;

    .pwv-ToolbarButton {
      width: 40px !important;
      height: 34px !important;
      margin-top: -4px;
      margin-right: -4px;
      color: inherit;
      background: transparent;
    }
  }
  .pwv-popup-draghandle {
    left: 2px;
    top: 2px;
    height: 34px;
  }
  .pwv-popup-view-only-content {
    position: absolute;
    top: 34px;
    bottom: 24px;
    left: 0;
    right: 0;
    padding: 4px 10px;
    display: flex;
    flex-direction: column;
    overflow: auto;
    user-select: text;
    background-color: rgba(255, 255, 255, 0.15);
    h4 {
      margin: 0 0 4px 0;
    }
    div {
      font-weight: 400;
    }
  }
  .pwv-popup-header-info {
    padding-left: 10px;
  }
}
