﻿/*!
 * app.css : Main CSS of the application
 * 
 * Copyright 2013-2023 Mossroy, Jaifroid and contributors
 * License GPL v3:
 * 
 * This file is part of Kiwix.
 * 
 * Kiwix is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Kiwix is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Kiwix (file LICENSE-GPLv3.txt).  If not, see <http://www.gnu.org/licenses/>
 */

[role=region] {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    position: fixed;
    overflow: hidden;
}

[role=region] > header {
    margin-left: 1px;
    text-align: center;
}

[role=region] > header > h1 {
    margin: 0;
    text-shadow: 0 1px 1px rgba(0,0,0,.4);
}

[role=region] > .view-content {
    margin: 0;
    position: relative; /*Fixes #250 Random button display bug in W10M */
    height: 0;
}

[role=region] > footer {
    background: rgba(217,237,247,0.8);
    right: 0;
    bottom: 0;
    left: 0;
    position: fixed;
    text-align: center;
}

[role=region] > footer > menu[role=toolbar] {
    margin: 0;
    padding: 0;
}

label {
    font-weight: normal !important;
    margin-left: 20px;
}

#navigationButtons .restrictedSize {
    max-width: 80%;
    margin-left: auto;
    margin-right: auto;
}

body {
    background-color: whitesmoke !important;
}

.panel-heading {
    font-weight: 600;
}

div:not(.panel-success, .alert-message) {
    -ms-user-select: none;
    -moz-user-select: none;
    -webkit-user-select: none;
    user-select: none;
}

.dark ::-webkit-scrollbar {
    height: 10px;
}

.dark ::-webkit-scrollbar-button:start:decrement,
.dark ::-webkit-scrollbar-button:end:increment {
    height: 30px;
    background-color: transparent;
}

.dark ::-webkit-scrollbar-track-piece {
    background-color: #3b3b3b;
}

.dark ::-webkit-scrollbar-thumb:vertical {
    height: 50px;
    background-color: #666;
    border: 1px solid #eee;
}

.nopadding {
    padding-right: 1px !important;
    padding-left: 1px !important;
}

.dragging-over * {
    pointer-events: none;
}

#articleList {
    margin-bottom: 12px !important;
    overflow-wrap: break-word;
}

#top, #articleContent, #footer, article {
    transition: transform 0.5s ease;
}

#scrollbox {
    width: 100%;
    overflow: auto;
}

#articleListWithHeader {
    position: absolute;
    top: 0;
    left: 5%;
    padding-left: 12px;
    padding-right: 12px;
    background: lightblue;
    z-index: 1;
}

#articleList a:hover, #articleList a.hover, .backgroundLightBlue {
    background: lightblue;
}

.dark #articleList a:hover, .dark #articleList a.hover {
    background: darkslategray;
}

.dark #articleListWithHeader {
    background: darkslategrey;
}

#btnHome {
    padding: 0px 1em !important;
}

#btnRandomArticle, #btnToggleTheme {
    top: 2px;
}

#OPFSQuota {
    padding: 4px;
    width: -moz-fit-content;
    width: fit-content;
    border-style: groove;
    border-width: 3px;
}

.form-control:not([id^="findInArticle"]) {
    margin-top: 5px !important;
    margin-bottom: 5px !important;
    /*box-shadow: none !important;*/
}

.form-control:not([id^="archiveList"]) {
    height: 2.2em !important;
    padding: 5px 1em !important;
}

.navbar-inverse {
    background-color: #d9edf7 !important;
    border-color: #d9edf7 !important;
    margin-bottom: 0 !important;
}

.dark .form-control {
    color: lightgray;
    background: #222;
}

.articleIFrame {
    position: fixed;
    width: 100%;
    border: 0;
    transition: top 300ms;
    z-index: 0;
}

.category-padding {
    margin: 0 auto;
    max-width: 800px;
}

.apiAvailable {
    color: green;
}

.apiUnavailable, .apiSuboptimal {
    color: orange;
}

.apiBroken {
    color : red;
}

.loader {
    position: absolute;
    margin: 0 auto;
    left: 0;
    right: 0;
    border: 5px solid lightgrey;
    -webkit-animation: spin 1s linear infinite;
    animation: spin 1s linear infinite;
    border-top: 5px solid steelblue;
    border-radius: 50%;
    width: 50px;
    height: 50px;
}

.glyphicon.spinning {
    color: white;
    -webkit-animation: spin 1s linear infinite;
    animation: spin 1s linear infinite;
}

.status {
    position: absolute;
    top: 50%;
    width: 100%;
    z-index: 1;
}

.message {
    position: absolute;
    margin: 70px auto 0;
    left: 0;
    right: 0;
    font-size: smaller;
    background: whitesmoke;
    color: dimgrey;
    border: 1px solid gainsboro;
    padding: 1px 4px;
    width: 200px;
}

.dark .message {
    background: darkslategrey;
    color: darkgrey;
    border: 1px solid dimgrey;
}

.dark code {
    background-color: lightsteelblue;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.settings {
    float: left;
    margin: 5px;
    padding: 10px;
    max-width: 500px;
    min-height: 150px;
    border: 1px solid black;
}

.navbar-header {
    float: none !important;
    -webkit-app-region: no-drag;
}

.navbar-fixed-bottom {
    background: inherit;
}

.navbar {
    min-height: 0px !important;
    height: 45px;
    left: env(titlebar-area-x, 0);
    top: env(titlebar-area-y, 0);
    width: env(titlebar-area-width, 100%);
    -webkit-app-region: drag;
}

nav a.btn-primary, .input-group-addon {
    background: #d9edf7;
    border-color: #d9edf7 !important;
    margin-top: 3px;
    padding: 5px 1em !important;
}

.btn:active, .btn-primary:active, .btn-primary.active {
    background: lightsteelblue !important;
    background-color: lightsteelblue !important;
}

.dark .btn:active, .dark .btn-primary:active, .dark .btn-primary.active {
    background: darkslategray !important;
    background-color: darkslategray !important;
}

.btn:hover  {
    background: lightsteelblue;
    background-color: lightsteelblue;
}

.dark .btn:hover {
    background: darkslategray;
    background-color: darkslategray;
}

@media (pointer: coarse) {
    .btn:hover {
        background: #d9edf7 !important;
        background-color: #d9edf7 !important;
    }
    .btn:active  {
        background: lightsteelblue !important;
        background-color: lightsteelblue !important;
    }
    .dark .btn:hover {
        background: #222 !important;
        background-color: #222 !important;
    }
    .dark .btn:active {
        background: darkslategray !important;
        background-color: darkslategray !important;
    }
}

.dark .btn-primary, .dark .btn-secondary, .dark .navbar-inverse {
    background: #222 !important;
    border-color: #222 !important;
}

.dark .btn-inline {
    background: #182828 !important;
    border-color: darkslategray !important;
}

.dark .modal-footer .btn-primary, .dark .modal-footer .btn-secondary {
    border-color: #777 !important;
}

footer .btn-xs {
    margin: 5px 5px 10px;
}

.glyphicon {
    color: darkblue;
}

.btn-sm, .btn-lg, .btn-default {
    background-color: rgba(217,237,247,0) !important;
    border: transparent !important;
    /*color: whitesmoke !important;*/
    color: darkblue !important;
    font-weight: bold !important;
}

.btn {
    z-index:initial !important;
}

.btn-danger {
    background-color: lightyellow !important;
    color: darkred !important;
}

.dark .btn-danger {
    background-color: #250000 !important;
    color: gainsboro !important;
}

.btn-danger:hover {
    background-color: red !important;
    color: lightyellow !important;
}

.dark .btn-danger:hover {
    background-color: darkred !important;
    color: lightyellow !important;
}

.darkfooter {
    background: rgba(34,34,34,0.8) !important;
}

.console {
    font-size: medium;
    font-weight:bold;
    font-family:consolas,monospace;
}

pre {
    font-weight: bold;
}

.dropdown-menu, .dropdown-menu a {
    background: rgba(255,255,255,0.7) !important;
}

    .dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus {
        background-color: #337ab7 !important;
    }

.disclaimer {
    background-color: lightyellow;
    border-left: 6px solid gold;
    padding: 10px 5px 1px 10px;
}

.dark .disclaimer {
    background: #333300;
}

.update {
    background-color: lightcyan;
    border-left: 6px solid cyan;
    padding: 10px 5px 1px 10px;
}

.dark .update {
    background: black;
    border-left: 6px solid grey;
}

.darkfooter .glyphicon, .dark .glyphicon {
    color: lightblue;
}

.modal-title {
    color: black;
    font-weight: bold;
}

.panel-group-heading {
    margin-top: 1em;
    margin-bottom: 0.8em;
    font-weight: 600;
}

.dark .modal-title {
    color: lightgray !important;
}

.modal-content.dark {
    background: #222 !important;
}

.modal-content:not(.dark) {
    background: #fff !important;
}

.dark .modal-content:not(.dark) {
    background: #333 !important;
}

.dark {
    color: lightgray !important;
    background: black !important;
    border-color: darkgray;
}

.dark .panel {
    color: lightgray !important;
    background: #222 !important;
    border-color: darkgray;
}

.dark .panel-heading {
    color: lightgray !important;
    background: #12303b !important;
    border-color: darkgray;
}

    .dark .panel-warning .panel-heading {
        background: #333300 !important;
    }


    .dark .panel-danger .panel-heading {
        background: #330000 !important;
    }

.dropdown {
    width: 100%;
    max-width: 8em;
    margin-bottom: 10px;
}

.dark .dropdown {
    color: #222 !important;
    background-color: lightblue !important;
    border-color: lightgray !important;
}

.dark .dropdown option:focus, .dark .dropdown option:hover {
    color: lightblue !important;
    background: darkslategray !important;
}

.darkfooter .dropdown-menu, .darkfooter .dropdown-menu a {
    color: lightblue !important;
    background: rgba(34,34,34,0.6) !important;
    border-color: darkgray;
}

.darkfooter .dropdown-menu a:focus, .darkfooter .dropdown-menu a:hover {
    color: lightblue !important;
    background: darkslategray !important;
}

.dark .list-group-item, .modal .dark .close {
    color: lightblue !important;
    background-color: #222;
}

.dark a.list-group-item:hover, .dark a.list-group-item:focus, .dark nav a:hover, .dark nav a:focus, .dark nav .active {
    color: lightblue !important;
    background-color: darkslategray !important;
}

.dark .btn-default, .dark .input-group-addon, .dark pre {
    background: #222 !important;
    border-color: #222 !important;
    color: lightgray !important;
    text-shadow: none;
}

.dark a {
    color: lightblue !important;
}

.darkfooter .btn-default {
    background: rgba(34,34,34,0) !important;
    color: lightblue !important;
}

.modal-full {
    width: 94% !important;
    margin: 3% !important;
}

#alert-modal {
    margin-top: 15% !important;
    margin-bottom: 15% !important;
}

#alertBoxHeader {
    transition: opacity 0.5s;
    text-align: center;
    position: relative;
    z-index: 1; 
}

#alertBoxFooter .alert {
    margin-bottom: 0;
}

.modal-dialog {
    -webkit-animation-name: animatetop;
    -webkit-animation-duration: 0.1s;
    animation-name: animatetop;
    animation-duration: 0.1s;
}

/* Add Animation */
@keyframes animatetop {
    from {top: -300px; opacity: 0}
    to {top: 0px; opacity: 1}
}

#dl-panel-body::before, #dl-panel-body::after {
    content: '' !important;
}

  /*********************************/
 /******* Custom checkboxes *******/
/*********************************/

/* Hide the browser's default checkbox */
.container input[type=checkbox], .container input[type=radio] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* Create a custom checkbox */
.checkmark {
    position: absolute;
    top: 0;
    left: -25px;
    height: 20px;
    width: 20px;
    background-color: whitesmoke;
    border: 2px solid #0078d7;
}

/* Style the checkmark/indicator */
.container input:checked ~ .checkmark:after {
    content: "";
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid steelblue;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

.container input:indeterminate ~ .checkmark:after {
    content: "";
    position: absolute;
    top: 30%;
    left: 30%;
    width: 40%;
    height: 40%;
    background: steelblue;
}

/* Create a custom radio button */
.radiobtn {
    position: absolute;
    top: 0;
    left: -25px;
    height: 20px;
    width: 20px;
    background-color: whitesmoke;
    border-radius: 50%;
    border: 2px solid #0078d7;
}

/* Style the indicator (dot/circle) */
.container input:checked ~ .radiobtn:after {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: steelblue;
}

.panel-warning .checkmark, .panel-warning .radiobtn, .panel-warning input:checked ~ .checkmark:after, .panel-warning input:indeterminate ~ .checkmark:after {
    border-color: #a0a090;
}

.panel-warning input:checked ~ .radiobtn::after {
    background: #a0a090;
}

.panel-danger .checkmark, .panel-danger .radiobtn, .panel-danger input:checked ~ .checkmark:after, .panel-danger input:indeterminate ~ .checkmark:after {
    border-color: #c37b7a;
}

.panel-danger input:checked ~ .radiobtn:after {
    background: #c37b7a;
}

.dark .checkmark, .dark .radiobtn {
    border-color: darkslategray;
}

.dark .panel-warning .checkmark, .dark .panel-warning .radiobtn, .dark .panel-warning input:checked ~ .checkmark:after, .dark .panel-warning input:indeterminate ~ .checkmark:after {
    border-color: #808000;
}

.dark .panel-danger .checkmark, .dark .panel-danger .radiobtn {
    border-color: #800000;
}

/* When the checkbox is checked, add a blue background 
.container input:checked ~ .checkmark, .container input:indeterminate ~ .checkmark, .container input:checked ~ .radiobtn {
    background-color: steelblue;
} */

.dark input ~ .checkmark, .dark input ~ .radiobtn, .dark input:checked ~ .checkmark, .dark input:indeterminate ~ .checkmark, .dark input:checked ~ .radiobtn {
    background-color: #12303b;
}

.dark .panel-warning input ~ .checkmark, .dark .panel-warning input ~ .radiobtn, .dark .panel-warning input:checked ~ .checkmark, .dark .panel-warning input:checked ~ .radiobtn {
    background-color: #4d4d00;
}

.dark .panel-danger input ~ .checkmark, .dark .panel-danger input ~ .radiobtn, .dark .panel-danger input:checked ~ .checkmark, .dark .panel-danger input:checked ~ .radiobtn {
    background-color: #4d0000;
}

/* On mouse-over, add a grey background color */
.checkbox:hover input ~ .checkmark, .checkbox:hover input:checked ~ .checkmark, .checkbox:hover input:indeterminate ~ .checkmark {
    background-color: #ccc;
}

/* On mouse-over, add a grey background color */
.radio:hover input ~ .radiobtn, .radio:hover input:checked ~ .checkmark {
    background-color: #ccc !important;
}

/* Collapsible features section */
.collapsible-section {
    border: 1px solid #ddd;
    border-radius: 4px;
    margin: 10px 0;
}

.features-summary {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    list-style: none;
    padding: 15px;
    margin: 0;
    outline: none;
    background-color: #f8f9fa;
    border-radius: 4px;
}

.features-summary:hover {
    background-color: #e9ecef;
}

.features-summary::-webkit-details-marker {
    display: none;
}

.features-summary h3 {
    margin: 0;
    flex-grow: 1;
}

.collapse-indicator {
    font-size: 0.8em;
    transition: transform 0.3s ease;
    margin-left: 10px;
}

.collapsible-section[open] .collapse-indicator {
    transform: rotate(180deg);
}

.features-content {
    margin-top: 0;
    padding: 0 15px 15px;
}

/* Dark theme support */
.dark .collapsible-section {
    border-color: #4a5568;
}

.dark .features-summary {
    background-color: #2d3748;
}

.dark .features-summary:hover {
    background-color: #374151;
}

/* Mobile-specific styling */
@media (max-width: 768px) {
    /*Increase touchability of bottom buttons*/
    footer .btn-default {
        font-size: 120% !important;
    }
    .navbar-nav {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }
    /*Make sure these align correctly rather than stacking at full width - GK*/
    .navbar-nav > li > a {
        /*float: left !important;*/
        /*Added this to prevent the buttons becoming so small*/
        padding-top: 15px !important;
    }
}