/*
 * The SaskOilseeds workspace and login headers, and the crop tag that the crop lists and the create, detail, and
 * edit modals show. Everything is scoped to .workspace-header and .crop-tag, so the applicant layout is untouched.
 * The headers are an Innovation Green bar with Warm Neutral text, and their dropdown menus are white with dark text.
 * A page that belongs to a crop sets --crop-accent once, for the whole page (see responses.py), and the header's
 * stripe and the crop tags take it from there. The other pages set none, so their headers have no stripe.
 */

.navbar.workspace-header {
    --innovation-green: #124944;
    --warm-neutral: #F7F3EA;
    --dark-neutral: #1A2A25;

    --bs-navbar-color: var(--warm-neutral);
    --bs-navbar-hover-color: var(--warm-neutral);
    --bs-navbar-active-color: var(--warm-neutral);
    --bs-navbar-brand-color: var(--warm-neutral);
    --bs-navbar-brand-hover-color: var(--warm-neutral);
    --bs-navbar-toggler-border-color: rgba(247, 243, 234, 0.5);
    --bs-navbar-toggler-icon-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23F7F3EA' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");

    background-color: var(--innovation-green);
    /* Transparent without a crop accent, so that every header is the same height */
    border-bottom: 5px solid var(--crop-accent, transparent);
}

.workspace-header .navbar-brand img {
    display: block;
}

.workspace-header .nav-item-selected > .nav-link {
    font-weight: bold;
    text-decoration: underline;
    text-decoration-color: var(--warm-neutral);
    text-decoration-thickness: 2px;
    text-underline-offset: 0.3em;
}

.workspace-header .crop-toggle {
    display: inline-flex;
    padding: 3px;
    border: 1px solid rgba(247, 243, 234, 0.45);
    border-radius: 6px;
    background-color: rgba(0, 0, 0, 0.12);
    vertical-align: middle;
}

.workspace-header .crop-toggle__option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 76px;
    min-height: 36px;
    border-radius: 3px;
    color: var(--warm-neutral);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.5;
    text-decoration: none;
}

.workspace-header .crop-toggle__option:hover {
    background-color: rgba(247, 243, 234, 0.12);
}

.workspace-header .crop-toggle__option[aria-current="page"] {
    background-color: var(--crop-accent);
    color: var(--dark-neutral);
}

.workspace-header .crop-toggle__option:focus-visible {
    outline: 2px solid var(--warm-neutral);
    outline-offset: 3px;
}

@media (max-width: 991.98px) {
    .workspace-header .crop-switcher {
        order: 3;
        flex-basis: 100%;
        margin-top: 0.5rem;
        margin-bottom: 0.25rem;
    }

    .workspace-header .navbar-collapse {
        order: 4;
    }
}

@media (max-width: 359.98px) {
    .workspace-header:has(.crop-switcher) .navbar-brand img {
        width: 160px;
        height: auto;
    }
}

/* The login header's "Admin Login", which would otherwise wear the theme's green heading colour */
.workspace-header .workspace-header__title {
    color: var(--warm-neutral);
}

/* The theme's Innovation Green focus ring wouldn't show on the green bar */
.workspace-header :focus {
    outline-color: var(--warm-neutral);
}

.workspace-header .dropdown-menu {
    --bs-dropdown-color: var(--dark-neutral);
    --bs-dropdown-link-color: var(--dark-neutral);
    --bs-dropdown-link-hover-color: var(--dark-neutral);
    --bs-dropdown-link-active-color: var(--warm-neutral);
    --bs-dropdown-link-active-bg: var(--innovation-green);
    --bs-dropdown-header-color: var(--dark-neutral);
    /* The user menu's Logout is a .btn-link, which takes the link colour */
    --bs-link-color: var(--dark-neutral);
    --bs-link-hover-color: var(--dark-neutral);
}

/* The menus are white, so their focus rings stay Innovation Green */
.workspace-header .dropdown-menu :focus {
    outline-color: var(--innovation-green);
}

.workspace-header .dropdown-menu .btn-link {
    /* Innovation Green */
    --bs-btn-focus-shadow-rgb: 18, 73, 68;
}

.crop-tag {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    background-color: var(--crop-accent);
    color: #1A2A25;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.5;
    vertical-align: 0.25em;
    white-space: nowrap;
}
