@use '@linzjs/lui/dist/scss/Foundation/Variables/ColorVars' as colors;
@use '@linzjs/lui/dist/scss/Foundation/Variables/FontVars' as fonts;

.WindowPanel,
.PopoutWindowContainer {
  @include fonts.font-regular();
  font-size: fonts.$base-font-size;
  line-height: fonts.$base-line-height;
  color: colors.$base-type-color;
}

.PopoutWindowContainer .PopoutWindowContainer--hidden {
  position: absolute;
  inset: 0;
  backdrop-filter: blur(4px);
  background-color: rgb(69 69 69 / 15%);
  z-index: 10000;
}

.LuiCheckboxInput--nomargin {
  margin: 0;
}

.panelDock > .panelDock-content:not(:empty) + .panelDock-empty {
  display: none;
}

.WindowPanel-children {
  display: flex;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.WindowPanel-header {
  height: 48px;
  line-height: 48px;
  user-select: none;
  color: colors.$charcoal;
  padding: 0 16px;
  display: flex;
  white-space: nowrap;
  overflow: hidden;
  justify-content: space-between;
  border-bottom: 2px colors.$lily solid;
  font-size: 1em;
  font-weight: 600;
  flex-direction: row;
  align-items: center;

  .LuiTabsGroup {
    margin-top: 4px;
    line-height: 16px;

    .LuiTab {
      min-width: 0;
      padding-left: 8px;
      padding-right: 8px;
      padding-bottom: 11px;
    }

    .LuiTab:not(.LuiTab--active):focus {
      padding-top: 8px;
      padding-bottom: 8px;
    }

    .LuiTab--active {
      padding-left: 7px;
      padding-right: 7px;
    }

    .LuiTab--active::after,
    .LuiTab--active:focus::after {
      padding: 0;
    }
  }

  .lui-button + .lui-button,
  a.lui-button + .lui-button {
    margin-left: 0 !important;
  }
}

.WindowPanel-footer {
  background-color: colors.$snow;
  border-top: 2px solid colors.$lily;
  display: flex;
  flex-direction: row;
  padding: 12px;

  .WindowPanel-footer-left {
    flex: 1;
  }

  &:where(:not(:has(.WindowPanel-footer-left))) {
    justify-content: right;
  }
}

.WindowPanel {
  box-sizing: border-box;

  box-shadow:
    0 1px 6px 0 #00000026,
    0 6px 10px 0 #00000040;
  background-color: #fff;
  display: flex;
  flex-direction: column;
  border-radius: 9px;

  .WindowPanel-header {
    border-radius: 9px 9px 0 0;
  }

  .WindowPanel-footer {
    border-radius: 0 0 9px 9px;
  }

  &:where(:has(.WindowPanel-header)) {
    // If the content is the last child, it means there is no footer, so we need to apply the border radius to the content element.
    // Use :where() to reduce css specificity so that overriding in downstream apps is easier.
    .WindowPanel-content:where(:last-child) {
      border-radius: 0 0 9px 9px;
    }
  }
}

%WindowPanel-divider {
  border-left: 2px solid colors.$lily;
  background-color: colors.$lily;
  width: 0;
  height: 19px;
}

.WindowPanel-divider-left {
  @extend %WindowPanel-divider;
  margin-right: 15px;
  margin-left: 19px;
}

.WindowPanel-divider-right {
  @extend %WindowPanel-divider;
  margin-right: 8px;
  margin-left: 8px;
}

.WindowPanel-buttons {
  display: flex;
  align-items: center;

  a.lui-button,
  button.lui-button {
    display: flex;
    align-items: center;

    span.LuiIcon {
      margin-left: auto;
      margin-right: auto;
    }
  }
}

.WindowPanel-header-title {
  display: flex;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
}

.WindowPanel-header-title-icon {
  fill: colors.$fuscous !important;
  margin-right: 8px;
}

.WindowPanel-content {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
}
