/* Late-loaded dark theme fixes. This file is intentionally loaded after Bootstrap. */
.theme-dark #popular-query .nav-tabs,
.theme-dark .nav-tabs {
    border-bottom-color: #334155!important;
}
.theme-dark #popular-query .nav-tabs > li > a,
.theme-dark .nav-tabs > li > a {
    background: #111827!important;
    color: #b9c7d6!important;
    border-color: transparent!important;
}
.theme-dark #popular-query .nav-tabs > li > a:hover,
.theme-dark #popular-query .nav-tabs > li > a:focus,
.theme-dark .nav-tabs > li > a:hover,
.theme-dark .nav-tabs > li > a:focus {
    background: #172033!important;
    color: #dbe5f1!important;
    border-color: #263449!important;
}
.theme-dark #popular-query .nav-tabs > li.active > a,
.theme-dark #popular-query .nav-tabs > li.active > a:hover,
.theme-dark #popular-query .nav-tabs > li.active > a:focus,
.theme-dark .nav-tabs > li.active > a,
.theme-dark .nav-tabs > li.active > a:hover,
.theme-dark .nav-tabs > li.active > a:focus {
    background: #111827!important;
    color: #8bd448!important;
    border-color: #334155 #334155 #8bd448!important;
    border-bottom: 3px solid #8bd448!important;
}
.theme-dark #popular-stats .stats-chart span,
.theme-dark #popular-stats .stats-chart .chart span {
    color: #263449!important;
    text-shadow: none!important;
}

/* Remove Bootstrap light gaps inside dark tabs. */
.theme-dark #popular-query .nav-tabs,
.theme-dark #popular-query .nav-tabs > li,
.theme-dark #popular-query .nav-tabs > li.active,
.theme-dark #popular-query .nav-tabs > li > a,
.theme-dark #popular-query .nav-tabs > li.active > a,
.theme-dark #popular-query .tab-content {
    background-color: #111827!important;
}
.theme-dark #popular-query .nav-tabs > li > a {
    margin-right: 0!important;
    border-radius: 0!important;
    border-left: 1px solid #263449!important;
    border-right: 0!important;
    border-top: 0!important;
}
.theme-dark #popular-query .nav-tabs > li:first-child > a {
    border-left: 0!important;
}
.theme-dark #popular-query .nav-tabs > li.active > a,
.theme-dark #popular-query .nav-tabs > li.active > a:hover,
.theme-dark #popular-query .nav-tabs > li.active > a:focus {
    border-left-color: #263449!important;
    border-bottom: 3px solid #8bd448!important;
}

/* Make sprite logo readable on dark header. */
.theme-dark #top-logo a {
    filter: invert(1) hue-rotate(180deg) saturate(1.15) brightness(1.08)!important;
}

/* Improve discussion card contrast in dark theme. */
.theme-dark .discussion-item .discussion-item-info a {
    color: #7dd3fc!important;
    border-bottom-color: #496174!important;
}
.theme-dark .discussion-item .discussion-item-info a:hover,
.theme-dark .discussion-item .discussion-item-info a:focus {
    color: #bae6fd!important;
}
.theme-dark .discussion-item .discussion-item-info .icon-author,
.theme-dark .discussion-item .discussion-item-info span.icon-author {
    color: #e5edf7!important;
}
.theme-dark .discussion-item .discussion-item-info span,
.theme-dark .discussion-item .discussion-item-indicators span {
    color: #c7d6e5!important;
}

/* Improve books shelf in dark theme. */
.theme-dark #book-items .module-title span {
    background: #172033!important;
    color: #d9ecff!important;
}
.theme-dark #book-items .module-title {
    border-bottom-color: #334155!important;
}
.theme-dark #book-items .carousel-control.left-control {
    background: linear-gradient(to right, rgba(23,32,51,1) 0%, rgba(23,32,51,.76) 42%, rgba(23,32,51,0) 100%)!important;
}
.theme-dark #book-items .carousel-control.right-control {
    background: linear-gradient(to left, rgba(23,32,51,1) 0%, rgba(23,32,51,.76) 42%, rgba(23,32,51,0) 100%)!important;
}
.theme-dark #book-items .carousel-control .left,
.theme-dark #book-items .carousel-control .right,
.theme-dark #book-items .carousel-control a:focus {
    background: #f8fafc!important;
    box-shadow: 0 12px 28px rgba(0,0,0,.35)!important;
}
.theme-dark #book-items #books-shelf {
    filter: saturate(.95) brightness(.9);
}
.theme-dark #book-items #books-shelf ul li img {
    box-shadow: 0 10px 24px rgba(0,0,0,.32);
}

/* Dark theme fixes for termins tabs and book thumbnails. */
.theme-dark #main-header > .col-sm-8 > .nav-tabs,
.theme-dark #main-header > .col-sm-8 > .nav-tabs > li,
.theme-dark #main-header > .col-sm-8 > .nav-tabs > li > a,
.theme-dark #main-header > .col-sm-8 > .tab-content {
    background-color: #0f172a!important;
}
.theme-dark #main-header > .col-sm-8 > .nav-tabs {
    border-bottom-color: #dbe5f1!important;
}
.theme-dark #main-header > .col-sm-8 > .nav-tabs > li > a {
    color: #dbe5f1!important;
    border-color: transparent!important;
}
.theme-dark #main-header > .col-sm-8 > .nav-tabs > li > a:hover,
.theme-dark #main-header > .col-sm-8 > .nav-tabs > li > a:focus {
    background-color: #172033!important;
    color: #8bd448!important;
}
.theme-dark #main-header > .col-sm-8 > .nav-tabs > li.active > a,
.theme-dark #main-header > .col-sm-8 > .nav-tabs > li.active > a:hover,
.theme-dark #main-header > .col-sm-8 > .nav-tabs > li.active > a:focus {
    background-color: #0f172a!important;
    color: #8bd448!important;
    border-color: transparent transparent #8bd448!important;
    border-bottom: 3px solid #8bd448!important;
}
.theme-dark .termins-book {
    color: #7dd3fc!important;
}
.theme-dark .termins-book:hover span {
    color: #bae6fd!important;
}
.theme-dark .termins-book img {
    background: #172033;
    border: 1px solid #334155;
    border-radius: 4px;
    padding: 6px;
    box-shadow: 0 12px 24px rgba(0,0,0,.22);
    opacity: .96;
}

/* Improve members list colors in dark theme. */
.theme-dark .messages-box li a {
    background: #111827!important;
    border-color: #52647a!important;
}
.theme-dark .messages-box li a:hover {
    background: #172033!important;
    border-color: #7dd3fc!important;
}
.theme-dark .messages-box .msg-name {
    color: #8fd3ff!important;
    font-weight: 600;
}
.theme-dark .messages-box .msg-date {
    color: #b9c7d6!important;
}

/* Improve popular article titles in dark theme. */
.theme-dark #popular-articles .popular-article-list a {
    color: #cfe9ff!important;
}
.theme-dark #popular-articles .popular-article-list a:hover,
.theme-dark #popular-articles .popular-article-list a:focus {
    color: #7dd3fc!important;
}
.theme-dark #popular-articles .popular-article-list span {
    color: #9fc0dd!important;
}
.theme-dark #popular-articles .popular-article-empty {
    color: #b9c7d6!important;
}

/* Improve bulletin button contrast in dark theme. */
.theme-dark #popular-stats .query-count .btn-primary,
.theme-dark #popular-stats .query-count a.btn-primary {
    background: #0b6ea8!important;
    border-color: #0b6ea8!important;
    color: #fff!important;
}
.theme-dark #popular-stats .query-count .btn-primary:hover,
.theme-dark #popular-stats .query-count .btn-primary:focus,
.theme-dark #popular-stats .query-count a.btn-primary:hover,
.theme-dark #popular-stats .query-count a.btn-primary:focus {
    background: #0ea5e9!important;
    border-color: #0ea5e9!important;
    color: #fff!important;
}

/* Improve books page filters in dark theme. */
.theme-dark .books-library-tools {
    background: #111827!important;
    border-color: #334155!important;
}
.theme-dark .books-library-tools h1 {
    color: #d9ecff!important;
}
.theme-dark .books-filter-field label {
    color: #dbe5f1!important;
}
.theme-dark .books-search-input input,
.theme-dark .books-filter-field select {
    background: #0f172a!important;
    border-color: #334155!important;
    color: #e5edf7!important;
}
.theme-dark .books-search-input input::placeholder {
    color: #9fb1c5!important;
}
.theme-dark .books-search-input span {
    color: #9fb1c5!important;
}
.theme-dark .books-filter-submit {
    background: #43c900!important;
    color: #fff!important;
}
.theme-dark .books-filter-submit:hover,
.theme-dark .books-filter-submit:focus {
    background: #38b500!important;
    color: #fff!important;
}
.theme-dark .books-empty-result {
    color: #b9c7d6!important;
}

/* Fix book cover backgrounds in dark theme. */
.theme-dark .books-item .books-image {
    background: transparent!important;
    box-shadow: none!important;
}
.theme-dark .books-item .books-image img {
    display: block;
    background: transparent!important;
    box-shadow: 0 12px 26px rgba(0,0,0,.38);
}
.theme-dark .books-item .book-shadow {
    display: none!important;
}
.theme-dark .books-item .books-rating-type {
    background: rgba(15,23,42,.62)!important;
}

/* Hide unused horizontal scroll in termins table area. */
.theme-dark .year-termins,
.theme-dark .year-termins .termins,
.theme-dark #termins-pagination,
.theme-dark #termins-pagination .simple-pagination {
    max-width: 100%;
    overflow-x: hidden!important;
}


html.theme-dark .search-highlight,
html.theme-dark mark.search-highlight {
    background: #facc15 !important;
    color: #111827 !important;
    box-shadow: 0 0 0 1px rgba(250, 204, 21, .35);
}


html.theme-dark #top-header .ss-id,
html.theme-dark #top-header .ss-id:before,
html.theme-dark #top-header .ss-id i,
html.theme-dark #top-header a.ss-id {
    color: #e5f2ff !important;
}

html.theme-dark #top-header .ss-id:hover,
html.theme-dark #top-header a.ss-id:hover {
    color: #38bdf8 !important;
}
