/*!
 * Copyright (C) 2023 Xibo Signage Ltd
 *
 * Xibo - Digital Signage - https://xibosignage.com
 *
 * This file is part of Xibo.
 *
 * Xibo is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * Xibo is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with Xibo.  If not, see <http://www.gnu.org/licenses/>.
 */
@import "variables";

.help-pane {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;

  &-loader {
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: $xibo-color-overlay-light;
    color: $xibo-color-primary-l60;
    top: 0;
    left: 0;
    font-size: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  &-card-header {
    display: flex;
    height: 34px;
    padding: 8px 16px;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
    border-bottom: 1px solid $xibo-color-neutral-500;
    background: $xibo-color-neutral-300;

    .card-header-title {
      flex: 1 0 0;
      line-height: 18px;
    }

    .back-icon, .close-icon {
      display: flex;
      width: 24px;
      height: 24px;
      justify-content: center;
      align-items: center;
      flex-shrink: 0;
      color: $xibo-color-neutral-900;
      cursor: pointer;

      &:hover {
        color: $xibo-color-neutral-1000;
      }
    }
  }

  &-container {
    position: relative;
    width: 400px;
    display: none;
    flex-direction: column;
    align-items: flex-start;
    border-radius: 3.5px;
    border: 1px solid $xibo-color-neutral-700;
    background: $xibo-color-neutral-0;
    overflow: hidden;
    max-height: calc(100vh - 100px);
    overflow-y: auto;

    .list-group-cards {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      gap: 1px;
      background: $xibo-color-neutral-500;

      .list-group-card-container {
        display: flex;
        padding: 12px 16px;
        align-self: stretch;
        background: $xibo-color-neutral-0;

        .list-group-card {
          display: flex;
          flex-direction: column;
          align-items: flex-start;
          align-self: stretch;

          .list-group-link {
            color: $xibo-color-primary;
          }

          .list-group-summary {
            color: $xibo-color-neutral-900;
            line-height: 18px;
          }
        }
      }

    }

    .list-group-padded-cards {
      display: flex;
      flex-direction: column;
      padding: 16px;
      gap: 8px;

      .help-pane-card {
        display: flex;
        padding: 8px;
        align-items: center;
        gap: 8px;
        align-self: stretch;
        border-radius: 3.5px;
        border: 1px solid $xibo-color-neutral-300;
        background: $xibo-color-neutral-0;
        text-decoration: none;
        cursor: pointer;

        &-preview {
          display: flex;
          width: 40px;
          height: 40px;
          justify-content: center;
          align-items: center;
          border-radius: 3.5px;
          background: $xibo-color-primary;

          i {
            color: $xibo-color-neutral-0;
            font-size: 24px;
          }
        }

        &-info {
          display: flex;
          flex-direction: column;
          align-items: flex-start;
        }

        &-title, &-desc {
          align-self: stretch;
          line-height: 18px;
        }

        &-title {
          color: $xibo-color-neutral-900;
        }

        &-desc {
          color: $xibo-color-primary;
        }

        &:hover {
          background: $xibo-color-primary-l20;

          .help-pane-card-preview {
            background: $xibo-color-primary-d40;
          }
        }

        &:focus {
          border-color: $xibo-color-primary-d60;
        }
      }
    }
  }

  &-feedback-form {
    display: flex;
    padding: 16px;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-end;
    gap: 16px;
    align-self: stretch;
    background: $xibo-color-neutral-0;

    & > *:not(.btn) {
      align-self: stretch;
    }

    .xibo-form-input {
      margin-bottom: 0;

      &.invalid {
        input, textarea {
          border-color: $bootstrap-theme-error-color;
        }

        .error-message {
          color: $bootstrap-theme-error-color;
          font-size: 13px;
        }
      }
    }

    .file-uploader-attachments {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      gap: 8px;
      margin-bottom: 0;

      .control-label {
        margin-bottom: 8px;
      }

      .uploads-area {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        align-self: stretch;

        .uploads-drop {
          display: flex;
          padding: 16px 24px;
          justify-content: center;
          align-items: center;
          gap: 16px;
          align-self: stretch;
          border-radius: 3.5px;
          border: 1px dashed $xibo-color-primary;

          i {
            font-size: 32px;
            opacity: 0.6;
            color: $xibo-color-primary;
          }

          .upload-text {
            display: flex;
            align-items: flex-start;
            align-content: flex-start;
            gap: 4px;
            flex: 1 0 0;
            flex-wrap: wrap;
            color: $xibo-color-neutral-700;

            .upload-text-browse {
              color: $xibo-color-primary;
              cursor: pointer;

              &:hover {
                color: $xibo-color-secondary;
              }
            }
          }

          &.highlight {
            border-style: solid;
            background: $xibo-color-primary-l30;
          }
        }

        .uploads-file-info {
          display: flex;
          justify-content: space-between;
          align-items: flex-start;
          align-self: stretch;
          color: $xibo-color-neutral-700;
        }
      }

      .help-pane-upload-files {
        display: flex;
        padding: 8px;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        align-self: stretch;
        border-radius: 3.5px;
        background: $xibo-color-neutral-500;

        .help-pane-upload-file {
          display: flex;
          padding: 8px;
          align-items: center;
          gap: 8px;
          align-self: stretch;
          border-radius: 3.5px;
          border: 1px solid $xibo-color-neutral-500;
          background: $xibo-color-neutral-0;

          &-preview {
            display: flex;
            width: 40px;
            height: 40px;
            flex: 0 0 40px;
            justify-content: center;
            align-items: center;
            overflow: hidden;
            background: $xibo-color-primary;

            img {
              width: 100%;
              height: 100%;
              object-fit: cover;
              object-position: center;
              display: block;
            }

            i {
              font-size: 24px;
              color: $xibo-color-neutral-0;
            }
          }

          &-info {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            flex: 1 1 auto;
            min-width: 0
          }

          &-name {
            align-self: stretch;
            color: $xibo-color-neutral-900;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
          }

          &-type {
            align-self: stretch;
            color: $xibo-color-primary;
          }

          .remove-file-icon {
            display: flex;
            width: 24px;
            height: 24px;
            flex: 0 0 24px;
            padding: 4px;
            font-size: 16px;
            justify-content: center;
            align-items: center;
            aspect-ratio: 1/1;
            color: $xibo-color-neutral-700;
            cursor: pointer;

            &:hover {
              color: $xibo-color-neutral-900;
            }
          }
        }
      }
    }
  }

  &-alert {
    display: flex;
    padding: 16px;
    gap: 8px;
    align-items: center;
    margin-bottom: 0;
    font-size: 16px;

    .alert-break-text {
      display: flex;
      flex-direction: row;
      flex-wrap: wrap;
    }
  }

  &-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    background-color: $xibo-color-primary;
    width: 48px;
    height: 48px;
    border-radius:  50px;
    cursor: pointer;

    &:hover {
      background-color: $xibo-color-primary-d40;
    }

    &.active {
      background-color: $xibo-color-primary-d60;
    }

    i {
      font-size: 24px;
      color: $xibo-color-neutral-0;
    }
  }

  &-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999;
    background: rgba(0, 0, 0, 0);
  }
}