#book-wrap {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    overflow: hidden;
    -webkit-box-orient: horizontal;
    -webkit-box-direction: normal;
    -webkit-flex-flow: row nowrap;
    -ms-flex-flow: row nowrap;
    flex-flow: row nowrap;
}

#container-wrap {
    position: relative;
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    -ms-flex: 1;
    flex: 1;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-flow: column nowrap;
    -ms-flex-flow: column nowrap;
    flex-flow: column nowrap;
    -webkit-box-ordinal-group: 3;
    -webkit-order: 2;
    -ms-flex-order: 2;
    order: 2;
    min-width: 0;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.zoom-container {
    position: relative;
}

button.pagenavbtn {
    display: block;
    position: absolute !important;
    left: 0;
    top: 50%;
    width: 68px;
    height: 68px;
    margin: -34px 0 0 0;
    text-align: center;
    outline: 0;
    background: url(../images/arrows-slider.svg) no-repeat;
    opacity: .7;
    will-change: transform;
}

button#nextBtn.pagenavbtn {
    left: auto;
    right: 0;
    -ms-transform: scaleX(-1);
    -moz-transform: scaleX(-1);
    -webkit-transform: scaleX(-1);
    transform: scaleX(-1);
}

#pgthumbs {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    -ms-flex-direction: column;
    flex-direction: column;
    -webkit-flex-shrink: 0;
    -ms-flex-negative: 0;
    flex-shrink: 0;
    -webkit-box-ordinal-group: 2;
    -webkit-order: 1;
    -ms-flex-order: 1;
    order: 1;
}

.gallery-wrap {
    flex-wrap: wrap;
    overflow-y: auto;
    max-height: calc(100vh - 105px);
}


/* Custom layout for thumbnails */

.gallery .thumbnail-container span {
    display: block;
    text-align: center;
}

.gallery .thumbnail-container a {
    display: inline-block;
}

.gallery .thumbnail-container:nth-child(1) {
    flex: 1 1 100%;
}

.gallery .thumbnail-container:nth-child(n+2) {
    flex: 1 1 calc(50% - 10px);
}

.gallery .thumbnail-container:nth-child(odd) {
    text-align: left;
}

.gallery .thumbnail-container:nth-child(even) {
    text-align: right;
}

.gallery .thumbnail-container:nth-child(even) img {
    border-right: 1px solid #636367;
}

.gallery .thumbnail-container:first-child,
.gallery .thumbnail-container:last-child {
    text-align: center !important;
}

.gallery .thumbnail-container:last-child img {
    border: 0;
}

.gallery .thumbnail-container:nth-child(n+2):nth-last-child(1) {
    flex: 1 1 100%;
    text-align: center;
}

#pgthumbs,
#toc {
    background-color: #99d7dd;
    font-family: 'Gill Sans', 'Arial Narrow', Helvetica, Arial, sans-serif;
}

#toc {}

.contentstable {
    overflow-y: auto;
    max-height: calc(100vh - 95px);
}

.contentstable ul li {
    border-bottom: 1px solid #ededed;
}

.contentstable ul li a {
    padding: 8px 20px;
    color: #636367;
    display: block;
    line-height: 1.2;
}

.thumbnail {
    width: 100px;
}

.gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 0;
}

.thumbnail-container {
    text-align: center;
}

.page-number {
    margin-top: 5px;
    font-size: 14px;
}

#pgthumbs,
#toc {
    visibility: hidden;
    /* Start with the TOC hidden */
    opacity: 0;
    transition: visibility 0s, opacity 0.5s linear;
    width: 0;
    overflow: scroll;
    z-index: 999;
}

.expanded {
    visibility: visible !important;
    opacity: 1 !important;
    width: 240px !important;
}

#thumbsgal {
    position: relative;
}


/* Loading Icon Styles */

.loading-icon {
    display: none;
    /* Initially hidden */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: #007bff;
}

.sidebarheader {
    height: 45px;
    display: table;
    width: 100%;
}

.sidebarheader>* {
    display: table-cell;
    vertical-align: middle;
    padding: 5px;
    height: 45px;
}

.sidebaricon {
    width: 24px;
}

.sidebarclose {
    width: 24px;
}

.sidebarheader svg {
    position: static;
}

#viewer-options>div.viewer-option-btn.sidebar_btn {
    margin-right: 0;
}

.viewer-option-btn[name="Go to Table of Contents"] {
    display: none;
}

.viewer-option-btn.zoom_btn button {
    display: inline-block;
}

.viewer-option-btn.zoom_btn svg {
    position: relative;
    left: auto;
    top: auto;
    width: 24px !important;
}

@media only screen and (max-width: 767px) {
    .viewer-option-btn.zoom_btn svg {
        width: 45px !important;
    }
}

@media (max-width: 780px) {
    #viewer-options-bar>span {
        display: flex;
        flex-wrap: nowrap;
        justify-content: space-between;
    }
    #viewer-options svg {
        width: 37.5px !important;
    }
    #viewer-options button.viewer-option-btn svg {
        position: relative;
    }
    #viewer-options>div.viewer-option-btn.zoom_btn,
    #viewer-options>div.viewer-option-btn.sidebar_btn {
        display: flex;
        flex-wrap: nowrap;
        justify-content: space-between;
        max-width: 100%;
        margin-right: 0 !important;
    }
    .viewer-option-btn {
        margin-right: 0 !important;
    }
    #viewer-options .viewer-option-btn:last-child {
        margin-right: 0;
    }
    nav#page-nav>button {
        height: 50px;
        width: 50px;
    }
}

@media (min-width: 781px) {
    nav#page-nav>button {
        height: 115px;
        width: 115px;
    }
}