/* --- CSS Completo para o PWA (Tema Dark Moderno) --- */
:root {
    --primary-color: #FFD600; /* Amarelo principal */
    --primary-dark: #e6c000;
    --dark-bg: #121212;       /* Fundo do App (preto) */
    --dark-card: #1E1E1E;     /* Fundo dos cards (cinza escuro) */
    --dark-grey: #2a2a2a;
    --light-grey: #888;
    --text-primary: #f0f0f0;  /* Texto principal */
    --text-secondary: #aaa;
    --font-main: 'Inter', sans-serif;
    --card-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    --bottom-nav-height: 65px;
}

/* --- Reset Básico --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-font-smoothing: antialiased;
    scroll-behavior: smooth;
}

body {
    background-color: var(--dark-bg);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 16px;
    line-height: 1.6;
}

#app-wrapper {
    max-width: 600px;
    margin: 0 auto;
    background-color: var(--dark-bg);
    min-height: 100vh;
    padding-bottom: var(--bottom-nav-height); /* Espaço para a barra de navegação */
}

/* --- Cabeçalho --- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background-color: var(--dark-bg);
    border-bottom: 1px solid var(--dark-grey);
    position: sticky;
    top: 0;
    z-index: 100;
    height: 65px; /* Altura fixa para alinhar */
}

.logo {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--text-primary);
    text-decoration: none;
}
.logo span {
    color: var(--primary-color);
}

.header-user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-user-info .user-name {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: none; /* Esconde em telas pequenas por padrão */
}

.header-user-info .logout-link {
    color: var(--text-secondary);
    font-size: 1.2rem;
    transition: color 0.2s ease;
    text-decoration: none;
}

.header-user-info .logout-link:hover {
    color: var(--primary-color);
}

/* Mostra o nome do usuário em telas maiores */
@media (min-width: 480px) {
    .header-user-info .user-name {
        display: inline;
    }
}


/* --- Conteúdo Principal --- */
.app-content {
    padding: 10px 0;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 15px;
    padding: 0 20px;
}

/* --- Card Base --- */
.card {
    background-color: var(--dark-card);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--dark-grey);
}

/* --- 1. Carrossel de Anúncios --- */
.ad-carousel-container {
    margin: 0 20px 25px 20px;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
}

.ad-carousel {
    display: flex;
    overflow-x: hidden; /* JS controla o scroll */
    scroll-snap-type: x mandatory;
}

.ad-slide {
    flex: 0 0 100%;
    width: 100%;
    aspect-ratio: 16 / 9;
    scroll-snap-align: start;
}
.ad-slide a { display: block; width: 100%; height: 100%; }
.ad-slide img { display: block; width: 100%; height: 100%; object-fit: cover; }

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    padding: 0;
}
.dot.active {
    background-color: var(--primary-color);
    width: 20px;
    border-radius: 5px;
}

/* --- 2. Carrosséis Horizontais (Votações e Categorias) --- */
.horizontal-scroll-section {
    margin-bottom: 30px;
}

.horizontal-scroll {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 5px 20px 10px 20px;
    /* Esconde a barra de rolagem */
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}
.horizontal-scroll::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

/* Card de Votação (no carrossel) */
.poll-card {
    flex: 0 0 280px;
    scroll-snap-align: start;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Para a imagem arredondada */
}
.poll-card:hover {
    transform: translateY(-5px);
}
.poll-card-image {
    height: 140px;
    background-size: cover;
    background-position: center;
    border-bottom: 1px solid var(--dark-grey);
}
.poll-category {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--primary-color);
    background-color: rgba(255, 214, 0, 0.1);
    padding: 5px 10px;
    border-radius: 20px;
    white-space: nowrap;
    display: inline-block;
    margin: 15px 15px 0 15px; /* Padding interno do card */
}
.poll-category .fas { margin-right: 5px; }

.poll-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 10px 15px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 2.4em;
    flex-grow: 1;
}
.poll-status {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0 15px 15px 15px;
    color: var(--primary-color);
}
.poll-status.voted {
    color: var(--text-secondary);
}
.poll-status .fas {
    margin-right: 5px;
}

.empty-state-horizontal {
    padding: 30px 20px;
    text-align: center;
    flex: 1;
    min-width: 250px;
}
.empty-state-horizontal p {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* Chips/Cards de Categoria (no carrossel) */
.category-card-small {
    flex: 0 0 auto;
    scroll-snap-align: start;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    transition: background-color 0.2s;
    min-width: 120px;
}
.category-card-small:hover {
    background-color: #252525;
}
.category-card-small .category-icon {
    font-size: 1.5rem;
    color: var(--primary-color);
}
.category-card-small .category-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    text-align: center;
}

/* --- 3. Ranking em Destaque (e página Ranking.php) --- */
.ranking-section {
    padding: 0 20px;
    margin-bottom: 30px;
}
.ranking-list {
    padding: 10px;
}
.ranking-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid var(--dark-grey);
}
.ranking-item:last-child {
    border-bottom: none;
}

.rank-number {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-secondary);
    width: 40px;
    text-align: center;
}
.ranking-logo {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 15px;
    border: 2px solid #333;
}
.ranking-info {
    flex-grow: 1;
}
.ranking-name {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}
.ranking-category {
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.ranking-votes {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary-color);
    white-space: nowrap;
}


/* --- 5. Barra de Navegação Inferior --- */
.bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 600px; /* Alinha com o #app-wrapper */
    margin: 0 auto;
    height: var(--bottom-nav-height);
    background-color: rgba(30, 30, 30, 0.85); /* Fundo com transparência */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid #2a2a2a;
    z-index: 1000;
}
.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-secondary);
    transition: color 0.2s;
}
.nav-item i {
    font-size: 1.2rem;
}
.nav-item span {
    font-size: 0.7rem;
    margin-top: 4px;
}
.nav-item:hover {
    color: var(--text-primary);
}
.nav-item.active {
    color: var(--primary-color);
}
/* Espaçador para o rodapé */
.app-footer-spacer {
    height: 20px; /* Apenas um pequeno espaço extra */
}


/* --- 6. Modal de Votação --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: none; /* Alterado por JS */
    align-items: flex-end; /* Modal sobe de baixo */
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.modal-overlay.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    background-color: var(--dark-card);
    width: 100%;
    max-width: 600px;
    margin: 0;
    border-radius: 20px 20px 0 0; /* Arredondado só em cima */
    padding: 10px;
    position: relative;
    box-shadow: 0 -5px 30px rgba(0,0,0,0.5);
    /* Animação de subida */
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-overlay.show .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--dark-grey);
}
.modal-header h3 {
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.3;
    flex-grow: 1;
    padding-right: 10px; /* Espaço para botão fechar */
}

.modal-close-btn {
    background: #333;
    border: none;
    color: var(--text-secondary);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 1.5rem;
    line-height: 28px;
    text-align: center;
    cursor: pointer;
    z-index: 10;
    padding: 0;
}

.modal-body {
    padding: 20px;
    max-height: 60vh; /* Limita a altura em telas grandes */
    overflow-y: auto;
}

/* Opções de Voto (dentro do modal) */
.options-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}
.option-row {
    display: flex;
    align-items: center;
    background-color: #383838;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    transition: background-color 0.2s, box-shadow 0.2s;
    border: 2px solid transparent;
}
.option-row:hover { background-color: #444; }

.option-logo-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 15px;
    border: 2px solid #555;
}
.option-name {
    flex-grow: 1;
    color: var(--text-primary);
    font-weight: 500;
}
.option-row input[type="radio"] { position: absolute; opacity: 0; }

.radio-checkmark {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--light-grey);
    margin-left: 15px;
    transition: all 0.2s;
    flex-shrink: 0;
    position: relative;
}
.radio-checkmark::after {
    content: ''; display: block; width: 12px; height: 12px;
    background-color: white; border-radius: 50%;
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.2s;
}
.option-row input[type="radio"]:checked + .radio-checkmark {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}
.option-row input[type="radio"]:checked + .radio-checkmark::after {
    transform: translate(-50%, -50%) scale(1);
}
.option-row input[type="radio"]:checked ~ .option-name {
    color: var(--primary-color);
    font-weight: 700;
}
.option-row input[type="radio"]:checked ~ .option-logo-small {
    border-color: var(--primary-color);
}
.option-row:has(input[type="radio"]:checked) {
    background-color: #333;
    border-color: var(--primary-color);
}

/* --- Estilos do Login com Google (NOVO) --- */
#google-login-prompt {
    padding: 20px;
    text-align: center;
}

#google-login-prompt p {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 10px;
}
#google-login-prompt p.small-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 25px;
}

/* O Google renderiza o botão dentro deste div */
#google-signin-btn-modal {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Botões e Mensagens (no Modal) */
.button-vote {
    display: block; width: 100%;
    padding: 15px 20px; font-size: 1.1rem;
    font-weight: 700; color: #111;
    background-color: var(--primary-color);
    border: none; border-radius: 8px;
    cursor: pointer; transition: all 0.2s;
    text-align: center;
}
.button-vote:hover { background-color: var(--primary-dark); }
.button-vote:disabled {
    background-color: var(--dark-grey);
    color: var(--text-secondary);
    cursor: not-allowed;
}

.voted-message {
    text-align: center;
    padding: 20px 0;
}
.voted-message .fas {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}
.voted-message p {
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 20px;
}
.button-secondary {
    display: inline-block; padding: 10px 20px;
    font-size: 0.9rem; font-weight: 500;
    color: var(--primary-color);
    background-color: transparent;
    border: 2px solid var(--primary-color);
    border-radius: 8px; text-decoration: none;
    transition: all 0.2s;
}
.button-secondary:hover {
    background-color: rgba(255, 214, 0, 0.1);
}

.form-message {
    text-align: center;
    margin-top: 15px;
    font-size: 0.9rem;
    font-weight: 500;
}
.form-message.error { color: #ff6b6b; }


/* --- Página de Ranking (ranking.php) --- */
.ranking-header {
    padding: 20px;
    text-align: center;
}
.ranking-header h2 {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--primary-color);
}
.ranking-header p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-top: 5px;
}
.category-filter {
    padding: 0 20px 20px 20px;
}
.category-filter-select {
    width: 100%;
    padding: 12px 15px;
    background-color: var(--dark-card);
    color: var(--text-primary);
    border: 1px solid var(--dark-grey);
    border-radius: 8px;
    font-size: 1rem;
    font-family: var(--font-main);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 10 6'%3E%3Cpath fill='%23aaa' d='M0 0l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
}


/* --- Responsividade (Ajustes finos) --- */
@media (max-width: 360px) {
    .logo {
        font-size: 1.2rem;
    }
    .section-title {
        font-size: 1.3rem;
    }
    .poll-card {
        flex-basis: 240px; /* Reduz a largura dos cards */
    }
    .poll-title {
        font-size: 1rem;
    }
    .modal-header h3 {
        font-size: 1.1rem;
    }
    .option-row {
        padding: 8px 10px;
    }
    .option-logo-small {
        width: 35px;
        height: 35px;
        margin-right: 10px;
    }
    .option-name {
        font-size: 0.9rem;
    }
}

