// @author    : Adarsh Pastakia
// @version   : 5.0.0
// @copyright : 2019
// @license   : MIT

.ui-panel {
  align-self: start;
  border-radius: $base-border-radius;
  display: grid;
  grid-template-areas: "header" "body" "footer";
  grid-template-rows: auto 1fr auto;
  max-height: 100%;
  max-width: 100%;
  overflow: hidden;
  position: relative;

  $base: unquote(".ui-panel");

  &__group {
    > #{$base} {
      border-radius: 0;

      &:first-child {
        border-top-left-radius: $base-border-radius;
        border-top-right-radius: $base-border-radius;
      }

      &:last-child {
        border-bottom-left-radius: $base-border-radius;
        border-bottom-right-radius: $base-border-radius;
      }
    }
  }

  &__body {
    display: grid;
    grid-area: body;
    grid-template-areas: "content";
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    overflow: hidden;
    position: relative;

    > compose {
      display: grid;
      grid-area: content;
      grid-template-areas: "content";
      grid-template-columns: 1fr;
      grid-template-rows: 1fr;
    }
  }

  &__header {
    align-items: center;
    display: grid;
    grid-area: header;
    grid-template-areas: "drag-handle header actions";
    grid-template-columns: auto 1fr auto;
    position: relative;

    .ui-header {
      position: static;
    }

    .ui-btn__wrapper {
      font-size: 0.75em;
    }

    &__actions {
      align-items: center;
      align-self: stretch;
      display: grid;
      grid-area: actions;
      grid-auto-flow: column;
      grid-gap: 2px;

      > .ui-divider {
        margin: 4px;
        @extend %vr;
      }

      &:not(:empty) {
        @include property-prefix(margin-start, -1em);
        padding: 0 0.5em;
      }
    }
  }

  &[data-collapsed="true"] {
    .ui-footer,
    .ui-panel__body {
      // stylelint-disable-next-line declaration-no-important
      max-height: 0 !important;
      min-height: 0;
    }
  }

  &[data-expanded="true"] {
    .ui-footer,
    .ui-panel__body {
      // stylelint-disable-next-line declaration-no-important
      max-height: unset !important;
      min-height: unset;
    }

    @include position(fixed, 1em);
    box-shadow: 0 0 4em rgba(0, 0, 0, 0.9);
    z-index: 5000;
  }

}
