@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;
    --question-bg-color: #2d2e33;
    --theme-border-color: #3c4043;
    --dragbar-color: #3c4043;
    --color-neutral-muted: rgba(110, 118, 129, 0.4);
    --code-background-color: rgb(13, 17, 23);
  }
  @media screen and (prefers-color-scheme: light) {
    @import 'highlight.js/scss/github.scss';
    --font-color: #24292f;
    --theme-color: #ffffff;
    --question-bg-color: #f7f7f7;
    --theme-border-color: #dbdbde;
    --dragbar-color: #ccced0;
    --color-neutral-muted: rgba(150, 160, 170, 0.3);
    --code-background-color: #f7f7f7;
  }
}

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

  --font-color: #c9d1d9;
  --theme-color: #202124;
  --question-bg-color: #2d2e33;
  --theme-border-color: #3c4043;
  --dragbar-color: #3c4043;
  --color-neutral-muted: rgba(110, 118, 129, 0.4);
  --code-background-color: rgb(13, 17, 23);
}

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

  --font-color: #24292f;
  --theme-color: #ffffff;
  --question-bg-color: #f7f7f7;
  --theme-border-color: #dbdbde;
  --dragbar-color: #ccced0;
  --color-neutral-muted: rgba(150, 160, 170, 0.3);
  --code-background-color: #f7f7f7;
}

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

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

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

  .gpt-inner {
    height: 100%;
    display: flex;
    position: relative;
    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: 0;
    }
  }

  .markdown-body {
    background-color: var(--theme-color);
    color: var(--font-color);
    overflow-y: auto;
    overflow-x: hidden;

    ::-webkit-scrollbar {
      background-color: var(--theme-color);
      width: 9px;
    }
    ::-webkit-scrollbar-thumb {
      background-color: var(--theme-border-color);
      border-radius: 20px;
      border: transparent;
    }
    ::-webkit-scrollbar-corner {
      background: transparent;
    }
    &::-webkit-scrollbar {
      background-color: var(--theme-color);
      width: 9px;
    }
    &::-webkit-scrollbar-thumb {
      background-color: var(--theme-border-color);
      border-radius: 20px;
      border: transparent;
    }
    &::-webkit-scrollbar-corner {
      background: transparent;
    }
    p {
      color: var(--font-color);
    }

    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;
  }

  .question {
    background: var(--question-bg-color);
  }

  :is(.answer, .question, .error) {
    font-size: 15px;
    line-height: 1.6;
    padding: 4px 15px;
    word-break: break-word;

    pre {
      margin-top: 10px;
      padding: 0;

      code {
        background-color: var(--code-background-color);
        font-size: 14px;
      }
    }

    p {
      margin: 0 0 10px;
    }

    code {
      padding: 0 0.4em;
      margin: 0;
      white-space: pre-wrap;
      word-break: break-word;
      border-radius: 8px;
      background-color: var(--color-neutral-muted);
      font-size: 11px;

      .hljs {
        padding: 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;
      margin: 0;
    }

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

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

  .error {
    p {
      color: #ec4336;
    }

    color: #ec4336;
  }

  .input-box {
    display: contents;
  }

  .interact-input {
    box-sizing: border-box;
    padding: 5px 15px;
    padding-right: 1em;
    border: 0;
    border-top: 1px solid var(--theme-border-color);
    width: 100%;
    height: 100%;
    background-color: var(--theme-color);
    color: var(--font-color);

    &:focus {
      outline: none;
    }

    &::-webkit-scrollbar {
      background-color: var(--theme-color);
      width: 9px;
    }
    &::-webkit-scrollbar-thumb {
      background-color: var(--theme-border-color);
      border-radius: 20px;
      border: transparent;
    }
    &::-webkit-scrollbar-corner {
      background: transparent;
    }
  }

  .submit-button {
    position: absolute;
    right: 1.1em;
    bottom: 0.4em;
    padding: 1px 6px;
    cursor: pointer;
    background-color: #30a14e;
    color: white;
    border: 1px solid;
    border-radius: 6px;
    border-color: rgba(31, 35, 40, 0.15);
    font-size: 1em;
    box-shadow: 0 1px 0 rgba(31, 35, 40, 0.1);
  }

  .draggable {
    cursor: move;
  }

  .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: 0 2px 0 0;
  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);
}
