/* =================================================================
   Queixómetro Nacional v4.0 - Estilos com Branding e Narrativa
   ================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700;900&display=swap');

/* --- Variáveis Globais --- */
:root {
    --primary-color: #d92323;
    --background-color: #f8f9fa;
    --text-color: #212529;
    --text-secondary-color: #6c757d;
    --container-bg-color: #ffffff;
    --container-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    --border-color: #dee2e6;
}

/* --- Reset e Estilos Base --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

/* --- Layout Principal --- */
.container {
    background-color: var(--container-bg-color);
    padding: 25px 35px;
    border-radius: 16px;
    box-shadow: var(--container-shadow);
    text-align: center;
    max-width: 550px;
    width: 100%;
}

/* --- Cabeçalho e Branding --- */
header {
    margin-bottom: 25px;
}

/* NOVO: Estilo para o logotipo principal */
.main-logo {
    max-width: 200px;
    height: auto;
    margin-bottom: 10px;
}

header h1 {
    font-weight: 900;
    font-size: clamp(2rem, 8vw, 2.8rem);
    margin-bottom: 5px;
}

header p {
    font-size: 1.1rem;
    color: var(--text-secondary-color);
}

/* --- Secção de Perfil e Login --- */
#profile-section, #login-prompt-section {
    font-size: 0.9rem;
    color: var(--text-secondary-color);
    padding: 5px 0;
    text-align: right;
    min-height: 25px;
    margin-bottom: 10px;
}

#profile-section {
    display: flex;
    align-items: center;
    justify-content: flex-end; /* Garante alinhamento à direita */
    gap: 15px;
}

#profile-section span {
    font-weight: 700;
}

.profile-link {
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}
.profile-link:hover {
    text-decoration: underline;
}

#logout-button, #login-button {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-weight: 700;
    text-decoration: underline;
    font-size: 0.9rem;
}

/* --- Secção de Estatísticas Rápidas --- */
.rankings {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    background-color: var(--background-color);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 30px;
}

.ranking-item h3 {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary-color);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ranking-item p {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-color);
    word-break: break-word;
}

/* --- Secção do Pódio (Leaderboard) --- */
.leaderboard-section {
    margin-bottom: 30px;
    text-align: left;
    background-color: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.04);
}

.leaderboard-section h3 {
    text-align: center;
    font-weight: 700;
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.leaderboard-section ol {
    list-style: none;
    padding-left: 0;
}

.leaderboard-section li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-weight: 700;
    transition: transform 0.2s ease-in-out;
}
.leaderboard-section li:last-child {
    margin-bottom: 0;
}

.leaderboard-section .leaderboard-name {
    flex-grow: 1;
}

.leaderboard-section .leaderboard-count {
    color: var(--primary-color);
    font-size: 1.1rem;
}

/* Medalhas */
.leaderboard-section li:nth-child(1) { background-color: #fff1c2; border: 1px solid #ffd700; }
.leaderboard-section li:nth-child(2) { background-color: #f0f0f0; border: 1px solid #c0c0c0; }
.leaderboard-section li:nth-child(3) { background-color: #ffe7d1; border: 1px solid #cd7f32; }


/* --- Zona de Interação (Formulário) --- */
.interaction-zone {
    border-top: 1px solid var(--border-color);
    padding-top: 25px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.selection-group {
    width: 100%;
    text-align: left;
}

.selection-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    font-size: 1rem;
}

select, textarea {
    width: 100%;
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 1rem;
    font-family: 'Montserrat', sans-serif;
    background-color: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(217, 35, 35, 0.2);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

#queixa-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 700;
    margin-top: 10px;
    transition: all 0.2s ease-in-out;
}

#queixa-button:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(217, 35, 35, 0.3);
}

#queixa-button:disabled {
    background-color: #cccccc;
    color: #666666;
    cursor: not-allowed;
}

/* NOVO: Estilos para a secção do slogan */
.slogan-section {
    margin-top: 40px;
    padding-top: 25px;
    border-top: 1px solid var(--border-color);
}
.slogan-section img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
}

/* --- Rodapé --- */
footer {
    margin-top: 30px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: #b3b3b3;
    line-height: 1.5;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
}
footer a:hover {
    text-decoration: underline;
}

/* --- Modal de Login --- */
.hidden {
    display: none !important;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.modal-content h2 { margin-bottom: 15px; }
.modal-content p { margin-bottom: 20px; color: #555; }
.modal-content button { width: 100%; padding: 12px; border-radius: 8px; border: none; cursor: pointer; font-weight: 700; }

.consent-group {
    font-size: 0.8rem;
    margin: 15px 0;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}
.consent-group input {
    width: auto;
    margin-right: 5px;
}
.consent-group a {
    color: var(--primary-color);
    text-decoration: underline;
}

#send-link-button {
    background-color: var(--primary-color);
    color: white;
    margin-bottom: 10px;
}
#close-modal-button {
    background: #eee;
    color: #333;
}

/* =================================================================
   Media Queries para Responsividade (Telemóveis)
   ================================================================= */
@media (max-width: 600px) {

    body {
        padding: 10px; /* Reduz o padding geral em ecrãs pequenos */
    }

    .container {
        padding: 20px 15px;
    }

    /* NOVO: Ajusta o tamanho do logotipo para telemóveis */
    .main-logo {
        max-width: 150px;
    }

    header h1 {
        font-size: 2rem;
    }
    
    #profile-section {
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 5px 10px;
    }
    #profile-section span {
        width: 100%;
        text-align: right;
    }
    
    .rankings {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    #queixa-button {
        font-size: 1.1rem;
        padding: 12px 25px;
    }
}

/* ====== ESTILOS PARA A NOVA BARRA DE NAVEGAÇÃO E LOJA ====== */
.main-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    background-color: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    margin: 20px 0;
}

.main-nav a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 5px;
    transition: background-color 0.3s, color 0.3s;
}

.main-nav a:hover {
    background-color: #f4f4f9;
}

/* Destaque especial para o link da Loja */
.main-nav .loja-link {
    background-color: #d9534f; /* Vermelho queixómetro */
    color: #fff;
    box-shadow: 0 2px 8px rgba(217, 83, 79, 0.4);
    transition: transform 0.2s, background-color 0.3s;
}

.main-nav .loja-link:hover {
    background-color: #c9302c;
    transform: translateY(-2px);
}