//
// Copyright © 2022 Hardcore Engineering Inc.
// 
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// 
// See the License for the specific language governing permissions and
// limitations under the License.
//

/* Dialogs */
.antiPanel {
  overflow: hidden;
  min-width: 400px;

  background: var(--body-accent);
  border: 1px solid var(--divider-color);
  border-radius: .5rem;
  flex-direction: row;
  box-shadow: var(--popup-shadow);
  // left: 1rem;

  .ac-header {
    &.highlight { background-color: var(--accent-bg-color); }
    &.divide { border-bottom: 1px solid var(--theme-card-divider); }
  }

  .ad-section-50 {
    display: flex;
    flex-direction: column;
    flex-basis: 50%;
    min-height: 0;
    width: 50%;

    &.divide { border-right: 1px solid var(--theme-card-divider); }
  }

  .ad-tools {
    position: absolute;
    display: flex;
    top: 1.25rem;
    right: 1.25rem;

    &.grow-reverse {
      display: flex;
      flex-direction: row-reverse;
      justify-content: flex-end;
      align-items: center;
    }
  }
}

.popupPanel {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  border-radius: .5rem;
  box-shadow: var(--popup-panel-shadow);

  .popupPanel-title {
    display: flex;
    flex-shrink: 0;
    justify-content: stretch;
    align-items: center;

    &.row {
      padding: .5rem .75rem;
      width: 100%;

      &-top { margin: .5rem .75rem .125rem; }
      &-bottom { margin: .5rem .75rem .5rem 1.25rem; }
    }
    &__bordered {
      min-width: 0;
      min-height: 3rem;
      background-color: var(--board-card-bg-color);
      border: 1px solid var(--divider-color);
      border-bottom: none;
      border-radius: .5rem .5rem 0 0;
    }
    &__content {
      flex-grow: 1;
      margin: 0 .75rem;
      min-width: 0;
      min-height: 0;

      &-container {
        display: flex;
        justify-content: stretch;
        min-width: 0;
        width: 100%;
      }
    }
  }

  .popupPanel-body {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 0;
    width: 100%;
    height: 100%;
    background-color: var(--body-color);
    border: 1px solid var(--divider-color);
    border-radius: 0 0 .5rem .5rem;

    &.main {
      justify-content: stretch;
    }
    &.mobile {
      justify-content: center;
    }
    &__main, &__mobile, &__aside {
      display: flex;
      flex-direction: column;
      min-width: 0;
      min-height: 0;
    }
    &__main, &__aside {
      height: 100%;
    }
    &__mobile {
      flex-grow: 1;
    }
    
    &__main {
      flex-grow: 2;
      flex-basis: 760px;
      border: none;
      border-radius: 0;

      &-content {
        display: flex;
        flex-direction: column;
        // flex-shrink: 0;
        margin-left: auto;
        margin-right: auto;
        width: calc(100% - 7.5rem);
        max-width: 860px;

        &.max {
          max-width: 100%;
        }
      }
    }

    .popupPanel-body__header {
      display: flex;
      flex-direction: column;

      &.main {
        margin: 0 auto;
        padding: .75rem 1.25rem;
        width: calc(100% - 5rem);
        max-width: 900px;

        &.max {
          max-width: 100%;
        }
      }
      &.mobile {
        flex-shrink: 0;
        padding: .5rem .75rem .75rem;
        width: 100%;
        min-width: 320px;
      }

      &.bottom-divider { border-bottom: 1px solid var(--divider-color); }
      &.top-divider { border-top: 1px solid var(--divider-color); }
      .header-row {
        display: flex;
        align-items: center;
        width: 100%;
        min-width: 0;
        flex-wrap: wrap;

        &.between { justify-content: space-between; }
      }
      .header-row + .header-row { margin-top: .625rem; }
    }
    .popupPanel-body__mobile-content {
      padding: .5rem;
      min-width: 320px;
    }

    &__aside {
      position: relative;
      width: 25%;
      min-width: 320px;

      &::before {
        position: absolute;
        content: '';
        top: 1rem;
        bottom: 1rem;
        left: 0;
        width: 0;
        border-left: 1px solid var(--divider-color);
      }

      &.float {
        position: absolute;
        flex-shrink: 0;
        top: 0;
        left: 100%;
        width: 320px;
        height: 100%;
        min-width: 0;
        background-color: var(--board-card-bg-color);
        border-left: 1px solid var(--divider-color);
        border-bottom-right-radius: .45rem;
        box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
        transition: box-shadow 150ms ease 0s, transform 150ms cubic-bezier(0.175, 0.885, 0.32, 1.275);
        transform: translateX(0);
        visibility: hidden;

        &::before { content: none; }
        &.shown {
          box-shadow: var(--popup-aside-shadow);
          transform: translateX(-100%);
          visibility: visible;

          &::after {
            position: absolute;
            content: '';
            top: 0;
            left: 100%;
            width: 360px;
            height: 100%;
            background-color: var(--board-card-bg-color);
            border: 1px solid var(--board-card-bg-color);
          }
        }
      }
    }

    // &.asideShown .popupPanel-body__main {
    //   border: 1px solid var(--divider-color);
    //   border-radius: 0 0 .5rem .5rem;
    // }
  }
}

// Full size state
.popup.fullsize .popupPanel {
  border-radius: 0;
  box-shadow: none !important;

  .popupPanel-title,
  .popupPanel-body {
    border-radius: 0;
    border: none;
  }
  // .popupPanel-title { border-bottom: 1px solid var(--divider-color); }
}
.popup.fullsize {
  transition-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19) !important;
}
