/* ========== RESET ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Trebuchet MS', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 30px 15px;
    min-height: 100vh;
}

/* ========== HEADER LOGO ========== */
.header-logo {
    text-align: center;
    margin-bottom: 25px;
}

.header-logo img {
    max-width: 200px;
    height: auto;
}

/* ========== CONTENEDOR PRINCIPAL ========== */
.certificate-container {
    max-width: 1400px;
    margin: 0 auto;
}

.certificate-wrapper {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 25px;
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* ========== PANEL LATERAL IZQUIERDO (INFORMACIÓN) ========== */
.info-panel {
    background: #f8f9fa;
    padding: 35px 25px;
    border-right: 1px solid #e0e0e0;
}

.info-header {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #dee2e6;
}

.info-header h2 {
    font-size: 22px;
    color: #2c3e50;
    margin-bottom: 8px;
    font-weight: 700;
}

.info-header p {
    font-size: 13px;
    color: #6c757d;
    margin: 0;
}

.info-section {
    margin-bottom: 22px;
}

.info-label {
    font-size: 11px;
    font-weight: 700;
    color: #868e96;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 6px;
}

.info-value {
    font-size: 15px;
    color: #2c3e50;
    font-weight: 500;
    line-height: 1.5;
}

.info-value.large {
    font-size: 17px;
    color: #667eea;
    font-weight: 700;
}

.info-description {
    background: #e7f3ff;
    border-left: 3px solid #0084d4;
    padding: 12px;
    margin-top: 20px;
    border-radius: 5px;
}

.info-description p {
    font-size: 13px;
    color: #2c3e50;
    line-height: 1.6;
    margin: 0;
}

.verification-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #d4edda;
    color: #155724;
    padding: 8px 14px;
    border-radius: 25px;
    font-size: 13px;
    font-weight: 600;
    margin-top: 5px;
}

.verification-badge::before {
    content: "✓";
    background: #28a745;
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
}

.code-display {
    background: white;
    border: 2px dashed #667eea;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    margin-top: 25px;
}

.code-display .label {
    font-size: 10px;
    color: #868e96;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.code-display .code {
    font-size: 19px;
    font-weight: 700;
    color: #667eea;
    font-family: 'Courier New', monospace;
}

.logos-container {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
}

.logos-container img {
    max-width: 130px;
    height: auto;
}

/* ========== ÁREA DEL CERTIFICADO (DERECHA) ========== */
.certificate-area {
    padding: 35px 25px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.certificate-background {
    position: relative;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    aspect-ratio: 16 / 12;

    /* Imagen de fondo del certificado */
    background-image: url('../images/certificate-template.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: scroll;
    background-color: white;

    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.certificate-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 60px 80px;
}

/* ========== TEXTO SUPERPUESTO EN EL CERTIFICADO ========== */
.cert-code {
    position: absolute;
    top: 55px;
    right: 70px;
    font-size: 18px;
    font-weight: bold;
    color: #b0b0b0;
    letter-spacing: 0.5px;
}

.cert-participant {
    position: absolute;
    top: 42%;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    text-align: center;
    font-size: 30px;
    font-weight: bold;
    color: #000;
    letter-spacing: 0.5px;
    line-height: 1.2;
    text-transform: uppercase;
}

.cert-program {
    position: absolute;
    top: 56%;
    left: 50%;
    transform: translateX(-50%);
    width: 85%;
    text-align: center;
    font-size: 22px;
    font-weight: bold;
    color: #000;
    letter-spacing: 0.3px;
    line-height: 1.3;
    text-transform: uppercase;
}

.cert-duration {
    position: absolute;
    top: 63%;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    text-align: center;
    font-size: 15px;
    color: #a0a0a0;
}

.qr-code-position {
    position: absolute;
    top: 80px;
    right: 75px;
}

.qr-img {
    width: 100px;
    height: 100px;
    border: 2px solid #000;
}

/* ========== BOTONES DE ACCIÓN ========== */
.action-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    flex: 1;
    min-width: 140px;
    padding: 13px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
}

.btn-back {
    background: #6c757d;
    color: white;
}

.btn-back:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.3);
}

.btn-print {
    background: #0084d4;
    color: white;
}

.btn-print:hover {
    background: #006bb3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 132, 212, 0.3);
}

.btn-download {
    background: #667eea;
    color: white;
}

.btn-download:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* ========== COMPARTIR EN REDES ========== */
.share-section {
    text-align: center;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.share-section h4 {
    font-size: 14px;
    color: #495057;
    margin-bottom: 12px;
    font-weight: 600;
}

.social-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.social-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    font-weight: bold;
    text-decoration: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.social-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.social-btn.facebook {
    background: #1877f2;
}

.social-btn.twitter {
    background: #000;
}

.social-btn.linkedin {
    background: #0077b5;
}

.social-btn.whatsapp {
    background: #25d366;
}

/* ========== ERROR ========== */
.error-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.error-box {
    background: white;
    padding: 40px 50px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
}

.error-icon {
    font-size: 60px;
    margin-bottom: 20px;
}

.error-box h1 {
    font-size: 26px;
    color: #dc3545;
    margin-bottom: 15px;
}

.error-msg {
    font-size: 16px;
    color: #6c757d;
    margin-bottom: 25px;
    line-height: 1.6;
}

.btn-return {
    display: inline-block;
    padding: 12px 30px;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-return:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* ========== IMPRESIÓN ========== */
@media print {
    @page {
        size: landscape;
        margin: 0;
    }

    body {
        background: white;
        padding: 0;
        margin: 0;
    }

    .certificate-container {
        max-width: 100%;
        padding: 0;
        margin: 0;
    }

    .certificate-wrapper {
        display: block;
        box-shadow: none;
        border-radius: 0;
    }

    .info-panel {
        display: none !important;
    }

    .certificate-area {
        padding: 0;
        margin: 0;
    }

    .certificate-background {
        max-width: 100%;
        width: 100vw;
        height: 100vh;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
        page-break-inside: avoid;
        background-attachment: scroll;
        aspect-ratio: 16 / 12;
        position: relative;
    }

    .certificate-overlay {
        padding: 60px 80px;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }

    .no-print,
    .action-buttons,
    .share-section {
        display: none !important;
    }

    /* Forzar colores exactos */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    /* Mantener las mismas posiciones que en pantalla */
    .cert-code {
        position: absolute;
        top: 55px;
        right: 70px;
        font-size: 18px;
        font-weight: bold;
        color: #b0b0b0;
    }

    .cert-participant {
        position: absolute;
        top: 42%;
        left: 50%;
        transform: translateX(-50%);
        width: 90%;
        text-align: center;
        font-size: 30px;
        font-weight: bold;
        color: #000;
        text-transform: uppercase;
    }

    .cert-program {
        position: absolute;
        top: 56%;
        left: 50%;
        transform: translateX(-50%);
        width: 85%;
        text-align: center;
        font-size: 22px;
        font-weight: bold;
        color: #000;
        text-transform: uppercase;
    }

    .cert-duration {
        position: absolute;
        top: 63%;
        left: 50%;
        transform: translateX(-50%);
        width: 90%;
        text-align: center;
        font-size: 15px;
        color: #a0a0a0;
    }

    .qr-code-position {
        position: absolute;
        top: 80px;
        right: 75px;
    }

    .qr-img {
        width: 100px;
        height: 100px;
        border: 2px solid #000;
    }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1100px) {
    .certificate-wrapper {
        grid-template-columns: 1fr;
    }

    .info-panel {
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
}

/* ========== RESPONSIVE TABLET ========== */
@media (max-width: 1024px) {
    .certificate-background {
        margin: 0 auto;
    }

    .certificate-overlay {
        padding: 50px 60px;
    }

    .cert-participant {
        font-size: 26px;
    }

    .cert-program {
        font-size: 20px;
    }

    .cert-duration {
        font-size: 14px;
    }
}

/* ========== RESPONSIVE MÓVIL ========== */
@media (max-width: 768px) {
    body {
        padding: 10px 0;
    }

    .certificate-area {
        padding: 20px 15px;
    }

    .certificate-background {
        border-radius: 5px;
    }

    .certificate-overlay {
        padding: 30px 20px;
    }

    .cert-code {
        font-size: 10px;
        top: 21px;
        right: 21px;
    }

    .cert-participant {
        font-size: 18px;
        top: 40%;
    }

    .cert-program {
        font-size: 15px;
        top: 54%;
    }

    .cert-duration {
        font-size: 12px;
        top: 62%;
    }

    .qr-code-position {
        top: 35px;
        right: 30px;
    }

    .qr-img {
        width: 70px;
        height: 70px;
    }

    .btn {
        min-width: 100px;
        font-size: 13px;
        padding: 11px 15px;
    }

    .info-panel {
        padding: 25px 20px;
    }

    .logos-container {
        flex-direction: column;
    }

    .logos-container img {
        max-width: 150px;
    }

    .action-buttons {
        flex-direction: column;
        align-items: center;
    }

    .btn {
        width: 100%;
        max-width: 280px;
    }

    .social-buttons {
        flex-direction: column;
        align-items: center;
    }

    .social-btn {
        /*width: 100%;*/
        max-width: 280px;
        justify-content: center;
    }
}

/* ========== RESPONSIVE MÓVIL PEQUEÑO ========== */
@media (max-width: 480px) {
    .cert-participant {
        font-size: 11px;
    }

    .cert-program {
        font-size: 9px;
    }

    .cert-duration {
        font-size: 8px;
    }

    .qr-img {
        width: 40px;
        height: 40px;
    }
}
