/* ============ CERTIFICATE COMPONENT STYLES ============ */
@import url('https://fonts.googleapis.com/css2?family=Great+Vibes&family=Pinyon+Script&family=Cinzel:wght@400;700;900&family=Lato:wght@300;400;700&display=swap');

.certificate-section h2 {
    color: var(--dark);
    margin-bottom: 30px;
    font-size: 2em;
}

/* ============ PREMIUM CERTIFICATE TEMPLATE ============ */
.certificate-template {
    position: relative;
    /* Cream paper background */
    background: #fdf9f0;
    width: 100%;
    max-width: 960px;
    margin: 20px auto;
    aspect-ratio: 1.414 / 1;
    /* Navy outer frame + gold lines via box-shadow */
    border: 6px solid #0d1b3e;
    box-shadow:
        0 0 0 9px  #c8a951,
        0 0 0 12px #0d1b3e,
        0 25px 70px rgba(0,0,0,0.3);
    overflow: hidden;
    animation: fadeIn 0.6s ease;
    font-family: 'Lato', sans-serif;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
}

/* Cream paper texture overlay */
.cert-paper-texture {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(200,169,81,0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 50%, rgba(13,27,62,0.04) 0%, transparent 60%);
    z-index: 0;
    pointer-events: none;
}

/* Inner gold decorative border */
.cert-border-inner {
    position: absolute;
    inset: 16px;
    border: 1px solid #c8a951;
    z-index: 1;
    pointer-events: none;
}
.cert-border-inner::before {
    content: '';
    position: absolute;
    inset: 4px;
    border: 0.5px solid rgba(200,169,81,0.4);
    pointer-events: none;
}

/* Corner ornament SVG containers */
.cert-corner {
    position: absolute;
    width: 60px;
    height: 60px;
    z-index: 4;
    pointer-events: none;
}
.cert-corner-tl { top: 18px;  left: 18px;  }
.cert-corner-tr { top: 18px;  right: 18px; transform: scaleX(-1); }
.cert-corner-bl { bottom: 18px; left: 18px;  transform: scaleY(-1); }
.cert-corner-br { bottom: 18px; right: 18px; transform: scale(-1,-1); }

/* Watermark */
.cert-watermark {
    position: absolute;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    font-size: 16em;
    opacity: 0.04;
    color: #0d1b3e;
    z-index: 0;
    pointer-events: none;
    user-select: none;
    line-height: 1;
}

/* ============ MAIN BODY — CENTERED LAYOUT ============ */
.cert-body {
    position: relative;
    z-index: 2;
    padding: 3.5% 6% 3% 6%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-sizing: border-box;
    text-align: center;
}

/* ============ HEADER ============ */
.cert-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.cert-header-logo-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 2px;
}

.cert-header-logo-row img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #c8a951;
}

.cert-uni-name {
    font-family: 'Cinzel', serif;
    font-size: 1em;
    font-weight: 900;
    color: #0d1b3e;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.cert-uni-tagline {
    font-size: 0.6em;
    color: #888;
    letter-spacing: 4px;
    text-transform: uppercase;
    font-weight: 300;
    margin-top: 1px;
}

.cert-header-rule {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 5px;
    width: 100%;
}
.cert-header-rule-line {
    flex: 1;
    height: 1.5px;
    background: linear-gradient(90deg, transparent, #c8a951 30%, #c8a951 70%, transparent);
    max-width: 160px;
}
.cert-header-rule-diamond {
    color: #c8a951;
    font-size: 0.65em;
    letter-spacing: 8px;
}

/* ============ MAIN SECTION ============ */
.cert-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 4%;
    gap: 0;
}

.cert-title {
    font-family: 'Cinzel', serif;
    font-size: 2.8em;
    font-weight: 900;
    color: #0d1b3e;
    letter-spacing: 8px;
    line-height: 1;
    margin: 0;
    text-transform: uppercase;
}

.cert-subtitle-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 3px 0 6px;
    width: 100%;
}
.cert-subtitle-line {
    flex: 1;
    height: 1.5px;
    background: linear-gradient(90deg, transparent, #c8a951, transparent);
    max-width: 90px;
}
.cert-subtitle {
    font-family: 'Cinzel', serif;
    font-size: 0.82em;
    font-weight: 700;
    color: #c8a951;
    letter-spacing: 5px;
    text-transform: uppercase;
}

.cert-presented-to {
    font-size: 0.68em;
    letter-spacing: 3px;
    color: #777;
    text-transform: uppercase;
    font-weight: 400;
    margin: 3px 0 0;
}

.cert-name {
    font-family: 'Great Vibes', cursive;
    font-size: 3.6em;
    color: #0d1b3e;
    line-height: 1.1;
    margin: 2px 0;
    text-shadow: 1px 1px 0 rgba(13,27,62,0.1);
}

.cert-name-rule {
    width: 55%;
    height: 1px;
    background: linear-gradient(90deg, transparent, #c8a951 30%, #c8a951 70%, transparent);
    margin: 0 auto 4px;
}

.cert-completing {
    font-size: 0.72em;
    color: #666;
    letter-spacing: 1px;
    margin: 0 0 3px;
}

.cert-course-name {
    font-family: 'Cinzel', serif;
    font-size: 1.05em;
    font-weight: 700;
    color: #0d1b3e;
    letter-spacing: 1px;
    margin: 0 0 3px;
}

.cert-description {
    font-size: 0.65em;
    color: #888;
    line-height: 1.5;
    margin: 0;
    font-style: italic;
}

/* ============ FOOTER — 3 COLUMNS ============ */
.cert-footer {
    display: grid;
    grid-template-columns: 1fr 1.4fr 1fr;
    align-items: flex-end;
    gap: 10px;
    padding-top: 7px;
    border-top: 1px solid #d4b86a;
}

/* Left: date stamp circle */
.cert-stamp {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
}
.cert-stamp-circle {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    border: 2px solid #0d1b3e;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: transparent;
    position: relative;
}
.cert-stamp-circle::before {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    border: 1px dashed #0d1b3e;
}
.cert-stamp-issued {
    font-size: 0.42em;
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #0d1b3e;
    line-height: 1;
}
.cert-stamp-date {
    font-size: 0.45em;
    font-weight: 700;
    color: #0d1b3e;
    line-height: 1.3;
    margin-top: 1px;
}

/* Center: signature */
.cert-sig-block {
    text-align: center;
}

.cert-sig-script {
    /* 𝓓𝓮𝓮𝓹𝓘𝓣𝓦𝓸𝓻𝓵𝓭 — Unicode Mathematical Script renders as natural calligraphy */
    font-size: 2.1em;
    color: #0d1b3e;
    line-height: 1.1;
    display: block;
    font-weight: 400;
    text-shadow: 1px 1px 0 rgba(13,27,62,0.12), -0.5px 0 0 rgba(13,27,62,0.06);
    letter-spacing: 1px;
}

.cert-sig-line {
    width: 80%;
    height: 1.5px;
    background: #0d1b3e;
    margin: 4px auto 4px;
}

.cert-sig-label {
    font-size: 0.52em;
    font-weight: 700;
    color: #0d1b3e;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    display: block;
}
.cert-sig-sub {
    font-size: 0.48em;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
}

/* Right: badge + cert ID */
.cert-id-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}
.cert-badge-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #f0d080, #c8a951 52%, #8b6914);
    border: 2px solid #c8a951;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(200,169,81,0.45);
    text-align: center;
    font-size: 0.48em;
    font-weight: 900;
    color: #0d1b3e;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1.3;
    padding: 6px;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}
.cert-id-label {
    font-size: 0.6em;
    letter-spacing: 2px;
    color: #666;
    text-transform: uppercase;
    font-weight: 700;
}
.cert-id-value {
    font-size: 0.72em;
    font-weight: 900;
    color: #0d1b3e;
    font-family: monospace;
    word-break: break-all;
    background: rgba(200,169,81,0.12);
    border: 1px solid rgba(200,169,81,0.5);
    border-radius: 4px;
    padding: 2px 5px;
    letter-spacing: 0.5px;
}
.cert-grade-info {
    font-size: 0.58em;
    color: #555;
}

/* ============ PAYMENT METHOD SELECTION ============ */
.payment-methods {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin: 30px 0;
    max-width: 400px;
}
.payment-method-btn {
    background: white;
    border: 3px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-family: inherit;
}
.payment-method-btn:hover {
    border-color: var(--primary);
    background: #f0eeff;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(108,92,231,0.25);
}
.payment-method-btn.active {
    background: #e0e0ff;
    border-color: var(--primary);
    font-weight: bold;
}
.payment-icon { font-size: 2.5em; margin-bottom: 10px; }
.payment-name { font-weight: bold; color: #333; margin-bottom: 5px; font-size: 0.95em; }
.payment-desc { font-size: 0.75em; color: #666; }

/* ============ STRIPE ============ */
#stripe-card-element {
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    background: white;
    transition: border-color 0.2s ease;
    min-height: 50px;
}
#stripe-card-element:focus-within { border-color: #6c5ce7; box-shadow: 0 0 0 3px rgba(108,92,231,0.1); }
#stripe-error { color: #e17055; font-size: 0.9em; margin-top: 8px; min-height: 20px; }

/* ============ BANK DETAILS ============ */
.bank-details-box {
    background: #f8f9fa;
    border-left: 5px solid #2196F3;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}
.detail-row { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid #e0e0e0; align-items: center; }
.detail-row:last-child { border-bottom: none; }
.detail-label { font-weight: bold; color: #333; min-width: 150px; }
.detail-value { color: #2196F3; font-weight: bold; word-break: break-all; text-align: right; flex-grow: 1; margin-left: 20px; }

/* ============ ELIGIBILITY & MISC ============ */
.eligibility-box { animation: slideIn 0.3s ease; }
.eligibility-details { background: white; padding: 15px; border-radius: 8px; margin: 15px 0; text-align: left; }
.eligibility-details p { margin: 8px 0; color: #333; }

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2196F3;
    border-radius: 50%;
    width: 50px; height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin    { 0%   { transform: rotate(0deg); }   100% { transform: rotate(360deg); } }
@keyframes slideIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }

/* ============ PRINT ============ */
@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }
    body * { visibility: hidden; }
    #certificateDisplay, #certificateDisplay * { visibility: visible; }
    #certificateDisplay { position: absolute; left: 0; top: 0; width: 100%; margin: 0; padding: 0; }
    .certificate-template {
        max-width: 100%; width: 100%; margin: 0; box-shadow: none;
        aspect-ratio: 1.414 / 1;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    .no-print { display: none !important; }
    @page { margin: 0; size: A4 landscape; }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .certificate-template { aspect-ratio: auto; min-height: 520px; }
    .cert-title { font-size: 1.8em; }
    .cert-name  { font-size: 2.4em; }
    .cert-footer { grid-template-columns: 1fr 1fr; gap: 6px; }
    .cert-stamp { display: none; }
    .payment-methods { grid-template-columns: repeat(2, 1fr); }
    .detail-row { flex-direction: column; align-items: flex-start; }
    .detail-value { text-align: left; margin-left: 0; margin-top: 8px; }
}
