/* ===== CONFIGURAÇÕES GERAIS ===== */
.mgest-wrapper {
    font-family: 'Inter', sans-serif;
    text-align: center;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    max-width: 1200px;
}

.mgest-form {
    margin-bottom: 30px;
    padding: 20px;
    background: #f5f5f5;
    border-radius: 10px;
}

.mgest-form input[type="text"] {
    width: 100%;
    max-width: 400px;
    padding: 12px 20px;
    font-size: 16px;
    border: 2px solid #4b2d83;
    border-radius: 5px;
    margin-bottom: 15px;
    font-family: 'Inter', sans-serif;
}

.mgest-form input[type="text"]:focus {
    outline: none;
    border-color: #6b3fa0;
}

.mgest-btn-gerar {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    background: #4b2d83;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
}

.mgest-btn-gerar:hover {
    background: #6b3fa0;
    transform: translateY(-2px);
}

.hidden {
    display: none !important;
}

/* ===== CONFIGURAÇÕES PARA IMPRESSÃO/PDF ===== */
@media print {
    @page {
        size: A4 landscape;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    body, html {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        height: 100% !important;
        overflow: hidden !important;
    }
    
    .mgest-wrapper {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        height: 100% !important;
    }
    
    .mgest-form,
    .mgest-acoes-container {
        display: none !important;
    }
    
    * {
        print-color-adjust: exact !important;
        -webkit-print-color-adjust: exact !important;
    }
}

/* ===== CERTIFICADO ===== */
.mgest-certificado {
    width: 297mm;
    height: 210mm;
    background: #fff;
    box-sizing: border-box;
    margin: 20px auto;
    position: relative;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

@media print {
    .mgest-certificado {
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        page-break-inside: avoid;
        page-break-after: avoid;
    }
}

/* ===== HEADER ===== */
.mgest-topo {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 225px;
    background-image: url('../assets/images/header_background.webp'), url('../assets/images/header_background.png');
    background-size: cover;
    background-position: center;
    background-color: #4b2d83;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

@media print {
    .mgest-topo {
        height: 200px !important;
        margin-top: -10px !important;
    }
}

/* ===== LOGOS DO HEADER ===== */
.mgest-logo-esq {
    position: absolute;
    top: 10px;
    left: 10px;
    height: 70px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
    margin: 0;
}

@media print {
    .mgest-logo-esq {
        top: 5px !important;
        left: 5px !important;
        height: 65px !important;
        max-width: 180px !important;
    }
}

.mgest-logo-dir {
    position: absolute;
    top: 10px;
    right: 20px;
    height: 80px;
    width: auto;
    max-width: 250px;
    object-fit: contain;
    margin: 0;
}

@media print {
    .mgest-logo-dir {
        top: 5px !important;
        right: 10px !important;
        height: 70px !important;
        max-width: 220px !important;
    }
}

/* TÍTULO CERTIFICADO */
.mgest-titulo-certificado {
    position: relative;
    margin: -95px 0 0 0;
    font-family: 'Inter', sans-serif;
    font-size: 120px;
    font-weight: 900;
    letter-spacing: 0em;
    line-height: 1;
    text-transform: uppercase;
    color: #ffffff;
    z-index: 2;
    padding: 0;
}

@media print {
    .mgest-titulo-certificado {
        margin: -85px 0 0 0 !important;
    }
}

/* SUBTÍTULOS */
.mgest-evento-nome {
    font-weight: bold;
    font-size: 30px;
    margin: 20px 0 0 0;
    color: #4b2d83;
    padding: 0;
}

@media print {
    .mgest-evento-nome {
        margin: 15px 0 0 0 !important;
    }
}

#mgest-nome-certificado {
    font-family: 'Alex Brush', cursive;
    font-size: 60px;
    color: #4b2d83;
    line-height: 1;
    margin: 25px 0 30px 0;
    padding: 0;
}

@media print {
    #mgest-nome-certificado {
        margin: 20px 0 25px 0 !important;
    }
}

#mgest-nome-certificado::after {
    content: "";
    display: block;
    width: 550px;
    height: 2px;
    background-color: #6b3fa0;
    margin: 0px auto 0 auto;
}

@media print {
    #mgest-nome-certificado::after {
        margin-top: -3px !important;
    }
}

/* ===== CONTEÚDO PRINCIPAL ===== */
.mgest-certificado > div:not(.mgest-topo):not(.mgest-rodape) {
    padding: 0 30mm;
    box-sizing: border-box;
}

@media print {
    .mgest-certificado > div:not(.mgest-topo):not(.mgest-rodape) {
        padding: 0 20mm !important;
    }
}

.mgest-texto {
    font-family: 'Inter', sans-serif;
    font-size: 18px;
    line-height: 2;
    color: #4b2d83;
    max-width: 80%;
    margin: 10px auto;
    text-align: justify;
    padding: 0;
}

@media print {
    .mgest-texto {
        margin: 5px auto !important;
        max-width: 85% !important;
    }
}

.mgest-tema {
    font-family: 'Inter', sans-serif;
    font-size: 26px;
    color: #4b2d83;
    font-style: italic;
    font-weight: bold;
    margin: 50px 0 0 0;
    padding: 0;
}

@media print {
    .mgest-tema {
        margin: 40px 0 0 0 !important;
    }
}

/* ===== RODAPÉ ===== */
.mgest-rodape {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 40px;
    padding: 0 120px;
    width: 100%;
    box-sizing: border-box;
    position: absolute;
    bottom: 5mm;
}

@media print {
    .mgest-rodape {
        margin-top: 20px !important;
        padding: 0 30px !important;
        bottom: -5mm !important;
        position: absolute !important;
    }
}

/* LOGO RODAPÉ ESQUERDA */
.mgest-logo-fdc-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin: 0;
    padding: 0;
}

.mgest-logo-fdc-container .mgest-logo-fdc {
    height: 60px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
    margin: 0;
}

@media print {
    .mgest-logo-fdc-container .mgest-logo-fdc {
        height: 55px !important;
        max-width: 180px !important;
    }
}

/* ASSINATURA RODAPÉ DIREITA */
.mgest-assinatura-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin: 0;
    padding: 0;
}

.mgest-assinatura {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: -22px;
    padding: 0;
}

@media print {
    .mgest-assinatura {
        margin-top: -18px !important;
    }
}

.mgest-img-assinatura {
    width: 192px;
    height: auto;
    max-height: 80px;
    object-fit: contain;
    margin-bottom: -40px;
    padding: 0;
}

@media print {
    .mgest-img-assinatura {
        width: 180px !important;
        max-height: 70px !important;
        margin-bottom: -35px !important;
    }
}

.mgest-linha-assinatura {
    width: 200px;
    height: 2px;
    background-color: #6b3fa0;
    margin-bottom: 4px;
    padding: 0;
}

@media print {
    .mgest-linha-assinatura {
        width: 150px !important;
    }
}

.mgest-cargo-assinatura {
    font-size: 13px;
    color: #6b3fa0;
    margin-top: 2px;
    text-align: center;
    padding: 0;
}

@media print {
    .mgest-cargo-assinatura {
        font-size: 12px !important;
    }
}

/* ===== AÇÕES DO CERTIFICADO ===== */
.mgest-acoes-container {
    margin: 20px 0;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.mgest-btn-acao {
    padding: 12px 25px;
    font-size: 16px;
    font-weight: 600;
    background: #4b2d83;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
}

.mgest-btn-acao:hover {
    background: #6b3fa0;
    transform: translateY(-2px);
}

.mgest-btn-acao:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* ===== POPUP ===== */
.mgest-popup {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    overflow: auto;
}

.mgest-popup.hidden {
    display: none !important;
}

.mgest-popup:not(.hidden) {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.mgest-popup-content {
    background-color: #fefefe;
    margin: auto;
    padding: 20px;
    border-radius: 10px;
    max-width: 95%;
    max-height: 95%;
    overflow: auto;
    position: relative;
}

.mgest-fechar-popup {
    color: #aaa;
    position: absolute;
    right: 10px;
    top: 10px;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10000;
    background: white;
    width: 40px;
    height: 40px;
    line-height: 35px;
    text-align: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.mgest-fechar-popup:hover,
.mgest-fechar-popup:focus {
    color: #000;
    background: #f0f0f0;
}

/* ===== AJUSTES RESPONSIVOS ===== */
@media screen and (max-width: 1200px) {
    .mgest-certificado {
        width: 100%;
        height: auto;
        aspect-ratio: 297/210;
    }
    
    .mgest-titulo-certificado {
        font-size: 10vw;
    }
    
    .mgest-evento-nome {
        font-size: 2.5vw;
    }
    
    #mgest-nome-certificado {
        font-size: 5vw;
    }
    
    .mgest-texto {
        font-size: 1.5vw;
    }
    
    .mgest-tema {
        font-size: 2.2vw;
    }
}

/* ===== AJUSTES ESPECÍFICOS PARA PDF ===== */
@media print {
    .mgest-certificado > * {
        max-width: 100% !important;
    }
    
    .mgest-certificado > div {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    .mgest-certificado > div:not(.mgest-topo):not(.mgest-rodape) {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding-top: 10mm !important;
        padding-bottom: 10mm !important;
    }
    
    .mgest-topo {
        position: relative !important;
        top: 0 !important;
    }
    
    .mgest-rodape {
        position: absolute !important;
        bottom: 10mm !important;
        left: 0;
        right: 0;
    }
}
