﻿/* ==========================================================================
   1) External Imports & Resets
   ========================================================================== */

/* Icon fonts */
@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');
@import url('bootstrap-icons/font/bootstrap-icons.min.css');

/* Reset default page margins & lock out horizontal scroll */
html, body {
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: hidden;
    margin: 0;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* ==========================================================================
   2) Global Elements & Utilities & Blazor error‐UI overrides
   ========================================================================== */

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0,0,0,0.2);
    display: none;
    left: 0;
    padding: .6rem 1.25rem .7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: .75rem;
        top: .5rem;
    }

/* this styles the <ErrorBoundary>-generated error box */
.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYi…) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred.";
    }


h1:focus {
    outline: none;
}

.container-hard-limit {
    max-width: 100rem;
    margin: 0 auto;
    width: 100%;
    padding-bottom: 3rem;
}

a, .btn-link {
    color: #0071C1;
}

.btn-primary {
    color: #fff;
    background-color: #1B6EC2;
    border-color: #1861AC;
}

.btn-icon-only {
    background: none;
    border: none;
    padding: 0;
    box-shadow: none;
}

.fake-input-field {
    display: flex;
    align-items: center;
    padding: .375rem .75rem;
    border-radius: .25rem;
    flex-grow: 1;
}

.buttonToLink {
    background: none;
    border: none;
    color: currentColor;
    padding: 0;
    margin: 0;
    line-height: inherit;
    cursor: pointer;
    display: inline;
}

.text-underline-hover {
    text-decoration: none;
    text-align: left;
}

    .text-underline-hover:hover {
        text-decoration: underline;
    }

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26B050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

/* ==========================================================================
   3) Core Layout (mobile-first defaults)
   ========================================================================== */

/* Page flexes column under toolbar */
.page {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 100vh;
}

@media (max-width: 768px) {
    .hide-mobile {
        display: none;
    }

    .hide-mobile-card {
        display: none;
    }

    .header-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

        .header-toolbar .form-select,
        .header-toolbar .btn,
        .header-toolbar .form-check {
            width: 100%; /* full-width controls on mobile */
        }
}

.header-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

    .header-toolbar > * {
        flex: 1 1 auto;
    }



main {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

    main > article.content,
    main > .content {
        flex: 1 1 auto;
        height: 0;
        overflow-y: auto;
        padding-top: 1rem;
        min-height: 0;
    }

/* Top bar (logo, links, toggle) */
.top-row {
    flex: 0 0 auto;
    display: flex;
    justify-content: flex-start; /* align items from the left */
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

    .top-row.navbar {
        padding-top: var(--safe-top);
        padding-left: var(--safe-left);
        padding-right: var(--safe-right);
        height: var(--header-height);
        align-items: center;
        z-index: 1050;
    }
top-row .container-fluid {
    display: flex;
    align-items: center;
}

    .top-row a, .top-row .btn-link {
        white-space: nowrap;
        margin-left: .5rem;
        text-decoration: none;
    }

        .top-row a:hover, .top-row .btn-link:hover {
            text-decoration: underline;
        }

.top-row .user-info {
    display: none; /* hide on mobile */
}

.top-row .user-info,
.top-row .logout-link,
.top-row .login-link,
.top-row #btnSwitch {
    display: none;    
}
.logout-link-mobile {
    display: inline-block;
    margin-left: auto; /* pushes logout to the far right */
    margin-right: .5rem; /* space before burger */
    color: gray; /* match your theme */
}

/* Tri-state switch (if used) */
.tri-switch {
    display: inline-block;
    width: 32px;
    height: 16px;
    background: transparent;
    border: 1px solid var(--bs-border-color);
    border-radius: 10px;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-left: -2.5em;
    margin-bottom: .2em;
}

    .tri-switch .handle {
        position: absolute;
        top: 1.8px;
        width: 10px;
        height: 10px;
        background: #ADB5BD;
        border-radius: 50%;
        box-shadow: 0 0 2px rgba(0,0,0,0.1);
        transition: left .2s ease;
    }

/* ==========================================================================
   4) MOBILE-ONLY: centered “hamburger” menu
   ========================================================================== */

/* Height of your fixed top bar (logo + user area). Adjust to match yours. */
:root {
    --header-base: 52px; /* your normal header height */
    --nudge-top: 8px; /* set -2px if you want it a tad higher */
    --safe-top: calc(env(safe-area-inset-top, 0px) + var(--nudge-top));
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --header-height: calc(var(--header-base) + var(--safe-top)); /* ← single canonical var */
}

.navbar-lower {
    position: fixed; /* overlay */
    top: var(--header-height);
    right: 8px; /* keep on the right */
    left: auto; /* don't stretch full width */
    bottom: auto; /* ← stop anchoring to bottom */
    width: auto; /* panel width */
    height: auto; /* size to content */
    max-height: calc(100dvh - var(--app-header-height) - 16px); /* scroll if tall */
    overflow-y: auto;
    /* keep your look on mobile */
    /*background: #1f2327;*/
    background: var(--menu-bg);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,.35);
    z-index: 1040;
}


/* Bottom drawer look & size START */

.offcanvas.offcanvas-bottom {
    --bs-offcanvas-height: min(72dvh, 560px); /* taller, but capped */
    /* Background follows theme */
    --bs-offcanvas-bg: var(--bs-body-bg) !important;
    background-color: var(--bs-body-bg) !important;
    /* Text follows theme */
    color: var(--bs-body-color) !important;
    border-top: 1px solid var(--menu-border);
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    box-shadow: 0 -20px 60px rgba(0,0,0,.55);
    padding: 12px 16px calc(env(safe-area-inset-bottom,0) + 12px);
}

/* Softer, blurred backdrop */
.offcanvas-backdrop.show {
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(2px);
}
/* Header + grab handle */
.offcanvas.offcanvas-bottom .offcanvas-header {
    padding: 10px 4px 12px;
    border-bottom: 1px solid var(--menu-border);
    position: relative;
}

    .offcanvas.offcanvas-bottom .offcanvas-header::before {
        content: "";
        position: absolute;
        left: 50%;
        top: 6px;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        border-radius: 4px;
        background: rgba(255,255,255,.20);
    }

/* Body: clean vertical flow */
.offcanvas.offcanvas-bottom .offcanvas-body {
    display: flex;
    flex-direction: column;
    gap: 1rem; /* uniform spacing between groups */
    padding-top: 12px;
}

/* Labels */
.offcanvas.offcanvas-bottom .form-label {
    font-size: 1rem; /* match toggle text */
    font-weight: 500; /* readable but not too heavy */
    color: var(--menu-input-color);
    margin-bottom: 0.25rem; /* keep label close to its field */
}

/* Inputs */
.offcanvas.offcanvas-bottom .form-select,
.offcanvas.offcanvas-bottom .form-control {
    background: var(--menu-input-bg);
    color: var(--bs-body-color) !important;
    border-color: var(--menu-input-border);
    border-radius: 10px;
    margin: 0; /* remove extra margins, spacing handled by gap */
}

    .offcanvas.offcanvas-bottom .form-select:focus,
    .offcanvas.offcanvas-bottom .form-control:focus {
        border-color: var(--bs-primary);
        box-shadow: var(--menu-focus-ring);
    }

/* Toggles */
.offcanvas.offcanvas-bottom .form-check {
    margin: 0; /* let gap handle spacing */
}

.offcanvas.offcanvas-bottom .form-check-label {
    font-size: 1rem; /* align with other labels */
    font-weight: 500;
    color: var(--bs-body-color);
}

/* Switch itself */
.offcanvas.offcanvas-bottom .form-check-input {
    background-color: var(--menu-input-bg);
    border-color: var(--menu-input-border);
}

/* Sticky action area so the primary button is always reachable */
.offcanvas.offcanvas-bottom .drawer-actions {
    position: sticky;
    bottom: 0;
    padding-top: 8px;
    margin-top: 4px;
    background: linear-gradient(to top, rgba(27,31,36,1), rgba(27,31,36,0));
}

    .offcanvas.offcanvas-bottom .drawer-actions .btn {
        width: 100%;
        border-radius: 10px;
    }


/* Bottom drawer look & size END */


/* Let sticky "see" the page scroll: keep only horizontal overflow on wrapper */
.table-responsive.d-block.d-md-none {
    overflow-x: auto; /* Bootstrap default */
    overflow-y: visible; /* important: don't create a vertical scroller here */
}

/* Sticky header for the mobile table */
.sticky-mobile {
    border-collapse: separate; /* helps Safari/WebKit */
    border-spacing: 0;
}

    /* make thead itself sticky (WebKit robustness) */
    .sticky-mobile thead {
        position: sticky;
        position: -webkit-sticky;
        top: 0; /* use var(--header-height) if it hides under the header */
        z-index: 2;
        background: var(--bs-body-bg, #1b1f24);
    }

        /* and keep <th> above rows */
        .sticky-mobile thead th {
            position: sticky;
            position: -webkit-sticky;
            top: 0; /* or var(--header-height) if needed */
            z-index: 3;
            background: inherit;
            box-shadow: 0 1px 0 rgba(255,255,255,.06);
        }

/* Respect the iOS/Android safe area and float above content */
.filter-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1040; /* below offcanvas (which is 1050) */
    padding: 8px calc(env(safe-area-inset-right, 0px) + 12px) calc(env(safe-area-inset-bottom, 0px) + 8px) calc(env(safe-area-inset-left, 0px) + 12px);
    background: var(--menu-input-bg);
    backdrop-filter: blur(6px);
    border-top: 1px solid rgba(255,255,255,0.08);
    border-color: var(--bs-border-color);
}

    .filter-dock .chip {
        display: inline-block;
        padding: 2px 8px;
        margin-left: 6px;
        border-radius: 999px;
        background: var(--menu-chip-bg);
        white-space: nowrap;
        max-width: 12rem;
        overflow: hidden;
        text-overflow: ellipsis;
        vertical-align: middle;
        font-size: .8rem;
    }

    /* Optional: hide dock while scrolling down, show on scroll up */
    .filter-dock.hide {
        transform: translateY(110%);
    }

.filter-dock {
    transition: transform .18s ease;
}



/*/* ==========================================================================
   5) NavMenu details (theme-agnostic)
   ========================================================================== */

.navbar-brand {
    font-size: 1.1rem;
}


.oi {
    width: 2rem;
    font-size: 1.1rem;
    vertical-align: text-top;
    top: -2px;
}

.nav-item {
    font-size: 0.9rem;
    padding-bottom: .5rem;
}

    .nav-item a {
        display: flex;
        align-items: center;
        height: 3rem;
        line-height: 3rem;
    }

        .nav-item a.active {
            background-color: rgba(133,133,133,0.25);
            border-radius: 5px;
        }

        .nav-item a:hover {
            background-color: rgba(90,90,90,0.25);
            border-radius: 5px;
        }


/* ==========================================================================
   6) Theme variables & light/dark overrides
   ========================================================================== */

/* Define panel imagery + tint per theme */
:root {
    --menu-bg: var(--bs-body-bg);
    --menu-border: var(--bs-border-color);
    --menu-chip-bg: color-mix(in oklab, var(--bs-emphasis-color) 8%, transparent);
    --menu-input-bg: var(--bs-form-control-bg, var(--bs-body-bg));
    --menu-input-color: var(--bs-body-color);
    --menu-input-border: var(--bs-border-color);
    --menu-focus-ring: 0 0 0 .2rem rgba(var(--bs-primary-rgb), .15);
}

    :root:not([data-bs-theme="dark"]) {
        color-scheme: light;
        --navbar-panel-src: url('/assets/light-navbar-side.png');
        --navbar-panel-after-bg: linear-gradient( to bottom, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.8) 30%, rgba(255,255,255,0.6) 80%, rgba(255,255,255,0) 100% );
        --navbar-panel-filter: blur(8px) brightness(1.2) contrast(0.8);
        --bs-body-color: #333333;
        --bs-emphasis-color: #333333;
        --bs-offcanvas-bg: var(--bs-body-bg);
    }

:root[data-bs-theme="dark"] {
    color-scheme: dark;
    --navbar-panel-src: url('/assets/dark-navbar-side.png');
    --navbar-panel-after-bg: linear-gradient( to bottom, rgba(25,25,25,0.95) 0%, rgba(25,25,25,0.85) 25%, rgba(25,25,25,0.75) 60%, rgba(25,25,25,0.6) 100% );
    --navbar-panel-filter: blur(6px) brightness(0.6) contrast(1.1);
    --bs-body-color: #B5BDC4;
    --bs-emphasis-color: #B5BDC4;
}

/* toggle button (theme-aware) */
#btnSwitch {
    position: relative;
    width: 1.2rem;
    height: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background .3s ease, box-shadow .3s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    z-index: 3;
}

    #btnSwitch:hover {
        box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    }

:root:not([data-bs-theme="dark"]) #btnSwitch {
    background: rgba(0,0,0,0.05);
    color: #333;
}

:root[data-bs-theme="dark"] #btnSwitch {
    background: rgba(255,255,255,0.1);
    color: #D1D5DB;
}

#themeIcon {
    font-size: 1rem;
    line-height: 1;
}


/* ==========================================================================
   7) Desktop layout & themed sidebar (641px+)
   ========================================================================== */
@media (min-width: 641px) {
    /* overall page → row */
    .page {
        flex-direction: row;
    }

    /* hide mobile toggle */
    .navbar-toggler {
        display: none !important;
    }

    /* sidebar container */
    .navbar-lower {
        position: relative;
        z-index: 0;
        width: 240px;
        height: 100vh;
        padding: 0 !important;
        margin: 0;
        background: transparent !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }

        /* rack image behind everything */
        .navbar-lower::before {
            content: "";
            position: absolute;
            inset: 0;
            background: var(--navbar-panel-src) center/cover no-repeat;
            filter: var(--navbar-panel-filter);
            z-index: -2;
            pointer-events: none;
        }

        /* gradient overlay */
        .navbar-lower::after {
            content: "";
            position: absolute;
            inset: 0;
            background: var(--navbar-panel-after-bg);
            z-index: -1;
            pointer-events: none;
        }

        /* ensure collapse is always visible, static */
        .navbar-lower:not(.show) {
            display: block !important;
            visibility: visible !important;
            position: static !important;
            transform: none !important;
            height: auto !important;
            overflow-y: auto !important;
        }

    /* sidebar scroll */
    .sidebar {
        flex: 0 0 250px;
        position: relative;
        overflow-y: auto;
    }

        .sidebar .collapse {
            display: block !important;
            visibility: visible !important;
            min-height: 100vh !important;
            overflow-y: auto !important;
        }

    .sidebar-content {
        margin-top: 1rem;
    }

    .top-row .user-info {
        display: inline-flex; /* ← bring it back */
        align-items: center;
        color: gray;
        margin-left: auto; /* push logout/toggle right as you had */
        margin-right: 1rem;
        
    }
    .top-row .user-info,
    .top-row .logout-link,
    .top-row .login-link,
    .top-row #btnSwitch {
        display: inline-block; /* or flex if needed */
        margin-left: 0.75rem;
        margin-right: 1rem;
        margin-top: 0.75rem;
    }
    .logout-link-mobile {
        display: none;
    }
}

    /* ==========================================================================
   8) Third-Party Overrides (Quill, etc.)
   ========================================================================== */
    .rich-text-editor .ql-container {
    border: none !important;
    border-bottom: 1px solid var(--bs-card-border-color) !important;
}

.rich-text-editor .ql-editor {
    font-size: var(--bs-body-font-size) !important;
    font-family: var(--bs-body-font-family) !important;
    line-height: var(--bs-body-line-height) !important;
    color: var(--bs-body-color) !important;
}

.rich-text-editor .ql-toolbar {
    border: none !important;
}

/* ==========================================================================
   9) Ultra-wide Media Query
   ========================================================================== */
@media (min-width: 2000px) and (max-width: 12000px) {
    .row-cols-highres > * {
        flex: 1 0 10;
        max-width: 24px;
    }
}
