/*=====================================
  CORES E FONTES
=======================================*/
:root {
    --color-green-primary: #44AB4E;
    --color-green-secondary: #5CBC59;
    --color-text-dark: #333;
    --color-text-medium: #555;
    --color-background-light: white;
    --color-input-bg: #f0f0f0;
    --header-height: 55px;
    --progress-height: 40px;
}

/*=====================================
  CONFIGURAÇÕES GLOBAIS
=======================================*/
/* CRÍTICO: Garante que o HTML e o BODY ocupem toda a viewport para centralização */
html, body {
    height: 100%;
}

body {
    font-family: 'Nunito', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--color-background-light);
    color: var(--color-text-dark);
    min-height: 100vh;
}

.hidden-screen {
    display: none !important; 
}

/*=====================================
  CABEÇALHO E PROGRESSO
=======================================*/
.fixed-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    background-color: var(--color-background-light);
    position: sticky; 
    top: 0;
    z-index: 10;
}

/* Contêiner para o botão de saldo (simples) */
.saldo-button-container {
    position: relative;
    height: 40px; 
    display: flex;
    align-items: center;
}

.logo-text {
    font-size: 1.2em;
    font-weight: 700;
    color: var(--color-green-primary); 
}

.saldo-button {
    background-color: var(--color-green-secondary); 
    color: var(--color-background-light);
    padding: 8px 15px;
    border-radius: 5px;
    font-size: 1em;
    font-weight: 700;
}

/* Animação de Saldo (Mantido) */
.cashback-animation-value {
    position: absolute;
    color: var(--color-green-primary);
    font-size: 1em;
    font-weight: 700;
    white-space: nowrap;
    opacity: 0; 
    transform: translateY(0) translateX(10px);
    z-index: 1;
}

.cashback-animation-value.animate {
    animation: slideUpCashback 1s ease-out forwards;
}

@keyframes slideUpCashback {
    0% { opacity: 0; transform: translateY(10px) translateX(10px); }
    20% { opacity: 1; transform: translateY(-5px) translateX(10px); }
    80% { opacity: 1; transform: translateY(-20px) translateX(10px); }
    100% { opacity: 0; transform: translateY(-30px) translateX(10px); }
}


/* BARRA DE PROGRESSO (Mantido) */
.progress-container {
    padding: 0 20px 10px 20px;
    margin-top: 5px;
    background-color: var(--color-background-light);
    position: sticky;
    top: var(--header-height); 
    z-index: 9;
}

.progress-label {
    font-size: 0.8em;
    color: var(--color-text-medium);
    margin-top: 5px;
    margin-bottom: 0;
}

.progress-bar {
    height: 5px;
    background-color: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%; 
    background-color: var(--color-green-primary); 
    transition: width 3s ease-in-out; 
}

/*=====================================
  OVERLAYS E MODAIS
=======================================*/

/* OVERLAY DE SUCESSO (Animação Visto) */
.success-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--color-green-primary); 
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0; 
    transition: opacity 0.3s ease-in-out;
}

.success-overlay.visible { opacity: 1; }
.success-animation-icon { font-size: 8em; color: white; transform: scale(0); opacity: 0; }
.success-animation-icon.animate { animation: growOut 1.2s ease-out forwards; }
@keyframes growOut {
    0% { transform: scale(0); opacity: 1; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 0; }
}

/* MODAL DE PROCESSAMENTO (QR Code) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    z-index: 500; 
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content-centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

/* FINAL MODAL - POP-UP FLUTUANTE CENTRALIZADO E DESLOCADO */
.final-overlay-full {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%; 
    background-color: rgba(68, 171, 78, 0.95); /* Fundo semi-transparente verde */
    z-index: 1500; 
    /* Centralização robusta com Flexbox */
    display: flex; 
    justify-content: center; /* Centraliza horizontalmente */
    align-items: center; /* Centraliza verticalmente */
    padding: 20px;
}

.final-modal-content {
    width: 100%;
    max-width: 400px;
    background-color: var(--color-background-light);
    border-radius: 10px;
    padding: 40px 30px;
    text-align: center; 
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    
    /* DESLOCAMENTO CRÍTICO:
       1. Posiciona o elemento de forma absoluta (necessário para transform)
       2. left: 50% move a borda esquerda para o centro.
       3. transform: translateX move o elemento de volta pela metade (centralizando-o) 
          e adiciona o deslocamento de -19px para a esquerda. */
    position: absolute;
    left: 50%;
    transform: translateX(calc(-50% - 19px)); 
    margin-top: auto;
    margin-bottom: auto;
}

.final-modal-content h1 {
    font-size: 2.2em;
    font-weight: 800;
    margin-bottom: 20px; 
}

/* Frase de ganho */
.final-prize-text {
    font-size: 1.1em; 
    margin-bottom: 25px;
    text-align: center; 
}

.final-prize-text b {
    color: var(--color-green-primary); 
    font-weight: 700; 
}

/* Instruções */
.final-instruction-text {
    font-size: 1em;
    color: var(--color-text-dark); 
    margin-bottom: 30px;
    line-height: 1.4;
    text-align: center; 
    max-width: 300px; 
    margin-left: auto;
    margin-right: auto;
}

.final-instruction-text b {
    font-weight: 900;
}

.final-cta-button {
    background-color: var(--color-green-secondary); 
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1em;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    width: 90%; 
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s;
}

.final-cta-button:hover {
    background-color: #4a9e48;
}

/*=====================================
  CONTEÚDO PRINCIPAL (TELAS)
=======================================*/
.screen-body {
    width: 100%;
    box-sizing: border-box;
    padding-left: 20px;
    padding-right: 20px;
    padding-bottom: 50px;
    
    display: flex; 
    flex-direction: column;
    align-items: center; 
    
    min-height: calc(100vh - (var(--header-height) + var(--progress-height))); 
}

/* TELA 1: CARREGAMENTO */
#loadingScreen { justify-content: center; }

/* TELA 2 e 4 - Layout padrão de formulário/conteúdo */
#codeScreen, #evaluationScreen {
    justify-content: flex-start; 
    padding-top: 50px; 
    min-height: auto; 
}

/* --- TELA 1: ANIMAÇÃO DE PESQUISA --- */
.circle-spinner { position: relative; width: 150px; height: 150px; display: flex; justify-content: center; align-items: center; }
.search-icon { position: absolute; font-size: 1.5em; color: var(--color-green-primary); z-index: 2; }
.circle-spinner::before, .circle-spinner::after { content: ''; position: absolute; border: 2px solid rgba(68, 171, 78, 0.2); border-radius: 50%; animation: expand 3s infinite cubic-bezier(0.25, 0.46, 0.45, 0.94); }
.circle-spinner::before { width: 60px; height: 60px; animation-delay: 0s; }
.circle-spinner::after { width: 120px; height: 120px; animation-delay: 0.5s; }
@keyframes expand { 0% { transform: scale(0.5); opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }
.loading-text, .consulting-text { font-size: 1em; font-weight: 700; color: var(--color-text-medium); margin-top: 50px; display: flex; align-items: center; gap: 10px; }
.consulting-text { margin-top: 0; }
.loading-spinner, .loading-spinner-small { color: var(--color-text-medium); animation: spin 1.5s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }


/* --- TELA 2: CÓDIGO --- */
.message-check { color: var(--color-green-primary); font-size: 0.9em; font-weight: 700; margin-bottom: 25px; }
.code-box-container { width: 90%; max-width: 300px; border-radius: 10px; overflow: hidden; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1); }
.code-box-header { background-color: var(--color-green-secondary); color: var(--color-background-light); padding: 10px; font-size: 1em; font-weight: 700; text-align: center; }
.code-box-content { background-color: var(--color-background-light); padding: 20px 10px; border: 2px solid #ccc; border-top: none; text-align: center; }
.code-label { font-weight: 700; font-size: 0.8em; color: var(--color-text-medium); margin-bottom: 10px; }
.code-display { display: flex; justify-content: space-around; margin-top: 10px; }
.code-char { font-size: 3em; font-weight: 900; color: var(--color-text-dark); }
.input-instruction { font-size: 1em; color: var(--color-text-medium); margin-top: 30px; margin-bottom: 15px; }
.code-input-area { display: flex; justify-content: center; gap: 15px; margin-bottom: 40px; }
.input-square { width: 50px; height: 50px; background-color: var(--color-input-bg); border-radius: 8px; border: 1px solid #ccc; text-align: center; font-size: 1.5em; font-weight: 700; text-transform: uppercase; }
.spacer-area { height: 48px; margin-bottom: 20px; }

/* --- TELA 3 (Modal): QR CODE SCANNER ANIMAÇÃO --- */
.qr-code-container { position: relative; width: 250px; height: 250px; margin-bottom: 40px; display: flex; justify-content: center; align-items: center; }
.qr-code-image { width: 100%; height: 100%; }
.scan-line { position: absolute; width: 90%; height: 3px; background: red; box-shadow: 0 0 5px red; top: 10%; animation: scan 2s infinite ease-in-out; }
@keyframes scan { 0% { top: 10%; } 50% { top: 90%; } 100% { top: 10%; } }

/* --- TELA 4: AVALIAÇÃO DE PRODUTO (Estática) --- */
#evaluationScreen { min-height: auto; }
.evaluation-item { display: flex; flex-direction: column; align-items: center; width: 100%; }
.cashback-message { font-size: 1.1em; font-weight: 700; color: var(--color-text-dark); margin-top: 20px; margin-bottom: 25px; text-align: center; }
.product-container { width: 100%; max-width: 350px; margin-bottom: 30px; }
.product-image-card { background-color: #364047; border-radius: 10px; position: relative; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);}
.value-label { background-color: var(--color-green-primary); color: white; font-size: 0.8em; font-weight: 700; padding: 5px 10px; border-radius: 5px; position: absolute; top: 10px; left: 10px; z-index: 5; }
.product-img { width: 100%; max-height: 230px; object-fit: contain; }
.timer-label { background-color: #388E3C; color: white; font-size: 0.8em; padding: 3px 8px; border-radius: 5px; position: absolute; bottom: 10px; right: 10px; }
.question-text { font-size: 1.2em; color: var(--color-text-dark); margin-bottom: 25px; text-align: center; }
.opinion-buttons { width: 100%; max-width: 300px; display: flex; flex-direction: column; gap: 15px; }
.opinion-button { width: 100%; padding: 15px 20px; border: none; border-radius: 8px; font-size: 1.1em; font-weight: 700; color: white; cursor: pointer; box-shadow: 0 3px 5px rgba(0, 0, 0, 0.15); transition: background-color 0.2s; }
.like-button { background-color: #00BCD4; }
.neutral-button { background-color: #FFC107; }
.dislike-button { background-color: #F44336; }

/* RESPONSIVIDADE BÁSICA */
@media (max-width: 400px) {
    .input-square { width: 40px; height: 40px; }
}

