/* ==========================================================================
   VARS & CONFIGURAÇÕES GERAIS
   ========================================================================== */
:root {
    --primary-color: #0056b3;
    --primary-hover: #004085;
    --danger-color: #dc3545;
    --danger-hover: #bd2130;
    --success-color: #28a745;
    --success-hover: #218838;
    --background-color: #f4f6f9;
    --card-color: #ffffff;
    --text-color: #333333;
    --border-color: #cccccc;
}

* {
    box-sizing: border-box; /* Garante que padding não quebre o tamanho do elemento */
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.5;
    padding: 20px;
}

/* ==========================================================================
   CONTAINERS E ESTRUTURA (ADAPTÁVEIS)
   ========================================================================== */
.container, .feed-container, .painel-container, .login-container {
    width: 100%;
    max-width: 650px;
    margin: 30px auto;
    background: var(--card-color);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

/* Containers maiores para o feed e painel */
.feed-container { max-width: 750px; }
.painel-container { max-width: 1100px; }
.login-container { max-width: 420px; margin-top: 80px; }

h1 {
    font-size: 24px;
    color: var(--primary-color);
    margin-bottom: 15px;
    text-align: center;
}

/* Elementos de aviso */
.aviso-topo {
    font-size: 14px;
    background-color: #e2e3e5;
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 25px;
    border-left: 4px solid #6c757d;
}

/* ==========================================================================
   FORMULÁRIOS & ENTRADAS (TOUCH FRIENDLY)
   ========================================================================== */
label {
    display: block;
    font-weight: bold;
    margin-bottom: 6px;
    font-size: 14px;
}

select, textarea, input[type="password"], input[type="file"] {
    width: 100%;
    padding: 12px; /* Aumentado para facilitar o clique no celular */
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 16px; /* Evita que o iOS dê zoom automático ao focar no campo */
    background: #fff;
}

textarea {
    resize: vertical;
    min-height: 120px;
}

/* Checkbox e Alerta Legal */
.alerta-legal {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background-color: #f8d7da;
    color: #721c24;
    padding: 14px;
    border-radius: 4px;
    margin-bottom: 25px;
    border-left: 4px solid var(--danger-color);
}

.alerta-legal input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    flex-shrink: 0; /* Impede o checkbox de esmagar no mobile */
    cursor: pointer;
}

.alerta-legal label {
    font-weight: normal;
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 0;
    cursor: pointer;
}

/* ==========================================================================
   BOTÕES GERAIS
   ========================================================================== */
button, .btn-secundario {
    display: block;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s;
}

button[type="submit"] {
    background-color: var(--primary-color);
    color: white;
}

button[type="submit"]:hover { background-color: var(--primary-hover); }
button:active, .btn-secundario:active { transform: scale(0.99); }

.btn-secundario {
    background-color: #6c757d;
    color: white;
    margin-top: 12px;
}
.btn-secundario:hover { background-color: #5a6268; }

/* Navigation bar superior */
.nav-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.btn-voltar {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 16px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
}
.btn-voltar:hover { background-color: var(--primary-hover); }

/* ==========================================================================
   FEED DE DENÚNCIAS PÚBLICAS
   ========================================================================== */
.card-denuncia {
    background: var(--card-color);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    margin-bottom: 20px;
    border-top: 4px solid var(--primary-color);
}

.meta-denuncia {
    font-size: 13px;
    color: #6c757d;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.badge-categoria {
    background-color: #e2e3e5;
    color: #383d41;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: bold;
}

.texto-denuncia {
    font-size: 15px;
    line-height: 1.6;
    color: #333;
    white-space: pre-line;
}

.midia-publica, .midia-preview {
    max-width: 100%;
    width: auto;
    height: auto;
    max-height: 350px;
    display: block;
    border-radius: 6px;
    margin-top: 15px;
}

.btn-pdf {
    display: inline-flex;
    background-color: #f8d7da;
    color: #721c24;
    padding: 10px 14px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
    margin-top: 15px;
}

/* ==========================================================================
   TABELAS DO PAINEL ADM (DESKTOP)
   ========================================================================== */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 25px;
}

th, td {
    padding: 12px;
    border: 1px solid #ddd;
    text-align: left;
    font-size: 14px;
}

th { background-color: var(--primary-color); color: white; }

.btn-acao {
    padding: 6px 12px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: bold;
    font-size: 12px;
    display: inline-block;
    margin-right: 4px;
    margin-bottom: 5px;
}
.btn-aprovar { background-color: var(--success-color); color: white; }
.btn-aprovar:hover { background-color: var(--success-hover); }
.btn-recusar { background-color: var(--danger-color); color: white; }
.btn-recusar:hover { background-color: var(--danger-hover); }

/* ==========================================================================
   MEDIA QUERIES (MUDANÇAS PARA CELULARES)
   ========================================================================== */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    .container, .feed-container, .painel-container, .login-container {
        margin: 10px auto;
        padding: 15px;
        border-radius: 6px;
    }

    h1 {
        font-size: 20px;
    }

    .nav-links {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .btn-voltar {
        width: 100%;
        text-align: center;
    }

    .meta-denuncia {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    /* TRANSFORMAÇÃO DA TABELA DO PAINEL EM CARDS NO CELULAR */
    table, thead, tbody, th, td, tr { 
        display: block; 
    }

    thead tr { 
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    tr { 
        border: 1px solid var(--border-color); 
        margin-bottom: 15px;
        border-radius: 6px;
        background: #fafafa;
        padding: 8px;
    }

    td { 
        border: none;
        border-bottom: 1px solid #eee; 
        position: relative;
        padding-left: 30% !important;
        white-space: normal;
        text-align: left;
        min-height: 40px;
    }

    td:last-child {
        border-bottom: none;
    }

    /* Injeta títulos para cada dado da tabela empilhada */
    td:before { 
        position: absolute;
        top: 12px;
        left: 10px;
        width: 25%; 
        padding-right: 10px; 
        white-space: nowrap;
        font-weight: bold;
        color: var(--primary-color);
    }

    td:nth-of-type(1):before { content: "Data:"; }
    td:nth-of-type(2):before { content: "Categoria:"; }
    td:nth-of-type(3):before { content: "Relato:"; }
    td:nth-of-type(4):before { content: "Evidência:"; }
    td:nth-of-type(5):before { content: "Ações:"; }

    .btn-acao {
        width: 48%;
        text-align: center;
        padding: 10px;
        font-size: 14px;
    }
}

/* ==========================================================================
   MÍDIAS TOTALMENTE RESPONSIVAS (FOTOS, VÍDEOS E ÁUDIOS)
   ========================================================================== */
.anexo-container {
    width: 100%;
    margin-top: 15px;
    display: block;
}

/* Força qualquer foto ou vídeo a se ajustar ao tamanho do card no celular */
.midia-publica, .midia-preview {
    max-width: 100% !important;
    width: 100%; /* Ocupa a largura total disponível no card */
    height: auto !important; /* Mantém a proporção original sem achatar */
    max-height: 450px; /* Evita que vídeos verticais fiquem gigantescos na tela */
    object-fit: contain; /* Garante que a imagem inteira apareça */
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: block;
}

/* Ajusta o player de áudio nativo do navegador para não estourar a tela */
audio {
    width: 100% !important;
    display: block;
    margin-top: 10px;
}

/* Ajusta o botão de PDF para cobrir a largura total no mobile */
.btn-pdf {
    display: inline-block;
    width: 100%;
    text-align: center;
    background-color: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
    margin-top: 15px;
    box-sizing: border-box;
}

/* Quando abrir em telas maiores (computador), o PDF e mídias voltam ao tamanho normal */
@media (min-width: 601px) {
    .midia-publica, .midia-preview {
        width: auto; /* No PC ele não precisa esticar 100% se for pequeno */
    }
    .btn-pdf {
        width: auto; /* No PC o botão do PDF fica do tamanho do texto */
    }
}
