/* ==========================================================================
   bic.css: the old app's wwwroot/css/site.css, unchanged, followed by the
   additions the Blazor version needs (marked "ADDED"). Bootstrap 5.3.2 and
   Bootstrap Icons 1.11.3 are self-hosted in BIC.Web/wwwroot/lib.
   ========================================================================== */

:root {
    --bic-navy:       #1a2332;
    --bic-navy-dark:  #111925;
    --bic-navy-mid:   #1f2d40;
    --bic-accent:     #f5a623;   /* amber / warning */
    --bic-accent-alt: #2196f3;   /* action blue */
    --bic-sidebar-w:  220px;
    --bic-topbar-h:   56px;
    --bic-text-muted: #8a9bb0;
}

/* --------------------------------------------------------------------------
   Reset / base
-------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

body.bic-body {
    margin: 0;
    padding: 0;
    background: #f0f2f5;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 0.9rem;
    color: #1a2332;
}

/* --------------------------------------------------------------------------
   Top bar
-------------------------------------------------------------------------- */
.bic-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--bic-topbar-h);
    background: var(--bic-navy-dark);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    z-index: 1030;
    padding: 0 1rem;
}

.bic-brand span {
    font-size: 0.95rem;
    letter-spacing: 0.01em;
}

.bic-breadcrumb {
    font-size: 0.78rem;
}

.bic-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    color: #4a5568;
}

/* --------------------------------------------------------------------------
   Wrapper: sidebar + main side by side
-------------------------------------------------------------------------- */
.bic-wrapper {
    display: flex;
    min-height: 100vh;
    padding-top: var(--bic-topbar-h);
}

/* --------------------------------------------------------------------------
   Sidebar
-------------------------------------------------------------------------- */
.bic-sidebar {
    width: var(--bic-sidebar-w);
    min-width: var(--bic-sidebar-w);
    background: var(--bic-navy);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--bic-topbar-h);
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 1020;
    transition: transform 0.25s ease;
}

.bic-sidebar .nav-link {
    color: #a0aec0;
    padding: 0.6rem 1.25rem;
    border-radius: 0;
    font-size: 0.875rem;
    transition: background 0.15s, color 0.15s;
    display: flex;
    align-items: center;
}

.bic-sidebar .nav-link:hover {
    background: var(--bic-navy-mid);
    color: #fff;
}

.bic-sidebar .nav-link.active {
    background: var(--bic-accent-alt);
    color: #fff;
    font-weight: 500;
}

/* Smaller secondary nav links */
.bic-sidebar .nav-link-sm {
    font-size: 0.8rem;
    padding: 0.45rem 1.25rem;
    color: var(--bic-text-muted);
}

.bic-sidebar .nav-link-sm:hover {
    color: #cbd5e0;
}

.bic-nav-divider {
    border-top: 1px solid rgba(255,255,255,0.07);
    margin: 0.5rem 1rem;
}

/* Admin submenu chevron rotation */
.bic-sidebar [data-bs-toggle="collapse"][aria-expanded="true"] .bi-chevron-down {
    transform: rotate(180deg);
}
#adminSubmenu .nav-link-sm {
    font-size: .82rem;
    padding-left: .5rem;
}

.bic-sidebar-footer {
    margin-top: auto;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.06);
    font-size: 0.75rem;
}

/* --------------------------------------------------------------------------
   Main content
-------------------------------------------------------------------------- */
.bic-main {
    margin-left: var(--bic-sidebar-w);
    flex: 1;
    padding: 1.75rem 2rem;
    min-width: 0; /* prevents flex overflow */
}

.bic-page-header {
    border-bottom: 1px solid #dde2ea;
    padding-bottom: 0.75rem;
}

.bic-page-header h1 {
    color: var(--bic-navy);
}

/* --------------------------------------------------------------------------
   Cards — slight elevation tweak
-------------------------------------------------------------------------- */
.card {
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.card-header {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 500;
}

/* --------------------------------------------------------------------------
   Tables
-------------------------------------------------------------------------- */
.table thead th {
    background: #f1f5f9;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
}

/* --------------------------------------------------------------------------
   Status badges
-------------------------------------------------------------------------- */
.badge-bidding    { background: #e3f2fd; color: #1565c0; }
.badge-active     { background: #e8f5e9; color: #2e7d32; }
.badge-complete   { background: #f3e5f5; color: #6a1b9a; }
.badge-closed     { background: #f5f5f5; color: #616161; }
.badge-pending    { background: #fff8e1; color: #f57f17; }
.badge-approved   { background: #e8f5e9; color: #2e7d32; }
.badge-rejected   { background: #ffebee; color: #c62828; }

/* --------------------------------------------------------------------------
   Mobile: collapse sidebar off-canvas
-------------------------------------------------------------------------- */
@media (max-width: 767.98px) {
    .bic-sidebar {
        transform: translateX(calc(-1 * var(--bic-sidebar-w)));
    }
    .bic-sidebar.sidebar-open {
        transform: translateX(0);
        box-shadow: 4px 0 16px rgba(0,0,0,0.25);
    }
    .bic-main {
        margin-left: 0;
        padding: 1rem;
    }
}

/* --------------------------------------------------------------------------
   Project cards (4A)
-------------------------------------------------------------------------- */
.project-card {
    transition: box-shadow 0.15s, transform 0.15s;
}
.project-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   Module shortcut cards (4A Detail page)
-------------------------------------------------------------------------- */
.module-card {
    transition: box-shadow 0.15s, transform 0.15s;
    cursor: pointer;
}
.module-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
    text-decoration: none;
}

/* --------------------------------------------------------------------------
   Markup tier radio buttons (4A Form)
-------------------------------------------------------------------------- */
.tier-label {
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    min-height: 90px;
}
.btn-check:checked + .tier-label {
    font-weight: 600;
}

/* ── Inline-editable qty cells on Bid Summary ──────────────────────────── */
.qty-display {
    border-radius: 4px;
    padding: 2px 6px;
    transition: background-color 0.15s;
}
.qty-display:hover {
    background-color: #e8f0fe;
}
.editable-qty {
    border-bottom: 1px dashed #adb5bd;
}
.qty-display input {
    display: inline-block;
}
.sq-input {
    text-align: right;
}

/* ==========================================================================
   ADDED for the Blazor version
   ========================================================================== */

/* Sign-in page (old Views/Account/Login.cshtml inline styles). */
.bic-login-page {
    background: var(--bic-navy);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.login-card { width: 100%; max-width: 420px; border-radius: 12px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,0.4); }
.login-header { background: var(--bic-accent); padding: 2rem; text-align: center; }
.login-header h1 { font-size: 1.4rem; font-weight: 700; color: #1a2332; margin: 0.5rem 0 0; }
.login-header p { color: rgba(26,35,50,0.7); margin: 0; font-size: 0.85rem; }
.login-body { background: #fff; padding: 2rem; }
.btn-signin { background: var(--bic-navy); border: none; color: #fff; font-weight: 600; padding: 0.7rem; }
.btn-signin:hover, .btn-signin:focus { background: #243447; color: #fff; }
.bic-login-page .form-control:focus { border-color: var(--bic-accent); box-shadow: 0 0 0 0.2rem rgba(245,166,35,0.25); }

/* Session-ended overlay: the page stays underneath so unsaved input survives. */
.bic-overlay {
    position: fixed; inset: 0;
    background: rgba(17, 25, 37, .6);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 10vh 16px 16px;
    z-index: 2000;
}
.bic-overlay .login-card { max-width: 420px; }

/* Mobile: tap outside the open sidebar to close it. */
.bic-sidebar-backdrop { display: none; }
@media (max-width: 767.98px) {
    .bic-sidebar-backdrop.show {
        display: block;
        position: fixed; inset: var(--bic-topbar-h) 0 0 0;
        background: rgba(0,0,0,.25);
        z-index: 1010;
    }
}

/* Sidebar links are buttons in a few places (admin toggle); keep them link-styled. */
.bic-sidebar button.nav-link { width: 100%; background: none; border: 0; text-align: left; }

/* Current-project indicator in the sidebar (old inline styles). */
.bic-context {
    background: rgba(255,255,255,0.07);
    border-radius: 6px;
    border-left: 3px solid var(--bic-accent);
}
.bic-context-name {
    font-size: .72rem; color: var(--bic-accent); font-weight: 600; line-height: 1.3;
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 140px;
}
.bic-context-name:hover { color: var(--bic-accent); }
.bic-context-clear { font-size: .7rem; color: rgba(255,255,255,0.4); line-height: 1; background: none; border: 0; padding: 0; }
.bic-context-job { font-size: .65rem; color: rgba(255,255,255,0.4); }

/* Blazor moves focus to the page's first h1 after navigation (for screen readers); no visible ring. */
h1:focus, h1:focus-visible { outline: none; }

/* Small label above a figure (old inline style="font-size:0.7rem"). */
.bic-figure-label { font-size: 0.7rem; }

/* Blazor validation */
.validation-message { color: var(--bs-danger); font-size: .875em; }
.form-control.invalid, .form-select.invalid { border-color: var(--bs-danger); }

/* ── Report printing (old Reports/_PrintStyles.cshtml, applied app-wide) ── */
.print-header { display: none; }
@media print {
    .bic-sidebar, .bic-topbar, .bic-sidebar-backdrop, .bic-page-header, .no-print,
    .bic-main .btn, .bic-main .form-select, .bic-main .alert-info, .breadcrumb { display: none !important; }
    body.bic-body { background: #fff !important; }
    .bic-wrapper { padding-top: 0 !important; }
    .bic-main { margin-left: 0 !important; padding: 0 !important; }
    .bic-main .card { border: 1px solid #ddd !important; box-shadow: none !important; page-break-inside: avoid; }
    .bic-main .table { font-size: 9pt; }
    .bic-main .badge { border: 1px solid #999; background: none !important; color: #000 !important; }
    .bic-main .table th, .bic-main .table td { border: 1px solid #ccc !important; }
    .print-header { display: block !important; }
}

/* ── Proposal (old GenerateProposal.cshtml inline styles, scoped) ── */
.bic-proposal {
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 11pt;
    color: #1a1a2e;
    background: #fff;
    min-height: 100vh;
}
.bic-proposal .page { max-width: 820px; margin: 0 auto; padding: 40px 48px; }
.bic-proposal .letterhead { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 3px solid #1a2332; padding-bottom: 16px; margin-bottom: 24px; gap: 16px; }
.bic-proposal .letterhead-brand { font-size: 22pt; font-weight: 800; color: #1a2332; letter-spacing: -0.5px; }
.bic-proposal .letterhead-brand span { color: #f5a623; }
.bic-proposal .letterhead-contact { font-size: 9pt; color: #555; text-align: right; line-height: 1.6; }
.bic-proposal .proposal-header { margin-bottom: 24px; }
.bic-proposal .proposal-header h1 { font-size: 15pt; font-weight: 700; margin: 0 0 4px; }
.bic-proposal .proposal-meta { display: flex; gap: 32px; font-size: 9.5pt; color: #555; margin-top: 8px; flex-wrap: wrap; }
.bic-proposal .client-block { background: #f8fafc; border: 1px solid #dde2ea; border-radius: 6px; padding: 14px 18px; margin-bottom: 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 32px; font-size: 10pt; }
.bic-proposal .client-block .label { color: #888; font-size: 8.5pt; text-transform: uppercase; letter-spacing: .04em; }
.bic-proposal .section-title { font-size: 11pt; font-weight: 700; color: #1a2332; border-bottom: 1px solid #e2e8f0; padding-bottom: 6px; margin: 24px 0 12px; }
.bic-proposal .scope-list { margin: 0 0 16px; padding-left: 20px; }
.bic-proposal .scope-list li { margin-bottom: 4px; font-size: 10pt; }
.bic-proposal table { width: 100%; border-collapse: collapse; font-size: 10pt; margin-bottom: 8px; }
.bic-proposal thead tr { background: #1a2332; color: #fff; }
.bic-proposal thead th { padding: 8px 10px; text-align: left; font-size: 9pt; font-weight: 600; }
.bic-proposal thead th.right { text-align: right; }
.bic-proposal tbody tr:nth-child(even) { background: #f8fafc; }
.bic-proposal tbody tr.trade-header td { background: #eef1f5; font-weight: 700; font-size: 9.5pt; padding: 6px 10px; border-top: 1px solid #dde2ea; }
.bic-proposal tbody td { padding: 5px 10px; border-bottom: 1px solid #f0f0f0; }
.bic-proposal tbody td.right { text-align: right; }
.bic-proposal tfoot tr { border-top: 2px solid #1a2332; }
.bic-proposal tfoot td { padding: 10px; font-weight: 700; font-size: 11pt; }
.bic-proposal tfoot td.right { text-align: right; color: #1a2332; }
.bic-proposal .total-box { background: #1a2332; color: #fff; border-radius: 6px; padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; margin: 16px 0 24px; gap: 16px; }
.bic-proposal .total-box .label { font-size: 10pt; opacity: 0.8; }
.bic-proposal .total-box .amount { font-size: 18pt; font-weight: 800; color: #f5a623; }
.bic-proposal .signature-block { margin-top: 32px; display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.bic-proposal .sig-line { border-top: 1px solid #555; margin-top: 40px; padding-top: 6px; font-size: 9pt; color: #555; }
.bic-proposal .notes { font-size: 9pt; color: #666; margin-top: 24px; border-top: 1px solid #eee; padding-top: 12px; }
.bic-proposal .print-bar { background: #1a2332; color: #fff; padding: 10px 48px; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 100; gap: 12px; flex-wrap: wrap; }
.bic-proposal .print-bar button { background: #f5a623; color: #1a2332; border: none; padding: 6px 18px; border-radius: 4px; font-weight: 700; cursor: pointer; }
.bic-proposal .print-bar a { color: #a0aec0; font-size: 9pt; text-decoration: none; }
@media (max-width: 575.98px) {
    .bic-proposal .page { padding: 16px; }
    .bic-proposal .print-bar { padding: 10px 16px; }
    .bic-proposal .client-block, .bic-proposal .signature-block { grid-template-columns: 1fr; }
}
@media print {
    .bic-proposal .print-bar { display: none !important; }
    .bic-proposal { font-size: 10pt; }
    .bic-proposal .page { padding: 20px; max-width: 100%; }
    .bic-proposal .total-box, .bic-proposal thead tr { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    body.bic-body { background: #fff; }
}

.bic-loading { padding: 3rem 0; text-align: center; color: var(--bs-secondary-color); }
