/**
 * certificado.css
 * Estilos da tela de emissão e visualização do certificado de participação.
 */

:root {
    --cert-bg: #0f0f15;
    --cert-card-bg: rgba(255, 255, 255, 0.03);
    --cert-border: rgba(255, 255, 255, 0.08);
}

body.certificado-page {
    background: linear-gradient(135deg, #0a0a0f 0%, #150b11 50%, #0d0d12 100%);
    color: var(--white);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.certificado-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.cert-title-section {
    text-align: center;
    margin-bottom: 1rem;
}

.cert-title-section h1 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    color: #ffd700;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 10px rgba(255, 215, 0, 0.2);
}

.cert-title-section p {
    color: #cbd5e0;
    font-size: 1.05rem;
    max-width: 700px;
    margin: 0 auto;
}

/* Grid Layout */
.cert-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 2.5rem;
    align-items: start;
}

@media screen and (max-width: 1024px) {
    .cert-grid {
        grid-template-columns: 1fr;
    }
}

/* Painel de Controle (Glassmorphism) */
.cert-control-panel {
    background: var(--cert-card-bg);
    border: 1px solid var(--cert-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.cert-control-panel::before {
    content: '';
    display: block;
    height: 4px;
    width: 100%;
    background: linear-gradient(90deg, #ffd700, var(--primary-color));
    border-radius: 4px;
    margin-top: -2rem;
    margin-bottom: 1.5rem;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group label {
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #ffd700;
}

.control-group select {
    width: 100%;
    padding: 0.9rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: var(--white);
    font-size: 0.95rem;
    font-family: var(--font-body);
    transition: all 0.3s ease;
    cursor: pointer;
}

.control-group select:focus {
    outline: none;
    border-color: #ffd700;
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.2);
    background: rgba(255, 255, 255, 0.08);
}

.control-group select option {
    background: #0f0f15;
    color: var(--white);
}

.btn-cert {
    width: 100%;
    padding: 1rem;
    border-radius: 50px;
    font-weight: bold;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-family: var(--font-heading);
}

.btn-cert-primary {
    background: linear-gradient(135deg, #ffd700 0%, #e6be00 100%);
    color: #1a0f12;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.25);
}

.btn-cert-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
}

.btn-cert-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-cert-secondary:hover:not(:disabled) {
    background: var(--white);
    color: #1a0f12;
    transform: translateY(-2px);
}

.btn-cert:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Preview do Certificado */
.cert-preview-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    container-type: inline-size;
    width: 100%;
}

/* O frame do certificado (A4 Proporções de Aspecto: 297/210 = 1.414) */
.certificate-frame {
    width: 100%;
    max-width: 850px;
    aspect-ratio: 1.414;
    background: url('fundo-certificado-geral.jpg') center/cover no-repeat;
    box-shadow: 0 20px 45px rgba(0,0,0,0.6);
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 22% 10% 22% 10%; /* Margens para evitar sobreposição com cabeçalho e assinaturas da imagem de fundo */
    color: #333333; /* Texto escuro do papel impresso */
    font-family: 'Montserrat', var(--font-body), sans-serif;
    border: 1px solid rgba(255,255,255,0.1);
}

/* Placeholder quando nenhuma turma está selecionada */
.cert-placeholder {
    width: 100%;
    max-width: 850px;
    aspect-ratio: 1.414;
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    color: #a0aec0;
    background: rgba(255, 255, 255, 0.01);
}

.cert-placeholder span {
    font-size: 4rem;
}

/* Conteúdo de Texto do Certificado */
.cert-content-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: max(10px, 3cqw);
}

.cert-text-title {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: max(18px, 4cqw);
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-top: 1rem;
}

.cert-text-body {
    font-size: max(11px, 2.1cqw);
    line-height: 1.8;
    color: #2d3748;
    font-weight: 500;
    max-width: 680px;
    margin: auto 0;
}

.cert-text-body strong {
    color: var(--primary-color);
    font-weight: 700;
}

/* Grid de Notas do Certificado */
.cert-scores-grid {
    display: flex;
    justify-content: center;
    gap: max(15px, 4.5cqw);
    background: rgba(138, 21, 56, 0.05);
    border: 1.5px solid rgba(138, 21, 56, 0.12);
    border-radius: 10px;
    padding: max(6px, 1.5cqw) max(15px, 4.5cqw);
    margin-top: auto;
    margin-bottom: 1.5rem;
}

.cert-score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cert-score-item .score-lbl {
    font-size: max(8px, 1.2cqw);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #718096;
}

.cert-score-item .score-val {
    font-family: var(--font-heading);
    font-size: max(13px, 2.5cqw);
    font-weight: 800;
    color: var(--primary-color);
}

.cert-apae-badge {
    background: rgba(40, 167, 69, 0.05);
    border: 1.5px solid rgba(40, 167, 69, 0.2);
    border-radius: 10px;
    padding: 0.8rem 2.5rem;
    margin-top: auto;
    margin-bottom: 1.5rem;
    color: #28a745;
    font-weight: bold;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Assinaturas Proporcionais */
.cert-signatures {
    width: 100%;
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    margin-top: auto;
}

.signature-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: max(100px, 21cqw);
}

.signature-line {
    width: 100%;
    height: 1px;
    background-color: #a0aec0;
    margin-bottom: 6px;
}

.signature-name {
    font-size: max(8px, 1.35cqw);
    font-weight: bold;
    color: #4a5568;
}

.signature-title {
    font-size: max(7px, 1.15cqw);
    color: #718096;
}

/* Estilos de Impressão */
@media print {
    @page {
        size: A4 landscape;
        margin: 0;
    }

    html, body.certificado-page {
        background: none !important;
        color: #000 !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        height: 100% !important;
        overflow: hidden !important;
    }

    .no-print {
        display: none !important;
    }

    .certificado-container {
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        height: 100% !important;
    }

    .cert-grid {
        display: block !important;
    }

    .cert-preview-area {
        width: 100% !important;
        height: 100% !important;
    }

    .certificate-frame {
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 100% !important;
        aspect-ratio: auto !important;
        margin: 0 !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        border: none !important;
        page-break-inside: avoid !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        padding: 22% 12% 22% 12% !important;
        background: url('fundo-certificado-geral.jpg') center / 100% 100% no-repeat !important;
    }

    .cert-text-title {
        font-size: 2.8rem !important;
    }

    .cert-text-body {
        font-size: 1.25rem !important;
        max-width: 850px !important;
    }

    .cert-scores-grid, .cert-apae-badge {
        padding: 1rem 3.5rem !important;
        margin-bottom: 2rem !important;
    }

    .cert-score-item .score-val {
        font-size: 1.6rem !important;
    }

    .signature-name {
        font-size: 0.8rem !important;
    }

    .signature-title {
        font-size: 0.7rem !important;
    }
}
