/* Explain: Estilos para el módulo de certificado de finalización, incluyendo visualización y estilos de impresión para PDF. */
/* ===================== Certificado de Finalización ===================== */

.tb-cert-root {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
    padding: 1rem;
    padding-top: max(4.25rem, calc(3rem + env(safe-area-inset-top, 0px)));
    background: rgba(0, 0, 0, 0.9);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    font-family: var(--font-body, 'Inter', sans-serif);
    -webkit-overflow-scrolling: touch;
}

.tb-cert-root.is-open {
    display: flex;
}

.tb-cert-toolbar {
    position: fixed;
    top: max(1rem, env(safe-area-inset-top, 0px));
    right: 1rem;
    left: 1rem;
    z-index: 2100;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
}

.tb-cert-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 42px;
    padding: 0 1.05rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-weight: 800;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 200ms ease, transform 200ms ease;
}

.tb-cert-btn:hover {
    background: rgba(255, 255, 255, 0.24);
}

.tb-cert-btn-primary {
    border-color: transparent;
    background: #ff5722;
    box-shadow: 0 10px 26px rgba(255, 87, 34, 0.45);
}

.tb-cert-btn-primary:hover {
    background: #e64a19;
}

.tb-cert-sheet {
    position: relative;
    margin: auto;
    width: 100%;
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    padding: clamp(1.4rem, 3.6vw, 3.25rem);
    background: #ffffff;
    color: #0b0b0b;
    border: 4px solid #0a0a0a;
    border-radius: 16px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.65);
    overflow: hidden;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.tb-cert-sheet::before {
    content: '';
    position: absolute;
    inset: clamp(0.55rem, 1.4vw, 1.05rem);
    border: 1.5px solid rgba(255, 87, 34, 0.5);
    border-radius: 9px;
    pointer-events: none;
}

.tb-cert-sheet::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url('https://files.cdn-files-a.com/uploads/12347122/normal_gi-6a9402cdb5378.jpg?format=avif');
    background-size: cover;
    background-position: center;
    opacity: 0.05;
    pointer-events: none;
}

.tb-cert-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: clamp(0.7rem, 1.9vw, 1.6rem);
    text-align: center;
}

.tb-cert-head {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(0.5rem, 1.6vw, 1.05rem);
}

.tb-cert-head img {
    height: clamp(30px, 4.8vw, 56px);
    width: auto;
    object-fit: contain;
}

.tb-cert-brand {
    font-family: var(--font-heading, 'Poppins', sans-serif);
    font-weight: 800;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    font-size: clamp(0.6rem, 1.4vw, 1rem);
    color: #0a0a0a;
}

.tb-cert-kicker {
    margin: 0;
    font-size: clamp(0.55rem, 1.15vw, 0.82rem);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    font-weight: 800;
    color: #b8420f;
}

.tb-cert-title {
    margin: 0;
    font-family: var(--font-heading, 'Poppins', sans-serif);
    font-size: clamp(1.5rem, 4vw, 2.85rem);
    font-weight: 800;
    line-height: 1.05;
    color: #0a0a0a;
}

.tb-cert-title span {
    color: #ff5722;
}

.tb-cert-lead {
    margin: 0;
    font-size: clamp(0.7rem, 1.5vw, 1.02rem);
    color: #4b5563;
}

.tb-cert-name {
    margin: 0 auto;
    align-self: center;
    max-width: 94%;
    font-family: var(--font-heading, 'Poppins', sans-serif);
    font-size: clamp(1.45rem, 4.6vw, 3.05rem);
    font-weight: 800;
    color: #b8420f;
    padding-bottom: 0.2em;
    border-bottom: 2px solid rgba(184, 66, 15, 0.28);
    word-break: break-word;
}

.tb-cert-course {
    margin: 0;
    font-family: var(--font-heading, 'Poppins', sans-serif);
    font-size: clamp(1rem, 2.6vw, 1.75rem);
    font-weight: 800;
    color: #0a0a0a;
}

.tb-cert-note {
    margin: 0;
    font-size: clamp(0.6rem, 1.25vw, 0.85rem);
    color: #6b7280;
    font-weight: 600;
}

.tb-cert-foot {
    margin-top: auto;
    padding-top: clamp(0.7rem, 2vw, 1.6rem);
    border-top: 1px solid rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: clamp(0.6rem, 2vw, 2rem);
}

.tb-cert-col {
    flex: 1 1 0;
    text-align: center;
}

.tb-cert-label {
    margin: 0;
    font-size: clamp(0.5rem, 1.05vw, 0.72rem);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-weight: 700;
    color: #6b7280;
}

.tb-cert-label-gap {
    margin-top: 0.55rem;
}

.tb-cert-strong {
    margin: 0.1rem 0 0;
    font-family: var(--font-heading, 'Poppins', sans-serif);
    font-size: clamp(0.78rem, 1.65vw, 1.08rem);
    font-weight: 800;
    color: #0a0a0a;
}

.tb-cert-code {
    margin: 0.1rem 0 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: clamp(0.62rem, 1.35vw, 0.9rem);
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #0a0a0a;
}

.tb-cert-sign {
    margin: 0;
    font-family: 'Brush Script MT', 'Segoe Script', cursive;
    font-size: clamp(1.05rem, 2.5vw, 1.85rem);
    color: #0a0a0a;
}

.tb-cert-seal {
    flex: 0 0 auto;
    width: clamp(70px, 13vw, 140px);
    height: clamp(70px, 13vw, 140px);
    border-radius: 50%;
    border: 2px dashed #b8420f;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotate(-8deg);
    background: radial-gradient(circle at 50% 38%, rgba(255, 215, 0, 0.22), rgba(255, 87, 34, 0.08));
}

.tb-cert-seal-inner {
    width: 78%;
    height: 78%;
    border-radius: 50%;
    border: 1.5px solid #ff5722;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.12em;
    text-align: center;
    color: #b8420f;
}

.tb-cert-seal-inner i {
    font-size: clamp(0.85rem, 1.9vw, 1.5rem);
    color: #ff5722;
}

.tb-cert-seal-inner span {
    font-size: clamp(0.34rem, 0.8vw, 0.54rem);
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1.15;
}

/* ---------- Impresión / guardado en PDF del certificado ---------- */
@media print {
    body.tb-cert-printing > *:not(.tb-cert-root) {
        display: none !important;
    }

    body.tb-cert-printing .tb-cert-root {
        position: static !important;
        display: block !important;
        overflow: visible !important;
        padding: 0 !important;
        background: #ffffff !important;
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
    }

    body.tb-cert-printing .tb-cert-toolbar {
        display: none !important;
    }

    body.tb-cert-printing .tb-cert-sheet {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        border-radius: 0 !important;
        border-width: 8px !important;
        box-shadow: none !important;
    }

    @page {
        size: A4 landscape;
        margin: 0;
    }
}