@import '../fonts/styles.css';
@import '../pages/styles.scss';

[data-theme='auto'] {
  @import 'github-markdown-css/github-markdown.css';
  @media screen and (prefers-color-scheme: dark) {
    @import 'highlight.js/scss/github-dark.scss';
    --font-color: #c9d1d9;
    --theme-color: #202124;
    --theme-border-color: #3c4043;
    --dragbar-color: #3c4043;
  }
  @media screen and (prefers-color-scheme: light) {
    @import 'highlight.js/scss/github.scss';
    --font-color: #24292f;
    --theme-color: #eaecf0;
    --theme-border-color: #aeafb2;
    --dragbar-color: #dfe0e1;
  }
}

[data-theme='dark'] {
  @import 'highlight.js/scss/github-dark.scss';
  @import 'github-markdown-css/github-markdown-dark.css';

  --font-color: #c9d1d9;
  --theme-color: #202124;
  --theme-border-color: #3c4043;
  --dragbar-color: #3c4043;
}

[data-theme='light'] {
  @import 'highlight.js/scss/github.scss';
  @import 'github-markdown-css/github-markdown-light.css';

  --font-color: #24292f;
  --theme-color: #eaecf0;
  --theme-border-color: #aeafb2;
  --dragbar-color: #ccced0;
}

.chatgptbox-sidebar-free {
  margin-left: 60px;
}

.chatgptbox-container * {
  font-family: 'Cairo', sans-serif;
  font-size: 14px;
}

.chatgptbox-container {
  width: 100%;
  flex-basis: 0;
  flex-grow: 1;
  margin-bottom: 20px;

  .gpt-inner {
    height: 100%;
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    border: 1px solid;
    overflow: hidden;
    border-color: var(--theme-border-color);
    background-color: var(--theme-color);
    margin: 0;

    hr {
      height: 1px;
      background-color: var(--theme-border-color);
      border: none;
      margin: 5px 0;
    }
  }

  .markdown-body {
    padding: 5px 15px 10px;
    background-color: var(--theme-color);
    color: var(--font-color);
    overflow-y: auto;

    ul,
    ol {
      padding-left: 1.5em;
    }

    ol {
      list-style: none;
      counter-reset: item;

      li {
        counter-increment: item;

        &::marker {
          content: counter(item) '. ';
        }
      }
    }
  }

  .icon-and-text {
    color: var(--font-color);
    display: flex;
    align-items: center;
    padding: 15px;
    gap: 6px;
  }

  .manual-btn {
    cursor: pointer;
  }

  .gpt-loading {
    color: var(--font-color);
    animation: chatgptbox-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  }

  .code-corner-util {
    color: inherit;
    position: absolute;
    right: 10px;
    top: 3px;
    transition: opacity 0.3s;
    opacity: 0.2;
  }

  .code-corner-util:hover {
    opacity: 1;
  }

  .gpt-util-group {
    display: flex;
    gap: 15px;
    align-items: center;
  }

  .gpt-util-icon {
    display: flex;
    cursor: pointer;
    align-items: center;
  }

  .normal-button {
    padding: 1px 6px;
    border: 1px solid;
    border-color: var(--theme-border-color);
    background-color: var(--theme-color);
    color: var(--font-color);
    border-radius: 5px;
    cursor: pointer;
    white-space: nowrap;
  }

  :is(.answer, .question, .error) {
    font-size: 15px;
    line-height: 1.6;
    border-radius: 8px;
    word-break: break-word;
    pre {
      margin-top: 10px;
      padding: 0;
    }

    & > p {
      margin-bottom: 10px;
    }

    code {
      white-space: pre-wrap;
      word-break: break-word;
      border-radius: 8px;

      .hljs {
        padding: 0;
      }
    }

    p {
      margin: 0;
    }
  }

  .gpt-header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    color: var(--font-color);

    p {
      font-weight: bold;
    }

    .gpt-feedback {
      display: flex;
      gap: 6px;
    }

    .gpt-feedback-selected {
      color: #f08080;
    }
  }

  .error {
    color: #ec4336;
  }

  .interact-input {
    box-sizing: border-box;
    padding: 5px 15px;
    border: 0;
    border-top: 1px solid var(--theme-border-color);
    width: 100%;
    background-color: var(--theme-color);
    color: var(--font-color);
    resize: none;
    min-height: 70px;
    max-height: 160px;
  }

  .dragbar {
    cursor: move;
    width: 42%;
    height: 12px;
    border-radius: 10px;
    background-color: var(--dragbar-color);
  }
}

@keyframes chatgptbox-pulse {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.chatgptbox-selection-toolbar {
  display: flex;
  align-items: center;
  border-radius: 15px;
  padding: 2px;
  background-color: #ffffff;
  box-shadow: 4px 2px 4px rgba(0, 0, 0, 0.2);
}

.chatgptbox-selection-toolbar-button {
  margin-left: 2px;
  padding: 2px;
  border-radius: 30px;
  background-color: #ffffff;
  color: #24292f;
  cursor: pointer;
}

.chatgptbox-selection-toolbar-button:hover {
  background-color: #d4d5da;
}

.chatgptbox-selection-window {
  height: auto;
  border-radius: 8px;
  background-color: var(--theme-color);
  box-shadow: 4px 4px 4px rgba(0, 0, 0, 0.2);
}
