/* ==========================================================================
   IIITIHAS UNIVERSAL - Official ISO 9001:2015 Certificate Template
   Professional, Balanced, Single-Page A4 Landscape Standard (297mm x 210mm)
   ========================================================================== */

/* Outer preview container */
.cert-document-wrapper {
    background: #0f0a1c;
    padding: 24px 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 16px;
    margin: 10px 0;
    overflow-x: auto;
}

/* Professional A4 Landscape Certificate Canvas */
.printable-certificate {
    width: 960px;
    min-height: 650px;
    aspect-ratio: 297 / 210;
    max-width: 100%;
    background: #ffffff;
    border-radius: 4px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    position: relative;
    box-sizing: border-box;
    padding: 30px 42px 24px 42px;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1e1b4b;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Elegant Outer Frame & Gold Accent Line */
.printable-certificate::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    border: 3px solid #1e1242;
    pointer-events: none;
}

.printable-certificate::after {
    content: '';
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    bottom: 16px;
    border: 1.8px solid #d4af37;
    pointer-events: none;
}

/* Corner Security Brackets */
.cert-corner-tl, .cert-corner-tr, .cert-corner-bl, .cert-corner-br {
    position: absolute;
    width: 28px;
    height: 28px;
    z-index: 2;
    pointer-events: none;
}
.cert-corner-tl { top: 8px; left: 8px; border-top: 4.5px solid #5b03e4; border-left: 4.5px solid #5b03e4; }
.cert-corner-tr { top: 8px; right: 8px; border-top: 4.5px solid #5b03e4; border-right: 4.5px solid #5b03e4; }
.cert-corner-bl { bottom: 8px; left: 8px; border-bottom: 4.5px solid #5b03e4; border-left: 4.5px solid #5b03e4; }
.cert-corner-br { bottom: 8px; right: 8px; border-bottom: 4.5px solid #5b03e4; border-right: 4.5px solid #5b03e4; }

/* Company Logo Watermark in Background */
.cert-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    height: auto;
    opacity: 0.055;
    pointer-events: none;
    z-index: 1;
    user-select: none;
    -webkit-user-select: none;
}

/* Inner Content Layer - FULL HEIGHT VERTICALLY BALANCED */
.cert-inner-content {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    flex: 1;
    box-sizing: border-box;
}

/* Top Header */
.cert-top-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid #5b03e4;
    padding-bottom: 12px;
    margin-bottom: 6px;
}

.cert-brand-block {
    display: flex;
    align-items: center;
    gap: 14px;
}

.cert-main-logo {
    height: 52px;
    width: auto;
    filter: drop-shadow(0 2px 6px rgba(91, 3, 228, 0.2));
}

.cert-company-title {
    font-size: 20px;
    font-weight: 900;
    color: #1e1242;
    letter-spacing: 0.5px;
    margin: 0;
    line-height: 1.1;
    font-family: 'Outfit', sans-serif;
}

.cert-company-sub {
    font-size: 10.5px;
    font-weight: 700;
    color: #5b03e4;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    margin-top: 3px;
}

.cert-company-legal {
    font-size: 9px;
    color: #64748b;
    margin-top: 2px;
    font-weight: 500;
}

/* ISO 9001:2015 Gold Badge */
.cert-iso-badge {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1.5px solid #f59e0b;
    border-radius: 10px;
    padding: 6px 14px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.12);
}

.cert-iso-title {
    font-size: 11px;
    font-weight: 900;
    color: #b45309;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.cert-iso-sub {
    font-size: 8.5px;
    font-weight: 800;
    color: #92400e;
    margin-top: 2px;
}

/* Title Section */
.cert-title-section {
    text-align: center;
    margin: 6px 0;
}

.cert-main-heading {
    font-size: 24px;
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #1e1242;
    margin: 0;
    font-family: 'Outfit', Georgia, serif;
    background: linear-gradient(135deg, #1e1242 0%, #5b03e4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.cert-sub-conferred {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: #94a3b8;
    margin-top: 4px;
}

/* Candidate Name */
.cert-recipient-name {
    font-size: 30px;
    font-weight: 900;
    color: #5b03e4;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 6px 0 2px 0;
    font-family: 'Outfit', serif;
    position: relative;
    display: inline-block;
    padding-bottom: 4px;
}

.cert-recipient-name::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10%;
    right: 10%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #d4af37, #5b03e4, #d4af37, transparent);
}

.cert-recipient-org {
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    margin-top: 3px;
}

/* Body Narrative */
.cert-narrative {
    font-size: 12.5px;
    line-height: 1.65;
    color: #334155;
    text-align: center;
    max-width: 820px;
    margin: 6px auto;
}

.cert-narrative strong {
    color: #0f172a;
    font-weight: 800;
}

/* Metadata Strip */
.cert-meta-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    background: #f8fafc;
    border: 1.5px solid #cbd5e1;
    border-radius: 10px;
    padding: 8px 14px;
    margin: 6px 0;
    text-align: center;
}

.cert-grid-item {
    border-right: 1px solid #cbd5e1;
    padding: 0 6px;
}

.cert-grid-item:last-child {
    border-right: none;
}

.cert-grid-label {
    font-size: 8.5px;
    font-weight: 800;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cert-grid-value {
    font-size: 12px;
    font-weight: 800;
    color: #1e1242;
    margin-top: 2px;
}

/* 2 Signatures & Seal Section */
.cert-footer-section {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding-top: 6px;
    margin-top: 4px;
}

.cert-sign-col {
    text-align: center;
    width: 220px;
}

.cert-sign-box {
    min-height: 44px;
    height: 44px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    margin-bottom: 3px;
}

.cert-sign-svg {
    height: 38px;
    width: auto;
    display: block;
}

.cert-sign-empty-placeholder {
    height: 36px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9.5px;
    color: #cbd5e1;
    font-style: italic;
    letter-spacing: 0.5px;
}

.cert-sign-line {
    width: 100%;
    height: 1.5px;
    background: #64748b;
    margin-bottom: 4px;
}

.cert-sign-name {
    font-size: 12px;
    font-weight: 900;
    color: #0f172a;
    line-height: 1.2;
}

.cert-sign-title {
    font-size: 9.5px;
    font-weight: 700;
    color: #5b03e4;
    line-height: 1.2;
    margin-top: 2px;
}

.cert-sign-org {
    font-size: 8px;
    font-weight: 600;
    color: #64748b;
    margin-top: 1px;
}

/* Neat QR Verification Card */
.cert-seal-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.cert-qr-card {
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 10px;
    padding: 6px 12px 6px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(91, 3, 228, 0.08);
    transition: all 0.2s ease;
    cursor: pointer;
}

.cert-qr-card:hover {
    border-color: #5b03e4;
    box-shadow: 0 6px 16px rgba(91, 3, 228, 0.16);
    transform: translateY(-1px);
}

.cert-qr-img {
    width: 74px;
    height: 74px;
    display: block;
    border-radius: 4px;
    background: #ffffff;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.cert-qr-label {
    font-size: 9px;
    font-weight: 800;
    color: #1e1242;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.cert-qr-label i {
    color: #5b03e4;
    font-size: 9.5px;
}

.cert-qr-date {
    font-size: 8px;
    font-weight: 700;
    color: #64748b;
    margin-top: 1px;
}

/* Security Verification Footer Strip */
.cert-security-strip {
    font-size: 8px;
    color: #64748b;
    text-align: center;
    margin-top: 6px;
    letter-spacing: 0.2px;
    border-top: 1px dashed #cbd5e1;
    padding-top: 4px;
}


/* ==========================================================================
   ADVANCED SHARING & ACTION TOOLBAR (For Verification Portal)
   ========================================================================== */
.cert-advanced-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 18px;
    margin-top: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.cert-toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-cert-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #1e293b;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-cert-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.btn-cert-action.print { background: #5b03e4 !important; color: #ffffff !important; border-color: #5b03e4 !important; }
.btn-cert-action.linkedin { background: #0a66c2 !important; color: #ffffff !important; border-color: #0a66c2 !important; }
.btn-cert-action.whatsapp { background: #25d366 !important; color: #ffffff !important; border-color: #25d366 !important; }
.btn-cert-action.twitter { background: #0f1419 !important; color: #ffffff !important; border-color: #0f1419 !important; }
.btn-cert-action.copy { background: #f1f5f9 !important; color: #334155 !important; }
.btn-cert-action.embed { background: #f1f5f9 !important; color: #334155 !important; }

/* ==========================================================================
   PRINT STYLESHEET (EXACT SINGLE-PAGE A4 LANDSCAPE - 297mm x 210mm)
   ========================================================================== */
@page {
    size: A4 landscape;
    margin: 0;
}

@media print {
    html, body {
        width: 297mm !important;
        height: 210mm !important;
        max-height: 210mm !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #ffffff !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        overflow: hidden !important;
    }

    body * {
        visibility: hidden !important;
    }

    .printable-certificate,
    .printable-certificate *,
    .printable-offer-letter,
    .printable-offer-letter *,
    #offerLetterCanvas,
    #offerLetterCanvas * {
        visibility: visible !important;
    }

    .cert-document-wrapper {
        background: transparent !important;
        padding: 0 !important;
        margin: 0 !important;
        border-radius: 0 !important;
        display: block !important;
    }

    .printable-certificate {
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        width: 297mm !important;
        height: 210mm !important;
        max-width: 297mm !important;
        max-height: 210mm !important;
        min-height: 210mm !important;
        margin: 0 !important;
        padding: 10mm 16mm 8mm 16mm !important;
        box-sizing: border-box !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        page-break-after: avoid !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        z-index: 9999999 !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
    }

    .printable-certificate .cert-inner-content {
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
        height: 100% !important;
        flex: 1 !important;
    }

    .printable-certificate::before {
        top: 6mm !important;
        left: 6mm !important;
        right: 6mm !important;
        bottom: 6mm !important;
        border: 3.5px solid #1e1242 !important;
    }

    .printable-certificate::after {
        top: 8.5mm !important;
        left: 8.5mm !important;
        right: 8.5mm !important;
        bottom: 8.5mm !important;
        border: 2px solid #d4af37 !important;
    }

    .printable-certificate .cert-corner-tl { top: 5mm !important; left: 5mm !important; }
    .printable-certificate .cert-corner-tr { top: 5mm !important; right: 5mm !important; }
    .printable-certificate .cert-corner-bl { bottom: 5mm !important; left: 5mm !important; }
    .printable-certificate .cert-corner-br { bottom: 5mm !important; right: 5mm !important; }

    header, footer, .pre-header, .page-heading, .floating-quick-widget, .search-pill-box, .btn, button, #toast, .modal-close, .sidebar, .sidebar-overlay, .login-screen, .app-layout > *:not(#certPreviewModal), #certPreviewModal .modal-header, #certPreviewModal .modal-actions {
        display: none !important;
    }
}
