@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=Poppins:wght@300;400;500;600&family=Great+Vibes&display=swap');

body {
    margin: 0;
    padding: 0;
    background-color: #f0f2f5;
    font-family: 'Poppins', sans-serif;
}

.screen-only {
    text-align: center;
    padding: 20px;
    background: #333;
    color: white;
    margin-bottom: 20px;
}

.controls {
    margin: 20px auto;
    text-align: center;
}

.btn {
    padding: 10px 20px;
    background: #ff6f00;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    margin: 0 10px;
}

.btn:hover {
    background: #e65100;
}

.cert-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    /* Space between certificates */
    padding-bottom: 50px;
}

.cert-container {
    width: 297mm;
    height: 210mm;
    position: relative;
    background: white;
    border: 20px solid #1a237e;
    box-sizing: border-box;
    overflow: hidden;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
}

.cert-inner {
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    bottom: 15px;
    border: 5px solid #ff6f00;
    pointer-events: none;
}

/* Fix for capture size */
.cert-content {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.corner-ornament {
    position: absolute;
    width: 80px;
    height: 80px;
    z-index: 2;
}

.corner-ornament.top-left {
    top: 40px;
    left: 40px;
    border-top: 5px solid #1a237e;
    border-left: 5px solid #1a237e;
}

.corner-ornament.top-right {
    top: 40px;
    right: 40px;
    border-top: 5px solid #1a237e;
    border-right: 5px solid #1a237e;
}

.corner-ornament.bottom-right {
    bottom: 40px;
    right: 40px;
    border-bottom: 5px solid #1a237e;
    border-right: 5px solid #1a237e;
}

.corner-ornament.bottom-left {
    bottom: 40px;
    left: 40px;
    border-bottom: 5px solid #1a237e;
    border-left: 5px solid #1a237e;
}

/* Ornaments */
.corner-ornament {
    position: absolute;
    width: 80px;
    height: 80px;
    z-index: 2;
}

.corner-ornament.top-left {
    top: 40px;
    left: 40px;
    border-top: 5px solid #1a237e;
    border-left: 5px solid #1a237e;
}

.corner-ornament.top-right {
    top: 40px;
    right: 40px;
    border-top: 5px solid #1a237e;
    border-right: 5px solid #1a237e;
}

.corner-ornament.bottom-right {
    bottom: 40px;
    right: 40px;
    border-bottom: 5px solid #1a237e;
    border-right: 5px solid #1a237e;
}

.corner-ornament.bottom-left {
    bottom: 40px;
    left: 40px;
    border-bottom: 5px solid #1a237e;
    border-left: 5px solid #1a237e;
}

/* Header Redesign */
.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 50px 80px 0;
    /* Adjust padding to fit inside border/ornaments */
    width: 100%;
    box-sizing: border-box;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
}

.logo-box {
    width: 120px;
    text-align: center;
}

.logo-img {
    height: 100px;
    /* Slightly larger logos */
    width: auto;
    object-fit: contain;
}

.header-center {
    text-align: center;
    flex-grow: 1;
    padding: 0 20px;
}

/* Header Section */
.header-logos {
    display: flex;
    justify-content: space-between;
    padding: 60px 50px 0;
}

.logo-img {
    height: 90px;
    object-fit: contain;
}

.header-text {
    text-align: center;
    position: absolute;
    top: 60px;
    width: 100%;
    box-sizing: border-box;
    padding: 0 140px;
}

.conf-title {
    font-family: 'Playfair Display', serif;
    font-size: 24px;
    font-weight: 800;
    color: #1a237e;
    margin-bottom: 8px;
    line-height: 1.1;
    text-transform: none;
}

.org-label,
.collab-label {
    font-size: 11px;
    color: #666;
    letter-spacing: 1px;
    margin-top: 5px;
}

.org-name {
    font-size: 22px;
    font-weight: 800;
    color: #d32f2f;
    font-family: 'Playfair Display', serif;
    margin-bottom: 2px;
    text-transform: none;
}

.collab-name {
    font-size: 22px;
    font-weight: 800;
    color: #d32f2f;
    font-family: 'Playfair Display', serif;
    margin-bottom: 10px;
    text-transform: none;
}

.conf-date {
    font-size: 16px;
    color: #1a237e;
    font-weight: 700;
    font-family: 'Playfair Display', serif;
    margin-top: 5px;
}

/* Main Content */
.main-title {
    position: absolute;
    top: 240px;
    width: 100%;
    text-align: center;
    font-family: 'Great Vibes', cursive;
    font-size: 50px;
    color: #d32f2f;
}

.intro {
    position: absolute;
    top: 310px;
    width: 100%;
    text-align: center;
    font-style: italic;
    color: #555;
    font-size: 18px;
}

.name-area {
    position: absolute;
    top: 360px;
    width: 100%;
    text-align: center;
}

.name {
    display: inline-block;
    font-family: 'Playfair Display', serif;
    font-size: 38px;
    font-weight: 700;
    color: #1a237e;
    border-bottom: 2px solid #1a237e;
    padding: 0 40px 5px;
    min-width: 300px;
    text-transform: none;
}

.body-text {
    position: absolute;
    top: 440px;
    width: 80%;
    left: 10%;
    text-align: center;
    font-size: 18px;
    line-height: 1.6;
    color: #333;
    font-family: 'Playfair Display', serif;
}

/* Signatures */
.signatures {
    position: absolute;
    bottom: 60px;
    width: 100%;
    display: flex;
    justify-content: space-around;
}

.sig-box {
    text-align: center;
    width: 250px;
}

.sig-img {
    height: 50px;
    width: auto;
    display: block;
    margin: 0 auto;
    margin-bottom: -15px;
    /* Overlap with line slightly or sit on it */
}

.sig-line {
    border-top: 1px solid #333;
    margin-top: 10px;
    padding-top: 5px;
    font-size: 12px;
    font-weight: 600;
}

.sig-role {
    font-size: 11px;
    color: #666;
}

.watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    opacity: 0.1;
    z-index: 0;
    pointer-events: none;
    filter: grayscale(100%);
}

@media print {
    body {
        background: white;
    }

    .screen-only,
    .controls {
        display: none;
    }

    .cert-wrapper {
        gap: 0;
        display: block;
    }

    .cert-container {
        page-break-after: always;
        margin: 0;
        box-shadow: none;
        border: 20px solid #1a237e !important;
    }

    .cert-container:last-child {
        page-break-after: auto;
    }
}