/* layout.css - header, navbar, sidebar, footer, and layout-related rules */

/* Admin tables-wrapper tweaks moved to components.css */

/* Fix sidebar responsive behavior */
#sidebarMenu {
    transition: none !important;
}

/* Mobile navigation styles */
@media (max-width: 767.98px) {
    #sidebarMenu {
        position: fixed !important;
        top: var(--header-height, 5rem) !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        z-index: 1050 !important;
        background-color: var(--bs-body-bg) !important;
        overflow-y: auto !important;
        transform: translateY(-100%);
        transition: transform 0.3s ease-in-out;
        width: 100vw !important;
        height: calc(100vh - var(--header-height, 5rem)) !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
    }

    #sidebarMenu.show {
        transform: translateY(0) !important;
    }

    #sidebarMenu.collapse:not(.show) {
        display: block !important;
        transform: translateY(-100%);
    }
}

/* Footer manage cookies link styling (kept in layout as it's footer related) */
.manage-cookies-footer-link {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.manage-cookies-footer-link i {
    font-size: 0.95rem;
    opacity: 0.9;
}

.manage-cookies-footer-link:hover {
    text-decoration: underline;
}

.btn-gtid-toggle {
    background: transparent;
    border: none;
    padding: 0;
    color: inherit;
    cursor: pointer;
    line-height: 1;
}

.btn-gtid-toggle:focus-visible {
    outline: 2px solid var(--bs-focus-ring-color, rgba(13, 110, 253, 0.5));
    outline-offset: 2px;
}

.gtid-value {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
    text-align: center;
}

/* Keep the Did You Know header stable */
.did-you-know-sidebar-section {
    color: var(--bs-body-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* default: stack inside flow for small screens */
    position: relative;
    width: inherit;
}

/* Anchor to the bottom of the sidebar and match sidebar width on desktop */
@media (min-width: 768px) {
    .did-you-know-sidebar-section {
        position: fixed;
        left: 0;
        bottom: 0;
        background-color: var(--bs-body-bg);
        box-sizing: border-box;
        padding: 0.5rem;
        box-shadow: inset -1px 0 0 var(--bs-border-color);
        /* DYK should be fixed and not scroll; sidebar scrolls */
        overflow: hidden;
        z-index: 1030;
    }

    /* Force footer to the same defined height so DYK can match it via CSS-only */
    .footer-main {

        box-sizing: border-box;
        padding: 0 !important;
        margin: 0 !important;
    }
}

.did-you-know-sidebar-section .buzzport-fact {
    margin: 0 !important;
    min-height: 3.5rem;
    overflow: hidden;
    transition: opacity 600ms ease-in-out;

}

/* Footer layout: footer should be in normal document flow and appear
   after the main content (will scroll into view). */

#accent-footer,
#org-footer {
    background-color: inherit !important;
}

#org-footer {
    flex: 1;
}

/* default footer height variable (fallback) so calc() doesn't break when not set elsewhere */
:root {
    --footer-height: 4rem;
    --dyk-height: 7rem;
    --sidebar-width: clamp(220px, 25%, 320px);
}

.sidebar-main {
    z-index: 1000;
    overflow-y: auto;
    top: 80px !important;
    /* keep sidebar scroll area above the footer */
    padding-bottom: 0;
    height: calc(100vh - var(--header-height, 80px) - var(--dyk-height, 4rem) - 1rem) !important;
}

.main-content {
    padding-bottom: 15px !important;
}

/* Ensure main content fills viewport when content is short so footer sits at bottom.
   Allow it to shrink to avoid forcing the overall page taller than the viewport. */
.main-content {
    /* grow to fill available space */
    flex: 1 0 auto !important;
    /* allow shrinking to prevent unnecessary page scrollbar */
    min-height: 0 !important;
    /* allow inner scrolling when content exceeds available space */
    overflow: auto;
}

/* Make body a column flex container so the content area can expand and push footer to bottom when content is short. */
html, body {
    height: 100%;
    min-height: 100%;
}

body {
    display: flex;
    flex-direction: column;
}

/* Allow the primary container (immediately after header) to grow and take available space between header and footer. Targets the top-level container only. */
body > .container-fluid {
    flex: 1 0 auto;
    display: block;
    /* allow the top-level container to shrink if inner content forces overflow */
    min-height: 0 !important;
}

/* Ensure the immediate row inside the top-level container can shrink as well */
body > .container-fluid > .row {
    min-height: 0 !important;
}

.buzzport-fact {
    font-size: 0.875rem;
    line-height: 1.4;
}

.footer-main {
    z-index: 1020 !important;
    /* keep footer in normal flow */
    position: static !important;
}

/* Mobile footer height */

@media (max-width: 767.98px) {
    .footer-main {
        /* no fixed positioning: allow footer to scroll into view */
        position: static !important;
        width: 100% !important;
    }

    .footer-main .container-fluid,
    .footer-main .row,
    .footer-main .col-12 {
        margin: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    body {
        overflow-x: hidden !important;
    }

    html {
        overflow-x: hidden !important;
    }
}

[data-bs-theme="dark"] .did-you-know-sidebar-section {
    background-color: var(--bs-body-bg);
    color: #fff;
}

.accent-footer-mobile {
    height: 0.75rem;
}

.accent-footer-desktop {
    height: 1.5rem;
}

.mobile-footer-text {
    font-size: 0.7rem;
}

.svg-icons-hidden {
    display: none;
}



/* Footer height is driven by --footer-height */

[data-bs-theme="dark"] #sidebarMenu {
    background-color: var(--bs-body-bg) !important;
}

/* BuzzPort specific styling */
h1.title,
.title.h1 {
    font-family: "Roboto Condensed", "Roboto", Arial, Helvetica, sans-serif;
    font-weight: 400;
}

header.navbar-main {
    color: #000;
    background-color: #b3a369;
    z-index: 9999 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
}

header.navbar-main a.nav-link,
header.navbar-main a.nav-link:focus,
header.navbar-main a.nav-link:hover {
    color: #000;
}

header.navbar-main a.nav-link:focus,
header.navbar-main a.nav-link:hover {
    text-decoration: underline;
}

.sidebar .dropdown-menu {
    background-color: rgba(0, 0, 0, 0);
    box-shadow: none;
}

.sidebar nav .dropdown-menu.show a.dropdown-item:focus,
.sidebar nav .dropdown-menu.show a.dropdown-item:hover {
    background-color: rgba(0, 0, 0, 0);
}

.card-header {
    font-family: "Roboto Condensed", "Roboto", Arial, Helvetica, sans-serif;
    font-weight: 700;
}

#buzzport_fact {
    padding-right: 5px;
}

/* Remove bottom spacing */
body {
    margin-bottom: 0 !important;
}

html {
    margin-bottom: 0 !important;
}

/* Navigation and Branding */
#navbar-main {
    height: 5rem;
    z-index: 1020;
}

/* Sidebar nav: align icons and allow wrapping on narrower widths */
#sidebarMenu .nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    padding-left: 0.25rem;
}

/* Reduce sidebar list padding from Bootstrap's px-3 on the <ul> */
#sidebarMenu .nav {
    padding-left: 0.0005rem !important;
    padding-right: 0.5rem !important;
}

#sidebarMenu .nav-link i {
    flex: 0 0 auto;
}

#navbar-logo-area {
    height: 5rem;
    display: block;
    background-color: #a4925a;
    background-image: url("../img/logo.svg");
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center center, 50%, 50%;
}

#navbar-logo-area.border-end {
    border-right: 1px solid #857437 !important;
}

#navbar-site-name {
    color: #000;
    font-family: "Abel", "Roboto Condensed", "Roboto", Arial, Helvetica, sans-serif;
    font-weight: 400;
}

#accent-logo {
    height: 2rem;
    display: block;
    background-color: transparent;
    background-image: url("../img/logo2.svg");
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center center, 50%, 50%;
    margin-bottom: 1rem;
}

[data-bs-theme="dark"] #navbar-logo-area {
    background-image: url("../img/logo-dark.svg");
}

[data-bs-theme="dark"] #accent-logo {
    background-image: url("../img/logo2-dark.svg");
}

.navbar-toggler .navbar-toggler-icon {
    background-image: url("../img/xmark.svg");
}

.navbar-toggler.collapsed .navbar-toggler-icon {
    background-image: url("../img/hamburger.svg");
}

/* Header layout: prevent wrap and keep toggler aligned with user menu on small widths */
@media (max-width: 767.98px) {
    header.navbar-main {
        flex-wrap: nowrap;
        align-items: center;
    }

    #navbar-logo-area {
        flex: 0 0 auto;
    }

    #navbar-site-name {
        flex: 1 1 auto;
        min-width: 0;
    }

    header.navbar-main .dropdown {
        flex: 0 0 auto;
    }

    .navbar-toggler {
        flex: 0 0 auto;
    }
}

@media (max-width: 575.98px) {
    #navbar-main {
        display: grid;
        grid-template-columns: 1fr auto auto;
        grid-template-rows: 4rem 4rem;
        grid-template-areas:
            "gtlogo gtlogo gtlogo"
            "buzzport user toggler";
        align-items: center;
    }

    #navbar-logo-area {
        grid-area: gtlogo;
        width: 100%;
    }

    #navbar-site-name {
        grid-area: buzzport;
        width: 100%;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    header.navbar-main .dropdown {
        grid-area: user;
        justify-self: end;
        padding-right: 0.5rem;
    }

    .navbar-toggler {
        grid-area: toggler;
        justify-self: end;
        margin-right: 0.5rem;
    }

    #navbar-site-name img {
        height: 32px;
        max-width: 100%;
    }
}

/* Warning background override */
.bg-warning {
    --bs-bg-opacity: .5;
    background-color: rgba(var(--bs-warning-rgb), var(--bs-bg-opacity)) !important;
}

/* Footer Background Gradients */
#accent-footer {
    background: #a4925a;
    background: linear-gradient(to right, #a4925a 0%, #a4925a 66%, #b3a369 80%, #b3a369 100%);
}

#org-footer {
    background: #b3a369;
    background: linear-gradient(to right, #b3a369 0%, #b3a369 66%, #a4925a 80%, #a4925a 100%);
}

#org-footer address,
#org-footer a,
#org-footer p {
    color: #000;
    font-family: "Roboto Condensed", Arial, Helvetica, sans-serif;
    font-size: .85rem;
    font-weight: 300;
    line-height: 1.1;
}

#org-footer address {
    margin-bottom: 0;
    line-height: 1.6;
}

#org-footer address strong {
    font-weight: 700;
}

#org-footer a,
#org-footer a:visited,
#org-footer a:hover,
#org-footer a:focus {
    color: #000;
}

#org-footer a {
    text-decoration: none;
}

#org-footer a:hover {
    text-decoration: underline;
}

#org-footer .left-bordered {
    border-left: 1px solid #fff;
    padding-left: 1rem;
}

#org-footer .copyr {
    color: #000;
    font-family: "Roboto", Arial, Helvetica, sans-serif;
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: normal !important;
    text-align: center;
}

/* CRITICAL FIX: Force sidebar visibility at 972px with complete override */
@media (min-width: 768px) {

    nav#sidebarMenu.col-lg-3.d-lg-block.sidebar.collapse,
    #sidebarMenu.d-lg-block.sidebar,
    nav.d-lg-block.sidebar {
        display: block !important;
        visibility: visible !important;
        position: fixed !important;
        left: 0 !important;
        top: var(--header-height, 80px) !important;
        transform: none !important;
        /* Keep sidebar at least 220px before collapsing; allow percentage otherwise */
        min-width: 220px !important;
        width: var(--sidebar-width) !important;
        height: calc(100vh - var(--header-height, 80px) - var(--dyk-height, 4rem) - 1rem) !important;
        z-index: 1000 !important;
        background-color: white !important;
        border-right: 1px solid #857437 !important;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    #sidebarMenu .nav-link {
        font-size: 0.95rem;
    }

    #sidebarMenu .nav-link i {
        margin-top: 0.15rem;
    }
}

/* CRITICAL FIX: Footer content visibility at all breakpoints above 768px */
@media (min-width: 768px) {
    footer .d-none.d-lg-block {
        display: block !important;
    }
}
