/* ============================================================
   VSTECS Onboarding Portal — global theme & layout
   ============================================================ */

:root {
    /* VSTECS brand palette (sampled from the corporate logo): deep navy + orange accent. */
    --brand: #003050;          /* navy — structure, links, active states, headings accent */
    --brand-strong: #00263f;   /* darker navy for hover */
    --brand-soft: #e7eef3;     /* light navy tint for active backgrounds */
    --accent: #f05030;         /* VSTECS orange — primary call-to-action */
    --accent-strong: #d8431f;
    --accent-soft: #fdebe5;
    --bg: #f4f6fa;
    --surface: #ffffff;
    --sidebar-bg: #ffffff;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e7ebf1;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
    --shadow-md: 0 6px 24px rgba(16, 24, 40, .08);

    --sidebar-w: 264px;
    --topbar-h: 68px;
    --ease: .22s cubic-bezier(.4, 0, .2, 1);
}

/* Scale the whole UI down slightly (rem-based sizing) so it reads less "upfront". */
html { font-size: 14.5px; }

html, body {
    font-family: 'Poppins', -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: var(--text);
    background: var(--bg);
    letter-spacing: -0.005em;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 { font-weight: 700; letter-spacing: -0.02em; }

a, .btn-link { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-strong); }

/* ---------- Page shell ---------- */
.page { display: flex; min-height: 100vh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: width var(--ease), transform var(--ease);
    overflow: hidden;
}

main {
    flex: 1 1 auto;
    min-width: 0;
    margin-left: var(--sidebar-w);
    transition: margin-left var(--ease);
    /* Column layout so the footer can be pushed to the bottom on short pages. */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 0 1.5rem;
    background: rgba(255, 255, 255, .82);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--border);
}

.topbar-title { font-weight: 600; font-size: .98rem; color: var(--text); }

/* Top-bar logo: only visible when the sidebar is collapsed (the sidebar shows it otherwise). */
.topbar-brand { display: none; align-items: center; text-decoration: none; }
.topbar-logo { height: 34px; width: auto; display: block; }
html.sidebar-collapsed .topbar-brand { display: inline-flex; }

.topbar-auth { display: flex; align-items: center; gap: .6rem; }
.topbar-user { font-size: .85rem; font-weight: 500; color: var(--muted); }
@media (max-width: 575.98px) { .topbar-user { display: none; } }

.sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    transition: background var(--ease), color var(--ease), border-color var(--ease);
}
.sidebar-toggle:hover { background: var(--brand-soft); color: var(--brand); border-color: var(--brand-soft); }

.content {
    padding: 1.75rem 2rem 3rem;
    max-width: 1180px;
    margin-inline: auto; /* center within main so collapsing doesn't dump all the space on the right */
    width: 100%;
    /* Take up the leftover height so the footer sits at the bottom on short pages. The content
       itself keeps its natural size; only this container grows. */
    flex: 1 0 auto;
}

/* ---------- Page footer ---------- */
/* margin-top:auto sits it at the bottom of the viewport when a page is short (main is a flex
   column), and simply after the content on long pages. Never fixed, so forms keep their height. */
.app-footer {
    margin-top: auto;
    background: var(--surface);
    border-top: 1px solid var(--border);
}
.app-footer-inner {
    max-width: 1180px;
    margin-inline: auto;
    padding: 1rem 2rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: .3rem;
    font-size: .8rem;
    color: var(--muted);
}
.app-footer-links { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .7rem; }
.app-footer a { color: var(--brand); font-weight: 500; }
.app-footer a:hover { color: var(--brand-strong); text-decoration: underline; }
.app-footer .sep { opacity: .4; }
.app-footer-legal { font-size: .76rem; opacity: .85; }

@media (max-width: 767.98px) {
    .app-footer-inner { padding: .9rem 1.1rem 1.1rem; }
}

/* ---------- Brand ---------- */
.brand {
    display: flex;
    align-items: center;
    gap: .7rem;
    height: var(--topbar-h);
    padding: 0 1.1rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    color: var(--text);
    text-decoration: none;
}
.brand:hover { color: var(--text); text-decoration: none; }

.brand-logo { height: 42px; width: auto; flex: 0 0 auto; display: block; }
.brand-sub {
    font-size: 1.05rem; font-weight: 600; color: var(--brand);
    line-height: 28px; padding-left: .7rem; border-left: 1px solid #d4dde4;
}

/* ---------- Nav ---------- */
.nav-list { padding: .9rem .75rem; overflow-y: auto; }

.nav-section {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #94a3b8;
    padding: .9rem .75rem .35rem;
    margin: 0;
    white-space: nowrap;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .62rem .75rem;
    margin-bottom: .15rem;
    border-radius: 10px;
    color: #475569;
    font-size: .92rem;
    font-weight: 500;
    white-space: nowrap;
    transition: background var(--ease), color var(--ease);
}
.nav-link:hover { background: #f1f5f9; color: var(--text); }

.nav-link svg {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-link.active {
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-weight: 600;
}
.nav-link.active svg { stroke: var(--brand); }

/* ---------- Collapsed: slide the sidebar fully off-screen; content reclaims full width ---------- */
html.sidebar-collapsed .sidebar { transform: translateX(-100%); }
html.sidebar-collapsed main { margin-left: 0; }

/* ---------- Mobile drawer ---------- */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--ease);
    z-index: 1035;
}

@media (max-width: 767.98px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-md); }
    main { margin-left: 0; }
    html.sidebar-open .sidebar { transform: none; }
    html.sidebar-open .sidebar-backdrop { opacity: 1; visibility: visible; }
    .content { padding: 1.25rem 1.1rem 2.5rem; }
}

/* ---------- Component polish ---------- */
.card { border: 1px solid var(--border); border-radius: 14px; }
.card.shadow-sm { box-shadow: var(--shadow-sm) !important; }

.btn { border-radius: 9px; font-weight: 600; }
.btn-lg { border-radius: 11px; }

/* Primary call-to-action uses the VSTECS orange; structural/brand elements use navy. */
.btn-primary {
    color: #fff;
    background-color: var(--accent);
    border-color: var(--accent);
}
.btn-primary:hover, .btn-primary:focus { color: #fff; background-color: var(--accent-strong); border-color: var(--accent-strong); }

/* Navy outline/secondary actions to match the brand structure. */
.btn-outline-primary { color: var(--brand); border-color: var(--brand); }
.btn-outline-primary:hover { background-color: var(--brand); border-color: var(--brand); color: #fff; }

.form-control, .form-select {
    border-radius: 9px;
    border-color: #d8dee8;
    padding: .55rem .8rem;
}
/* Keep room for the native dropdown caret so it doesn't overlap the text. */
.form-select {
    padding-right: 2.25rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 .2rem rgba(0, 48, 80, .15);
}

.list-group-item { border-color: var(--border); }
.list-group-item:first-child { border-top-left-radius: 12px; border-top-right-radius: 12px; }
.list-group-item:last-child { border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; }

.badge { font-weight: 600; border-radius: 7px; padding: .4em .65em; }

/* ---------- Document checklist ---------- */
.doc-group { margin-bottom: 1.6rem; }
.doc-group:last-child { margin-bottom: 0; }
.doc-group-head { margin-bottom: .55rem; }
.doc-group-title { font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #334155; margin: 0; }
.doc-group-sub { font-size: .82rem; color: var(--muted); margin: .1rem 0 0; }

.doc-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.doc-info { min-width: 0; flex: 1 1 240px; }
.doc-name { font-weight: 600; }

.doc-note {
    display: flex;
    align-items: flex-start;
    gap: .4rem;
    margin-top: .4rem;
    padding: .4rem .6rem;
    font-size: .82rem;
    color: #92400e;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
}
.doc-note .doc-ico { stroke: #d97706; margin-top: 1px; }

.doc-filemeta { display: inline-flex; align-items: center; gap: .35rem; margin-top: .25rem; font-size: .8rem; color: var(--muted); }
.doc-uploaded { margin-top: .35rem; font-size: .82rem; font-weight: 500; color: #15803d; }
.doc-error { margin-top: .35rem; font-size: .82rem; color: #dc2626; }

.doc-actions { display: flex; gap: .5rem; align-items: center; flex-shrink: 0; }
.doc-actions .btn { white-space: nowrap; display: inline-flex; align-items: center; gap: .35rem; }

.doc-ico { flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 .2rem rgba(0, 48, 80, .2);
}

.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }

h1:focus { outline: none; }
.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid #e50000; }
.validation-message { color: #e50000; }

/* ---------- Error UIs (kept from template) ---------- */
.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAt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ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}
.blazor-error-boundary::after { content: "An error has occurred."; }

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    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; }

/* ---------- Search pickers (Sales Taker / ISR / Delegate): close on click outside ----------
   While a picker's list is open, an invisible full-screen layer sits behind it (above the sidebar at 1040),
   so a click anywhere else lands on the layer and closes the list. The open picker is raised above it. */
.picker-backdrop { position: fixed; inset: 0; z-index: 1050; }
.picker-open { z-index: 1051; }
