@use 'sass:map';
@use '../abstracts/variables';
@use '../abstracts/functions';
@use '../abstracts/mixins/typography';
@use '../abstracts/mixins/breakpoints' as *;

.pkt-preview {
  position: relative;
  .pkt-tabs {
    --pkt-tabs-bg: var(--pkt-color-surface-default-gray);
  }
  &__component {
    position: relative;
    display: flex;
    justify-content: space-around;
    align-items: center;
    min-height: 10rem;
    padding: 3rem 1rem;
    margin: 0;
    background-color: var(--pkt-color-background-default);
    transition: background-color 0.2s linear;
    &--fullwidth > div {
      width: 100%;
    }
    &-container {
      border: 2px solid var(--pkt-color-border-gray);
      display: flex;
      flex-direction: column;
      gap: 0;
      @include bp('tablet-big-up') {
        flex-direction: row;
        .pkt-preview__component {
          flex: 1 1 0;
          min-width: 0;
        }
        .pkt-preview__panel {
          flex: 0 0 auto;
          min-width: 20rem;
          max-width: 25rem;
          width: 100%;
        }
      }
    }
  }
  &__panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 2rem 1.5rem;
    justify-content: space-between;
    align-items: stretch;
    background-color: var(--pkt-color-surface-default-gray);
    &__options {
      display: flex;
      flex-direction: column;
      gap: 1rem;
      margin-bottom: 1rem;
    }
  }
  &__options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }
  &__opts {
    padding: 1rem;
    background-color: var(--pkt-color-surface-default-gray);
    > .pkt-cell {
      position: relative;
      > .pkt-tag {
        display: block;
        position: absolute;
        top: 0;
        right: 0;
        padding: 0 0.25rem 0;
      }
    }
  }
  .hide-code-button {
    position: absolute;
    top: 100%;
    margin-top: -1.5rem;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 1rem;
    z-index: 2;
  }
  &__code {
    color: var(--pkt-color-text-body-default);
    position: relative;
    &-container {
      position: relative;
      padding: 2rem 2rem 0;
      background-color: var(--pkt-color-grays-gray-800);
      transition: max-height 0.5s ease;
      max-height: 50rem;
      .pkt-tabs {
        --pkt-tabs-bg: var(--pkt-color-grays-gray-800);
      }
      &.hide-code {
        overflow: hidden;
        max-height: 11.7rem;
        &:after {
          content: '';
          display: block;
          position: absolute;
          top: 0;
          bottom: 0;
          left: 0;
          right: 0;
          background: linear-gradient(180deg, transparent 0%, transparent 93%, var(--pkt-color-grays-gray-800) 100%);
        }
      }
    }
    pre {
      max-height: 30rem;
      overflow: auto;
      margin-top: 0 !important;
      background-color: transparent !important;
      font-size: 1rem;
      padding: 2rem 0;
    }
  }
  &__copy {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
  }
  &__array-item,
  &__object-editor {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }
  &__add-object {
    text-align: right;
    margin-top: 0.5rem;
  }
  &__remove-object {
    position: absolute;
    top: -2rem;
    right: -0.25rem;
  }
  &__specs {
    pre {
      margin-top: 0 !important;
    }
  }
}

.astro-code.github-light {
  background-color: var(--pkt-color-surface-default-gray) !important;
}

.preview-content {
  display: contents;
}
