@import url('https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap');

/* ===== Base look ===== */
body {
    background: #ebebeb;
    font-family: "Open Sans", sans-serif;
    font-weight: 500;
}

img {
    max-width: 100%;
    height: auto;
}



.printarea-header-part .prntarea-header-main-logo img {
    width: 100%;
}

.printarea-footer-part {
    margin-top: 20px;
}

.top-header-part {
    padding: 20px 0;
    text-align: center;
}

.top-header-main-logo img {
    max-width: 100px;
}

.top-header-logo-name {
    font-size: 30px;
    font-weight: 600;
    color: #970102;
}

.top-header-invoice-text {
    font-size: 20px;
    text-transform: uppercase;
    font-weight: 600;
    border-bottom: 2px solid;
    display: inline-block;
}


.login-section {
    background: #CCCCCC;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}



.login-section h2 {
    font-size: 20px;
    font-weight: 600;
}

.login-section .login-panel {
    max-width: 400px;
    background-color: #FFF;
    padding: 50px;
    margin: 10px 20px;
    box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    text-align: center;

}


/* For cross-browser compatibility */
.login-section .login-panel input::placeholder {
    font-size: 12px;
}

.login-section .login-panel input:-ms-input-placeholder {
    /* Internet Explorer 10-11 */
    font-size: 12px;
}

.login-section .login-panel input::-ms-input-placeholder {
    /* Microsoft Edge */
    font-size: 12px;
}

.form-area .form-group {
    padding: 50px 0;
}

.form-area .form-group h1 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 25px;
    text-transform: uppercase;
    font-weight: 600;
}

.form-area .form-group h3 {
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 15px;
    color: #970102;
}

.form-area .form-field {
    background: rgba(255, 255, 255, 0.2);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.3);
    margin-bottom: 30px;
}

.search-section {
    background-color: #FFF;
    padding: 30px;
}

.search-section h3 {
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 15px;
    color: #970102;
}


.table thead th {
    white-space: nowrap;
}

.currency {
    font-variant-numeric: tabular-nums;
}

.date-wrap {
    cursor: pointer;
}

/* ===== Section headings ===== */
.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: .75rem;
    display: flex;
    align-items: center;
}

.section-subtitle {
    font-size: 1.05rem;
    font-weight: 700;
    margin: .5rem 0 .75rem;
    display: flex;
    align-items: center;
}

/* ===== Stats cards ===== */
.stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: linear-gradient(135deg, #eef3ff 0%, #f7fcff 100%);
    border: 1px solid #e6ecff;
    border-radius: 14px;
    padding: 14px 16px;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #ffffff;
    display: grid;
    place-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .06);
    font-size: 1.25rem;
}

.stat-label {
    font-size: .82rem;
    color: #6b7280;
    margin-bottom: 2px;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: .2px;
}

/* ===== Thumbnails (uploader & gallery) ===== */
.thumb-img {
    width: 100%;
    height: 130px;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.4);
    padding: 5px;
}

.thumb-frame {
    position: relative;
}

.thumb-remove,
.thumb-keep {
    position: absolute;
    top: 6px;
    right: 6px;
    padding: .15rem .4rem;
    font-size: .7rem;
    border-radius: 8px;
}

/* ===== Print ===== */
.a4 {
    width: 210mm;
    min-height: 297mm;
    padding: 16mm;
    background: #fff;
    margin: 0 auto;
}

.print-header {
    display: flex;
    justify-content: space-between;
}

.print-kv {
    margin: 0 0 8px;
}

.table-print-dark,
.table-print-dark th,
.table-print-dark td {
    border-color: #000 !important;
}


/* minor */
.input-group>.btn {
    min-width: 46px;
}

/* nicer section chips */
.section-subtitle.pill {
    background: linear-gradient(180deg, #f8fbff 0%, #eef3ff 100%);
    border: 1px solid #e6ecff;
    border-radius: 999px;
    text-align: center;
}

/* date areas feel clickable */
.date-wrap {
    cursor: pointer;
    position: relative;
}

/* hide calendar glyph on date fields */
.date-wrap::after {
    content: none !important;
}

/* keep the rest from earlier file … (stats, print, thumbnails, etc.) */

/* View-only page state (Form/Search/List सबै .form-section भित्र छन्) */
.view-only .form-section {
    display: none !important;
}

/* #printView (A4 view) मात्र देखियोस् */
.view-only #printView {
    display: block !important;
}

/* Sticky header when table scrolls */
#listTable thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}

/* Scrollable table area when many rows */
#tableWrap.scroll-limit {
    max-height: 520px;
    overflow-y: auto;
}

/* Flash highlight for newly added/updated row */
@keyframes rowFlash {
    0% {
        background: #fff8cc;
    }

    100% {
        background: transparent;
    }
}

tr.row-flash {
    animation: rowFlash 2s ease-out 1;
}

/* in-field overlay hint (shows inside the input box) */
.infield-wrap {
    position: relative;
}

.infield-wrap .infield-hint {
    position: absolute;
    right: .75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    color: #6c757d;
    /* muted */
    pointer-events: none;
    /* click goes to input */
    white-space: nowrap;
    max-width: 65%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* a bit more right padding so text and hint don't overlap on long strings */
.infield-wrap .form-control {
    padding-right: 10rem;
    /* tweak if your Nepali text is longer/shorter */
}

/* ----------------------------------- */

/* ======= ONE-PAGE A4 PRINT WITH MARGINS + IN-PAGE FOOTER ======= */
@media print {

    /* A4 + margins */
    :root {
        --page-m: 12mm;
        /* side/top/bottom page margin */
        --footer-h: 20mm;
        /* footer image को अधिकतम उचाइ */
        --inner-h: calc(297mm - (var(--page-m) * 2));
        /* A4 height minus margins */
    }

    @page {
        size: A4;
        margin: var(--page-m);
    }

    /* Only print sheet */
    .no-print {
        display: none !important;
    }

    /* Main print container must live inside one A4 page */
    #printView {
        display: block !important;
        position: relative;
        box-sizing: border-box;
        width: auto;
        min-height: var(--inner-h);
        /* content लाई footer नछोपियोस् भनेर तल padding राखियो */
        padding: 6mm 0 calc(var(--footer-h) + 3mm) 0;
        overflow: visible !important;
        background: #fff !important;

        /* Space compact (one-page fit help) */
        line-height: 1.25;
    }

    /* Tables / spacing compact */
    .table {
        margin-bottom: 6mm;
    }

    .table th,
    .table td {
        padding: 4px 6px !important;
    }

    /* .print-header { margin: 0 0 6mm 0 !important; } */
    .printarea-header-part,
    .printarea-footer-part {
        page-break-inside: avoid;
        break-inside: avoid;
    }

    /* Keep large blocks unbroken if possible (prevents page 2) */
    #printView,
    #printView .print-header,
    #printView table,
    #printView .table,
    #printView .table tbody,
    #printView .table tr {
        page-break-inside: avoid;
        break-inside: avoid;
    }

    /* === Footer INSIDE the page ===
     absolute (not fixed) so Chrome/Safari preview मा पनि reliably देखियोस् */
    .printarea-footer-part {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        /* page content box भित्रको तल */
        margin: 0;
        z-index: 5;
    }

    .printarea-footer-image img,
    .print-footer-img {
        display: block;
        width: 100%;
        height: auto;
        max-height: var(--footer-h);
        object-fit: contain;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Optional: light borders darker for print clarity */
    .table.table-print-dark th,
    .table.table-print-dark td {
        border-color: #000 !important;
    }
}


/* ==== PRINT: show only #printView, hide the rest; footer sticks to bottom ==== */
@media print {
    @page {
        size: A4;
        margin: 12mm;
    }

    /* page margin चाहिएको जति राख्नुस् */

    /* पेजमा #printView बाहेक अरु सबै सेक्शन लुकाउने */
    nav,
    .navbar,
    .search-section,
    .modal {
        display: none !important;
    }

    .form-area> :not(#printView) {
        display: none !important;
    }

    /* #printView देखाउने र कॉलम लेआउट: footer लाई तल धकेल्न */
    #printView {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
        background: #fff !important;
        /* grey हटाउन */
        color: #000 !important;
    }

    /* header दुई-तिर मिलाएर */
    #printView .print-header {
        display: flex !important;
        justify-content: space-between !important;
        align-items: flex-start !important;
        gap: 12px !important;
    }

    #printView .print-header>div {
        flex: 1 1 50% !important;
    }

    #printView .print-header .text-end {
        text-align: right !important;
    }

    /* फोटो/बटन/लाइटबक्स/क्यारोसेल जस्ता UI लुकाउने */
    #printView .no-print,
    #photoGallery,
    #photoModal,
    .btn,
    .carousel {
        display: none !important;
    }

    /* टेबल border गाढा */
    #printView .table,
    #printView .table th,
    #printView .table td {
        border-color: #000 !important;
    }

    /* letterhead footer पेजको तल बसाउने */
    #printView .printarea-footer-part {
        margin-top: auto !important;
        /* मुख्य जादू: तल धकेल्ने */
    }

    #printView .printarea-footer-part img {
        display: block !important;
        width: 100% !important;
        height: auto !important;
    }

    /* प्रिन्ट preview मा अनावश्यक break नपरोस् */
    #printView,
    #printView * {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}
