/* ==========================================================================
   EducaIA - Módulo Oficial de Certificados (Verificación y Descarga)
   Diseño Glassmorphism Premium Corporativo
   ========================================================================== */

/* Fondo general de la sección con iluminación radial berry/violeta */
.cert-page-wrapper {
    min-height: calc(100vh - 80px);
    background: radial-gradient(circle at 20% 15%, #581c3f 0%, #30173d 40%, #0d0718 85%, #05030a 100%);
    position: relative;
    padding: 60px 20px 100px;
    overflow: hidden;
    color: #FFFFFF;
}

/* Efectos de luz ambiental de fondo */
.cert-page-wrapper::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    top: -150px;
    left: 10%;
    background: radial-gradient(circle, rgba(234, 88, 12, 0.15) 0%, rgba(139, 92, 246, 0.08) 50%, transparent 70%);
    border-radius: 50%;
    filter: blur(60px);
    pointer-events: none;
    z-index: 1;
}

.cert-page-wrapper::after {
    content: '';
    position: absolute;
    width: 550px;
    height: 550px;
    bottom: -100px;
    right: 5%;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.18) 0%, rgba(59, 130, 246, 0.1) 50%, transparent 70%);
    border-radius: 50%;
    filter: blur(70px);
    pointer-events: none;
    z-index: 1;
}

.cert-container {
    max-width: 780px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

/* Breadcrumbs superiores */
.cert-breadcrumbs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 0.9rem;
    color: #CBD5E1;
    margin-bottom: 30px;
}

.cert-breadcrumbs a {
    color: #93C5FD;
    text-decoration: none;
    transition: color 0.2s ease;
}

.cert-breadcrumbs a:hover {
    color: #FFFFFF;
    text-decoration: underline;
}

/* Selector de pestañas / Switcher */
.cert-tabs-nav {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 35px;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px;
    border-radius: 40px;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.cert-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 10px 24px;
    border-radius: 30px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #E2E8F0;
    text-decoration: none;
    transition: all 0.25s ease;
    border: 1px solid transparent;
}

.cert-tab-btn i {
    font-size: 1rem;
    transition: transform 0.25s ease;
}

.cert-tab-btn:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.08);
}

.cert-tab-btn.active {
    background: linear-gradient(135deg, #7C3AED 0%, #9333EA 100%);
    color: #FFFFFF;
    box-shadow: 0 4px 18px rgba(124, 58, 237, 0.45);
    border-color: rgba(216, 180, 254, 0.3);
}

.cert-tab-btn.active i {
    transform: scale(1.1);
}

/* ==========================================================================
   Tarjeta Glassmorphism Principal (Idéntica al modelo de referencia)
   ========================================================================== */
.cert-card {
    background: rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 28px;
    padding: 48px 42px;
    box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.55),
        inset 0 1px 1px rgba(255, 255, 255, 0.25);
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

@media (max-width: 640px) {
    .cert-card {
        padding: 32px 22px;
        border-radius: 20px;
    }
}

/* Ícono en Squircle Superior */
.cert-icon-squircle {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: rgba(255, 255, 255, 0.13);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    transition: transform 0.3s ease;
}

.cert-icon-squircle i {
    font-size: 1.75rem;
    color: #FFFFFF;
}

.cert-card:hover .cert-icon-squircle {
    transform: scale(1.08) rotate(4deg);
}

/* Badge superior */
.cert-badge-eyebrow {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 2.2px;
    text-transform: uppercase;
    color: #E9D5FF;
    margin-bottom: 12px;
}

/* Título Principal */
.cert-main-title {
    font-family: 'Outfit', sans-serif;
    font-size: 2.4rem;
    font-weight: 800;
    line-height: 1.15;
    color: #FFFFFF;
    margin: 0 0 14px;
    letter-spacing: -0.5px;
}

@media (max-width: 640px) {
    .cert-main-title {
        font-size: 1.95rem;
    }
}

/* Subtítulo descriptivo */
.cert-subtitle {
    font-size: 1rem;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.82);
    max-width: 520px;
    margin: 0 auto 30px;
}

.cert-subtitle strong {
    color: #FFFFFF;
    font-weight: 700;
}

/* Línea divisoria suave */
.cert-divider {
    border: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    margin: 0 0 32px;
}

/* Formulario */
.cert-form {
    width: 100%;
}

.cert-field-group {
    margin-bottom: 22px;
    text-align: center;
}

.cert-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    color: #F8FAFC;
    margin-bottom: 14px;
}

.cert-input {
    width: 100%;
    max-width: 580px;
    height: 56px;
    border-radius: 14px;
    border: 2px solid transparent;
    background: #FFFFFF;
    color: #0F172A;
    font-size: 1.05rem;
    font-weight: 600;
    text-align: center;
    padding: 0 24px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.2);
    transition: all 0.25s ease;
    outline: none;
}

.cert-input:focus {
    border-color: #F97316;
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.25), 0 8px 24px rgba(0, 0, 0, 0.3);
}

.cert-input::placeholder {
    color: #94A3B8;
    font-weight: 400;
}

/* Botones de acción (Naranja + Púrpura exactamente como el modelo) */
.cert-btn-group {
    display: flex;
    justify-content: center;
    gap: 16px;
    max-width: 580px;
    margin: 0 auto;
}

@media (max-width: 520px) {
    .cert-btn-group {
        flex-direction: column;
    }
}

.cert-btn-primary {
    flex: 1.2;
    height: 50px;
    border-radius: 12px;
    background: linear-gradient(135deg, #F97316 0%, #EA580C 100%);
    border: none;
    color: #FFFFFF;
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(234, 88, 12, 0.45);
    transition: all 0.25s ease;
}

.cert-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(234, 88, 12, 0.6);
    background: linear-gradient(135deg, #FB923C 0%, #EA580C 100%);
}

.cert-btn-secondary {
    flex: 1;
    height: 50px;
    border-radius: 12px;
    background: rgba(139, 92, 246, 0.35);
    border: 1px solid rgba(216, 180, 254, 0.35);
    color: #FFFFFF;
    font-size: 0.95rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.25s ease;
}

.cert-btn-secondary:hover {
    background: rgba(139, 92, 246, 0.55);
    border-color: rgba(216, 180, 254, 0.6);
    transform: translateY(-2px);
    color: #FFFFFF;
}

/* ==========================================================================
   Resultados de Verificación / Mensajes de Éxito y Error
   ========================================================================== */
.cert-result-box {
    margin-top: 36px;
    text-align: left;
    animation: fadeInCert 0.4s ease-out;
}

@keyframes fadeInCert {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tarjeta de Certificado Encontrado / Válido */
.cert-valid-card {
    background: rgba(15, 23, 42, 0.85);
    border: 2px solid #10B981;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 12px 35px rgba(16, 185, 129, 0.2);
    position: relative;
}

.cert-valid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 22px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.cert-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    background: rgba(16, 185, 129, 0.18);
    color: #34D399;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.cert-code-pill {
    font-family: monospace;
    font-size: 0.95rem;
    font-weight: 700;
    color: #F8FAFC;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.cert-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.cert-detail-item {
    background: rgba(255, 255, 255, 0.04);
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.cert-detail-item .label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #94A3B8;
    margin-bottom: 4px;
}

.cert-detail-item .value {
    font-size: 1.05rem;
    font-weight: 700;
    color: #FFFFFF;
}

.cert-action-bar {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.cert-action-btn-pdf {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 10px;
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: #FFFFFF;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.35);
    transition: all 0.2s ease;
}

.cert-action-btn-pdf:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(16, 185, 129, 0.5);
    color: #FFFFFF;
}

/* Alerta de no encontrado */
.cert-not-found-box {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    color: #FCA5A5;
}

.cert-not-found-box i {
    font-size: 1.8rem;
    color: #F87171;
    flex-shrink: 0;
    margin-top: 2px;
}

.cert-not-found-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #FFFFFF;
    margin-bottom: 6px;
}

/* ==========================================================================
   Listado para Descarga de Certificados por Cédula
   ========================================================================== */
.cert-download-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cert-download-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    transition: all 0.25s ease;
}

.cert-download-item:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.cert-download-info h4 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #FFFFFF;
    margin-bottom: 6px;
}

.cert-download-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 0.85rem;
    color: #CBD5E1;
}

.cert-download-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.cert-download-meta span i {
    color: #F97316;
}

/* ==========================================================================
   VISTA DE DIPLOMA DIGITAL / IMPRESIÓN OFICIAL (PDF & PRINT)
   ========================================================================== */
.diploma-wrapper {
    background: #0B0F19;
    min-height: 100vh;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.diploma-toolbar {
    width: 100%;
    max-width: 960px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.diploma-frame {
    width: 100%;
    max-width: 960px;
    aspect-ratio: 1.414 / 1;
    background: #FFFFFF;
    color: #0F172A;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.55), 0 0 1px rgba(0, 0, 0, 0.2);
    position: relative;
    border-radius: 6px;
    box-sizing: border-box;
    display: flex;
    flex-direction: row;
    overflow: hidden;
    margin: 0 auto;
}

/* ==========================================================================
   COLUMNA IZQUIERDA: BARRA INSTITUCIONAL AZUL POSGRADO UTMACH
   ========================================================================== */
.diploma-sidebar {
    flex: 0 0 28%;
    width: 28%;
    background: linear-gradient(180deg, #094074 0%, #0C4E8A 55%, #083863 100%);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 1;
}

.diploma-sidebar-watermark {
    position: absolute;
    inset: 0;
    background-image: url('../assets/images/logo-utmach-seal.png');
    background-repeat: no-repeat;
    background-position: center bottom 25px;
    background-size: 195px auto;
    opacity: 0.07;
    pointer-events: none;
}

.diploma-sidebar-content {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 30px 20px 24px;
    box-sizing: border-box;
    text-align: center;
    gap: 28px;
}

.diploma-sidebar-logos {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 10px;
    margin-top: 0;
}

.diploma-sidebar-logo-utmach {
    width: 100%;
    max-width: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.diploma-sidebar-logo-utmach img {
    width: 100%;
    height: auto;
    max-height: 240px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.25));
}

.diploma-sidebar-divider {
    width: 46px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
    margin: 1px 0;
}

.diploma-sidebar-logo-posgrado {
    width: 100%;
    max-width: 86px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.diploma-sidebar-logo-posgrado img {
    width: 100%;
    height: auto;
    max-height: 44px;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.2));
}

.diploma-sidebar-footer {
    width: 100%;
    padding-top: 0;
    margin: 0;
}

.diploma-sidebar-program {
    color: #FFFFFF;
    font-family: 'Outfit', sans-serif;
    font-size: 1.22rem;
    line-height: 1.45;
    font-weight: 400;
    letter-spacing: 0.3px;
    margin: 0;
    text-align: center;
    opacity: 0.98;
}

.diploma-sidebar-program strong {
    font-weight: 800;
    color: #FFFFFF;
    font-size: 1.28rem;
}

/* ==========================================================================
   COLUMNA DERECHA: CUERPO OFICIAL DEL CERTIFICADO
   ========================================================================== */
.diploma-main {
    flex: 1;
    width: 72%;
    background: #FFFFFF;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.diploma-watermark-seal {
    position: absolute;
    right: 10%;
    top: 50%;
    transform: translateY(-50%);
    width: 360px;
    height: 360px;
    background-image: url('../assets/images/logo-utmach-solo.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.04;
    pointer-events: none;
    z-index: 1;
}

.diploma-watermark-text {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%) rotate(-90deg);
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: 5rem;
    font-weight: 900;
    letter-spacing: 16px;
    color: #0A4E88;
    opacity: 0.038;
    pointer-events: none;
    user-select: none;
    z-index: 1;
}

.diploma-main-content {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 100px 36px 20px 36px;
    box-sizing: border-box;
    text-align: center;
}

/* Cabecera / Título */
.diploma-top-row {
    width: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2px;
}

.diploma-title-wrap {
    text-align: center;
}

.diploma-brand-badge {
    position: absolute;
    right: 0;
    top: 0;
}

.diploma-main-title {
    font-family: 'Outfit', sans-serif;
    font-size: 2.35rem;
    font-weight: 800;
    color: #0C4E8A;
    margin: 0 0 6px 0;
    letter-spacing: 1.2px;
    line-height: 1;
    text-align: center;
}

.diploma-grant-label {
    font-family: 'Outfit', sans-serif;
    font-size: 0.92rem;
    font-weight: 700;
    color: #1E293B;
    letter-spacing: 2.2px;
    text-transform: uppercase;
    margin: 0;
    text-align: center;
}

.diploma-signature-image {
    text-align: center;
    margin-bottom: 5px;
}

.diploma-signature-image img {
    width: 150px;
    height: 65px;
    object-fit: contain;
}

.diploma-brand-logo {
    height: 26px;
    width: auto;
    object-fit: contain;
    opacity: 0.88;
}

/* Destinatario */
.diploma-recipient-wrap {
    margin: 2px 0;
    text-align: center;
    width: 100%;
}

.diploma-recipient {
    font-family: 'Outfit', sans-serif;
    font-size: 2.25rem;
    font-weight: 800;
    color: #0F172A;
    letter-spacing: 0.3px;
    line-height: 1.15;
    margin: 0 0 2px 0;
    text-align: center;
    display: inline-block;
}

.diploma-doc-id {
    font-size: 0.86rem;
    font-weight: 600;
    color: #64748B;
    margin: 0;
    text-align: center;
}

/* Divisor decorativo azul con nodo central simétrico */
.diploma-accent-divider {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 440px;
    margin: 6px auto 10px auto;
    gap: 0;
}

.diploma-divider-line {
    flex: 1 1 0;
    height: 2px;
    background: #2563EB;
    min-width: 20px;
}

.diploma-divider-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #2563EB;
    box-shadow: 0 0 0 3px #FFFFFF, 0 0 0 4.5px #2563EB;
    margin: 0 8px;
    flex-shrink: 0;
}

/* Descripción narrativa */
.diploma-description {
    font-family: 'Inter', sans-serif;
    font-size: 0.93rem;
    line-height: 1.6;
    color: #1E293B;
    max-width: 590px;
    margin: 0 auto 4px auto;
    text-align: center;
}

.diploma-description strong {
    color: #0F172A;
    font-weight: 700;
}

.diploma-event-title {
    color: #0C4E8A;
    font-weight: 700;
}

.diploma-date {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    margin: 2px auto 6px auto;
    text-align: center;
}

/* Pie del Diploma: Firma Oficial Centrada y Validación QR */
.diploma-footer {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-top: auto;
    padding-top: 4px;
    gap: 10px;
    width: 100%;
    text-align: center;
}

.diploma-signature-col {
    text-align: center;
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
}

.diploma-signature-line {
    border-top: 1.5px solid #1E293B;
    padding-top: 4px;
    font-size: 0.80rem;
    font-weight: 700;
    color: #0F172A;
    line-height: 1.25;
    text-align: center;
}

.diploma-signature-role {
    font-size: 0.70rem;
    color: #64748B;
    line-height: 1.3;
    margin: 2px 0 0 0;
    text-align: center;
}

.diploma-qr-col {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    padding: 4px 14px 4px 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    margin: 0 auto;
}

.diploma-qr-box {
    width: 44px;
    height: 44px;
    background: #FFFFFF;
    border: 1px solid #CBD5E1;
    border-radius: 6px;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.diploma-qr-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.diploma-qr-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.diploma-qr-code {
    font-size: 0.70rem;
    font-weight: 700;
    color: #334155;
    letter-spacing: 0.4px;
    font-family: monospace;
}

.diploma-qr-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    color: #059669;
    background: rgba(16, 185, 129, 0.14);
    border: 1px solid rgba(16, 185, 129, 0.35);
    border-radius: 999px;
    padding: 2px 8px;
}

/* Soporte para Plantilla Oficial de Fondo Personalizada */
.diploma-frame.diploma-has-bg {
    background-size: 100% 100% !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    border: none !important;
}

/* ==========================================================================
   CONFIGURACIÓN DE IMPRESIÓN OFICIAL: FORMATO A4 HORIZONTAL (LANDSCAPE)
   ========================================================================== */
@page {
    size: A4 landscape;
    margin: 0;
}



/* ========================================================================== 
   VISTA PREVIA RESPONSIVA: escala completa sin deformar el certificado
   La impresión usa el tamaño A4 real, independientemente de la pantalla.
   ========================================================================== */
@media screen {
    .diploma-wrapper {
        box-sizing: border-box;
        width: 100%;
        max-width: 100%;
        padding: 28px clamp(12px, 3vw, 40px);
        min-height: 100dvh;
        justify-content: flex-start;
    }
    .diploma-stage {
        position: relative;
        width: 100%;
        max-width: 960px;
        aspect-ratio: 1.414 / 1;
        margin-inline: auto;
    }
    .diploma-stage > .diploma-frame {
        position: absolute;
        top: 0;
        left: 0;
        width: 960px;
        max-width: none;
        height: calc(960px / 1.414);
        margin: 0;
        transform: scale(var(--diploma-scale, 1));
        transform-origin: top left;
    }
    .diploma-toolbar {
        width: 100%;
        max-width: 960px;
        gap: 12px;
        flex-wrap: wrap;
    }
    .diploma-toolbar > div { min-width: 0; }
    .diploma-toolbar .cert-btn-primary,
    .diploma-toolbar .cert-btn-secondary {
        box-sizing: border-box;
        max-width: 100%;
        text-align: center;
    }
}
@media screen and (max-width: 600px) {
    .diploma-toolbar {
        display: grid;
        grid-template-columns: 1fr;
        margin-bottom: 18px;
    }
    .diploma-toolbar > div { width: 100%; }
    .diploma-toolbar .cert-btn-primary,
    .diploma-toolbar .cert-btn-secondary {
        width: 100%;
        min-height: 44px;
        height: auto !important;
        padding: 10px 14px !important;
        font-size: 0.77rem !important;
        line-height: 1.35;
        flex: none !important;
    }
}

/* ================================================================
   IMPRESIÓN FIEL A LA VISTA DE ESCRITORIO
   El diploma base de 960 x 678.93 px se amplía hasta un A4 apaisado.
   No se alteran tamaños de fuente, espaciados, logos, firma o QR.
   Las reglas responsivas @media screen de arriba permanecen intactas.
   ================================================================ */
@media print {
    *, *::before, *::after {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    html, body {
        width: 297mm !important;
        height: 210mm !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        overflow: hidden !important;
    }
    .diploma-toolbar, .navbar, .top-bar-institutional,
    .cert-breadcrumbs, .cert-tabs-nav {
        display: none !important;
    }
    /* El certificado es todo el contenido de la página. */
    .diploma-wrapper {
        display: block !important;
        width: 297mm !important;
        height: 210mm !important;
        min-height: 0 !important;
        max-width: none !important;
        padding: 0 !important;
        margin: 0 !important;
        background: #fff !important;
        overflow: hidden !important;
    }
    .diploma-stage {
        display: block !important;
        position: relative !important;
        width: 297mm !important;
        height: 210mm !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        aspect-ratio: auto !important;
        overflow: hidden !important;
    }
    .diploma-frame,
    .diploma-stage > .diploma-frame {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 960px !important;
        min-width: 960px !important;
        max-width: none !important;
        height: 678.925px !important;
        min-height: 678.925px !important;
        max-height: none !important;
        aspect-ratio: auto !important;
        display: flex !important;
        flex-direction: row !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        overflow: hidden !important;
        transform-origin: top left !important;
        transform: scale(1.16929134) !important;
        break-inside: avoid !important;
    }
    /* Respetar las medidas originales (28% / 72%) del diploma. */
    .diploma-sidebar { flex: 0 0 28% !important; width: 28% !important; }
    .diploma-main { flex: 1 1 auto !important; width: 72% !important; }
    /* No esconder el pie: contiene la firma y el código QR. */
    .diploma-footer { display: flex !important; }
}
