/* ── Brand tokens (sampled from images/insights_logo.png) ───── */
:root {
    --brand-navy: #182d5a;
    --brand-mint: #9fe7dc;
    --brand-nav-idle: #9fb3d4;
}

html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* ── Brand mark ─────────────────────────────────────────────── */
.brand-logo {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

/* Full logo, not the mark: at 96px the detailed artwork resolves properly, and the
   420px login card has room for it. */
.login-logo {
    width: 96px;
    height: 96px;
}

/* ── Blazor Server reconnect modal ──────────────────────────── */
.components-reconnect-first-attempt-visible,
.components-reconnect-repeated-attempt-visible,
.components-reconnect-failed-visible,
.components-pause-visible,
.components-resume-failed-visible,
.components-rejoining-animation {
    display: none;
}

#components-reconnect-modal.components-reconnect-show .components-reconnect-first-attempt-visible,
#components-reconnect-modal.components-reconnect-show .components-rejoining-animation,
#components-reconnect-modal.components-reconnect-paused .components-pause-visible,
#components-reconnect-modal.components-reconnect-resume-failed .components-resume-failed-visible,
#components-reconnect-modal.components-reconnect-retrying,
#components-reconnect-modal.components-reconnect-retrying .components-reconnect-repeated-attempt-visible,
#components-reconnect-modal.components-reconnect-retrying .components-rejoining-animation,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-failed .components-reconnect-failed-visible {
    display: block;
}

#components-reconnect-modal {
    background-color: white;
    width: 20rem;
    margin: 20vh auto;
    padding: 2rem;
    border: 0;
    border-radius: 0.5rem;
    box-shadow: 0 3px 6px 2px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: display 0.5s allow-discrete, overlay 0.5s allow-discrete;
    animation: components-reconnect-modal-fadeOutOpacity 0.5s both;
}

#components-reconnect-modal[open] {
    animation: components-reconnect-modal-slideUp 1.5s cubic-bezier(.05, .89, .25, 1.02) 0.3s, components-reconnect-modal-fadeInOpacity 0.5s ease-in-out 0.3s;
    animation-fill-mode: both;
}

#components-reconnect-modal::backdrop {
    background-color: rgba(0, 0, 0, 0.4);
    animation: components-reconnect-modal-fadeInOpacity 0.5s ease-in-out;
    opacity: 1;
}

@keyframes components-reconnect-modal-slideUp {
    0% { transform: translateY(30px) scale(0.95); }
    100% { transform: translateY(0); }
}

@keyframes components-reconnect-modal-fadeInOpacity {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes components-reconnect-modal-fadeOutOpacity {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

.components-reconnect-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

#components-reconnect-modal p {
    margin: 0;
    text-align: center;
}

#components-reconnect-modal button {
    border: 0;
    background-color: #6b9ed2;
    color: white;
    padding: 4px 24px;
    border-radius: 4px;
}

#components-reconnect-modal button:hover { background-color: #3b6ea2; }
#components-reconnect-modal button:active { background-color: #6b9ed2; }

.components-rejoining-animation {
    position: relative;
    width: 80px;
    height: 80px;
}

.components-rejoining-animation div {
    position: absolute;
    border: 3px solid #0087ff;
    opacity: 1;
    border-radius: 50%;
    animation: components-rejoining-animation 1.5s cubic-bezier(0, 0.2, 0.8, 1) infinite;
}

.components-rejoining-animation div:nth-child(2) { animation-delay: -0.5s; }

@keyframes components-rejoining-animation {
    0% { top: 40px; left: 40px; width: 0; height: 0; opacity: 0; }
    4.9% { top: 40px; left: 40px; width: 0; height: 0; opacity: 0; }
    5% { top: 40px; left: 40px; width: 0; height: 0; opacity: 1; }
    100% { top: 0px; left: 0px; width: 80px; height: 80px; opacity: 0; }
}

/* ── Sidebar layout ─────────────────────────────────────────── */
.page {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: var(--brand-navy);
    color: #c9d1d9;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    /* Lock the rail to the viewport so .nav-scrollable scrolls internally. Without this,
       .page's min-height:100vh lets a long nav grow the page and push the env strip
       below the fold — the one place it must never be. */
    height: 100vh;
    position: sticky;
    top: 0;
}

.nav-scrollable {
    overflow-y: auto;
    flex: 1;
    padding: 0.5rem 0;
}

.sidebar .navbar-brand {
    color: #ffffff;
    font-size: 1rem;
    letter-spacing: 0.02em;
    /* Bootstrap defaults .navbar-brand to nowrap; with the mark alongside it the wordmark
       has only ~172px and would overflow the 240px rail. Let it wrap instead. */
    white-space: normal;
    line-height: 1.2;
}

.sidebar .navbar-brand > span {
    min-width: 0;
}

/* Environment banner, pinned to the bottom of the rail. Filled band rather than tinted
   text so it reads at a glance; both variants clear AA on white (~6.5:1). */
.env-strip {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    color: #ffffff;
    padding: 0.45rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.env-strip-warn { background: #b3261e; }   /* non-production — caution */
.env-strip-live { background: #146c43; }   /* production — confirmation, not alarm */

/* Spacing that used to come from Bootstrap px-3 / me-2 utilities. Moved here so the
   collapsed rules can override it without fighting Bootstrap's !important. */
.sidebar .nav-item {
    padding-left: 1rem;
    padding-right: 1rem;
}

.sidebar .nav-item-brand {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.sidebar .navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar .nav-link {
    color: var(--brand-nav-idle);
    border-radius: 6px;
    padding: 0.45rem 0.75rem;
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar .nav-link .bi {
    flex-shrink: 0;
}

.sidebar .nav-link:hover {
    background: rgba(255,255,255,0.08);
    color: #ffffff;
}

.sidebar .nav-link.active {
    background: rgba(159,231,220,0.12);
    color: var(--brand-mint);
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-row {
    height: 52px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
}

/* ── Responsive navigation ──────────────────────────────────── */
.nav-toggle-checkbox { display: none; }

.nav-toggle-btn {
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--brand-navy);
    margin-bottom: 0;
    padding: 0 0.25rem;
    background: none;   /* the collapse control is a <button>; the mobile one is a <label> */
    border: 0;
}

.mobile-brand { color: var(--brand-navy); }

/* Both are hidden by default and revealed only at >= 768px, below which the off-canvas
   drawer owns the interaction and a collapsed rail would make no sense. */
.nav-collapse-btn { display: none; }
.desktop-brand { display: none; color: var(--brand-navy); }

.nav-backdrop { display: none; }

/* ── Collapsible rail (desktop only) ────────────────────────── */
@media (min-width: 768px) {
    .nav-collapse-btn {
        display: inline-flex;
        align-items: center;
    }

    .sidebar { transition: width 0.18s ease; }

    html[data-nav="collapsed"] .sidebar { width: 64px; }

    /* Clipped rather than display:none — display:none drops the label from the
       accessibility tree, which would leave every nav link without an accessible name. */
    html[data-nav="collapsed"] .nav-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }

    html[data-nav="collapsed"] .sidebar .nav-item {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    html[data-nav="collapsed"] .sidebar .nav-link,
    html[data-nav="collapsed"] .sidebar .navbar-brand {
        justify-content: center;
        gap: 0;
    }

    /* The environment name stays legible while collapsed — it's a safety signal, so the
       icon yields to it rather than the other way round. */
    html[data-nav="collapsed"] .env-strip .bi { display: none; }

    html[data-nav="collapsed"] .env-strip {
        font-size: 0.7rem;
        letter-spacing: 0.02em;
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }

    html[data-nav="collapsed"] .desktop-brand { display: inline; }
}

@media (max-width: 767.98px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        z-index: 1045;
    }

    .nav-toggle-checkbox:checked ~ .sidebar {
        transform: translateX(0);
        box-shadow: 0 0 24px rgba(0, 0, 0, 0.4);
    }

    .nav-toggle-checkbox:checked ~ .nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 1044;
    }

    .content {
        padding: 1rem 0;
    }
}

.content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.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;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

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

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny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;
    color: white;
}

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

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.dashboard-progress {
    height: 8px;
    min-width: 88px;
}

/* ── Barcode tool preview ────────────────────────────────────── */
.barcode-output svg {
    max-width: 100%;
    height: auto;
}

.barcode-qr svg {
    width: 260px;
    height: 260px;
}

/* ── Package contents ───────────────────────────────────────── */
.pkg-files {
    max-height: 26rem;
    overflow-y: auto;
}

/* Pinned while scrolling. Needs an opaque background of its own — the sticky header
   would otherwise show the scrolling rows through it. */
.pkg-files thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--bs-table-bg, #f8f9fa);
}

/* ── Sortable table headers ─────────────────────────────────── */
th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

th.sortable:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

th.sortable .bi {
    font-size: 0.75rem;
    margin-left: 0.25rem;
}

/* ── Log activity bar chart ─────────────────────────────────── */
.log-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 200px;
}

.log-chart-col {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
    height: 100%;
}

.log-chart-bar-wrap {
    width: 100%;
    flex: 1 1 auto;
    display: flex;
    align-items: flex-end;
}

.log-chart-bar {
    width: 100%;
    background: var(--bs-info);
    border-radius: 3px 3px 0 0;
    min-height: 2px;
    transition: height 0.2s ease, background 0.2s ease;
}

.log-chart-col:hover .log-chart-bar {
    background: var(--bs-primary);
}

.log-chart-label {
    font-size: 0.65rem;
    color: var(--bs-secondary-color);
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.modal.show .modal-dialog {
    z-index: 1060;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}
