/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

@import 'common/variable';
@import '~bootstrap/scss/bootstrap';
@import '~bootstrap-icons';
@import 'common/color';

.bg-gray-300 {
  background-color: var(--an-gray-300);
}

.focus {
  color: $input-focus-color !important;
  background-color: $input-focus-bg !important;
  border-color: $input-focus-border-color !important;
  outline: 0 !important;
  @if $enable-shadows {
    @include box-shadow($input-box-shadow, $input-focus-box-shadow);
  } @else {
    box-shadow: $input-focus-box-shadow !important;
  }
}

html,
body {
  padding: 0;
}

a {
  text-decoration: none;
}
// If the image does not have a `src` attribute, it must break and may not trigger the `onerror` event.
// With or without the `alt` attribute, it is visually hidden directly.
img[src=''] {
  visibility: hidden !important;
}

.btn-link {
  text-decoration: none;
}

.fs-12 {
  font-size: 0.75rem;
}

.small {
  font-size: 0.875rem;
}

.pic-auth-modal {
  width: 25%;
}

.no-toggle {
  &::after {
    display: none;
  }
}

.unread-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  position: absolute;
  left: 15px;
  top: 0;
  border: 1px solid #fff;
}

.badge-tag {
  display: inline-block;
  font-size: 14px;
  background: $gray-200;
  padding: 0 7px 1px;
  color: $gray-700;
  font-weight: 400;
  border: 1px solid transparent;
  &:hover {
    background: $gray-300;
  }
}

.badge-tag-required {
  font-weight: 700;
}

.badge-tag-reserved {
  background: $orange-100;
  color: $orange-700;
  border: 1px solid transparent;
  &:hover {
    background: $orange-200;
  }
}

.divide-line {
  border-bottom: 1px solid rgba(33, 37, 41, 0.25);
}

#root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
#root > footer {
  margin-top: auto !important;
  padding-bottom: constant(safe-area-inset-bottom);
  padding-bottom: env(safe-area-inset-bottom);
}

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

.btn-no-border,
.btn-no-border:hover,
.btn-no-border:focus,
.btn-no-border:active:focus {
  border: none;
  box-shadow: none;
}

.pointer:hover {
  cursor: pointer;
}

.resize-none {
  resize: none;
}

.split-dot {
  margin-left: 0.25rem !important;
  margin-right: 0.25rem !important;
  &:before {
    content: '\2022';
    color: #6c757d;
  }
}

.name-ellipsis {
  display: inline-block;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.text-truncate-1,
.text-truncate-2,
.text-truncate-3,
.text-truncate-4 {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.text-truncate-2 {
  -webkit-line-clamp: 2;
}
.text-truncate-3 {
  -webkit-line-clamp: 3;
}
.text-truncate-4 {
  -webkit-line-clamp: 4;
}

.last-p {
  p:last-child {
    margin-bottom: 0;
  }
}

.me-10 {
  margin-right: 10px;
}

.warning {
  background-color: var(--an-inbox-warning);
}

.fit-content {
  height: fit-content;
  width: fit-content;
  flex: none;
}

// fix bug for React-Bootstrap Form.Text
.form-text {
  display: inline-block;
}

.fmt {
  width: 100%;
  hr {
    height: 3px;
    border: none;
    position: relative;
    overflow: visible;
    text-align: center;
    opacity: 1;
    flex: none;
    margin: 1.5rem 0;
    &::before {
      content: '';
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(calc(-50% - 16px), -50%);
      width: 3px;
      height: 3px;
      background-color: var(--bs-border-color);
      border-radius: 50%;
    }

    &::after {
      content: '';
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      width: 3px;
      height: 3px;
      background-color: var(--bs-border-color);
      border-radius: 50%;
      box-shadow: 16px 0 0 var(--bs-border-color);
    }
  }
  h1 {
    @extend .fs-3;
    margin-top: 2rem;
  }
  h2 {
    @extend .fs-4;
    margin-top: 2rem;
  }
  h3 {
    @extend .fs-5;
    margin-top: 2rem;
  }
  h4 {
    @extend .fs-6;
    margin-top: 2rem;
  }
  h5 {
    @extend .small;
    margin-top: 2rem;
  }
  h6 {
    @extend .fs-12;
    margin-top: 2rem;
  }
  img {
    max-width: 100%;
  }
  video {
    max-width: 100%;
  }
  p {
    > code {
      background-color: var(--an-e9ecef);
      color: var(--an-212529);
      padding: 2px 4px;
      border-radius: 0.25rem;
    }
  }
  pre {
    background-color: var(--bs-gray-100);
    border-radius: 0.25rem;
    padding: 1rem;
    max-height: 38rem;
    white-space: pre-wrap;
  }
  blockquote {
    border-left: 0.25rem solid #ced4da;
    padding: 1rem;
    color: #6c757d;
    p {
      color: var(--bs-body-color);
    }
    > p:last-child {
      margin-bottom: 0;
    }
  }
  table {
    td,
    th {
      word-break: initial;
    }
  }
  ol ol,
  ol ul,
  ul ol,
  ul ul {
    margin-bottom: 1rem;
  }
}

.upload-img-wrap {
  flex-grow: 1;
  height: 128px;
}

.review-text-delete {
  color: #842029;
  background-color: #f8d7da;
  text-decoration: line-through;
  .review-text-add {
    text-decoration: none;
  }
}

.review-text-add {
  color: #0f5132;
  background-color: #d1e7dd;
  text-decoration: none !important;
}

.rotate-90-deg {
  display: inline-block;
  transform: rotate(90deg);
  transition: transform 0.2s;
}
.rotate-0-deg {
  display: inline-block;
  transform: rotate(0deg);
  transition: transform 0.2s;
}

.pre-line {
  white-space: pre-wrap;
}

.reset-p {
  p {
    margin-bottom: 0;
  }
}

@keyframes bg-fade-out {
  0%,
  25% {
    background-color: var(--bs-highlight-bg);
  }
  100% {
    background-color: transparent;
  }
}
.bg-fade-out {
  animation: bg-fade-out 2s ease 0.3s;
}

.btnSvg,
.btnSvg:hover {
  display: inline-block;
  font-size: 16px;
  width: 16px;
  height: 16px;
  fill: currentColor;
  vertical-align: -0.125em;
}

.max-width-200 {
  max-width: 200px;
}

.alert-exist {
  color: var(--an-alert-exist-color);
}

.bronze {
  color: #cd7f32;
}
.silver {
  color: #c0c0c0;
}
.gold {
  color: #ffd700;
}

.view-level1 {
  color: $orange-600;
}

.view-level2 {
  color: $orange-700;
}

.view-level3 {
  color: $orange-800;
}

.mb-12 {
  margin-bottom: 12px;
}

.a-code-wrap:hover .a-code-tool {
  display: block;
}
.a-code-tool {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  font-size: 16px;
  z-index: 1;
  display: none;
  line-height: 1;
}
