/* =========================================
   1. VARIÁVEIS E CORES (SYSTEM THEME)
   ========================================= */
:root {
    /* Cores da Marca */
    --primary-color: #6200ea;       /* Roxo Vibrante (Identidade) */
    --primary-light: #b388ff;       /* Roxo Claro */
    --primary-dark: #4a00b0;        /* Roxo Escuro */
    
    --accent-color: #00e676;        /* Verde (Ação/Concordar) */
    --danger-color: #ff1744;        /* Vermelho (Discordar) */
    --warning-color: #ffab00;       /* Laranja (Atenção/Plebiscito) */
    
    /* Padrão (Light Mode) */
    --bg-body: #f3f4f6;             /* Cinza Fundo */
    --bg-card: #ffffff;             /* Branco */
    --bg-input: #ffffff;            /* Fundo de Inputs */
    --text-main: #1f2937;           /* Texto Escuro */
    --text-secondary: #6b7280;      /* Texto Cinza */
    --border-color: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);

    /* Tags de Categoria */
    --tag-urgent-bg: #fee2e2; --tag-urgent-text: #ef4444;
    --tag-money-bg: #d1fae5;  --tag-money-text: #059669;
    --tag-shop-bg: #ffedd5;   --tag-shop-text: #ea580c;

    /* Tags de Voto */
    --tag-bg: #f3f4f6;
    --tag-text: #4b5563;

    /* Dimensões */
    --nav-height: 70px;
    --radius: 16px;
}

/* === MODO ESCURO (DARK MODE) === */
body.dark-mode {
    --bg-body: #121212;
    --bg-card: #1e1e1e;
    --bg-input: #2c2c2c;
    --text-main: #e0e0e0;
    --text-secondary: #a0a0a0;
    --border-color: #333333;
    --shadow: 0 4px 10px rgba(0, 0, 0, 0.5);

    /* Tags no Dark Mode */
    --tag-urgent-bg: #4a1a1a; --tag-urgent-text: #ff8a80;
    --tag-money-bg: #1a3b2a;  --tag-money-text: #69f0ae;
    --tag-shop-bg: #3e2723;   --tag-shop-text: #ffcc80;
    
    --tag-bg: #333;
    --tag-text: #ccc;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    padding-bottom: 100px; /* Espaço para navegação mobile */
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background 0.3s, color 0.3s;
}

/* Container Centralizado */
#app-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* Utilitários de Animação */
.hidden { display: none !important; }
.view { animation: fadeIn 0.4s ease-out; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   2. HEADER (TOPO)
   ========================================= */
.main-header {
    background-color: var(--bg-card);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    max-width: 600px;
    margin: 0 auto;
    transition: background-color 0.3s;
}

.logo-container {
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

/* Botão Toggle Dark Mode */
.theme-toggle {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-main);
    transition: transform 0.2s;
}
.theme-toggle:active { transform: rotate(20deg); }

/* =========================================
   3. HOME & CARDS GERAIS
   ========================================= */
.hero-text { 
    margin: 20px 0; 
    text-align: left; 
}
.hero-text h1 { font-size: 1.6rem; margin-bottom: 5px; color: var(--text-main); line-height: 1.2; }
.hero-text p { color: var(--text-secondary); font-size: 0.95rem; }

/* Filtros (Scroll Horizontal) */
.filter-scroll {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 5px;
    scrollbar-width: none; 
    -ms-overflow-style: none;
}
.filter-scroll::-webkit-scrollbar { display: none; }

.filter-pill {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
}
.filter-pill.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Cards de Projetos */
.cards-container { display: flex; flex-direction: column; gap: 15px; }

.pl-card {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    cursor: pointer;
    border-left: 5px solid var(--primary-color);
    transition: transform 0.2s, background 0.3s;
    /* Adicionado animação para quando filtrar */
    animation: fadeIn 0.3s ease-out;
}

.pl-card:active { transform: scale(0.98); }

.pl-card h3 { font-size: 1.1rem; margin: 10px 0 5px; color: var(--text-main); }
.pl-card p { color: var(--text-secondary); font-size: 0.9rem; }

/* Tags Coloridas (Badges) */
.tag-badge {
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
}
.tag-badge.urgent { background: var(--tag-urgent-bg); color: var(--tag-urgent-text); }
.tag-badge.money { background: var(--tag-money-bg); color: var(--tag-money-text); }
.tag-badge.shop { background: var(--tag-shop-bg); color: var(--tag-shop-text); }

/* =========================================
   4. ESTILOS ESPECÍFICOS (OBRAS E PLEBISCITOS)
   ========================================= */

/* --- Card de Obras --- */
.obra-card {
    border-left-color: var(--accent-color); /* Verde lateral */
}

.obra-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.status-badge {
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 800;
    text-transform: uppercase;
}

.status-badge.andamento { background: #dcfce7; color: #166534; }
.status-badge.atrasada { background: #fee2e2; color: #991b1b; }
/* Dark Mode Badges */
body.dark-mode .status-badge.andamento { background: #14532d; color: #dcfce7; }
body.dark-mode .status-badge.atrasada { background: #7f1d1d; color: #fecaca; }

.progress-wrapper {
    margin: 15px 0;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-weight: 600;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--accent-color);
    border-radius: 10px;
    transition: width 1s ease-in-out;
}

.obra-meta {
    display: flex;
    gap: 15px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
    margin-top: 10px;
}
.obra-meta i { margin-right: 4px; }

/* --- Card de Plebiscitos --- */
.plebiscito-card {
    border-left-color: var(--warning-color); /* Laranja lateral */
}

.vote-preview {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.vote-btn {
    flex: 1;
    padding: 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: 0.2s;
}

/* Botões Sim/Não dentro do card */
.vote-btn.yes { 
    background-color: #dcfce7; 
    color: #166534; 
    border-color: #bbf7d0;
}
.vote-btn.no { 
    background-color: #fee2e2; 
    color: #991b1b; 
    border-color: #fecaca;
}

/* Dark Mode Botões Voto */
body.dark-mode .vote-btn.yes { background-color: #14532d; color: #dcfce7; border-color: #15803d; }
body.dark-mode .vote-btn.no { background-color: #7f1d1d; color: #fecaca; border-color: #991b1b; }

.vote-btn:hover { filter: brightness(0.95); transform: scale(1.02); }

.vote-count {
    display: block;
    margin-top: 10px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-style: italic;
}

/* =========================================
   5. DETALHES & INPUT
   ========================================= */
.nav-back {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 20px;
    cursor: pointer;
}

.pl-header-detail h1 { font-size: 1.4rem; margin-bottom: 8px; color: var(--text-main); line-height: 1.3; }
.pl-header-detail p { color: var(--text-secondary); border-left: 3px solid var(--border-color); padding-left: 10px; font-size: 0.95rem; }

/* === BOTÃO GRANDE DE PDF === */
.pdf-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 15px;
    padding: 10px 20px;
    background-color: #e63946; /* Vermelho PDF */
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 700;
    transition: background 0.2s, transform 0.2s;
    box-shadow: 0 4px 10px rgba(230, 57, 70, 0.3);
}
.pdf-action-btn:hover {
    background-color: #d62828;
    transform: translateY(-2px);
}
.pdf-action-btn.hidden {
    display: none;
}

.divider { border: 0; height: 1px; background: var(--border-color); margin: 25px 0; }

/* Box de Input */
.ai-interaction-box {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.ai-interaction-box label {
    font-weight: 600;
    display: block;
    margin-bottom: 10px;
    color: var(--text-main);
    font-size: 0.9rem;
}

.input-group { display: flex; gap: 10px; }

.input-group input {
    flex: 1;
    padding: 12px;
    background: var(--bg-input);
    color: var(--text-main);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    outline: none;
    transition: border 0.2s;
}
.input-group input:focus { border-color: var(--primary-color); }

/* === BOTÃO PEQUENO DE DOWNLOAD DO PDF === */
.input-group .btn-icon-download {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    background: #e0e7ff;
    color: var(--primary-color);
    border-radius: 12px;
    font-size: 1.2rem;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s;
    margin-right: 5px;
}
.input-group .btn-icon-download:hover { background: #c7d2fe; }
.input-group .btn-icon-download:active { transform: scale(0.95); }

/* Ajuste botão de download no Dark Mode */
body.dark-mode .input-group .btn-icon-download {
    background: #333;
    color: var(--primary-light);
}

/* Botão Enviar */
.input-group button {
    width: 50px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.2s;
}
.input-group button:hover { background: var(--primary-dark); }

/* =========================================
   6. PLAYER DE ÁUDIO
   ========================================= */
.audio-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, #7c4dff 100%);
    color: white;
    padding: 20px;
    border-radius: 20px;
    margin: 25px 0 20px;
    box-shadow: 0 10px 20px rgba(98, 0, 234, 0.25);
    animation: slideUp 0.5s;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.audio-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
    font-weight: 700;
}

.audio-controls-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

/* Barrinha de Progresso */
.progress-container { width: 100%; }

#speech-progress {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    outline: none;
    -webkit-appearance: none;
    cursor: default;
}

#speech-progress::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    cursor: default;
    box-shadow: 0 0 10px rgba(255,255,255,0.8);
}

/* Linha de Botões */
.buttons-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

#speed-select {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
}

#speed-select option { background: #333; color: white; }

/* Botão Play Principal */
#play-pause-btn {
    flex: 1;
    background: white;
    color: var(--primary-color);
    border: none;
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: 800;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.1s;
}

#play-pause-btn:active { transform: scale(0.95); }
#play-pause-btn.playing { background: #ffeb3b; color: black; }

/* Botão Stop */
.stop-btn {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: background 0.2s;
}
.stop-btn:hover { background: rgba(255,255,255,0.4); }

/* Texto Transcrição */
#explanation-content {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}
#explanation-content h3 { font-size: 1rem; margin-bottom: 10px; color: var(--text-secondary); }
#text-output { color: var(--text-main); line-height: 1.6; font-size: 1.05rem; }

/* =========================================
   7. VOTAÇÃO E FEEDBACK (PÁGINA DETALHES)
   ========================================= */
.vote-box {
    background: var(--bg-card);
    padding: 25px 20px;
    border-radius: var(--radius);
    text-align: center;
    margin-top: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.vote-box h3 { margin-bottom: 20px; color: var(--text-main); font-size: 1rem; }

.thumbs-container { display: flex; gap: 15px; justify-content: center; }

.thumb-btn {
    flex: 1;
    padding: 15px;
    border: 2px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-main);
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.thumb-btn.up:hover { background: rgba(0, 230, 118, 0.1); border-color: var(--accent-color); color: var(--accent-color); }
.thumb-btn.down:hover { background: rgba(255, 23, 68, 0.1); border-color: var(--danger-color); color: var(--danger-color); }

.tags-cloud {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px dashed var(--border-color);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    animation: slideUp 0.3s;
}

.tags-cloud p { width: 100%; font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 8px; }

.tags-cloud button {
    background: var(--tag-bg);
    border: 1px solid var(--border-color);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-main);
    cursor: pointer;
    transition: background 0.2s;
}

.tags-cloud button:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Notificação GPS (Toast) */
.gps-toast {
    position: fixed;
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideDown 0.5s ease-out;
}

/* Loader */
#loader {
    text-align: center;
    padding: 30px;
    color: var(--primary-color);
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

@keyframes slideDown { from { opacity: 0; transform: translate(-50%, -20px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* =========================================
   8. MEDIA QUERIES (DESKTOP)
   ========================================= */
@media (min-width: 768px) {
    .main-header, #app-container { max-width: 800px; }
    .cards-container { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
}

/* =========================================
   9. NAVEGAÇÃO MOBILE
   ========================================= */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--bg-card);
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    z-index: 100;
}

.nav-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    flex: 1;
    transition: color 0.2s;
}

.nav-btn i { font-size: 1.4rem; margin-bottom: 2px; }
.nav-btn.active { color: var(--primary-color); font-weight: 600; }

/* No final do seu CSS */
.user-logged-in {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.user-logged-in:hover {
    transform: scale(1.1);
}

.user-icon {
    cursor: pointer; /* Para indicar que pode clicar pra logar */
}



/* =========================================
   BOTÃO DE ACESSIBILIDADE FLUTUANTE
   ========================================= */
.accessibility-btn {
    position: fixed;
    top: 50%;                /* Metade da altura da tela */
    right: 0;                /* Colado na direita */
    transform: translateY(-50%); /* Centraliza exatamente no meio */
    
    background-color: #2563eb; /* Azul padrão de acessibilidade */
    padding: 12px 10px 12px 15px; /* Mais espaço na esquerda para ficar bonito */
    
    border-top-left-radius: 30px;
    border-bottom-left-radius: 30px;
    box-shadow: -4px 4px 15px rgba(0, 0, 0, 0.2);
    
    cursor: pointer;
    z-index: 9999; /* Ficar em cima de tudo */
    transition: transform 0.3s, background-color 0.3s;
}

.accessibility-btn:hover {
    background-color: #1d4ed8;
    transform: translateY(-50%) translateX(-5px); /* Efeito de "puxar" pra fora */
}

.accessibility-btn img {
    width: 32px;  /* Tamanho do ícone */
    height: 32px;
    display: block;
    filter: brightness(0) invert(1); /* Deixa o ícone branco se for preto */
}

/* === CLASSE QUE ALTERA AS CORES PARA DALTÔNICOS === */
/* Aplica um filtro de alto contraste e escala de cinza na página toda */
body.daltonico-mode {
    filter: contrast(120%) grayscale(100%);
}

/* Opcional: Se quiser apenas inverter cores em vez de preto e branco */
/*
body.daltonico-mode {
    filter: invert(1) hue-rotate(180deg);
}
/* === MODO DALTÔNICO (ATIVADO PELO JS) === */
body.daltonico-mode {
    /* 
       grayscale(1) = Tira as cores (preto e branco)
       contrast(1.2) = Aumenta o contraste em 20% para facilitar leitura 
    */
    filter: grayscale(100%) contrast(120%);
}

/* Opcional: Ajuste para imagens não ficarem ruins, se quiser */
body.daltonico-mode img {
    filter: grayscale(0%); /* Mantém imagens originais se preferir */
}