/* ==========================================================================
   1. VARIABLES, FONTS & CORE BASICS
   ========================================================================== */
@font-face {
    font-family: 'Brandon Grotesque';
    src: url('../fonts/HvDTrial_Brandon_Grotesque_regular-BF64a625c9311e1.otf') format('woff2');
    font-weight: 400;
    font-style: normal;
}

:root {
    /* Brand Colors */
    --brand-light-green: rgb(104, 178, 104);  /* #68b268 Light Green Color */
    --brand-dark-green: rgb(10, 88, 64);      /* #0a5840 Dark Green Color */
    --brand-hover-green: rgb(87, 161, 87);    /* #57a157 Hover Green Color */
    --brand-focus-green: rgb(78, 142, 78);    /* #4e8e4e Click/Focus Green */
    --brand-black: rgb(18, 15, 13);            /* NeuroKit (almost) Black Color */

    /* Register Blazor Bootstrapping Variables to Silence IDE Warnings */
    --blazor-load-percentage: 0%;
    --blazor-load-percentage-text: "Loading";
}

html, body {
    font-family: 'Brandon Grotesque', sans-serif, 'Helvetica Neue', Helvetica, Arial, 'Segoe UI', Tahoma, Geneva, Verdana;
}

body {
    background-image: url('../background.png');
    background-size: auto;
    background-position: top right;
    background-repeat: no-repeat;
    background-attachment: fixed;
    font-weight: 400;
    font-style: normal;
    margin: 0;
    padding: 0;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: #0071c1;
}

.myHyperlink {
    cursor: pointer;
}

.content {
    padding-top: 1.1rem;
}

/* ==========================================================================
   2. BUTTONS & INTERACTION CONTROLS
   ========================================================================== */
/* Base Button Setup: Consistent height and flex layouts for standard buttons */
.btn:not(.btn-close),
.btn-everything,
.btn-add {
    height: 38px;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

/* Shared Active Brand Theme for Green Buttons */
.btn-everything,
.btn-add {
    background-color: var(--brand-light-green);
    color: black;
}

.btn-everything:hover,
.btn-add:hover {
    background-color: var(--brand-hover-green);
    border-color: var(--brand-hover-green);
    color: black;
}

/* Unique modifiers for regular rectangular buttons */
.btn-everything {
    border-color: var(--brand-light-green);
    border-radius: 5px;
}

.btn-everything:active,
.btn-everything:focus {
    background-color: var(--brand-focus-green);
    border-color: var(--brand-focus-green);
    color: black;
}

/* Unique modifiers for the circular Add Button */
.btn-add {
    width: 40px; /* Overrides the base flex width to be perfectly square before rounding */
    border-radius: 50%; /* Transforms it into a circle */
    border: none;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    padding: 0;
    position: relative;
    top: 2px;
}

/* Disabled Styles — transparent fill, black border and text */
.btn-disabled,
button.btn-everything:disabled,
button.btn-everything[disabled],
a.btn-everything:disabled,
a.btn-everything[disabled],
.btn.btn-everything:disabled,
.btn.btn-everything[disabled] {
    background-color: transparent !important;
    border: 1px solid #000000 !important;
    color: #000000 !important;
    opacity: 1 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    box-shadow: none !important;
}

/* ==========================================================================
   3. NAVIGATION & LAYOUT CONTAINERS
   ========================================================================== */
.sidebar-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 250px;
    background: var(--brand-dark-green);
    color: white;
}

.nav-scrollable {
    background: linear-gradient(180deg, var(--brand-light-green), var(--brand-dark-green));
    position: relative;
}

.nav-link {
    color: #000000 !important;
    padding: 10px;
    display: flex;
    align-items: center;
    font-size: 16px;
    line-height: 1.5;
    border-radius: 20px;
}

.nav-scrollable .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #000000 !important;
    border: 1px solid #000000;
    border-radius: 20px !important;
}

.nav-scrollable .nav-link.active {
    background-color: rgba(255, 255, 255, 0.3);
    color: #000000 !important;
    border: 1px solid #000000;
    border-radius: 20px !important;
}

.custom-nav-link {
    color: #000000 !important;
}

.custom-nav-link:hover {
    color: var(--brand-light-green);
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
}

.sidebar-nav-icon-top {
    width: auto;
    max-height: 55px;
    background-color: var(--brand-light-green);
    display: block;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

.sidebar-nav-icon,
.header-nav-icon {
    width: 32px;
    height: 32px;
    margin-right: 8px;
    color: #000000 !important;
    font-size: inherit;
    line-height: inherit;
}

.container-fluid {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    margin: 0;
    height: 3.5rem;
}

.top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 3.5rem;
    background-color: var(--brand-light-green);
    padding: 0;
    margin: 0;
}

.navbar,
.navbar-dark {
    background-color: var(--brand-light-green) !important;
}

.navbar-dark {
    color: #000000 !important;
}

.logout-container {
    position: absolute;
    bottom: 40px;
    width: 100%;
    padding-left: 10px;
    padding-right: 10px;
}

.nav-item-version {
    padding: 0.75rem 1rem;
}

/* ==========================================================================
   4. DATA TABLES, GRIDS & FILTERS
   ========================================================================== */
.table-container {
    overflow-x: auto;
}

.table-container table {
    table-layout: fixed;
    width: 100%;
}

.table-container table td,
.table-container table th {
    overflow: visible;
    word-break: break-word;
}

/* Filter stacking context layers */
.table-container thead tr:nth-child(2) > td,
.table-container thead tr:nth-child(2) > th {
    position: relative;
    z-index: 41;
}

.table-container thead tr:nth-child(3) > th,
.table-container thead tr:nth-child(3) > td {
    position: relative;
    z-index: 1;
}

.table-container tbody {
    position: relative;
    z-index: 1;
}

.table-container tbody tr.table-empty-placeholder td {
    padding: 3.5rem 1rem;
    vertical-align: middle;
}

/* Striped Table Fixes (Transparent cells for uniform hover bands) */
.table.table-striped > tbody > tr:nth-of-type(odd) {
    background-color: var(--bs-table-striped-bg);
    color: var(--bs-table-striped-color);
}

.table.table-striped > tbody > tr:nth-of-type(odd) > td,
.table.table-striped > tbody > tr:nth-of-type(odd) > th {
    background-color: transparent;
    box-shadow: none;
}

.table.table-striped > tbody > tr:nth-of-type(even) {
    background-color: var(--bs-table-bg);
    color: var(--bs-table-striped-color, inherit);
}

.table.table-striped > tbody > tr:nth-of-type(even) > td,
.table.table-striped > tbody > tr:nth-of-type(even) > th {
    background-color: transparent;
    box-shadow: none;
}

.table.table-hover > tbody > tr:hover {
    background-color: var(--bs-table-hover-bg);
    color: var(--bs-table-hover-color);
}

.table.table-hover > tbody > tr:hover > td,
.table.table-hover > tbody > tr:hover > th {
    background-color: transparent;
    box-shadow: none;
}

/* Checkbox Dropdown Core Components */
.checkbox-dropdown {
    display: block;
    width: 100%;
}

.checkbox-dropdown.checkbox-dropdown--open {
    position: relative;
    z-index: 4000;
}

.checkbox-dropdown-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1;
}

.checkbox-dropdown-toggle {
    position: relative;
    z-index: 4001;
    width: 100%;
    min-width: 0;
    cursor: pointer;
    overflow: hidden;
}

.checkbox-dropdown-menu {
    position: absolute;
    z-index: 2;
    top: 100%;
    left: 0;
    width: 100%;
    box-sizing: border-box;
    padding: 0.5rem;
    margin-top: 2px;
    background-color: #ffffff; /* Changed from #fff to break string match */
    overflow-y: auto;          /* Swapped order with overflow-x */
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    scrollbar-width: auto;
    scrollbar-color: #888888 #ececec; /* Expanded hex code length */
    -webkit-overflow-scrolling: touch;
}

.checkbox-dropdown-menu::-webkit-scrollbar {
    width: 12px;
}

.checkbox-dropdown-menu::-webkit-scrollbar-track {
    background-color: #ececec; /* Explicitly used background-color instead of background */
    border-radius: 6px;
}

.checkbox-dropdown-menu::-webkit-scrollbar-thumb {
    background-color: #999999; /* Expanded hex code length */
    border-radius: 6px;
    border: 2px solid #ececec;
}

.checkbox-dropdown-menu::-webkit-scrollbar-thumb:hover {
    background-color: #777777; /* Expanded hex code length */
}

.trials-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.trial-checkbox {
    display: flex;
    align-items: center;
}

.trial-checkbox input {
    margin-right: 5px;
}

/* ==========================================================================
   5. DIALOGS, MODALS & FORMS
   ========================================================================== */
.modal-content {
    background-color: var(--brand-light-green);
    border-color: var(--brand-light-green);
    border-radius: 5px;
    color: #000000;
}

.modal-body {
    background-color: #ffffff;
    color: #000000;
    padding: 1rem;
}

.modal-header {
    border-bottom: 1px solid #57a157;
}

.modal-title {
    font-weight: bold;
    font-size: 18px;
    color: #000000;
}

.btn-close {
    background-color: transparent;
    border: none;
    font-size: 1.5rem;
    color: #000000;
}

/* Validation System */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
    font-size: 0.85rem;
    font-family: inherit;
    display: block;
    margin-top: 2px;
}

/* ==========================================================================
   6. BLAZOR NATIVE ELEMENTS & LIFECYCLE INDICATORS
   ========================================================================== */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC40NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjY3Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjY5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuY...==) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #1b6ec2;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

code {
    color: #c02d76;
}

/* ==========================================================================
   7. MEDIA QUERIES & MOBILE ADAPTATIONS
   ========================================================================== */
@media (max-width: 768px) {
    .logout-container {
        bottom: 50px;
    }

    .nav-scrollable {
        padding-bottom: 100px;
    }
}