@use 'sass:color';
@use '../utils/box-shadow_variables';
@use '../utils/font_variables';
@use '../utils/size_variables';

/**
 * Copyright IBM Corp. 2016, 2025
 * SPDX-License-Identifier: BUSL-1.1
 */

$console-close-height: 35px;

.console-ui-panel {
  background: var(--token-color-palette-neutral-700);
  width: -moz-available;
  width: -webkit-fill-available;
  height: 0;
  min-height: 0;
  overflow: auto;
  position: fixed;
  bottom: 0;
  transition:
    min-height size_variables.$speed size_variables.$easing,
    transform size_variables.$speed ease-in;
  will-change: transform, min-height;
  -webkit-overflow-scrolling: touch;
  z-index: 199;
}

.console-ui-panel-content {
  color: hsl(0, 0%, 100%);
  display: flex;
  flex-direction: column;
  font-size: size_variables.$size-7;
  font-weight: font_variables.$font-weight-semibold;
  justify-content: flex-end;
  min-height: calc(100% - $console-close-height); // account for close button that is sticky positioned
  padding: size_variables.$spacing-12 size_variables.$spacing-12 size_variables.$spacing-18;
  transition: justify-content size_variables.$speed ease-in;

  pre,
  p {
    background: none;
    color: inherit;
    font-size: size_variables.$size-7;
    min-height: 2rem;
    padding: 0;
  }

  .console-ui-panel-intro {
    color: var(--token-color-palette-neutral-400);
  }
}

.console-ui-input {
  align-items: center;
  display: flex;

  input {
    background-color: rgba(hsl(0, 0%, 4%), 0.5);
    border: 1px solid var(--token-color-palette-neutral-500);
    border-radius: var(--token-side-nav-body-list-item-border-radius);
    caret-color: hsl(0, 0%, 100%);
    color: hsl(0, 0%, 100%);
    flex: 1 1 auto;
    font-family: font_variables.$family-monospace;
    font-size: size_variables.$size-6;
    font-weight: font_variables.$font-weight-bold;
    outline: none;
    padding: size_variables.$spacing-8;
    margin-right: size_variables.$spacing-8;
    transition: background-color size_variables.$speed;
  }
}

.console-ui-command {
  line-height: 2;
}

.console-ui-output {
  transition: background-color size_variables.$speed ease-in-out;
  will-change: background-color;
  padding-right: size_variables.$spacing-36;
  position: relative;
  background-color: rgba(#000, 0);
  color: var(--token-color-palette-neutral-400);
  &:hover {
    background-color: rgba(#000, 0.5);
  }
}

.console-ui-alert {
  margin-left: calc(#{size_variables.$spacing-20} - 0.33rem);
  position: relative;
  color: var(--token-color-palette-neutral-400);

  svg {
    position: absolute;
    left: 0;
    top: 0;
  }

  &.console-ui-alert--error {
    color: color.adjust(#e52228, $lightness: 20%);
  }
  &.console-ui-alert--success {
    color: color.adjust(#008a22, $lightness: 20%);
  }
}

.panel-open .console-ui-panel {
  box-shadow: box-shadow_variables.$box-shadow-highest;
  min-height: 425px;
}

.main--console-open {
  padding-bottom: 425px;
}

.panel-open .console-ui-panel.fullscreen {
  bottom: 0;
  right: 0;
  min-height: 100vh;
  width: 100%;
}

.console-spinner.control {
  height: 21px;
  width: 21px;
  transform: scale(0.75);
  transform-origin: center;
  &::after {
    height: auto;
    width: auto;
    right: 0.25rem;
    left: 0.25rem;
    top: 0.25rem;
    bottom: 0.25rem;
  }
}

.console-close-button {
  position: sticky;
  top: size_variables.$spacing-8;
  height: $console-close-height;
  display: flex;
  justify-content: flex-end;
  z-index: 210;

  button {
    margin-right: size_variables.$spacing-8;
  }
}
