/* Custom Stylesheet for AuraCert */

/* --- UI Theme & CSS Variables --- */
:root {
    --navy-primary: #0f172a;
    --navy-secondary: #1e293b;
    --navy-dark: #020617;
    --gold-accent: #d4af37;
    --gold-light: #f3e5ab;
    --gold-hover: #b89742;
    --bg-dark: #f8fafc;
    --card-border: rgba(226, 232, 240, 0.8);
    
    /* Theme Colors for Certificates */
    --cert-navy: #0d1b2a;
    --cert-gold: #c5a85c;
    --cert-gold-light: #f5eedc;
    
    --cert-crimson: #5e0b15;
    --cert-crimson-light: #fdf5f5;
    
    --cert-emerald: #0b3c26;
    --cert-emerald-light: #f4f8f5;
}

body {
    font-family: 'Inter', sans-serif;
    color: #334155;
    background-color: #f1f5f9;
    min-height: 100vh;
    overflow-x: hidden;
}

/* --- UI Component Styles --- */
.bg-premium {
    background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy-primary) 100%);
    border-bottom: 2px solid var(--gold-accent);
}

.bg-premium-dark {
    background: var(--navy-primary);
}

.text-gold {
    color: var(--gold-accent);
}

.text-gradient {
    background: linear-gradient(45deg, #ffd700, #fff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

.bg-gold-badge {
    background-color: var(--gold-accent);
    color: var(--navy-dark);
}

/* Tab Design */
.nav-tabs .nav-link {
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border-radius: 0;
    border-bottom: 3px solid transparent;
}
.nav-tabs .nav-link.active {
    background-color: rgba(255,255,255,0.08) !important;
    border-bottom: 3px solid var(--gold-accent) !important;
    color: var(--gold-accent) !important;
}
.nav-tabs .nav-link:hover:not(.active) {
    color: var(--gold-light) !important;
    background-color: rgba(255,255,255,0.03);
}

/* Custom Control Panel Card */
.control-panel {
    border: 1px solid var(--card-border) !important;
}

.bg-glass {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

.uppercase {
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.fs-7 {
    font-size: 0.8rem;
}
.fs-8 {
    font-size: 0.72rem;
}

/* Range Input Stylings */
.form-range::-webkit-slider-thumb {
    background: var(--navy-primary);
}
.form-range::-webkit-slider-thumb:active {
    background: var(--gold-accent);
}

/* Buttons */
.btn-outline-navy {
    color: var(--navy-primary);
    border-color: var(--navy-primary);
    transition: all 0.2s;
}
.btn-outline-navy:hover {
    background-color: var(--navy-primary);
    color: #fff;
}

.btn-gradient-gold {
    background: linear-gradient(135deg, var(--gold-accent) 0%, #ffd700 100%);
    border: none;
    color: var(--navy-dark);
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.2);
}
.btn-gradient-gold:hover {
    background: linear-gradient(135deg, #ffd700 0%, var(--gold-hover) 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 15deg rgba(212, 175, 55, 0.3);
}

/* Theme Selection Previews */
.theme-color-preview {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.bg-tpl-classic {
    background: linear-gradient(135deg, var(--cert-navy) 50%, var(--cert-gold) 50%);
}
.bg-tpl-minimalist {
    background: linear-gradient(135deg, #ffffff 50%, #334155 50%);
}
.bg-tpl-islamic {
    background: linear-gradient(135deg, var(--cert-emerald) 50%, var(--cert-gold) 50%);
}
.bg-tpl-luxury {
    background: linear-gradient(135deg, #111 50%, #ffd700 50%);
}
.bg-tpl-academic {
    background: linear-gradient(135deg, #800020 50%, var(--cert-gold) 50%);
}
.bg-tpl-artistic {
    background: linear-gradient(135deg, #20b2aa 50%, #ffdab9 50%);
}
.bg-tpl-geometric {
    background: linear-gradient(135deg, #10b981 50%, #f97316 50%);
}
.bg-tpl-vintage {
    background: linear-gradient(135deg, #edd6b1 50%, #4a3728 50%);
}
.bg-tpl-corporate {
    background: linear-gradient(135deg, #1e3a8a 50%, #cbd5e1 50%);
}
.bg-tpl-contemporary {
    background: linear-gradient(135deg, #0f172a 50%, #ffd700 50%);
}
.bg-tpl-nurulhuda {
    background: linear-gradient(135deg, #091636 50%, #ffd700 50%);
}

.btn-outline-theme {
    border: 2px solid #dee2e6;
    color: #495057;
    transition: all 0.2s ease;
    background-color: #fff;
}
.btn-check:checked + .btn-outline-theme {
    border-color: var(--navy-primary);
    background-color: rgba(30, 41, 59, 0.05);
    color: var(--navy-primary);
    font-weight: 600;
}

/* Preset Lists */
.preset-item {
    transition: all 0.2s;
}
.preset-item:hover {
    background-color: #f8fafc;
}

/* Micro-animations */
.animate-pulse {
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* --- Certificate Core Layout --- */
.preview-card-container {
    background: #e2e8f0;
    border: 2px dashed #cbd5e1;
    border-radius: 16px;
    padding: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    overflow: hidden;
}

.certificate-preview-wrapper {
    width: 100%;
    position: relative;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    /* Box shadow to make it lift from grid background */
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15) !important;
}

/* Hardcoded A4 landscape dimension container */
.certificate-card {
    width: 1123px;
    height: 794px;
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: top left;
    background-color: #faf8f5;
    box-sizing: border-box;
    padding: 45px 55px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    user-select: none;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

/* Patterns & Watermark Backgrounds */
.cert-bg-patterns {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* Elegant Vector Corners */
.pattern-corner {
    position: absolute;
    width: 160px;
    height: 160px;
    background-repeat: no-repeat;
    background-size: contain;
    opacity: 0.85;
}

.pattern-top-left {
    top: 25px;
    left: 25px;
}
.pattern-top-right {
    top: 25px;
    right: 25px;
    transform: rotate(90deg);
}
.pattern-bottom-left {
    bottom: 25px;
    left: 25px;
    transform: rotate(-90deg);
}
.pattern-bottom-right {
    bottom: 25px;
    right: 25px;
    transform: rotate(180deg);
}

.cert-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 380px;
    height: 380px;
    opacity: 0.035;
    background-image: url('school-logo-placeholder.png');
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
    z-index: 1;
}

/* Certificate Borders */
.cert-border-outer {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    bottom: 20px;
    border-width: 6px;
    border-style: solid;
    z-index: 2;
    pointer-events: none;
}

.cert-border-inner {
    position: absolute;
    top: 6px;
    left: 6px;
    right: 6px;
    bottom: 6px;
    border-width: 2px;
    border-style: double;
    z-index: 2;
    pointer-events: none;
}

/* Body Content Area */
.cert-body {
    position: relative;
    z-index: 3;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* School Header */
.cert-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
}
.cert-logo-container {
    width: 75px;
    height: 75px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cert-logo-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.cert-school-info {
    text-align: left;
}
.cert-school-name {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 1.55rem;
    margin: 0;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.cert-school-sub {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    margin: 3px 0 0 0;
    color: #64748b;
    font-weight: 500;
}
.cert-header-line {
    height: 3px;
    margin-top: 6px;
    border-radius: 2px;
}

/* Award Title */
.cert-title-section {
    text-align: center;
    margin-top: 20px;
}
.cert-award-type {
    font-family: 'Cinzel', serif;
    font-weight: 800;
    font-size: 2.8rem;
    margin: 0;
    letter-spacing: 0.06em;
}
.cert-award-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 8px;
}
.cert-award-divider::before,
.cert-award-divider::after {
    content: '';
    height: 1px;
    width: 150px;
}
.divider-star {
    font-size: 0.75rem;
    padding: 0 15px;
}

/* Recipient details */
.cert-recipient-section {
    text-align: center;
    margin-top: 15px;
}
.cert-given-to {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 1.15rem;
    margin: 0 0 10px 0;
}
.cert-recipient-name {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-style: italic;
    font-size: 2.6rem;
    margin: 0;
    display: inline-block;
    padding-bottom: 2px;
}
.cert-recipient-line {
    width: 450px;
    height: 1px;
    margin: 6px auto 0 auto;
}

/* Award Text Details */
.cert-detail-section {
    text-align: center;
    margin-top: 15px;
    padding: 0 80px;
}
.cert-award-desc {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0 0 6px 0;
    font-weight: 400;
}
.cert-rank {
    font-family: 'Cinzel', serif;
    font-size: 1.25rem;
    line-height: 1.4;
    margin: 0 0 10px 0;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--cert-gold);
}
.cert-meta-info {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    color: #475569;
    margin: 0;
}
.cert-wish {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 0.85rem;
    line-height: 1.4;
    margin: 8px 0 0 0;
    color: #475569;
}

/* Signatures & Seals */
.cert-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 30px;
    padding: 0 20px;
}
.cert-sign-col {
    width: 250px;
}
.cert-date-top {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    margin-bottom: 5px;
}
.cert-sign-role {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.cert-signature-space {
    height: 70px;
    position: relative;
}
.signature-decorative-line {
    position: absolute;
    bottom: 20px;
    left: 10%;
    width: 80%;
    height: 25px;
    opacity: 0.15;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 30' width='100' height='30'%3E%3Cpath d='M10,20 Q30,5 50,20 T90,20' fill='none' stroke='%23334155' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
}
.cert-sign-name {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 1.05rem;
    margin: 0;
    border-top: 1px solid #94a3b8;
    padding-top: 4px;
}
.cert-sign-nip {
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    color: #64748b;
    margin: 2px 0 0 0;
}

/* Center Golden Seal */
.cert-seal-col {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    width: 150px;
}
.cert-gold-seal {
    position: relative;
    width: 90px;
    height: 90px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}
.seal-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.15));
    animation: rotateSlow 20s linear infinite;
}
@keyframes rotateSlow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.seal-ribbon {
    position: absolute;
    width: 25px;
    height: 60px;
    background: linear-gradient(to bottom, #d4af37, #996515);
    bottom: -35px;
    z-index: -1;
    clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 50% 85%, 0% 100%);
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
}
.ribbon-left {
    left: 20px;
    transform: rotate(15deg);
}
.ribbon-right {
    right: 20px;
    transform: rotate(-15deg);
}


/* ==========================================================================
   --- 10 UNIQUE TEMPLATE DESIGNS ---
   ========================================================================== */

/* Hidden elements by default (shown selectively by templates) */
.cert-shape-left-bar,
.cert-shape-watercolor,
.cert-shape-wave-top,
.cert-shape-wave-bottom,
.cert-gold-flourish-top,
.cert-illustration-trophy {
    display: none;
    position: absolute;
    pointer-events: none;
}
.cert-detail-wrapper {
    display: block; /* Normal block flow by default */
}

/* Template helper variables */
.certificate-card {
    --border-color-primary: #0d1b2a;
    --border-color-secondary: #c5a85c;
    --text-color-primary: #0d1b2a;
    --text-color-secondary: #64748b;
    --accent-color: #c5a85c;
}

/* --------------------------------------------------------------------------
   TEMPLATE 1: CLASSIC NAVY GOLD (.tpl-classic)
   Nuansa: Elegan Klasik (Default)
   -------------------------------------------------------------------------- */
.tpl-classic {
    background-color: #fdfbf7;
    color: #0d1b2a;
}
.tpl-classic .cert-border-outer {
    border-color: #0d1b2a;
}
.tpl-classic .cert-border-inner {
    border-color: #c5a85c;
}
.tpl-classic .cert-school-name {
    color: #0d1b2a;
}
.tpl-classic .cert-header-line {
    background: linear-gradient(90deg, #0d1b2a 0%, #c5a85c 50%, #0d1b2a 100%);
}
.tpl-classic .cert-award-type {
    color: #c5a85c;
}
.tpl-classic .cert-award-divider::before,
.tpl-classic .cert-award-divider::after {
    background-color: #c5a85c;
}
.tpl-classic .divider-star {
    color: #c5a85c;
}
.tpl-classic .cert-recipient-name {
    color: #0d1b2a;
}
.tpl-classic .cert-recipient-line {
    background: linear-gradient(90deg, transparent 0%, #c5a85c 50%, transparent 100%);
}
.tpl-classic .cert-rank {
    color: #c5a85c;
}
.tpl-classic .seal-outer-circle,
.tpl-classic .seal-inner-circle {
    fill: #0d1b2a;
    stroke: #c5a85c;
}
.tpl-classic .seal-star,
.tpl-classic .seal-text-center {
    fill: #c5a85c;
}
.tpl-classic .pattern-corner {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' width='100' height='100'%3E%3Cpath d='M 0,0 L 25,0 C 25,25 0,25 0,0 Z M 0,0 L 0,25 C 25,25 25,0 0,0 Z' fill='%23c5a85c'/%3E%3Cpath d='M 12,12 Q 35,12 35,35' fill='none' stroke='%230d1b2a' stroke-width='2.5'/%3E%3Cpath d='M 6,6 Q 45,6 45,45' fill='none' stroke='%23c5a85c' stroke-width='1.5' stroke-dasharray='1,2'/%3E%3C/svg%3E");
}

/* --------------------------------------------------------------------------
   TEMPLATE 2: MODERN MINIMALIST (.tpl-minimalist)
   Nuansa: Minimalis Rata Kiri & Asimetris
   -------------------------------------------------------------------------- */
.tpl-minimalist {
    background-color: #ffffff;
    color: #334155;
    padding: 60px 80px;
}
.tpl-minimalist .cert-border-outer,
.tpl-minimalist .cert-border-inner,
.tpl-minimalist .pattern-corner {
    display: none; /* Tanpa border klasik */
}
.tpl-minimalist .cert-shape-left-bar {
    display: block;
    width: 8px;
    height: 100%;
    background: linear-gradient(to bottom, #1e293b, #c5a85c, #1e293b);
    left: 0;
    top: 0;
}
/* Aliansi Rata Kiri */
.tpl-minimalist .cert-body {
    align-items: flex-start;
    text-align: left;
}
.tpl-minimalist .cert-header {
    flex-direction: row-reverse;
    justify-content: space-between;
    width: 100%;
    align-items: center;
}
.tpl-minimalist .cert-school-info {
    text-align: left;
}
.tpl-minimalist .cert-school-name {
    color: #1e293b;
    font-size: 1.45rem;
}
.tpl-minimalist .cert-header-line {
    background: #c5a85c;
    margin-left: 0;
    width: 150px;
}
.tpl-minimalist .cert-title-section {
    text-align: left;
    margin-top: 15px;
}
.tpl-minimalist .cert-award-type {
    font-family: 'Inter', sans-serif;
    font-weight: 800;
    font-size: 2.5rem;
    color: #1e293b;
    letter-spacing: -0.02em;
}
.tpl-minimalist .cert-award-divider {
    justify-content: flex-start;
    margin-top: 4px;
}
.tpl-minimalist .cert-award-divider::before {
    content: none;
}
.tpl-minimalist .cert-award-divider::after {
    width: 80px;
    background-color: #c5a85c;
    height: 2px;
}
.tpl-minimalist .divider-star {
    display: none;
}
.tpl-minimalist .cert-recipient-section {
    text-align: left;
    margin-top: 15px;
}
.tpl-minimalist .cert-given-to {
    font-family: 'Inter', sans-serif;
    font-style: normal;
    text-transform: uppercase;
    font-size: 0.78rem;
    letter-spacing: 0.15em;
    color: #c5a85c;
    font-weight: 600;
}
.tpl-minimalist .cert-recipient-name {
    font-family: 'Montserrat', sans-serif;
    font-style: normal;
    font-weight: 800;
    font-size: 2.3rem;
    color: #0f172a;
}
.tpl-minimalist .cert-recipient-line {
    margin: 4px 0 0 0;
    width: 250px;
    background: #cbd5e1;
}
.tpl-minimalist .cert-detail-section {
    text-align: left;
    padding: 0;
    margin-top: 15px;
}
.tpl-minimalist .cert-rank {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.15rem;
    color: #10b981; /* Emerald accent */
}
.tpl-minimalist .cert-footer {
    width: 100%;
    padding: 0;
}
.tpl-minimalist .cert-gold-seal {
    width: 70px;
    height: 70px;
}
.tpl-minimalist .seal-ribbon {
    display: none; /* Tanpa pita merah/emas */
}
.tpl-minimalist .seal-outer-circle,
.tpl-minimalist .seal-inner-circle {
    fill: #f8fafc;
    stroke: #cbd5e1;
}
.tpl-minimalist .seal-star {
    fill: #10b981;
}
.tpl-minimalist .seal-text-center {
    fill: #1e293b;
}

/* --------------------------------------------------------------------------
   TEMPLATE 3: ISLAMIC EMERALD (.tpl-islamic)
   Nuansa: Islami Dengan Bingkai Kubah Masjid
   -------------------------------------------------------------------------- */
.tpl-islamic {
    background-color: #fbfbfa;
    color: #0b3c26;
}
.tpl-islamic .cert-border-outer {
    border-color: #0b3c26;
    border-width: 4px;
}
/* Islamic Arch Border Effect */
.tpl-islamic .cert-border-inner {
    border-color: #c5a85c;
    border-width: 2px;
    border-radius: 100px 100px 0 0; /* Membuat lengkungan kubah di atas */
}
.tpl-islamic .cert-school-name {
    color: #0b3c26;
}
.tpl-islamic .cert-header-line {
    background: linear-gradient(90deg, #0b3c26 0%, #c5a85c 50%, #0b3c26 100%);
}
.tpl-islamic .cert-award-type {
    color: #c5a85c;
    font-family: 'Cinzel', serif;
}
.tpl-islamic .cert-recipient-name {
    color: #0b3c26;
}
.tpl-islamic .cert-recipient-line {
    background: linear-gradient(90deg, transparent 0%, #c5a85c 50%, transparent 100%);
}
.tpl-islamic .cert-rank {
    color: #0b3c26;
    font-weight: 800;
}
.tpl-islamic .seal-outer-circle,
.tpl-islamic .seal-inner-circle {
    fill: #0b3c26;
    stroke: #c5a85c;
}
.tpl-islamic .seal-star,
.tpl-islamic .seal-text-center {
    fill: #c5a85c;
}
/* Islamic Background Mandala */
.tpl-islamic .cert-watermark {
    opacity: 0.045;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' width='100' height='100'%3E%3Cpath d='M50,5 L53,20 L68,17 L60,30 L73,35 L61,45 L70,58 L57,59 L58,73 L48,67 L40,77 L38,63 L25,67 L31,54 L20,49 L32,41 L27,27 L40,29 Z' fill='%23c5a85c'/%3E%3Ccircle cx='50' cy='50' r='20' fill='none' stroke='%23c5a85c' stroke-width='1'/%3E%3C/svg%3E");
    width: 450px;
    height: 450px;
}
.tpl-islamic .pattern-corner {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' width='100' height='100'%3E%3Ccircle cx='0' cy='0' r='30' fill='none' stroke='%23c5a85c' stroke-width='2'/%3E%3Ccircle cx='0' cy='0' r='20' fill='none' stroke='%230b3c26' stroke-width='1.5'/%3E%3Cpath d='M0,0 L21,21' stroke='%23c5a85c' stroke-width='1.5'/%3E%3C/svg%3E");
}

/* --------------------------------------------------------------------------
   TEMPLATE 4: MIDNIGHT LUXURY (.tpl-luxury)
   Nuansa: Premium Gelap & Emas
   -------------------------------------------------------------------------- */
.tpl-luxury {
    background: radial-gradient(circle at center, #1e293b 0%, #090d16 100%);
    color: #f8fafc;
}
.tpl-luxury .cert-border-outer {
    border-color: #ffd700;
    box-shadow: inset 0 0 20px rgba(255, 215, 0, 0.2);
}
.tpl-luxury .cert-border-inner {
    border-color: rgba(255, 215, 0, 0.4);
}
.tpl-luxury .cert-school-name {
    color: #ffd700;
}
.tpl-luxury .cert-school-sub {
    color: #94a3b8;
}
.tpl-luxury .cert-header-line {
    background: linear-gradient(90deg, transparent 0%, #ffd700 50%, transparent 100%);
}
.tpl-luxury .cert-award-type {
    color: #ffffff;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}
.tpl-luxury .cert-award-divider::before,
.tpl-luxury .cert-award-divider::after {
    background-color: #ffd700;
}
.tpl-luxury .divider-star {
    color: #ffd700;
}
.tpl-luxury .cert-given-to {
    color: #94a3b8;
}
.tpl-luxury .cert-recipient-name {
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.15);
}
.tpl-luxury .cert-recipient-line {
    background: linear-gradient(90deg, transparent 0%, #ffd700 50%, transparent 100%);
}
.tpl-luxury .cert-rank {
    color: #ffffff;
    font-weight: 700;
}
.tpl-luxury .cert-meta-info {
    color: #94a3b8;
}
.tpl-luxury .cert-wish {
    color: #cbd5e1;
}
.tpl-luxury .cert-sign-role {
    color: #94a3b8;
}
.tpl-luxury .cert-sign-name {
    color: #ffffff;
    border-top-color: rgba(255, 255, 255, 0.2);
}
.tpl-luxury .cert-sign-nip {
    color: #64748b;
}
.tpl-luxury .signature-decorative-line {
    opacity: 0.15;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 30' width='100' height='30'%3E%3Cpath d='M10,20 Q30,5 50,20 T90,20' fill='none' stroke='%23ffd700' stroke-width='1.5'/%3E%3C/svg%3E");
}
.tpl-luxury .seal-outer-circle,
.tpl-luxury .seal-inner-circle {
    fill: #ffd700;
    stroke: #111;
}
.tpl-luxury .seal-star {
    fill: #111;
}
.tpl-luxury .seal-text-center {
    fill: #111;
}
.tpl-luxury .seal-ribbon {
    background: linear-gradient(to bottom, #d4af37, #ffd700);
}
.tpl-luxury .cert-watermark {
    opacity: 0.02;
    filter: invert(1);
}
.tpl-luxury .pattern-corner {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' width='100' height='100'%3E%3Cpath d='M 0,0 L 30,0 L 30,5 L 5,5 L 5,30 L 0,30 Z' fill='%23ffd700'/%3E%3Ccircle cx='15' cy='15' r='5' fill='none' stroke='%23ffd700' stroke-width='1.5'/%3E%3C/svg%3E");
}

/* --------------------------------------------------------------------------
   TEMPLATE 5: ACADEMIC FORMAL (.tpl-academic)
   Nuansa: Formal Akademik & Wax Seal
   -------------------------------------------------------------------------- */
.tpl-academic {
    background-color: #faf7f0;
    color: #800020;
}
.tpl-academic .cert-border-outer {
    border-color: #800020;
    border-width: 8px;
}
.tpl-academic .cert-border-inner {
    border-color: #c5a85c;
    border-style: solid;
    border-width: 1px;
}
.tpl-academic .cert-school-name {
    color: #800020;
}
.tpl-academic .cert-header-line {
    background: #800020;
    height: 4px;
}
.tpl-academic .cert-award-type {
    color: #800020;
    font-weight: 700;
}
.tpl-academic .cert-recipient-name {
    color: #800020;
}
.tpl-academic .cert-recipient-line {
    background: #800020;
}
.tpl-academic .cert-rank {
    color: #c5a85c;
}
/* Red Wax Seal */
.tpl-academic .seal-outer-circle {
    fill: #a21a24;
    stroke: #800020;
    stroke-width: 2;
}
.tpl-academic .seal-inner-circle {
    fill: #800020;
    stroke: #a21a24;
}
.tpl-academic .seal-star {
    fill: #c5a85c;
}
.tpl-academic .seal-text-center {
    fill: #ffffff;
    font-weight: bold;
}
.tpl-academic .seal-ribbon {
    background: linear-gradient(to bottom, #800020, #5e0b15);
}
.tpl-academic .pattern-corner {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' width='100' height='100'%3E%3Cpath d='M0,0 M25,0 L25,25 L0,25' fill='none' stroke='%23800020' stroke-width='2'/%3E%3Cpath d='M0,0 M15,0 L15,15 L0,15' fill='none' stroke='%23c5a85c' stroke-width='1'/%3E%3C/svg%3E");
}

/* --------------------------------------------------------------------------
   TEMPLATE 6: PASTEL ARTISTIC (.tpl-artistic)
   Nuansa: Artistik Cat Air & Kaligrafi Dinamis
   -------------------------------------------------------------------------- */
.tpl-artistic {
    background-color: #f4fcfb;
    color: #0f4c5c;
}
.tpl-artistic .cert-border-outer {
    border-color: rgba(32, 178, 170, 0.4);
    border-width: 2px;
    border-style: solid;
}
.tpl-artistic .cert-border-inner {
    border-color: rgba(197, 168, 92, 0.3);
    border-width: 1px;
}
/* Background Cat Air (Watercolor Gradient blobs) */
.tpl-artistic .cert-shape-watercolor {
    display: block;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(32,178,170,0.15) 0%, rgba(255,218,185,0.1) 60%, rgba(255,255,255,0) 100%);
    right: -100px;
    top: -100px;
    border-radius: 50%;
    filter: blur(30px);
}
.tpl-artistic .cert-school-name {
    color: #0f4c5c;
}
.tpl-artistic .cert-header-line {
    background: linear-gradient(90deg, transparent 0%, #20b2aa 50%, transparent 100%);
}
.tpl-artistic .cert-award-type {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    color: #0f4c5c;
    font-weight: 700;
}
.tpl-artistic .cert-recipient-name {
    font-family: 'Alex Brush', cursive;
    font-size: 3.5rem;
    color: #fb8b24; /* Pastel orange/gold highlight */
}
.tpl-artistic .cert-recipient-line {
    background: #e2e8f0;
}
.tpl-artistic .cert-rank {
    color: #0f4c5c;
}
.tpl-artistic .seal-outer-circle,
.tpl-artistic .seal-inner-circle {
    fill: #f4fcfb;
    stroke: #20b2aa;
}
.tpl-artistic .seal-star {
    fill: #fb8b24;
}
.tpl-artistic .seal-text-center {
    fill: #0f4c5c;
}
.tpl-artistic .seal-ribbon {
    background: linear-gradient(to bottom, #20b2aa, #0f4c5c);
}
.tpl-artistic .pattern-corner {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' width='100' height='100'%3E%3Cpath d='M0,0 Q30,10 20,40 Q10,20 0,0' fill='%2320b2aa' opacity='0.2'/%3E%3C/svg%3E");
}

/* --------------------------------------------------------------------------
   TEMPLATE 7: GEOMETRIC LINE (.tpl-geometric)
   Nuansa: Geometris Modern Dengan Garis Poligonal
   -------------------------------------------------------------------------- */
.tpl-geometric {
    background-color: #f8fafc;
    color: #1e293b;
}
.tpl-geometric .cert-border-outer {
    border-color: #10b981; /* Emerald */
    border-width: 3px;
}
.tpl-geometric .cert-border-inner {
    border-color: #f97316; /* Orange */
    border-width: 1px;
}
.tpl-geometric .cert-school-name {
    color: #1e293b;
}
.tpl-geometric .cert-header-line {
    background: linear-gradient(90deg, #10b981 0%, #f97316 50%, #10b981 100%);
    height: 4px;
}
.tpl-geometric .cert-award-type {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    color: #10b981;
}
.tpl-geometric .cert-recipient-name {
    color: #1e293b;
}
.tpl-geometric .cert-recipient-line {
    background: #cbd5e1;
}
.tpl-geometric .cert-rank {
    color: #f97316;
}
.tpl-geometric .seal-outer-circle,
.tpl-geometric .seal-inner-circle {
    fill: #10b981;
    stroke: #ffffff;
    stroke-width: 2;
}
.tpl-geometric .seal-star {
    fill: #f97316;
}
.tpl-geometric .seal-text-center {
    fill: #ffffff;
}
.tpl-geometric .seal-ribbon {
    background: linear-gradient(to bottom, #f97316, #ea580c);
}
/* Poligonal Corner SVG */
.tpl-geometric .pattern-corner {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' width='100' height='100'%3E%3Cpolygon points='0,0 40,0 0,40' fill='%2310b981' opacity='0.15'/%3E%3Cpolygon points='0,0 25,0 0,25' fill='%23f97316' opacity='0.25'/%3E%3C/svg%3E");
}

/* --------------------------------------------------------------------------
   TEMPLATE 8: VINTAGE DIPLOMA (.tpl-vintage)
   Nuansa: Klasik Vintage / Perkamen Tua
   -------------------------------------------------------------------------- */
.tpl-vintage {
    background-color: #edd6b1;
    color: #4a3728;
}
.tpl-vintage .cert-border-outer {
    border-color: #4a3728;
    border-width: 10px;
    border-style: double;
}
.tpl-vintage .cert-border-inner {
    border-color: #5c4033;
    border-width: 2px;
}
.tpl-vintage .cert-school-name {
    color: #4a3728;
}
.tpl-vintage .cert-school-sub {
    color: #5c4033;
}
.tpl-vintage .cert-header-line {
    background: #4a3728;
    height: 3px;
}
.tpl-vintage .cert-award-type {
    font-family: 'Cinzel', serif;
    font-weight: 800;
    color: #4a3728;
}
.tpl-vintage .cert-recipient-name {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    color: #4a3728;
}
.tpl-vintage .cert-recipient-line {
    background: #4a3728;
}
.tpl-vintage .cert-rank {
    color: #4a3728;
}
.tpl-vintage .seal-outer-circle,
.tpl-vintage .seal-inner-circle {
    fill: #4a3728;
    stroke: #edd6b1;
}
.tpl-vintage .seal-star,
.tpl-vintage .seal-text-center {
    fill: #edd6b1;
}
.tpl-vintage .seal-ribbon {
    background: linear-gradient(to bottom, #4a3728, #5c4033);
}
.tpl-vintage .pattern-corner {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' width='100' height='100'%3E%3Cpath d='M0,0 L20,0 C20,10 10,20 0,20 Z' fill='%234a3728'/%3E%3Cpath d='M0,0 M10,10 Q25,10 25,25' fill='none' stroke='%234a3728' stroke-width='1.5'/%3E%3C/svg%3E");
}

/* --------------------------------------------------------------------------
   TEMPLATE 9: CORPORATE PREMIUM (.tpl-corporate)
   Nuansa: Profesional Korporat
   -------------------------------------------------------------------------- */
.tpl-corporate {
    background-color: #f1f5f9;
    color: #1e3a8a;
}
.tpl-corporate .cert-border-outer {
    border-color: #1e3a8a;
    border-width: 5px;
}
.tpl-corporate .cert-border-inner {
    border-color: #cbd5e1;
    border-width: 1px;
}
.tpl-corporate .cert-school-name {
    color: #1e3a8a;
}
.tpl-corporate .cert-header-line {
    background: linear-gradient(90deg, #1e3a8a 0%, #cbd5e1 50%, #1e3a8a 100%);
    height: 4px;
}
.tpl-corporate .cert-award-type {
    font-family: 'Montserrat', sans-serif;
    color: #1e3a8a;
    font-weight: 700;
}
.tpl-corporate .cert-recipient-name {
    color: #1e3a8a;
}
.tpl-corporate .cert-recipient-line {
    background: #1e3a8a;
}
.tpl-corporate .cert-rank {
    color: #0284c7; /* Corporate sky blue */
}
.tpl-corporate .seal-outer-circle,
.tpl-corporate .seal-inner-circle {
    fill: #1e3a8a;
    stroke: #cbd5e1;
}
.tpl-corporate .seal-star {
    fill: #cbd5e1;
}
.tpl-corporate .seal-text-center {
    fill: #ffffff;
}
.tpl-corporate .seal-ribbon {
    background: linear-gradient(to bottom, #1e3a8a, #0284c7);
}
.tpl-corporate .pattern-corner {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' width='100' height='100'%3E%3Cpath d='M0,0 L15,0 L15,15 L0,15 Z' fill='%231e3a8a'/%3E%3Cpath d='M5,5 L20,5 L20,20 L5,20 Z' fill='none' stroke='%23cbd5e1' stroke-width='1'/%3E%3C/svg%3E");
}

/* --------------------------------------------------------------------------
   TEMPLATE 10: CONTEMPORARY WAVE (.tpl-contemporary)
   Nuansa: Seni Fluid Khas Modern Art
   -------------------------------------------------------------------------- */
.tpl-contemporary {
    background-color: #ffffff;
    color: #0f172a;
    padding: 90px 70px;
}
.tpl-contemporary .cert-border-outer,
.tpl-contemporary .cert-border-inner,
.tpl-contemporary .pattern-corner {
    display: none; /* Tanpa border garis klasik */
}
/* Wave Graphics */
.tpl-contemporary .cert-shape-wave-top {
    display: block;
    width: 100%;
    height: 90px;
    background: linear-gradient(135deg, #0f172a 30%, #3b82f6 80%, #ffd700 100%);
    clip-path: polygon(0 0, 100% 0, 100% 45%, 0% 100%);
    left: 0;
    top: 0;
}
.tpl-contemporary .cert-shape-wave-bottom {
    display: block;
    width: 100%;
    height: 90px;
    background: linear-gradient(135deg, #ffd700 0%, #3b82f6 20%, #0f172a 70%);
    clip-path: polygon(0 55%, 100% 0, 100% 100%, 0% 100%);
    left: 0;
    bottom: 0;
}
.tpl-contemporary .cert-school-name {
    color: #0f172a;
    font-size: 1.4rem;
}
.tpl-contemporary .cert-header-line {
    background: #ffd700;
}
.tpl-contemporary .cert-award-type {
    color: #3b82f6;
}
.tpl-contemporary .cert-recipient-name {
    color: #0f172a;
}
.tpl-contemporary .cert-recipient-line {
    background: #3b82f6;
}
.tpl-contemporary .cert-rank {
    color: #ffd700;
    text-shadow: 1px 1px 0px rgba(0,0,0,0.1);
}
.tpl-contemporary .seal-outer-circle,
.tpl-contemporary .seal-inner-circle {
    fill: #0f172a;
    stroke: #ffd700;
}
.tpl-contemporary .seal-star,
.tpl-contemporary .seal-text-center {
    fill: #ffd700;
}
.tpl-contemporary .seal-ribbon {
    background: linear-gradient(to bottom, #3b82f6, #0f172a);
}

/* --------------------------------------------------------------------------
   TEMPLATE 11: VIBRANT BLUE GOLD / NURUL HUDA (.tpl-nurulhuda)
   Nuansa: Biru Gold Dengan Piala & Rata Tengah Istimewa
   -------------------------------------------------------------------------- */
.tpl-nurulhuda {
    background-color: #ffffff;
    color: #0d1b2a;
    padding: 45px 65px;
}
/* Sudut gelombang navy kustom di border-outer */
.tpl-nurulhuda .cert-border-outer {
    border-width: 0px; /* Hide default border box */
}
.tpl-nurulhuda .cert-border-inner {
    border-color: #0d1b2a;
    border-width: 3px;
    border-style: solid;
    top: 25px;
    left: 25px;
    right: 25px;
    bottom: 25px;
}
/* Gold brackets in corners */
.tpl-nurulhuda .pattern-corner {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' width='100' height='100'%3E%3Cpath d='M 10,10 L 45,10 M 10,10 L 10,45 M 20,20 L 35,20 M 20,20 L 20,35' fill='none' stroke='%23ffd700' stroke-width='4'/%3E%3C/svg%3E");
    width: 80px;
    height: 80px;
    top: 35px;
    left: 35px;
    opacity: 1;
}
.tpl-nurulhuda .pattern-top-right {
    top: 35px;
    right: 35px;
}
.tpl-nurulhuda .pattern-bottom-left {
    bottom: 35px;
    left: 35px;
}
.tpl-nurulhuda .pattern-bottom-right {
    bottom: 35px;
    right: 35px;
}
/* Navy wave shapes in corners */
.tpl-nurulhuda .cert-shape-wave-top {
    display: block;
    width: 280px;
    height: 140px;
    background: linear-gradient(135deg, #091636 70%, #ffd700 71%, #ffd700 75%, transparent 76%);
    left: 0;
    top: 0;
    clip-path: polygon(0 0, 100% 0, 0 100%);
}
.tpl-nurulhuda .cert-shape-wave-bottom {
    display: block;
    width: 280px;
    height: 140px;
    background: linear-gradient(135deg, transparent 24%, #ffd700 25%, #ffd700 29%, #091636 30%);
    right: 0;
    bottom: 0;
    clip-path: polygon(100% 0, 100% 100%, 0 100%);
}
/* Gold Flourish Top */
.tpl-nurulhuda .cert-gold-flourish-top {
    display: block;
    height: 35px;
    width: 150px;
    margin: 0 auto 10px auto;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 25' width='100' height='25'%3E%3Cpath d='M10,12 C30,2 40,22 50,12 C60,2 70,22 90,12 M50,12 C40,12 40,7 50,7 C60,7 60,12 50,12' fill='none' stroke='%23c5a85c' stroke-width='1.5'/%3E%3Ccircle cx='50' cy='12' r='2' fill='%23c5a85c'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
}
/* Text modifications */
.tpl-nurulhuda .cert-school-name {
    color: #091636;
}
.tpl-nurulhuda .cert-header-line {
    background: linear-gradient(90deg, transparent 0%, #091636 50%, transparent 100%);
}
.tpl-nurulhuda .cert-award-type {
    font-family: 'Cinzel', serif;
    font-size: 2.7rem;
    font-weight: 800;
    color: #091636;
}
.tpl-nurulhuda .cert-award-divider::before,
.tpl-nurulhuda .cert-award-divider::after {
    background-color: #091636;
    height: 2px;
}
.tpl-nurulhuda .divider-star {
    color: #ffd700;
}
/* Recipient Name 3D Blue Outline Text Style */
.tpl-nurulhuda .cert-recipient-name {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-style: normal;
    font-size: 2.8rem;
    color: #00b4d8; /* Light blue fill */
    -webkit-text-stroke: 1.5px #03045e; /* Navy outline */
    text-shadow: 2px 2px 0px #03045e, -2px -2px 0px #03045e, 2px -2px 0px #03045e, -2px 2px 0px #03045e, 4px 4px 6px rgba(0,0,0,0.25);
    letter-spacing: 0.02em;
}
.tpl-nurulhuda .cert-recipient-line {
    background: #cbd5e1;
    width: 600px;
}
/* Spacing & Two-Column details (trophy + text) */
.tpl-nurulhuda .cert-detail-section {
    padding: 0 40px;
    margin-top: 10px;
}
.tpl-nurulhuda .cert-detail-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    text-align: center;
}
.tpl-nurulhuda .cert-illustration-trophy {
    display: block;
    position: static; /* Let flex handle it */
    flex: 0 0 90px;
}
.tpl-nurulhuda .cert-detail-text {
    flex: 1;
    text-align: center;
}
/* Yellow capsule pill badge for cert-rank */
.tpl-nurulhuda .cert-rank {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    color: #091636;
    background-color: #ffd700; /* Yellow gold */
    padding: 6px 20px;
    border-radius: 6px;
    display: inline-block;
    border: 1px dashed #d4af37;
    margin: 8px 0;
    text-shadow: none;
    letter-spacing: 0.05em;
}
.tpl-nurulhuda .cert-award-desc {
    font-size: 0.9rem;
    color: #334155;
}
.tpl-nurulhuda .cert-wish {
    font-size: 0.82rem;
    color: #475569;
}
/* Column Swapping and grid positioning for footer signatures */
.tpl-nurulhuda .cert-footer {
    display: grid;
    grid-template-columns: 1fr 120px 1fr;
    grid-template-rows: auto;
    align-items: flex-end;
    margin-top: 25px;
}
/* Swap: Left signatory Wali Kelas moves to the right. Right signatory Kepala Sekolah moves to the left. */
.tpl-nurulhuda .cert-sign-col:nth-child(1) {
    order: 3; /* Wali Kelas to the right */
}
.tpl-nurulhuda .cert-seal-col {
    order: 2; /* Seal in the middle */
}
.tpl-nurulhuda .cert-sign-col:nth-child(3) {
    order: 1; /* Kepala Sekolah to the left */
}
/* Relocate Date: Make the date appear above Wali Kelas on the right. */
.tpl-nurulhuda .cert-sign-col:nth-child(1) .cert-date-top {
    display: none; 
}
/* We handle date displacement: swap date from Kepala Sekolah column and put it over the right column */
.tpl-nurulhuda .cert-sign-col:nth-child(3) .cert-date-top {
    position: absolute;
    bottom: 125px;
    right: 85px;
    width: 250px;
    text-align: center;
}
.tpl-nurulhuda .cert-sign-role {
    font-weight: 700;
    color: #091636;
}
.tpl-nurulhuda .cert-sign-name {
    color: #03045e;
    border-top-color: #cbd5e1;
    font-weight: bold;
    text-decoration: underline; /* underline as seen in preview image */
}
.tpl-nurulhuda .seal-outer-circle,
.tpl-nurulhuda .seal-inner-circle {
    fill: #3b82f6;
    stroke: #ffd700;
}
.tpl-nurulhuda .seal-star,
.tpl-nurulhuda .seal-text-center {
    fill: #ffd700;
}
.tpl-nurulhuda .seal-ribbon {
    background: linear-gradient(to bottom, #091636, #3b82f6);
}

/* --------------------------------------------------------------------------
   TEMPLATE 12: CUSTOM UPLOADED BACKGROUND (.tpl-custom-bg)
   Nuansa: Menggunakan Background Kustom Unggahan Pengguna
   -------------------------------------------------------------------------- */
.tpl-custom-bg {
    background-color: #ffffff;
    background-position: center;
    background-size: 100% 100% !important;
    background-repeat: no-repeat;
    color: var(--text-color-primary);
}
/* Menyembunyikan ornamen bawaan */
.tpl-custom-bg .cert-border-outer,
.tpl-custom-bg .cert-border-inner,
.tpl-custom-bg .pattern-corner,
.tpl-custom-bg .cert-watermark,
.tpl-custom-bg .cert-shape-left-bar,
.tpl-custom-bg .cert-shape-watercolor,
.tpl-custom-bg .cert-shape-wave-top,
.tpl-custom-bg .cert-shape-wave-bottom,
.tpl-custom-bg .cert-gold-flourish-top,
.tpl-custom-bg .cert-illustration-trophy {
    display: none !important;
}
.tpl-custom-bg .cert-school-name {
    color: var(--text-color-primary);
}
.tpl-custom-bg .cert-school-sub {
    color: var(--text-color-secondary);
}
.tpl-custom-bg .cert-header-line {
    background: var(--text-color-primary);
}
.tpl-custom-bg .cert-award-type {
    color: var(--accent-color);
}
.tpl-custom-bg .cert-award-divider::before,
.tpl-custom-bg .cert-award-divider::after {
    background-color: var(--accent-color);
}
.tpl-custom-bg .divider-star {
    color: var(--accent-color);
}
.tpl-custom-bg .cert-given-to {
    color: var(--text-color-secondary);
}
.tpl-custom-bg .cert-recipient-name {
    color: var(--text-color-primary);
}
.tpl-custom-bg .cert-recipient-line {
    background: var(--text-color-secondary);
}
.tpl-custom-bg .cert-rank {
    color: var(--accent-color);
    text-shadow: none;
}
.tpl-custom-bg .cert-meta-info {
    color: var(--text-color-secondary);
}
.tpl-custom-bg .cert-wish {
    color: var(--text-color-primary);
}
.tpl-custom-bg .cert-sign-role {
    color: var(--text-color-primary);
}
.tpl-custom-bg .cert-sign-name {
    color: var(--text-color-primary);
    border-top-color: var(--text-color-secondary);
}
.tpl-custom-bg .cert-sign-nip {
    color: var(--text-color-secondary);
}
.tpl-custom-bg .seal-outer-circle,
.tpl-custom-bg .seal-inner-circle {
    fill: var(--text-color-primary);
    stroke: var(--accent-color);
}
.tpl-custom-bg .seal-star,
.tpl-custom-bg .seal-text-center {
    fill: var(--accent-color);
}
.tpl-custom-bg .seal-ribbon {
    background: linear-gradient(to bottom, var(--text-color-primary), var(--accent-color));
}

/* ==========================================================================
   --- PRINT OVERRIDES (@media print) ---
   ========================================================================== */
@media print {
    /* Set page dimension for A4 landscape */
    @page {
        size: A4 landscape;
        margin: 0;
    }
    
    html, body {
        width: 297mm;
        height: 210mm;
        background: #fff !important;
        margin: 0 !important;
        padding: 0 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    /* Hide all non-printable components */
    .no-print, nav, .control-panel, .preview-header, .card.mt-4, #brand-logo {
        display: none !important;
    }
    
    .main-content {
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
    }
    
    /* Flatten columns */
    .col-lg-5, .col-xl-4, .col-lg-7, .col-xl-8 {
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .preview-card-container {
        background: none !important;
        border: none !important;
        padding: 0 !important;
        border-radius: 0 !important;
        display: block !important;
        min-height: auto !important;
    }
    
    .certificate-preview-wrapper {
        width: 297mm !important;
        height: 210mm !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        overflow: hidden !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    /* Make the card exactly matches A4 and reset visual scaling */
    .certificate-card {
        width: 297mm !important;
        height: 210mm !important;
        transform: none !important; /* Disables script-controlled scaling */
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        box-shadow: none !important;
        border: none !important;
        margin: 0 !important;
    }
    
    /* Background colors and shapes print compatibility */
    .tpl-classic { background-color: #fdfbf7 !important; }
    .tpl-minimalist { background-color: #ffffff !important; }
    .tpl-islamic { background-color: #fbfbfa !important; }
    .tpl-luxury { background: radial-gradient(circle at center, #1e293b 0%, #090d16 100%) !important; }
    .tpl-academic { background-color: #faf7f0 !important; }
    .tpl-artistic { background-color: #f4fcfb !important; }
    .tpl-geometric { background-color: #f8fafc !important; }
    .tpl-vintage { background-color: #edd6b1 !important; }
    .tpl-corporate { background-color: #f1f5f9 !important; }
    .tpl-contemporary { background-color: #ffffff !important; }
    .tpl-nurulhuda { background-color: #ffffff !important; }
    .tpl-custom-bg { background-color: #ffffff !important; }
}
