/*
 Theme Name:   Diversity for Nutrition
 Theme URI:    https://diversity-for-nutrition.org
 Description:  Diversity for Nutrition (D4N) tool — WordPress theme that renders species recommendations returned by the d4n AWS Lambda function.
 Author:       Camilo Rodriguez
 Author URI:   https://diversity-for-nutrition.org
 Version:      0.1.0
 License:      GNU General Public License v2 or later
 License URI:  http://www.gnu.org/licenses/gpl-2.0.html
 Text Domain:  d4n
 Tags:         nutrition, diversity, maps, bootstrap
*/

:root {
    --d4n-primary: #2b6cb0;
    --d4n-primary-dark: #1e4e8c;
    --d4n-accent: #d97706;
    --d4n-light-grey: #f8f9fa;
    --d4n-border: #dee2e6;
}

/* Layout */
.wrapper {
    display: flex;
    align-items: stretch;
    height: calc(100vh - 76px);
    overflow: hidden;
}

.admin-bar .wrapper {
    height: calc(100vh - 76px - 32px);
}

#dmap {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 100%;
    transition: all 0.3s;
    cursor: crosshair;
    z-index: 2;
}

#dcontrols {
    min-width: 400px;
    max-width: 400px;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    background-color: var(--d4n-light-grey);
    transition: all 0.6s cubic-bezier(0.945, 0.020, 0.270, 0.665);
}

.submit-area {
    position: sticky;
    bottom: 0;
    margin: 0 -1rem;
    padding: 0.75rem 1rem 1rem;
    background-color: #fff;
    border-top: 1px solid var(--d4n-border);
    box-shadow: 0 -6px 12px -8px rgba(0, 0, 0, 0.12);
    z-index: 10;
}

/* Give the form enough breathing room at the bottom so the last control
 * (e.g. "No" in the Modeling options accordion, the language dropdown)
 * is not covered by the sticky submit area when scrolling. */
#d4nForm {
    padding-bottom: 10rem;
}

.no-scroll {
    height: 100%;
    overflow: hidden;
}

/* Loading overlay */
.loading {
    display: none;
    position: absolute;
    top: 0;
    width: 100%;
    height: 100%;
    background: #FFF;
    opacity: 0.8;
    z-index: 9999;
}

.loading img {
    position: absolute;
    top: 44%;
    left: 50%;
}

#loading-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--d4n-primary);
    z-index: 10000;
    transition: width 0.3s;
}

#loading-bar.active {
    animation: loading-progress 300s ease-out forwards;
}

@keyframes loading-progress {
    0% { width: 0%; }
    50% { width: 70%; }
    90% { width: 90%; }
    100% { width: 95%; }
}

/* Accordion */
.accordion-button:not(.collapsed) {
    background-color: rgba(43, 108, 176, 0.1);
    color: var(--d4n-primary-dark);
}

.accordion-button:focus {
    border-color: var(--d4n-primary);
    box-shadow: 0 0 0 0.25rem rgba(43, 108, 176, 0.25);
}

/* Navbar */
.navbar {
    padding: 0.5rem 1rem;
}

.navbar-brand {
    font-weight: 600;
    color: var(--d4n-primary-dark) !important;
}

.nav-link.active {
    color: var(--d4n-primary) !important;
}

/* Report modal */
.modal-xl {
    max-width: 90%;
}

/* Results alert */
#results {
    position: fixed;
    top: 76px;
    left: 0;
    right: 0;
    z-index: 1050;
}

.admin-bar #results {
    top: 108px;
}

#results .alert {
    margin: 0;
    border-radius: 0;
}

/* Select2 overrides */
.select2-container--default .select2-selection--multiple,
.select2-container--default .select2-selection--single {
    border: 1px solid var(--d4n-border);
    border-radius: 0.375rem;
    min-height: 38px;
    padding: 2px 6px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px;
}

/* Tool page: no vertical scroll */
.page-template-page-tool #page {
    height: 100vh;
    overflow: hidden;
}

.page-template-page-tool .site-footer {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    .page-template-page-tool #page {
        height: auto;
        overflow: auto;
    }

    .wrapper {
        flex-direction: column;
        height: auto;
    }

    .admin-bar .wrapper {
        height: auto;
    }

    #dmap {
        display: none;
    }

    #dcontrols {
        min-width: 100%;
        max-width: 100%;
        height: auto;
        overflow-y: visible;
    }

    .page-template-page-tool .site-footer {
        display: block;
    }
}
