/* =========================================================
   BS25 Reporting / Print stylesheet
   Used by all printable documents (Challan, Invoice, etc.)
   ========================================================= */

/* ---------- Screen layout (preview in browser) ---------- */
.bs-print-page {
    background: #f3f3f3;
    padding: 24px 0;
    min-height: 100vh;
}

.bs-print-paper {
    background: #ffffff;
    width: 210mm;             /* A4 width */
    min-height: 297mm;        /* A4 height */
    margin: 0 auto 16px auto;
    padding: 14mm 14mm 18mm 14mm;
    box-shadow: 0 0 8px rgba(0,0,0,0.15);
    color: #000;
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 12px;
    line-height: 1.35;
    box-sizing: border-box;
    position: relative;
}

.bs-print-toolbar {
    width: 210mm;
    margin: 0 auto 12px auto;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ---------- Header (logo + company block) ---------- */
.bs-doc-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    border-bottom: 2px solid #000;
    padding-bottom: 8px;
    margin-bottom: 10px;
}

.bs-doc-logo {
    width: 90px;
    height: 90px;
    border: 1px dashed #999;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 11px;
    text-align: center;
    flex: 0 0 90px;
    background: #fafafa;
}

.bs-doc-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.bs-doc-company {
    flex: 1;
    text-align: center;
}

.bs-doc-company .name {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin: 0;
}

.bs-doc-company .addr,
.bs-doc-company .meta {
    font-size: 11px;
    margin: 0;
}

.bs-doc-company .meta {
    margin-top: 2px;
    color: #333;
}

.bs-doc-title-bar {
    text-align: center;
    margin: 8px 0 12px 0;
}

.bs-doc-title-bar .title {
    display: inline-block;
    border: 1.5px solid #000;
    padding: 4px 22px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.bs-doc-title-bar .copy {
    margin-left: 10px;
    font-size: 11px;
    font-style: italic;
}

/* ---------- Meta blocks (challan no, dates, party) ---------- */
.bs-doc-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 14px;
    margin-bottom: 10px;
}

.bs-doc-meta-grid .cell {
    border: 1px solid #ccc;
    padding: 4px 6px;
}

.bs-doc-meta-grid .cell .label {
    font-size: 10px;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bs-doc-meta-grid .cell .value {
    font-size: 12px;
    font-weight: 600;
    min-height: 14px;
}

.bs-party-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border: 1px solid #000;
    margin-bottom: 10px;
}

.bs-party-grid .col {
    padding: 6px 8px;
}

.bs-party-grid .col + .col {
    border-left: 1px solid #000;
}

.bs-party-grid .heading {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: #555;
    margin-bottom: 2px;
    letter-spacing: 0.5px;
}

.bs-party-grid .name {
    font-weight: 700;
    font-size: 13px;
}

.bs-party-grid .addr {
    font-size: 11px;
    white-space: pre-wrap;
}

/* ---------- Items table ---------- */
.bs-items-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
}

.bs-items-table th,
.bs-items-table td {
    border: 1px solid #000;
    padding: 4px 6px;
    vertical-align: top;
}

.bs-items-table thead th {
    background: #eee;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

.bs-items-table tbody td {
    font-size: 12px;
}

.bs-items-table .num    { text-align: right; }
.bs-items-table .center { text-align: center; }
.bs-items-table tfoot td {
    background: #f7f7f7;
    font-weight: 700;
}

/* ---------- Signature blocks ---------- */
.bs-doc-sign-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-top: 32px;
}

.bs-doc-sign-row .sign-cell {
    text-align: center;
    font-size: 11px;
}

.bs-doc-sign-row .sign-line {
    border-top: 1px solid #000;
    margin: 36px 12px 4px 12px;
}

/* ---------- Footer ---------- */
.bs-doc-footer {
    margin-top: 18px;
    border-top: 1px dashed #999;
    padding-top: 6px;
    font-size: 10px;
    color: #555;
    display: flex;
    justify-content: space-between;
}

/* =========================================================
   PRINT MEDIA: hide UI chrome and shape page for printer
   ========================================================= */
@media print {
    @page {
        size: A4;
        margin: 10mm;
    }

    html, body {
        background: #fff !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Hide the app's main shell (sidebar, top bar, popups, idle timer, etc.) */
    .sidebar-custom,
    .bb-top-row,
    .mobile-backdrop,
    .bs-print-toolbar,
    nav,
    header,
    footer.app-footer,
    #bs25-floating-tools {
        display: none !important;
    }

    /* The Blazor layout wraps content in <main><article class="content">...
       Strip its padding/margins so the paper goes edge-to-edge. */
    .bb-page,
    main,
    article.content,
    .bs-print-page {
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        display: block !important;
        width: 100% !important;
        min-height: 0 !important;
    }

    .bs-print-paper {
        box-shadow: none !important;
        margin: 0 auto !important;
        padding: 0 !important;
        width: 100% !important;
        min-height: 0 !important;
    }

    /* Repeat table headers across pages */
    .bs-items-table thead { display: table-header-group; }
    .bs-items-table tfoot { display: table-footer-group; }
    tr { page-break-inside: avoid; }
}
