/* =================================================================
   Perfil do Queixoso - Estilos Finais e Unificados
   ================================================================= */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700;900&display=swap');

:root {
    --primary-color: #d92323; 
    --background-color: #f8f9fa; 
    --text-color: #212529; 
    --border-color: #dee2e6;
}

body {
    font-family: 'Montserrat', sans-serif; 
    line-height: 1.7; 
    background-color: var(--background-color); 
    color: var(--text-color); 
    margin: 0; 
    padding: 20px;
}

.container {
    max-width: 800px; 
    margin: 20px auto; 
    background-color: #ffffff; 
    padding: 30px 40px; 
    border-radius: 12px; 
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}
header { text-align: center; border-bottom: 1px solid var(--border-color); padding-bottom: 20px; margin-bottom: 30px; }
.main-logo { max-width: 150px; margin-bottom: 10px; }
h1 { font-weight: 900; color: #000; }
#welcome-message { color: var(--primary-color); font-weight: 700; }
.profile-section { margin-bottom: 40px; }
h2 { font-weight: 700; margin-bottom: 15px; border-bottom: 2px solid var(--primary-color); padding-bottom: 5px; }
.form-group label { display: block; font-weight: 700; margin-bottom: 8px; }
.input-group { display: flex; gap: 10px; }
.input-group input { flex-grow: 1; padding: 10px 15px; border: 1px solid var(--border-color); border-radius: 8px; font-family: 'Montserrat', sans-serif; font-size: 1rem; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; text-align: center; }
.stat-item { background-color: #f8f9fa; padding: 20px; border-radius: 8px; }
.stat-item h3 { font-size: 0.9rem; color: #6c757d; margin-bottom: 10px; text-transform: uppercase; }
.stat-item p { font-size: 1.8rem; font-weight: 700; color: var(--primary-color); word-break: break-word; }
.leaderboard-section { background-color: #f8f9fa; padding: 20px; border-radius: 12px; }
.leaderboard-section ol { list-style: none; padding-left: 0; margin: 0; }
.leaderboard-section li { display: flex; justify-content: space-between; align-items: center; padding: 12px; border-radius: 8px; margin-bottom: 8px; font-weight: 700; background-color: #fff; border: 1px solid #eee; }
.leaderboard-rank { flex-basis: 50px; }
.leaderboard-name { flex-grow: 1; margin: 0 10px; }
.leaderboard-count { color: var(--primary-color); font-size: 1.1rem; }
.leaderboard-section li:nth-child(1) { background-color: #fff1c2; border-color: #ffd700; }
.leaderboard-section li:nth-child(2) { background-color: #f0f0f0; border-color: #c0c0c0; }
.leaderboard-section li:nth-child(3) { background-color: #ffe7d1; border-color: #cd7f32; }
#history-list .history-item { border: 1px solid #eee; padding: 15px; border-radius: 8px; margin-bottom: 10px; background-color: #fff; }
#history-list .history-item-meta { font-size: 0.8rem; color: #6c757d; margin-bottom: 5px; }
.danger-zone { border: 2px solid var(--primary-color); border-radius: 8px; padding: 20px; background-color: #fff8f8; }
button { font-family: 'Montserrat', sans-serif; font-weight: 700; cursor: pointer; border: none; padding: 12px 25px; border-radius: 50px; background-color: var(--primary-color); color: white; transition: all 0.2s; }
button:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
button:disabled { background-color: #ccc; cursor: not-allowed; }
footer { text-align: center; margin-top: 40px; }
footer a { font-weight: 700; color: var(--primary-color); }
@media (max-width: 600px) { .container { padding: 20px 15px; } .input-group { flex-direction: column; } .stats-grid { grid-template-columns: 1fr; } }

/* ===================================================================== */
/* --- ESTILOS DO CERTIFICADO ---                                      */
/* ===================================================================== */

/* Esconde o template por defeito, posicionando-o fora do ecrã. */
#certificate-template {
    position: absolute;
    left: -9999px;
    top: 0;
    width: 800px;
    height: 565px;
    background-color: #f9f9f9;
    border: 10px solid #e0e0e0;
    padding: 40px;
    font-family: 'Georgia', 'Times New Roman', serif;
    color: #333;
}
#certificate-template .cert-content { display: flex; flex-direction: column; justify-content: space-around; align-items: center; text-align: center; height: 100%; border: 2px solid #ccc; padding: 20px; }
#certificate-template .cert-logo { max-width: 150px; height: auto; margin-bottom: 20px; }
#certificate-template h1 { font-family: 'Georgia', 'Times New Roman', serif; font-size: 2.8em; font-weight: bold; color: #1a237e; margin: 0; border-bottom: none; padding-bottom: 0; }
#certificate-template .cert-intro { font-size: 1.2em; margin: 20px 0 10px 0; }
#certificate-template .cert-name { font-size: 2.5em; font-weight: bold; color: var(--primary-color); margin: 10px 0; border-bottom: 2px solid #e0e0e0; padding-bottom: 10px; width: 90%; }
#certificate-template .cert-body { font-size: 1.3em; line-height: 1.6; margin: 20px 0; }
#certificate-template .cert-body strong { color: #333; font-weight: 700; }
#certificate-template .cert-footer { font-size: 0.9em; color: #666; margin-top: auto; }