// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Copyright (c) KALEIDOS INC Sucursal en España SL

@use "refactor/common-refactor.scss" as deprecated;

.element-options {
  display: flex;
  flex-direction: column;
  height: calc(100vh - #{deprecated.$s-160}); // TODO: Fix this hardcoded value
  overflow: hidden;
  padding-bottom: deprecated.$s-16;
  overflow-y: auto;
  padding-inline: var(--sp-m);
}

.viewer-code-block {
  height: calc(100vh - #{deprecated.$s-108}); // TODO: Fix this hardcoded value
}

.download-button {
  @extend %button-secondary;
  @include deprecated.uppercase-title-typography;

  height: deprecated.$s-32;
  width: 100%;
  margin: deprecated.$s-8 0;
}

.code-block {
  @include deprecated.code-typography;

  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding: 0 deprecated.$s-4 deprecated.$s-8 0;

  pre {
    border-radius: deprecated.$br-8;
    padding: deprecated.$s-16;
    overflow: auto;
    height: 100%;
  }

  // Overrides background setted in the theme
  :global(.hljs) {
    background: var(--color-background-tertiary);
  }

  &.collapsed {
    height: initial;
  }
}

.code-row-lang {
  display: grid;
  grid-template-columns: deprecated.$s-12 1fr deprecated.$s-60;
  gap: deprecated.$s-4;
  width: 100%;
}

.code-lang {
  @include deprecated.uppercase-title-typography;

  display: flex;
  align-items: center;
}

.action-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: deprecated.$s-4;
}

.expand-button,
.css-copy-btn,
.html-copy-btn {
  @extend %button-tertiary;

  height: deprecated.$s-32;
  width: deprecated.$s-28;

  svg {
    @extend %button-icon;

    stroke: var(--icon-foreground);
  }
}

.code-lang-options {
  max-width: deprecated.$s-108;
}

.code-lang-select {
  @include deprecated.uppercase-title-typography;

  width: deprecated.$s-72;
  border: deprecated.$s-1 solid transparent;
  background-color: transparent;
  color: var(--menu-foreground-color-disabled);
}

.code-lang-option {
  @include deprecated.uppercase-title-typography;

  width: deprecated.$s-72;
  height: deprecated.$s-32;
  padding: deprecated.$s-8;
  color: var(--menu-foreground-color-disabled);
}

.code-row-display {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding-bottom: deprecated.$s-8;
}

.toggle-btn {
  @include deprecated.button-style;

  display: flex;
  align-items: center;
  padding: 0;
  color: var(--title-foreground-color);
  stroke: var(--title-foreground-color);

  .collapsabled-icon {
    @include deprecated.flex-center;

    height: deprecated.$s-24;
    border-radius: deprecated.$br-8;

    svg {
      @extend %button-icon-small;

      transform: rotate(90deg);
      stroke: var(--icon-foreground);
    }

    &.rotated svg {
      transform: rotate(0deg);
    }
  }

  &:hover {
    color: var(--title-foreground-color-hover);
    stroke: var(--title-foreground-color-hover);

    .title {
      color: var(--title-foreground-color-hover);
      stroke: var(--title-foreground-color-hover);
    }

    .collapsabled-icon svg {
      stroke: var(--title-foreground-color-hover);
    }
  }
}
