/* ========================================================
   FORMAL CERTIFICATE PRINT TEMPLATE - CLEAN DESIGN
   ======================================================== */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,700&family=Tinos:ital,wght@0,400;0,700;1,400&display=swap');

.certificate-paper {
    background-color: #ffffff;
    width: 100%;
    max-width: 800px;
    min-height: 1050px;
    /* Approx 8.5x11 ratio */
    margin: 0 auto;
    padding: 60px 80px;
    /* REMOVED: No black borders around the paper */
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    color: #000000;
    font-family: 'Tinos', 'Times New Roman', serif;
    position: relative;
    line-height: 1.6;
    box-sizing: border-box;
}

/* ── HEADER STYLES ── */
.cert-header-wrapper {
    margin-bottom: 30px;
}

.cert-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: center;
}

.cert-logo-container {
    width: 100px;
    height: 100px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.cert-logo-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Invisible spacer to perfectly center the text */
.cert-logo-spacer {
    width: 100px;
}

.cert-header-text {
    flex: 1;
    line-height: 1.3;
}

.cert-header-sm {
    display: block;
    font-size: 1.1rem;
}

.cert-barangay-name {
    display: block;
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    font-weight: 500;
    font-style: italic;
    color: #1a365d;
    /* Elegant dark blue color */
    margin: 8px 0 0 0;
}

.cert-divider {
    border: 0;
    border-top: 1.5px solid #000000;
    margin: 15px 0;
}

.cert-office-title {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 700;
    font-family: 'Tinos', 'Times New Roman', serif;
    letter-spacing: 1px;
}

/* ── BODY STYLES ── */
.cert-title {
    text-align: center;
    font-family: 'Tinos', 'Times New Roman', serif;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin: 30px 0;
}

.cert-greeting {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 20px;
    text-transform: uppercase;
}

.cert-body {
    font-size: 1.15rem;
    text-align: justify;
    /* Increased line-height slightly to accommodate the fill lines */
    line-height: 2.2;
    margin-bottom: 40px;
}

.cert-body p {
    text-indent: 50px;
    margin-bottom: 15px;
}

.cert-body strong {
    font-size: 1.15rem;
}

/* Blank lines for filling in text (like "______") */
.cert-fill-blank {
    display: inline-block;
    border-bottom: 1px solid #000;
    padding: 0 10px;
    text-align: center;
    line-height: 1.2;
}

/* ── FOOTER STYLES ── */
.cert-footer-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 60px;
    font-size: 1.1rem;
}

.cert-footer-left {
    text-align: left;
    line-height: 2;
}

/* Underline fields for OR No, Date, Doc Stamp */
.footer-line-fill {
    display: inline-block;
    border-bottom: 1px solid #000;
    width: 160px;
    margin-left: 10px;
    text-align: center;
}

.cert-footer-right {
    text-align: center;
    width: 300px;
    margin-bottom: 10px;
}

.cert-signatory-name {
    font-weight: 700;
    font-size: 1.2rem;
    text-transform: uppercase;
    margin: 0 0 5px 0;
}

.cert-signatory-title {
    font-size: 1.1rem;
}


/* ========================================================
   🚨 PRINT OVERRIDES (THE REAL FIX) 🚨
   ======================================================== */
/* ========================================================
   🚨 PRINT OVERRIDES (THE REAL FIX FOR 1-PAGE A4) 🚨
   ======================================================== */
/* ========================================================
   🚨 PRINT OVERRIDES
   ======================================================== */
@media print {

    /* HIDE THE UI JUNK */
    .dashboard-wrapper,
    .modal-header,
    .no-print,
    .toast,
    .workspace-action-bar,
    .edit-form-panel {
        display: none !important;
    }

    /* BREAK MODALS OUT OF THEIR CAGE */
    .modal-fullscreen,
    .modal-content,
    .modal-body,
    #processWorkspaceModal,
    #wsDynamicDetailsGrid {
        position: static !important;
        display: block !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        background: white !important;
        border: none !important;
    }

    /* ── ID CARD PRINT: side-by-side at the TOP of the page ── */
    .id-card-print-wrapper {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 0 !important;
        justify-content: flex-start !important;
        align-items: flex-start !important;
        padding: 30px 0 0 30px !important;
        margin: 0 !important;
        background: white !important;
        box-shadow: none !important;
        width: auto !important;
        min-height: unset !important;
        page-break-inside: avoid;
    }

    /* Override generic certificate-paper rules for the ID card variant */
    .certificate-paper.id-card-print-wrapper {
        padding: 0 !important;
        min-height: unset !important;
        max-width: unset !important;
        box-shadow: none !important;
        background: white !important;
    }

    /* The page itself: force default margins so no manual selection needed */
    @page {
        margin: 15mm;
    }
}