/**
 * Copyright (c) Forward Email LLC
 * SPDX-License-Identifier: BUSL-1.1
 */

// https://github.com/twbs/bootstrap/issues/24374
.min-vh-80 {
  min-height: 80vh !important;
}
.min-vh-100 {
  min-height: calc(100vh - 58.61px) !important;
}
.min-h-100 {
  min-height: 100%;
}

// <https://stackoverflow.com/a/63947940>
:root {
  --sat: env(safe-area-inset-top);
  --sar: env(safe-area-inset-right);
  --sab: env(safe-area-inset-bottom); /* THIS ONE GETS US THE HOME BAR HEIGHT */
  --sal: env(safe-area-inset-left);
}

// NOTE: we have to use class name here otherwise emails get a padding on top
//       which is especially annoying in email clients like Thunderbird where it pads the top of composition window
body.app {
  padding-top: 60px;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.text-decoration-underline {
  text-decoration: underline !important;
}

.navbar-toggler {
  outline: transparent !important;
  border-color: transparent !important;
  background-color: transparent !important;
  -webkit-transition: all 0.3s ease;
  -moz-transition: all 0.3s ease;
  -o-transition: all 0.3s ease;
  transition: all 0.3s ease;
  &[aria-expanded*="false"] {
    -webkit-transform: rotate(0deg);
    -moz-transform: rotate(0deg);
    -o-transform: rotate(0deg);
    -ms-transform: rotate(0deg);
    transform: rotate(0deg);
  }
  &[aria-expanded*="true"] {
    -webkit-transform: rotate(-180deg);
    -moz-transform: rotate(-180deg);
    -o-transform: rotate(-180deg);
    -ms-transform: rotate(-180deg);
    transform: rotate(-180deg);
    i.fas.fa-bars:before {
      content: "\f00d"
    }
  }
}

@include media-breakpoint-up(sm) {
  .navbar-small {
    .navbar-collapse {
      a.btn, button.btn {
        font-size: 0.8rem !important;
      }
      &.show {
        a.btn, button.btn {
          font-size: 1rem !important;
        }
      }
    }
  }
}

@media (prefers-color-scheme: light) {
  .text-themed a, a.text-themed, a.text-themed.btn-link {
    color: inherit;
    &:hover {
      color: inherit;
    }
  }
  .btn-link.text-themed {
    color: inherit;
  }
  mark, .mark {
    margin: 0 -0.4em;
    padding: 0.1em 0.4em;
    border-radius: 0.8em 0.3em;
    background: transparent;
    background-image: linear-gradient(
      to right,
      rgba(255, 225, 0, 0.1),
      rgba(255, 225, 0, 0.7) 4%,
      rgba(255, 225, 0, 0.3)
    );
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
  }
}

// <https://github.com/forwardemail/forwardemail.net/issues/141>
// <https://stackoverflow.com/q/58931615>
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-delay: -1s !important;
    animation-duration: 1s !important;
    animation-iteration-count: 1 !important;
    background-attachment: initial !important;
    scroll-behavior: auto !important;
    transition-duration: 0s !important;
  }
}

.dropdown-toggle::after {
  vertical-align:middle !important;
}

.modal-header {
  font-family: $headings-font-family;
  h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    margin-bottom: 0 !important;
  }
}

@media (prefers-color-scheme: light) {
  @include media-breakpoint-up(md) {
    .bg-fixed {
      background-color: #E6FAFF;
    }
  }
}

@media (prefers-color-scheme: dark) {
  @include media-breakpoint-up(md) {
    .bg-fixed {
      background-color: #0d1116;
    }
  }
}

.bg-fixed {
  min-height: 100%;
  background-repeat: no-repeat;
  // background-attachment: fixed;
  background-size: cover;
  background-position: 50% 50%;
}

@include media-breakpoint-down(md) {
  .bg-md-down-none {
    background-image: none !important;
  }
}

html {
  &.no-js {
    .no-js {
      display: none !important;
    }
    img.lazyload, span.lazyload {
      display: none !important;
    }
  }


  &.no-js, &.bot-detected {
    // hide css for js that bots don't use
    // (since we only support lazyload for bots)
    .dropdown-toggle:after {
      display: none !important;
    }

    // override for pages like FAQ to render q&a dropdowns
    .collapse:not(.show) {
      display: block;
    }
  }
}

pre {
  white-space: pre-wrap !important;
}


.btn.focus, .btn:focus {
  box-shadow: none !important;
}

.card-columns {
  column-count: 1;
  @include media-breakpoint-up(sm) {
    column-count: 2;
  }
  @include media-breakpoint-up(md) {
    column-count: 3;
  }
  @include media-breakpoint-up(lg) {
    column-count: 4;
  }
}

.card-columns-2 {
  column-count: 1;
  @include media-breakpoint-up(md) {
    column-count: 2 !important;
  }
}

.dropdown-menu {
  overflow-y: auto !important;
  max-height: 50vh !important;
  .card-columns {
    column-count: 1;
    @include media-breakpoint-up(md) {
      column-count: 2;
    }
  }
}

.navbar .dropdown-menu {
  @include media-breakpoint-up(md) {
    max-height: 80vh !important;
  }
}

.swal2-toast {
  .swal2-title {
    visibility: hidden;
    overflow: hidden;
    width: 0;
    height: 0;
  }
}

// render fullscreen (see @ladjs/assets since it does Swal.fire immediately)
// (e.g. this is so generated password modals render above everything else and instantly)
.swal2-grow-fullscreen {
  z-index: 9999;
}

.dropdown-header {
  @include font-size($font-size-base);
}

a, .markdown-body a {
  color: $link-color;
  text-decoration: $link-decoration;
  background-color: transparent; // Remove the gray background on active links in IE 10.

  @include hover() {
    color: $link-hover-color;
    text-decoration: $link-hover-decoration;
  }
}

.lazyframe[data-vendor=youtube], .lazyframe[data-vendor=youtube_nocookie] {
  background-color: #000000;
}

.lazyframe {
  width: 100%;
  height: 450px;
  border-radius: 0.3rem !important;
}

.lazyframe-bordered {
  max-width: 100%;
  border-width: 0.5rem !important;
  width: 640px;
  height: 360px;
}

.text-sans-serif {
  font-family: $font-family-sans-serif !important;
}

.border-05rem {
  border-width: 0.5rem !important;
}

.right-0 {
  right: 0;
}

.cursor-initial {
  cursor: initial;
}

.max-height-300px {
  max-height: 300px;
}

.min-width-25 {
  min-width: 25%;
}

// paypal due to CSP issue with inline styling
.component-frame {
  width: 100%;
  height: 100%;
}

// for email comparison page
.w-33 {
  width: 33%;
}

.ubuntu-font {
  font-family: "Ubuntu", sans-serif !important;
  font-weight: 400;
  font-style: normal;
}

.bounce-animation {
  animation: bounce-animation 2s ease infinite;
}
@keyframes bounce-animation {
	0%, 20%, 50%, 80%, 100% {transform: translateY(0);}
	40% {transform: translateY(-20px);}
	60% {transform: translateY(-10px);}
}

#modal-reply-to-email-list {
  list-style-type: none;
  padding: 0;
}

#modal-reply-to-email-list li {
  padding: 8px 12px;
  border-bottom: 1px solid #ccc;
}

#modal-reply-to-email-list li:last-child {
  border-bottom: none;
}
