﻿@import url('https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap');

:root {
    --byui-brand-primary-color: #006eb6;
    --byui-brand-secondary-color: #000000;
    --byui-brand-tertiary-color: #ffffff;
    --byui-brand-quaternary-color: #949598;
    --byui-logo-color: var(--byui-brand-tertiary-color);
    --byui-logo-bg-color: var(--byui-brand-secondary-color);
    --byui-header-title-color: var(--byui-brand-tertiary-color);
    --byui-header-site-bg-color: #eaeaea;
    --byui-nav-bg-color: #eaeaea;
    --byui-nav-color: #525352;
    --byui-footer-text-color: var(--byui-brand-tertiary-color);
    --byui-footer-bg-color: var(--byui-brand-secondary-color);
    --byui-test-overlay-bg-color: #f96e46;
    --byui-test-overlay-text-color: #ffffff;
}

html {
    font-size: 14px; /* Set base font size for rem units */
}

/* Layout */
body {
    font-family: "Open Sans", sans-serif;
    display: grid;
    grid-template-areas:
        "header"
        "nav"
        "main"
        "footer";
    grid-template-rows: auto auto 1fr auto;
    height: 100vh;
    width: 100%;
    margin: 0;
}

header {
    grid-area: header;
    background: var(--byui-brand-primary-color);
    color: var(--byui-header-title-color);
    padding: 1rem 0;
    text-align: center;
}

    header a, header a:hover {
        color: var(--byui-header-title-color);
    }

    header .byui-template-header-content {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    header .byui-template-header-constraint {
        width: 100%;
        padding-left: 100px;
        text-align: left;
    }

    header .byui-template-logo-relative {
        position: relative;
        display: inline-block;
    }

    header .byui-template-logo {
        background: var(--byui-logo-bg-color);
        padding: 25px 15px;
        position: absolute;
        left: -100px;
        top: -1rem;
        z-index: 1;
    }

    header .byui-template-title {
        font-size: 1.7rem;
        overflow: hidden;
        max-height: 80px;
    }

    header .site-header {
        background-color: var(--byui-header-site-bg-color);
        text-align: left;
    }

.header-constrained {
    max-width: 1140px;
    box-sizing: unset;
}

nav {
    grid-area: nav;
    display: grid;
    grid-template-areas: "empty menu";
    grid-template-columns: 100px 1fr;
    grid-template-rows: minmax(30px, auto);
    text-align: center;
    align-content: center;
    background-color: var(--byui-nav-bg-color);
    color: var(--byui-nav-color);
    font-size: 1rem;
    padding-right: 20px;
}

    nav .byui-template-menu-empty {
        grid-area: empty;
    }

    nav .byui-template-menu-constraint {
        width: 100%;
        text-align: left;
        justify-self: center;
    }

main {
    grid-area: main;
    background-color: #fff;
    display: grid;
    grid-template-columns: auto 1fr auto;
    padding: 1rem;
    box-sizing: border-box;
    width: 100%;
}

    main .content {
        text-align: left;
    }

.content-constrained {
    grid-template-columns: 1fr minmax(auto, 1240px) 1fr;
    padding-right: 25px;
}

footer {
    grid-area: footer;
    background-color: var(--byui-footer-bg-color);
    padding: .5rem;
    text-align: center;
    font-size: .9rem;
    color: var(--byui-footer-text-color);
}

    footer.main-footer a,
    footer.main-footer a:visited {
        width: fit-content;
        color: var(--byui-footer-text-color);
        cursor: pointer;
        padding: 5px 10px;
        text-decoration: none;
    }
    
    footer.main-footer a:empty {
        padding: 0;
    }

    footer.main-footer {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
        
/* Utility */
.position-relative {
    position: relative;
}

/* Environment Testing Banner */
#byui-template-testing-overlay {
    display: grid;
    justify-content: center;
    align-items: center;
    color: var(--byui-test-overlay-text-color);
    height: 20px;
    width: 40vw;
    font-size: 0.8rem;
    font-weight: 600;
    position: fixed;
    top: 0;
    background: var(--byui-test-overlay-bg-color);
    left: 50%;
    transform: translateX(-50%);
    border-bottom-left-radius: 25px;
    border-bottom-right-radius: 25px;
    z-index: 30000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}


/* ========================================
   MENU STYLES
   ======================================== */

.byui-template-menu-user {
    grid-area: user;
    align-items: center;
    justify-self: flex-end;
    padding: 0 1rem;
    display: grid;
    gap: 0.5rem;
    grid-template-columns: auto auto;
}

.byui-template-user .byui-template-user-icon {
    padding-top: 5px;
}

.byui-template-menu-items {
    list-style: none;
    position: static;
    background: none;
    padding: 0;
    margin: 0;
}

/* Desktop username positioning */
@media (min-width: 735px) {
    .byui-template-menu-items {
        display: flex !important;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }

    .byui-template-menu-user-item {
        display: flex !important;
        align-items: center;
        gap: 0.5rem;
        padding: 0;
        background: none !important;
        border: none !important;
        margin: 0 !important;
        margin-left: auto;
        flex: 1 1 0%;
        justify-content: flex-end;
        order: 9999;
        margin-right: 10px !important;
    }

        .byui-template-menu-user-item .byui-template-user-icon {
            padding-top: 5px;
        }

        .byui-template-menu-user-item .byui-template-user-name {
            color: var(--byui-nav-color);
            font-size: 1rem;
        }
}

@media (max-width: 734px) {
    .byui-template-menu-items {
        display: block !important;
    }

    .byui-template-menu-user-item {
        display: flex !important;
        flex: none !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        order: initial !important;
        justify-content: flex-start !important;
    }
}

.byui-template-menu-items li:not(.byui-template-menu-user-item) {
    display: block;
    text-align: center;
    /* Remove padding from li and move to anchor for desktop */
    border-bottom: 6px solid transparent;
}

/* Desktop: Move padding to anchor to make entire area clickable */
@media (min-width: 735px) {
    .byui-template-menu-items li:not(.byui-template-menu-user-item) {
        padding: 0;
    }

        .byui-template-menu-items li:not(.byui-template-menu-user-item) a {
            display: block;
            padding: 10px 20px 6px 20px;
        }
}

/* Mobile: Keep padding on li for mobile layout */
@media (max-width: 734px) {
    .byui-template-menu-items li:not(.byui-template-menu-user-item) {
        padding: 10px 20px 6px 20px;
    }
}

.byui-template-menu-items li.byui-template-active {
    border-bottom: 6px solid var(--byui-brand-primary-color);
}

.byui-template-menu-items li.byui-template-active-parent {
    border-bottom: 6px solid var(--byui-brand-primary-color);
}

.byui-template-menu-items li a {
    text-decoration: none;
    box-sizing: border-box;
    font-size: 1rem;
    color: var(--byui-nav-color);
    cursor: pointer;
    transition: color 0.1s;
}

/* Desktop-only width constraints */
@media (min-width: 735px) {
    .byui-template-menu-items > li:not(.byui-template-submenu) a {
        min-width: 50px;
        max-width: 250px;
    }
}

.byui-template-menu-items li a:hover {
    color: black;
}

.byui-template-menu-items > li:not(.byui-template-menu-user-item):hover {
    background-color: #fff;
    z-index: 10000;
}

.byui-template-menu-hamburger {
    display: none;
    position: static;
}

/* Hide accordion indicators in desktop view */
.byui-template-accordion-indicator {
    display: none;
}

.byui-template-submenu-item {
    display: none;
    position: absolute;
    background-color: #fff;
    text-align: left;
    padding: 10px 0;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
    z-index: 2;
    min-width: 150px;
    max-width: 400px; /* Prevent menu from getting too wide */
    top: 6px;
    left: 0px;
    border-radius: 3px;
}

    /* Right-aligned submenu when it would go off-screen */
    .byui-template-submenu-item.align-right {
        right: 0px;
        left: auto;
    }

    .byui-template-submenu-item li {
        padding: 0px 0px !important;
    }

    /* Remove border-bottom from submenu items */
    .byui-template-submenu-item > li {
        border-bottom: 0 !important;
    }

    .byui-template-submenu-item li {
        margin: 0;
        padding: 0;
    }

    .byui-template-submenu-item a {
        display: block;
        text-align: left;
        padding: 10px 20px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

        .byui-template-submenu-item a:hover {
            background-color: var(--byui-nav-bg-color);
        }

.byui-template-submenu:hover .byui-template-submenu-item {
    display: block;
}

.byui-template-submenu-item > li a.byui-template-active {
    background: var(--byui-brand-primary-color);
    color: white;
}

.byui-template-overlay {
    height: 100%;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    background-color: rgba(0,0,0,0.3);
    opacity: 0;
    transition: opacity 0.5s;
    visibility: hidden;
    z-index: 1;
}

    .byui-template-overlay.byui-template-active {
        opacity: 1;
        visibility: visible;
    }

/* Keep hover background on expanded accordion header (desktop) */
/*@media (min-width: 735px) {
  .byui-template-accordion-item.accordion-active > div:first-child {
    background: var(--byui-nav-bg-color);
  }
}*/

/* ========================================
   MENU MOBILE STYLES (max-width: 735px)
   ======================================== */
@media screen and (max-width: 735px) {
    ul {
        display: inline-block;
        margin-top: 0;
    }

    /* Username is now part of the menu items */
    .byui-template-menu-user-item {
        display: flex !important;
        align-items: center;
        text-align: left;
        gap: 0.5rem;
        padding: 20px 24px !important;
        padding-bottom: 10px !important;
        background: #fff;
        margin: 0 !important;
    }

    nav {
        grid-template-columns: 1fr;
        justify-items: end;
        min-height: 50px;
    }

    header {
        overflow-x: visible;
        -ms-overflow-style: none; /* Hides scrollbar in IE/Edge */
        scrollbar-width: none; /* Hides scrollbar in Firefox */
        /*padding: 1.32rem 0;*/
    }

    .byui-template-menu-hamburger {
        display: block;
        text-align: right;
    }

    nav .byui-template-menu-hamburger a {
        text-decoration: none;
        font-size: 1.3rem;
        color: black;
        display: inline-block;
        width: 40px;
        height: 40px;
        text-align: center;
        margin-right: 10px;
        align-content: center;
    }

        nav .byui-template-menu-hamburger a:hover {
            background: white;
            border-radius: 40px;
        }

    nav ul {
        padding: 0;
        margin: 0;
        list-style: none;
    }

    .byui-template-menu-items {
        display: flex;
        flex-direction: column;
        height: calc(100vh - 50px);
        text-align: left;
        width: 300px;
        max-width: 0;
        position: fixed;
        z-index: 1000;
        top: 50px;
        right: 0;
        background: #fff;
        overflow-x: hidden;
        transition: max-width 0.5s;
        padding: 0 !important;
        border-top-left-radius: 20px;
        overflow-y: auto;
        max-height: 100vh;
    }

        .byui-template-menu-items > li {
            display: block;
        }

            .byui-template-menu-items > li:not(.byui-template-menu-user-item) {
                padding: 0 16px !important; /* Add left and right padding to list items */
            }

        .byui-template-menu-items li {
            text-align: left;
            background: #fff;
            margin: 0;
        }

        .byui-template-menu-items > li:not(.byui-template-menu-user-item) {
            padding: 20px 24px;
            border-bottom: 6px solid transparent;
        }

        .byui-template-menu-items.byui-template-active {
            max-width: 300px;
        }

        .byui-template-menu-items li a {
            text-decoration: none;
            display: block;
            transition: color 0.3s;
            color: var(--byui-brand-primary-color) !important;
            font-weight: normal;
            font-size: 1rem;
            padding-left: 5px;
        }

        .byui-template-menu-items > li > a {
            padding: 10px 0; /* Vertical padding only */
            margin: 0 -24px; /* Negative margin to extend hover to full width */
            padding-left: 24px; /* Add back left padding for text indent */
            padding-right: 24px; /* Add back right padding to extend to edge */
            text-align: left;
        }

            .byui-template-menu-items > li > a:hover {
                background: var(--byui-nav-bg-color);
            }

        .byui-template-menu-items li:hover {
            background: none;
        }

        .byui-template-menu-items li a:hover {
            color: var(--byui-brand-primary-color);
        }

        .byui-template-menu-items li > div {
            font-size: 1rem;
            font-weight: 600;
            color: #000;
            display: block;
            cursor: default;
        }

    .byui-template-hamburger {
        display: inline-block !important;
        position: relative;
    }

    .byui-template-menu-items li .byui-template-active {
        background: var(--byui-brand-primary-color);
        color: #fff !important;
    }

    .byui-template-active a, .byui-template-submenu-item .byui-template-active a {
        color: white !important;
    }

    .byui-template-submenu-item {
        position: static;
        display: block;
        background: none;
        box-shadow: none;
        text-align: left;
        padding: 0;
        margin: 0;
        border-radius: 0;
        min-width: auto;
        max-width: none;
        top: auto;
        left: auto;
    }

        .byui-template-submenu-item li {
            margin: 0;
            padding: 0;
            padding-left: 20px;
        }

        .byui-template-submenu-item a {
            padding: 10px 20px;
            margin: 0;
            white-space: normal;
            overflow: visible;
            text-overflow: clip;
            color: var(--byui-brand-primary-color) !important;
            font-weight: normal;
            font-size: 1rem;
        }

    .byui-template-submenu > div:first-child {
        padding-left: 5px;
    }

    /* Show accordion indicator in mobile */
    .byui-template-accordion-indicator {
        display: inline-block;
        margin-left: 4px;
        transition: transform 0.3s ease;
        margin-left: 10px;
        width: 20px;
        height: 20px;
        transition: transform 0.15s ease-in-out;
    }

        .byui-template-accordion-indicator svg {
            width: 100%;
            height: 100%;
            fill: currentColor; /* Inherit color from parent */
        }

        .byui-template-accordion-indicator.expanded {
            transform: rotate(180deg);
        }

    /* Accordion item styling for mobile */
    .byui-template-accordion-item > div:first-child {
        display: flex;
        justify-content: space-between;
        align-items: center;
        cursor: pointer;
        padding: 14px 0; /* Vertical padding only */
        margin: 0 -24px; /* Negative margin to extend hover to full width */
        padding-left: 24px; /* Add back left padding for text indent */
        padding-right: 24px; /* Add back right padding to extend to edge */
        border-bottom: 6px solid transparent;
    }

    .byui-template-accordion-content {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.1s ease-out;
        padding-left: 15px; /* Indent sub-items */
    }

    .byui-template-accordion-item.accordion-active .byui-template-accordion-content {
        max-height: 500px;
        transition: max-height 0.15s ease-in;
    }

    .byui-template-accordion-item.accordion-active .byui-template-accordion-indicator {
        transform: rotate(180deg); /* Rotate SVG for open state */
    }

    .byui-template-accordion-item:not(.accordion-active) .byui-template-submenu-item {
        display: none;
    }

    /* Accordion header hover */
    .byui-template-accordion-item > div:first-child:hover {
        background: var(--byui-nav-bg-color);
    }

        .byui-template-accordion-item > div:first-child:hover a {
            color: var(--byui-brand-primary-color) !important;
        }

    header .byui-template-title {
        font-size: 1.3rem;
    }

    /* Lighter gray for username in mobile menu */
    .byui-template-menu-user-item .byui-template-user-name {
        color: #555555;
        font-weight: 500;
    }

    /* Remove border-bottom from active li in mobile */
    li.byui-template-active {
        border-bottom: none !important;
    }

    /* Remove background from active link in mobile so underline is visible */
    .byui-template-menu-items > li.byui-template-active > a,
    .byui-template-menu-items > li > a.byui-template-active {
        background: none !important;
        color: var(--byui-brand-primary-color) !important;
        position: relative;
    }

    /* Accordion header underline only if a submenu item is active */
    .byui-template-accordion-item:has(.byui-template-active) > div:first-child {
        position: relative;
    }

        .byui-template-accordion-item:has(.byui-template-active) > div:first-child::after {
            content: '';
            display: block;
            position: absolute;
            left: 20px;
            right: 20px;
            bottom: 2px;
            height: 6px;
            background: var(--byui-brand-primary-color);
            z-index: 2;
            pointer-events: none;
        }

    /* Mobile-specific styling for active main menu items (standalone items) */
    .byui-template-menu-items > li.byui-template-active:not(.byui-template-menu-user-item) {
        background: var(--byui-brand-primary-color);
        color: white;
    }

        .byui-template-menu-items > li.byui-template-active:not(.byui-template-menu-user-item) > a {
            color: white !important;
        }
}

@media screen and (max-width: 275px) {
    nav .byui-template-menu-hamburger a {
        width: 100% !important;
        margin-right: 0 !important;
    }
}

/* Desktop: Make accordion/submenu parent items fully clickable */
@media (min-width: 735px) {
    .byui-template-accordion-item > div:first-child {
        display: block;
        padding: 10px 20px 6px 20px;
        cursor: pointer;
        margin: 0;
    }
}
