:root {
    --gold-primary: #c5a059;
    --gold-secondary: #8e6d2f;
    --gold-light: #e2c08d;
    --dark-deep: #1a1a1a;
    --text-main: #2c3e50;
    --border-width: 30px;
}

body {
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #e0e0e0;
    font-family: 'EB Garamond', serif;
    color: var(--text-main);
}

#certificate-container {
    padding: 1px;
    /* Shadow clipping fix */
}

.certificate {
    width: 1123px;
    /* A4 Landscape at 96 DPI */
    height: 794px;
    background-size: cover;
    background-position: center;
    position: relative;
    background-color: #fffdf9;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Ornate Border Overlay */
.certificate-border {
    position: absolute;
    top: 25px;
    left: 25px;
    right: 25px;
    bottom: 25px;
    border: 2px solid var(--gold-primary);
    pointer-events: none;
    z-index: 1;
}

.certificate-border::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 1px solid var(--gold-secondary);
}

/* Corner Ornaments */
.corner {
    position: absolute;
    width: 80px;
    height: 80px;
    border: 4px solid var(--gold-primary);
    z-index: 2;
}

.corner-tl {
    top: 15px;
    left: 15px;
    border-right: none;
    border-bottom: none;
}

.corner-tr {
    top: 15px;
    right: 15px;
    border-left: none;
    border-bottom: none;
}

.corner-bl {
    bottom: 15px;
    left: 15px;
    border-right: none;
    border-top: none;
}

.corner-br {
    bottom: 15px;
    right: 15px;
    border-left: none;
    border-top: none;
}

.content {
    position: relative;
    z-index: 5;
    width: 85%;
    height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding-bottom: 130px;
    /* footer uchun joy */
    box-sizing: border-box;
}

.institution {
    font-family: 'Cinzel', serif;
    font-size: 16px;
    letter-spacing: 4px;
    font-weight: 700;
    color: var(--dark-deep);
    margin-bottom: 18px;
    line-height: 1.4;
    text-transform: uppercase;
}

.journal-info {
    font-family: 'Playfair Display', serif;
    font-size: 26px;
    color: var(--gold-secondary);
    margin-bottom: 18px;
    font-style: italic;
}

.cert-title-wrapper {
    margin: 8px 0 6px 0;
    position: relative;
}

.main-title {
    font-family: 'Cinzel', serif;
    font-size: 72px;
    font-weight: 900;
    letter-spacing: 15px;
    color: var(--dark-deep);
    margin: 0;
}

.award-final {
    font-family: 'EB Garamond', serif;
    font-size: 20px;
    font-style: italic;
    letter-spacing: 2px;
    color: #444;
    margin-top: 4px;
}

.recipient-name {
    font-family: 'Bodoni Moda', serif;
    font-size: 35px;
    font-weight: 700;
    color: #000;
    border-bottom: 2px solid var(--gold-light);
    padding-bottom: 5px;
    margin-bottom: 14px;
    min-width: 400px;
}

.article-container {
    width: 85%;
    margin-bottom: 10px;
}

.article-text {
    font-size: 20px;
    line-height: 1.6;
    color: #444;
}

.article-name {
    font-family: 'EB Garamond', serif;
    font-weight: 700;
    font-size: 22px;
    display: block;
    margin: 10px 0;
    color: var(--dark-deep);
    font-style: italic;
}

/* Footer dizaynini yangilash */
.footer {
    position: absolute;
    bottom: 20px; /* Pastdan masofa */
    left: 0;
    right: 0;
    padding: 0 50px;
    display: flex;             /* Grid o'rniga Flex */
    justify-content: space-around; /* Elementlar orasida teng masofa */
    align-items: center;       /* Vertikal markazga tekislash (O'rtaga) */
    box-sizing: border-box;
    z-index: 6;
}

/* Har bir blokni ichidan ham markazga tekislash */
.signature-box, .qr-code-box, .seal-box {
    display: flex;
    flex-direction: column;
    align-items: center;       /* Gorizontal markazga (Markazga) */
    justify-content: center;   /* Vertikal markazga */
    flex: 1;                   /* Har biri teng joy egallaydi */
}

.signature-name {
    font-family: 'Playfair Display', serif;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 5px;
}

.signature-line {
    width: 180px;
    height: 1.5px;
    background: #000;
    margin: 8px auto;
}

.signature-title {
    font-size: 16px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.qr-code-box {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* QR kod va Medal o'lchamlarini biroz muvozanatlash */
.qr-wrapper {
    width: 90px;
    height: 90px;
    padding: 5px;
    background: white;
    border: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: center;
}

.seal-box {
    display: flex;
    justify-content: center;
    align-items: center;
}

.seal-img {
    width: 120px;
    height: auto;
    object-fit: contain;
}

.cert-number {
    position: absolute;
    bottom: 35px;
    left: 45px;
    font-size: 12px;
    font-family: monospace;
    color: #999;
}

/* Controls */
.controls {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 1000;
}

.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 50px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-decoration: none;
    font-family: 'Inter', sans-serif;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.btn-print {
    background-color: #34495e;
}

.btn-pdf {
    background-color: #c0392b;
}

@media print {
    @page {
        size: A4 landscape;
        margin: 0;
    }

    body {
        background: none;
        margin: 0;
        padding: 0;
        display: block;
    }

    #certificate-container {
        margin: 0;
        padding: 0;
        width: 297mm;
        height: 210mm;
    }

    .certificate {
        box-shadow: none;
        transform: none !important;
        width: 297mm !important;
        height: 210mm !important;
    }

    .no-print {
        display: none !important;
    }

    .controls {
        display: none !important;
    }
}

/* Scaling for regular screens */
@media (max-width: 1200px) {
    .certificate {
        transform: scale(0.8);
        transform-origin: center center;
    }
}

@media (max-width: 900px) {
    .certificate {
        transform: scale(0.6);
    }
}

/* Partner Logos Styles */
.left-logos-container, .right-logos-container {
    position: absolute;
    top: 140px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 10;
    width: 120px;
    align-items: center;
}

.left-logos-container {
    left: 40px;
}

.right-logos-container {
    right: 35px;
}

.top-logos-container, .bottom-logos-container {
    position: absolute;
    display: flex;
    flex-direction: row;
    gap: 15px;
    z-index: 10;
    width: fit-content;
    align-items: center;
}

.bottom-logos-container {
    left: 50%;
    transform: translateX(-50%);
    bottom: 40px;
}

.top-logos-container {
    left: 40px;
    top: 40px;
}

.partner-logo-item {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

/* Side logos sizing */
.left-logos-container .partner-logo-item img,
.right-logos-container .partner-logo-item img {
    max-width: 110px;
    max-height: 80px;
    object-fit: contain;
}

/* Top/Bottom logos sizing (wider possible) */
.top-logos-container .partner-logo-item img,
.bottom-logos-container .partner-logo-item img {
    max-width: 150px;
    max-height: 90px;
    object-fit: contain;
}
