﻿/* File: wwwroot/css/site.css */

/* ========= Variables ========= */
:root {
    --brand-height: 18px; /* small logo */
    --header-height: 30px;
    --header-icon-size: 20px; /* header user/logout icons */
    --nav-width: 180px;
    --nav-viewport-offset: 60px; /* keep your original (header + spacing) */
    --nav-top-offset: 10px; /* lowers Dashboard + Upload */
    --footer-height: 52px; /* approx footer text block */
    --bottom-gap: 72px; /* raises Admin/Help above footer */
    --nav-indent: 18px; /* left padding for nav links */
    --nav-icon-size: 18px; /* EXACT requested size */
    --nav-text-size: 14px; /* EXACT requested size */
    /* Primary palette for ALL buttons */
    --primary-color: #0f6cbd;
    --primary-hover: #213058;
}

/* ========= Base layout ========= */
html, body {
    height: 100%;
    background-color: #f8f9fa;
}

#app { /* WHY: ensure Blazor root participates in height calc */
    min-height: 100vh; /* fallback */
    min-height: 100dvh; /* modern viewport unit */
    display: flex;
    flex-direction: column;
}

/* Root container must span viewport and be flex column */
.container-fluid { /* SINGLE SOURCE OF TRUTH (deduped) */
    min-height: 100vh; /* fallback */
    min-height: 100dvh; /* modern */
    display: flex;
    flex-direction: column;
}

/* Prevent header from stealing height on first paint */
.top-row {
    flex: 0 0 auto;
}

/* Let the main row grow and allow children to compute height */
.row {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

/* Columns must allow their children to shrink/scroll */
.col, [class^="col-"], [class*=" col-"] {
    min-height: 0;
}

/* ========= Misc component tweaks ========= */
.custom-icon-align {
    vertical-align: -0.35em;
    width: 15px;
    height: 15px;
}

.ant-table-cell {
    font: 12px Arial;
}

.ant-select-item {
    font-size: 12px;
}

.ant-select-selection-item {
    font-size: 12px;
}

.ant-btn {
    line-height: 0;
}

@keyframes color-change {
    0% {
        color: #1b67a6;
    }

    25% {
        color: #213258;
    }

    50% {
        color: #127643;
    }

    100% {
        color: #35a955;
    }
}

.color-changing-icon {
    font-size: 40px;
    animation: color-change 0.5s infinite;
}

.dxbl-wait-indicator {
    --dxbl-wait-indicator-color: white;
}

/* ========= Buttons: unified primary palette ========= */
.spc-button {
    background-color: var(--primary-color) !important;
    color: white !important;
    border: none !important;
    height: 24px !important;   
    padding: 0 14px !important;
    font-size: 12px !important;
    font-weight: 500;
    border-radius: 3px !important;
    line-height: 1 !important;
    bottom: 0;
    margin-top: 19px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.spc-close-button {
    background-color: var(--primary-color) !important;
    color: white !important;
    border: none !important;
    height: 24px !important;
    padding: 0 14px !important;
    font-size: 12px !important;
    font-weight: 500;
    border-radius: 3px !important;
    line-height: 1 !important;
    bottom: 0;
    margin-top: 19px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

    .spc-button:hover {
        background-color: var(--primary-hover) !important;
        color: #fff !important;
    }


.spc-close-button:hover {
    background-color: var(--primary-hover) !important;
    color: #fff !important;
}

/* Update button */
.update-button {
    background-color: var(--primary-color) !important;
    color: white !important;
    border: none !important;
    height: 24px !important;
    width: 110px !important;
    padding: 0 14px !important;
    font-size: 12px !important;
    font-weight: 500;
    border-radius: 3px !important;
    line-height: 1 !important;
    bottom: 0;
    margin-top: 19px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

    .update-button:hover {
        background-color: var(--primary-hover) !important;
        color: #fff !important;
    }

/* Small icon buttons (unselected remain white) */
.small-icon-button:not(.selected-chart-button),
.small-icon-button:not(.selected-chart-button):focus,
.small-icon-button:not(.selected-chart-button):active,
.small-icon-button:not(.selected-chart-button)[disabled] {
    background-color: #fff !important;
    color: #213159 !important;
    border-color: #d0d7de !important;
    box-shadow: none !important;
    transition: background-color 0.2s ease, color 0.2s ease;
}

    .small-icon-button:not(.selected-chart-button):hover {
        background-color: #d6dae5 !important;
        color: #213159 !important;
        border-color: #c2c8d6 !important;
        cursor: pointer;
    }

/* Selected states = primary */
.small-icon-button.selected-chart-button,
.small-icon-button.selected-chart-button:focus,
.small-icon-button.selected-chart-button:active {
    background-color: var(--primary-color) !important;
    color: #fff !important;
    border-color: var(--primary-color) !important;
    cursor: pointer;
}

    .small-icon-button.selected-chart-button:hover {
        background-color: var(--primary-hover) !important;
        border-color: var(--primary-hover) !important;
    }

.small-icon-button i {
    color: inherit;
}

.chart-selection-btn {
    height: 24px;
    width: 24px;
    font-size: 12px !important;
    font-weight: 500;
    border-radius: 3px !important;
    margin-top: 19px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Alias classes used elsewhere for selected look */
.selected-chart-button {
    background-color: var(--primary-color) !important;
    color: #fff !important;
}

    .selected-chart-button:hover {
        background-color: var(--primary-hover) !important;
    }

.selected-day-button {
    background-color: var(--primary-color) !important;
    color: #fff !important;
}

    .selected-day-button:hover {
        background-color: var(--primary-hover) !important;
    }

/* ========= Header ========= */
.top-row {
    height: var(--header-height);
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    flex-direction: row !important; /* guard against theme overrides */
    justify-content: space-between;
    padding: 0 .75rem;
    gap: .5rem;
}

.brand {
    display: flex;
    align-items: center;
}

.brand-logo, .logo {
    height: var(--brand-height) !important;
    width: auto !important;
    display: block;
    object-fit: contain;
}

.user-actions,
.top-row .col.d-flex.justify-content-end.align-items-center {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-left: auto;
}

    .user-actions .nav-link,
    .user-actions form,
    .user-actions button,
    .top-row .col.d-flex.justify-content-end.align-items-center .nav-link,
    .top-row .col.d-flex.justify-content-end.align-items-center form,
    .top-row .col.d-flex.justify-content-end.align-items-center button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        height: 40px;
        padding: 0 .5rem;
        line-height: 1;
        background: transparent;
        border: 0;
    }

    .user-actions form, .top-row .col.d-flex.justify-content-end.align-items-center form {
        margin: 0;
    }

    .user-actions .anticon, .user-actions svg,
    .top-row .col.d-flex.justify-content-end.align-items-center .anticon,
    .top-row .col.d-flex.justify-content-end.align-items-center svg {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        vertical-align: middle;
        font-size: var(--header-icon-size);
    }

/* ========= Nav drawer ========= */
.nav-drawer {
    position: fixed;
    left: 0;
    height: calc(100vh - var(--nav-viewport-offset));
    height: calc(100dvh - var(--nav-viewport-offset));
    background-color: #f8f9fa;
    width: var(--nav-width);
    overflow: hidden;
    z-index: 999;
    display: flex;
    flex-direction: column;
}

    .nav-drawer .nav.flex-column {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        padding-top: var(--nav-top-offset);
        padding-bottom: calc(var(--footer-height) + var(--bottom-gap));
    }

/* Nav items */
.nav-link {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    color: #213159;
    padding: 12px 12px 12px var(--nav-indent);
    min-height: 42px;
    line-height: 1;
    gap: 10px;
    text-decoration: none;
}

.nav-drawer .nav-link .anticon,
.nav-drawer .nav-link svg,
.nav-drawer .nav-link .icon,
.nav-drawer .nav-link .active-nav-icon,
.nav-drawer .nav-link i {
    font-size: var(--nav-icon-size) !important;
    line-height: 1;
}

.nav-drawer .nav-link span {
    font-size: var(--nav-text-size);
    display: inline-flex;
    align-items: center;
    text-align: left;
}

/* Active states */
.active-nav-icon i {
    color: #1566A8;
    font-weight: 600;
    cursor: pointer;
}

.active-nav-text {
    color: #1566A8;
}

/* ========= Content area ========= */
.content-area {
    margin-left: var(--nav-width);
    background-color: #f8f9fa;
    transition: margin-left 0.3s ease;
    padding: 20px;
    padding-top: 20px;
}

#contentArea {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

    #contentArea .content-box {
        flex: 1 1 auto;
        min-height: 0;
        overflow: auto;
    }

.content-box {
    background-color: #ffffff;
    box-shadow: 0 0 10px rgba(0,0,0,.1);
    padding: 20px;
    border-radius: 8px;
}

/* ========= Optional header above drawer ========= */
.toggle-icon {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    height: 50px;
    cursor: pointer;
    background-color: #f8f9fa;
    border-bottom: 1px solid #ddd;
    padding-right: 10px;
    transition: justify-content 0.1s ease;
}

/* ========= Misc ========= */
.icon {
    font-size: 1.4em;
    cursor: pointer;
    transition: transform .3s ease;
}

    .icon.rotated {
        transform: rotate(180deg);
    }

.bottom-icon {
    margin-top: auto;
    margin-bottom: 30px;
    text-align: center;
}

.noselect {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* ========= Bottom groups ========= */
.nav-bottom {
    position: absolute;
    left: 0;
    bottom: var(--bottom-gap);
    width: 100%;
}

.nav-footer {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: var(--footer-height);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding-bottom: 12px;
}

    .nav-footer .footer-text {
        text-align: center;
        font-size: 8px;
        color: #313131;
        line-height: 1.4;
        font-weight: 700;
    }

/* ===== Fallback: current inline bottom block (no markup changes) ===== */
#navDrawer .nav > div[style*="position:absolute"] {
    position: absolute !important;
    left: 0;
    bottom: 0;
    width: 100%;
    padding-bottom: 12px;
}

    #navDrawer .nav > div[style*="position:absolute"] .nav-link {
        transform: translateY(calc(-1 * var(--bottom-gap)));
    }

    #navDrawer .nav > div[style*="position:absolute"] .mt-3,
    #navDrawer .nav > div[style*="position:absolute"] .mt-1 {
        width: 100%;
        text-align: center;
        color: #313131;
        font-size: 8px;
        line-height: 1.4;
        font-weight: 700;
    }

/* Dashboard host to ensure loader fills immediately */
.dashboard-viewport {
    min-height: calc(100dvh - var(--header-height));
    min-height: calc(100vh - var(--header-height));
    display: flex;
    flex-direction: column;
}

    .dashboard-viewport > * {
        flex: 1 1 auto;
        min-height: 0;
    }
