/* ============================================================
   app.css — Estilos principais Nova Rifa
   Tecnologia: Tailwind CSS (CDN) + customizações
   Fonte: Montserrat (Google Fonts)
   Paleta: Roxo #7C3AED, Verde #16a34a, Cinza #f9fafb
   ============================================================ */

/* ── Variáveis CSS ───────────────────────────────────────── */
:root {
    --cor-primaria:       #7C3AED;
    --cor-primaria-hover: #6D28D9;
    --cor-primaria-light: #EDE9FE;
    --cor-sucesso:        #16a34a;
    --cor-sucesso-hover:  #15803d;
    --cor-perigo:         #dc2626;
    --cor-aviso:          #d97706;
    --cor-fundo:          #f9fafb;
    --cor-card:           #ffffff;
    --cor-texto:          #111827;
    --cor-texto-muted:    #6b7280;
    --cor-borda:          #e5e7eb;
    --raio-borda:         0.75rem;
    --sombra-card:        0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --sombra-media:       0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --sombra-grande:      0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* Dark mode */
[data-tema="escuro"] {
    --cor-fundo:       #0f172a;
    --cor-card:        #1e293b;
    --cor-texto:       #f1f5f9;
    --cor-texto-muted: #94a3b8;
    --cor-borda:       #334155;
}

/* ── Reset e base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--cor-fundo);
    color: var(--cor-texto);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    margin: 0;
    padding: 0;
}

/* ── Tipografia ──────────────────────────────────────────── */
h1, h2, h3, h4, h5 { font-weight: 700; line-height: 1.2; margin: 0; }
p { margin: 0; }
a { text-decoration: none; color: inherit; }

/* ── Botões ──────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s;
    text-decoration: none;
    line-height: 1;
    font-family: 'Montserrat', sans-serif;
}

.btn:active { transform: scale(0.98); }

.btn-primario {
    background-color: var(--cor-primaria);
    color: #fff;
    box-shadow: 0 4px 14px rgb(124 58 237 / 0.4);
}
.btn-primario:hover {
    background-color: var(--cor-primaria-hover);
    box-shadow: 0 6px 20px rgb(124 58 237 / 0.5);
}

.btn-sucesso {
    background-color: var(--cor-sucesso);
    color: #fff;
    box-shadow: 0 4px 14px rgb(22 163 74 / 0.4);
}
.btn-sucesso:hover {
    background-color: var(--cor-sucesso-hover);
    box-shadow: 0 6px 20px rgb(22 163 74 / 0.5);
}

.btn-outline {
    background-color: transparent;
    color: var(--cor-primaria);
    border: 2px solid var(--cor-primaria);
}
.btn-outline:hover {
    background-color: var(--cor-primaria-light);
}

.btn-lg { padding: 1rem 2rem; font-size: 1.05rem; border-radius: 0.75rem; }
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.8rem; }
.btn-block { width: 100%; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
    background-color: var(--cor-card);
    border-radius: var(--raio-borda);
    box-shadow: var(--sombra-card);
    border: 1px solid var(--cor-borda);
    overflow: hidden;
}

.card-campanha {
    transition: transform 0.25s, box-shadow 0.25s;
    cursor: pointer;
}
.card-campanha:hover {
    transform: translateY(-4px);
    box-shadow: var(--sombra-grande);
}

/* ── Badge de status ─────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-ativo {
    background-color: #dcfce7;
    color: #166534;
}
.badge-ativo::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #16a34a;
    animation: piscar 1.5s ease-in-out infinite;
}

.badge-concluido { background-color: #dbeafe; color: #1e40af; }
.badge-pausado   { background-color: #fef3c7; color: #92400e; }
.badge-sorteado  { background-color: #f3e8ff; color: #6b21a8; }

@keyframes piscar {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.3; }
}

/* ── Barra de progresso ──────────────────────────────────── */
.barra-progresso {
    width: 100%;
    height: 8px;
    background-color: var(--cor-borda);
    border-radius: 9999px;
    overflow: hidden;
}
.barra-progresso-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--cor-primaria), #a855f7);
    border-radius: 9999px;
    transition: width 0.6s ease;
}

/* ── Formulários ─────────────────────────────────────────── */
.input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--cor-borda);
    border-radius: 0.5rem;
    background-color: var(--cor-card);
    color: var(--cor-texto);
    font-family: 'Montserrat', sans-serif;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
.input:focus {
    border-color: var(--cor-primaria);
    box-shadow: 0 0 0 3px rgb(124 58 237 / 0.15);
}
.input::placeholder { color: var(--cor-texto-muted); }

.label {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.375rem;
    color: var(--cor-texto);
}

/* ── Seletor de quantidade ───────────────────────────────── */
.seletor-quantidade {
    display: flex;
    align-items: center;
    gap: 0;
    border: 2px solid var(--cor-borda);
    border-radius: 0.5rem;
    overflow: hidden;
}
.seletor-quantidade button {
    width: 48px;
    height: 48px;
    background: var(--cor-fundo);
    border: none;
    font-size: 1.25rem;
    font-weight: 700;
    cursor: pointer;
    color: var(--cor-primaria);
    transition: background-color 0.15s;
    font-family: 'Montserrat', sans-serif;
}
.seletor-quantidade button:hover { background-color: var(--cor-primaria-light); }
.seletor-quantidade input {
    flex: 1;
    border: none;
    border-left: 2px solid var(--cor-borda);
    border-right: 2px solid var(--cor-borda);
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    outline: none;
    background: var(--cor-card);
    color: var(--cor-texto);
    padding: 0 0.5rem;
    height: 48px;
    font-family: 'Montserrat', sans-serif;
}

/* ── Botões de pacote rápido ─────────────────────────────── */
.pacotes-rapidos {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.btn-pacote {
    padding: 0.4rem 1rem;
    border: 2px solid var(--cor-primaria);
    border-radius: 0.375rem;
    background: transparent;
    color: var(--cor-primaria);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
    font-family: 'Montserrat', sans-serif;
}
.btn-pacote:hover, .btn-pacote.ativo {
    background-color: var(--cor-primaria);
    color: #fff;
}

/* ── Countdown ───────────────────────────────────────────── */
.countdown {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}
.countdown-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--cor-primaria);
    color: #fff;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    min-width: 60px;
}
.countdown-numero {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
}
.countdown-label {
    font-size: 0.65rem;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.2rem;
}

/* ── Roleta ──────────────────────────────────────────────── */
.roleta-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}
.roleta-canvas {
    border-radius: 50%;
    box-shadow: 0 8px 30px rgb(0 0 0 / 0.3);
    max-width: 300px;
    width: 100%;
}
.roleta-ponteiro {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 24px solid #ef4444;
    filter: drop-shadow(0 2px 4px rgb(0 0 0 / 0.3));
}
#btnGirarRoleta {
    margin-top: 0.5rem;
}

/* ── PIX Modal ───────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgb(0 0 0 / 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(4px);
}
.modal-box {
    background: var(--cor-card);
    border-radius: 1rem;
    padding: 2rem;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
}
.modal-fechar {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--cor-texto-muted);
    line-height: 1;
    padding: 0.25rem;
}

/* ── Alerta / Toast ──────────────────────────────────────── */
.alerta {
    padding: 0.875rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    border: 1px solid transparent;
    margin-bottom: 1rem;
}
.alerta-sucesso  { background: #dcfce7; color: #166534; border-color: #86efac; }
.alerta-erro     { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.alerta-aviso    { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.alerta-info     { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }

/* ── Ranking ─────────────────────────────────────────────── */
.ranking-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    background: var(--cor-fundo);
    transition: background-color 0.15s;
}
.ranking-item:hover { background: var(--cor-primaria-light); }
.ranking-posicao {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--cor-primaria);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.ranking-posicao.ouro   { background: linear-gradient(135deg, #f59e0b, #d97706); }
.ranking-posicao.prata  { background: linear-gradient(135deg, #9ca3af, #6b7280); }
.ranking-posicao.bronze { background: linear-gradient(135deg, #d97706, #92400e); }

/* ── Cotas premiadas ─────────────────────────────────────── */
.cota-premiada-card {
    border: 2px solid #fbbf24;
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border-radius: 0.75rem;
    padding: 1rem;
    text-align: center;
    transition: transform 0.2s;
}
.cota-premiada-card:hover { transform: scale(1.02); }
.cota-premiada-numero {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--cor-primaria);
}
.cota-premiada-premio {
    font-size: 0.875rem;
    color: #92400e;
    font-weight: 600;
    margin-top: 0.25rem;
}

/* ── FAQ accordion ───────────────────────────────────────── */
.faq-item { border-bottom: 1px solid var(--cor-borda); }
.faq-pergunta {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 0;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--cor-texto);
    text-align: left;
    font-family: 'Montserrat', sans-serif;
    gap: 1rem;
}
.faq-pergunta svg {
    flex-shrink: 0;
    transition: transform 0.3s;
}
.faq-item.aberto .faq-pergunta svg { transform: rotate(180deg); }
.faq-resposta {
    display: none;
    padding-bottom: 1.25rem;
    color: var(--cor-texto-muted);
    line-height: 1.7;
    font-size: 0.9rem;
}
.faq-item.aberto .faq-resposta { display: block; }

/* ── Galeria de imagens ──────────────────────────────────── */
.galeria-thumbs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.galeria-thumb {
    width: 64px;
    height: 64px;
    border-radius: 0.375rem;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.15s;
}
.galeria-thumb.ativa { border-color: var(--cor-primaria); }

/* ── Layout grid ─────────────────────────────────────────── */
.grid-campanhas {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

@media (max-width: 640px) {
    .grid-campanhas {
        grid-template-columns: 1fr;
    }
    .countdown-item { min-width: 50px; }
    .countdown-numero { font-size: 1.2rem; }
}

/* ── Utilitários ─────────────────────────────────────────── */
.truncar    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linha-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sombra-texto  { text-shadow: 0 1px 3px rgb(0 0 0 / 0.4); }

/* ── Loading spinner ─────────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: girar 0.6s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

/* ── Copiar PIX ──────────────────────────────────────────── */
.campo-pix {
    background: var(--cor-fundo);
    border: 2px dashed var(--cor-primaria);
    border-radius: 0.5rem;
    padding: 0.875rem;
    font-size: 0.75rem;
    word-break: break-all;
    color: var(--cor-texto-muted);
    cursor: pointer;
    transition: background-color 0.2s;
}
.campo-pix:hover { background: var(--cor-primaria-light); }

/* ── Scroll customizado ──────────────────────────────────── */
::-webkit-scrollbar       { width: 8px; }
::-webkit-scrollbar-track { background: var(--cor-fundo); }
::-webkit-scrollbar-thumb { background: var(--cor-primaria); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--cor-primaria-hover); }

/* ── Animações ───────────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.4s ease forwards; }

@keyframes pulse-suave {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.02); }
}
.pulse { animation: pulse-suave 2s ease-in-out infinite; }
