@font-face {
    font-family: "Fira_Sans";
    src: url(../../../../assets/fonts/Fira_Sans/FiraSans-Regular.woff2) format("woff2");
    font-display: swap;
}

@font-face {
    font-family: "Lato";
    src: url(../../../../assets/fonts/Lato/Lato-Regular.woff2) format("woff2");
    font-display: swap;
}

@font-face {
    font-family: "Libre_Baskerville";
    src: url(../../../../assets/fonts/Libre_Baskerville/LibreBaskerville-Regular.woff2) format("woff2");
    font-display: swap;
}

@font-face {
    font-family: "Merriweather";
    src: url(../../../../assets/fonts/Merriweather/Merriweather-Regular.woff2) format("woff2");
    font-display: swap;
}

@font-face {
    font-family: "Nanum_Gothic";
    src: url(../../../../assets/fonts/Nanum_Gothic/NanumGothic-Regular.woff2) format("woff2");
    font-display: swap;
}

@font-face {
    font-family: "RocknRoll_One";
    src: url(../../../../assets/fonts/RocknRoll_One/RocknRollOne-Regular.woff2) format("woff2");
    font-display: swap;
}

@font-face {
    font-family: "OpenDyslexic2";
    src: url(../../../../assets/fonts/OpenDyslexic2/OpenDyslexic-Regular.woff2) format("woff2");
    font-display: swap;
}

:root {
    --br-actionbar-button-text-color: #6c757d;
    --accordion-body-bg-color: black;
    --accordion-header-bg-color: grey;
    --br-actionbar-button-hover-border-color: #6c757d;
    --br-actionbar-bg-color: white;
}


$dark-form-background-no-opacity: rgb(1, 4, 9);
$primary-color: #0062cc;
$action-bar-height: 38px;


// Drawer
.control-container {
    padding-bottom: 5px;
}

.page-stub {
    margin-top: 6px;
    padding-left: 2px;
    padding-right: 2px;
}

.drawer-body {
    overflow: auto;

    .reader-pills {
        justify-content: center;
        margin: 0 0.25rem;

        li a {
            border: 1px solid var(--primary-color);
            margin: 0 0.25rem;

            .active {
                border: unset;
            }
        }
    }
}

//          Drawer End

.fixed-top {
    z-index: 1022;
    direction: ltr;
}

.dark-mode .overlay {
    opacity: 0;
}


.action-bar {
    background-color: var(--br-actionbar-bg-color);
    overflow: hidden;
    box-shadow: 0 0 6px 0 rgb(0 0 0 / 70%);
    max-height: $action-bar-height;
    height: $action-bar-height;

    .book-title-text {
        text-align: center;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    @media(max-width: 875px) {
        .book-title {
            display: none;
        }
    }

    .book-title {
        margin-top: 10px;
        text-align: center;
        text-transform: capitalize;
        max-height: inherit;
    }

    .next-page-highlight {
        color: var(--primary-color);
    }
}

.reader-container {
    outline: none; // Only the reading section itself shouldn't receive any outline. We use it to shift focus in fullscreen mode
    overflow: auto;
    height: calc(var(--vh, 1vh) * 100);
    position: relative;
    // This is completely invisible, everything else renders over it

    &.column-layout-1 {
        height: calc(var(--vh) * 100);
    }

    &.column-layout-2 {
        height: calc(var(--vh) * 100);
    }

    &.writing-style-vertical {
        direction: rtl;
    }
}

.reading-section {
    width: 100%;
    //overflow: auto;  // This will break progress reporting
    height: 100vh;
    padding-top: $action-bar-height;
    padding-bottom: $action-bar-height;
    position: relative;
    direction: ltr;

    //background-color: green !important;

    &.column-layout-1 {
        height: calc((var(--vh, 1vh) * 100) - $action-bar-height);
    }

    &.column-layout-2 {
        height: calc((var(--vh, 1vh) * 100) - $action-bar-height);
    }

    &.immersive {
        height: calc((var(--vh, 1vh) * 100));
        //padding-top: 0px;
        //padding-bottom: 0px;
    }

    &.writing-style-vertical {
        writing-mode: vertical-rl;
        height: 100%;
    }
}

.book-container {
    position: relative;
    height: 100%;

   // background-color: purple !important;

    &.column-layout-1 {
        height: calc((var(--vh, 1vh) * 100) - $action-bar-height);
    }

    &.column-layout-2 {
        height: calc((var(--vh, 1vh) * 100) - $action-bar-height);
    }

    &.writing-style-vertical {
        // Fixes an issue where chrome will cut of margins, doesn't seem to affect other browsers
        overflow: auto;
    }

}

.book-content {
  position: relative;
  margin: 0 0;
  padding: 20px 0px;

  &.column-layout-1 {
      height: calc((var(--vh) * 100) - calc($action-bar-height)); //  * 2

      &.writing-style-vertical {
          padding: 0 10px 0 0;
          margin: 20px 0;
      }
    }

    &.column-layout-2 {
        height: calc((var(--vh) * 100) - calc($action-bar-height)); //  * 2

        &.writing-style-vertical {
            padding: 0 10px 0 0;
            margin: 20px 0;
        }
    }

    &.writing-style-vertical {
        height: auto;
    }

    // &.immersive {
    //     // Note: I removed this for bug: https://github.com/Kareadita/Kavita/issues/1726
    //     //height: calc((var(--vh, 1vh) * 100) - $action-bar-height);
    // }

    a, :link {
        color: var(--brtheme-link-text-color);
    }

    background-color: var(--brtheme-bg-color);
}

.pagination-cont {
    background: var(--br-actionbar-bg-color);
    border-radius: 5px;
    padding: 5px 15px;
    margin: 0 0 5px;
    border: var(--drawer-pagination-border);
}

.virt-pagination-cont {
    padding-bottom: 5px;
    margin-bottom: 5px;
    box-shadow: var(--drawer-pagination-horizontal-rule);
}

.bottom-bar {
    position: fixed;
    width: 100%;
    bottom: 0px;
    left: 0px;
    writing-mode: horizontal-tb;
}



// This is essentially fitting the text to height and when you press next you are scrolling over by page width
.column-layout-1 {
    .book-content {
        column-count: 1;
        column-gap: 20px;
        overflow: hidden;
        word-break: break-word;
        overflow-wrap: break-word;
    }
}

.column-layout-2 {
    .book-content {
        column-count: 2;
        column-gap: 20px;
        overflow: hidden;
        word-break: break-word;
        overflow-wrap: break-word;
    }
}

// A bunch of resets so books render correctly
::ng-deep .book-content {
    & a, & :link {
        color: blue;
    }
}

// This is applied to images in the backend
::ng-deep .kavita-scale-width-container {
    width: auto;
    max-height: calc(var(--book-reader-content-max-height) - ($action-bar-height)) !important;
    max-width: calc(var(--book-reader-content-max-width)) !important;
    position: var(--book-reader-content-position) !important;
    top: var(--book-reader-content-top) !important;
    left: var(--book-reader-content-left) !important;
    transform: var(--book-reader-content-transform) !important;

}

// This is applied to images in the backend
::ng-deep .kavita-scale-width {
    max-height: calc(var(--book-reader-content-max-height) - ($action-bar-height)) !important;
    max-width: calc(var(--book-reader-content-max-width)) !important;
    object-fit: contain;
    object-position: top center;
    break-inside: avoid;
    break-before: column;
    max-height: 100vh;
}


// Click to Paginate styles
.icon-primary-color {
    color: $primary-color;
}



.right {
    position: absolute;
    right: 0px;
    top: $action-bar-height;
    width: 20vw;
    z-index: 3;
    background: transparent;
    border-color: transparent;
    border: none !important;
    opacity: 0;
    outline: none;

    &.immersive {
        top: 0px;
    }

    &:hover {
        cursor: pointer;
    }
}

// This class pushes the click area to the left a bit to let users click the scrollbar
.right-with-scrollbar {
    position: absolute;
    right: 17px;
    top: $action-bar-height;
    width: 18%;
    z-index: 3;
    background: transparent;
    border-color: transparent;
    border: none !important;
    opacity: 0;
    outline: none;

    &.immersive {
        top: 0px;
    }
    &:hover {
      cursor: pointer;
    }
}

.left {
    position: absolute;
    left: 0px;
    top: $action-bar-height;
    width: 20vw;
    background: transparent;
    border-color: transparent;
    border: none !important;
    z-index: 3;
    opacity: 0;
    outline: none;

    &.immersive {
        top: 0px;
    }

    &:hover {
      cursor: pointer;
    }
}



.highlight {
  background-color: rgba(65, 225, 100, 0.5) !important;
  animation: fadein .5s both;
}
.highlight-2 {
  background-color: rgba(65, 105, 225, 0.5) !important;
  animation: fadein .5s both;
}




.btn {
    &.btn-secondary {
        color: var(--br-actionbar-button-text-color);
        border-color: transparent;
        background-color: unset;

        &:hover, &:focus {
            border-color: var(--br-actionbar-button-hover-border-color);
        }
    }

    &.btn-outline-secondary {
        border-color: transparent;
        background-color: unset;

        &:hover, &:focus {
            border-color: var(--br-actionbar-button-hover-border-color);
        }
    }

    span {
        background-color: unset;
        color: var(--br-actionbar-button-text-color);
    }

    i {
        background-color: unset;
        color: var(--br-actionbar-button-text-color);
    }

    &:active {
        * {
            color: white;
        }
    }
}
