/* ======== CORES E FONTES BASE ======== */
:root {
  --cor-principal: #4a5c2f; /* Verde escuro */
  --cor-secundaria: #d9772a; /* Laranja */
  --cor-fundo: #fdf8e6;     /* Creme */
  --cor-texto: #333;
  --cor-branco: #ffffff;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--cor-fundo);
  color: var(--cor-texto);
  margin: 0;
  padding: 0;
  overflow: hidden; /* Evita scroll da página inteira */
}

/* ======== UTILITÁRIOS ======== */
.hidden {
  display: none !important;
}

/* ======== ESTRUTURA DAS TELAS ======== */
.screen {
  display: none; /* Esconde todas as telas por padrão */
  width: 100%;
  height: 100vh;
  overflow-y: auto; /* Permite scroll dentro da tela, se precisar */
  box-sizing: border-box; 
  position: absolute;
  top: 0;
  left: 0;
  background-color: var(--cor-fundo);
}

.screen.active {
  display: block; /* Mostra apenas a tela ativa */
  z-index: 10;
}

.container {
  padding: 20px;
  text-align: center;
  padding-bottom: 80px;
}

.container-full {
  padding: 0;
  position: absolute; /* Posição absoluta */
  top: 54px;  /* Altura do header-slim */
  bottom: 0;  /* Estica até o fim da tela */
  width: 100%;
}

/* ======== CABEÇALHOS ======== */
.app-header {
  background-color: var(--cor-principal);
  color: white;
  padding: 15px;
  text-align: center;
  border-bottom-left-radius: 20px;
  border-bottom-right-radius: 20px;
  display: flex; 
  justify-content: center; 
  align-items: center; 
  position: relative;
  min-height: 60px;
}
.app-header .logo {
  width: 80px;
  height: 80px;
}
.app-header h1 {
  font-size: 1.5rem;
  margin: 0;
}

.app-header-slim {
  background-color: var(--cor-principal);
  padding: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 34px; 
  position: relative; 
  z-index: 200;
}

/* Botão Voltar no Header */
.btn-icon-header {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    padding: 10px;
    cursor: pointer;
    z-index: 10;
}

/* ======== ABAS (MAPA/LOJA) ======== */
.tabs {
  display: flex;
  background-color: #3a4a25;
  border-radius: 8px;
  overflow: hidden;
  margin: 0 auto;
}

.tab-btn {
  background: none;
  border: none;
  color: white;
  padding: 8px 20px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}

.tab-btn.active {
  background-color: #fdf8e6;
  color: var(--cor-principal);
  font-weight: bold;
}


/* ======== BARRA DE NAVEGAÇÃO CONTEXTUAL (MAPA) ======== */
.contextual-nav {
  position: absolute; 
  bottom: 0;
  left: 0;
  width: 100%;
  height: 60px;
  background-color: #ffffff;
  border-top: 1px solid #ddd;
  display: flex;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 -2px 5px rgba(0,0,0,0.05);
  z-index: 100; /* Garante que fique sobre o mapa */
}

.nav-btn-icon {
  background: none;
  border: none;
  color: #555; /* Cor mais escura para os ícones */
  font-size: 1.3rem; /* Tamanho do ícone */
  font-family: inherit;
  cursor: pointer;
  padding: 5px;
  flex: 1; /* Ocupa espaço igual */
}
.nav-btn-icon:hover {
  color: var(--cor-principal);
}

/* ======== BARRA DE BUSCA ======== */
#search-bar {
  position: absolute;
  top: 10px; 
  left: 10px;
  right: 10px;
  z-index: 200; 
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  padding: 5px;
}

#search-input {
  flex: 1; 
  border: none;
  outline: none;
  padding: 10px;
  font-size: 1rem;
  font-family: inherit;
}

#search-clear-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #888;
  padding: 10px;
  cursor: pointer;
}

/* ======== ELEMENTOS GERAIS (Botões, Inputs) ======== */
.container h2 {
  font-size: 1.8rem;
  color: var(--cor-texto);
}
.container p {
  font-size: 1.1rem;
  max-width: 300px;
  margin: 15px auto;
}
.coin-icon {
  width: 100px;
  margin: 20px 0;
}

.btn {
  display: inline-block;
  padding: 15px 30px;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  text-decoration: none;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 10px;
}
.btn-primary {
  background-color: var(--cor-secundaria);
  color: white;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.form-container {
  width: 100%;
  max-width: 400px;
  margin: 20px auto 0 auto;
  display: flex;
  flex-direction: column;
  gap: 15px; 
}

.form-container input[type="text"],
.form-container input[type="email"],
.form-container input[type="password"] {
  padding: 15px;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-family: inherit;
}

.btn-link {
  background: none;
  border: none;
  color: var(--cor-secundaria);
  text-decoration: underline;
  font-size: 1rem;
  margin-top: 10px;
  cursor: pointer;
  display: inline-block;
}


/* ======== MAPA ======== */
#map {
  width: 100%;
  height: 100%; 
  background-color: #e0e0e0;
  z-index: 50; 
}

/* ======== PERFIL ======== */
.logo-small {
  width: 60px;
  height: 60px;
}
.profile-header {
  text-align: center;
  margin-bottom: 20px;
  margin-top: 20px;
}

/* Foto de Perfil */
/* ======== PERFIL (Correção Definitiva) ======== */

.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 20px;
  margin-bottom: 20px;
  width: 100%; /* Garante que tem espaço */
}

/* 1. O Container (Label) define o tamanho fixo */
.profile-pic-label {
  position: relative; 
  display: block;
  width: 120px;       /* Tamanho FIXO largura */
  height: 120px;      /* Tamanho FIXO altura */
  min-width: 120px;   /* Impede de encolher */
  min-height: 120px;  /* Impede de encolher */
  margin: 0 auto 10px;
  cursor: pointer;
}

/* 2. A Imagem preenche o container sem distorcer */
.profile-pic {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;    /* O segredo: corta o excesso, não achata */
  border: 4px solid var(--cor-principal);
  display: block;
}

/* Ícone de editar */
.profile-pic-edit {
  position: absolute;
  bottom: 5px;
  right: 5px;
  background-color: var(--cor-secundaria);
  color: white;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  z-index: 5;
}

.btn-balance {
  background-color: #f7d44f;
  color: #333;
  font-weight: bold;
  font-size: 1.2rem;
  padding: 15px;
  border: none;
  border-radius: 12px;
}
.btn-secondary {
  background-color: #e8f0dd;
  border: 2px solid var(--cor-principal);
  color: var(--cor-principal);
  font-weight: bold;
  font-size: 1rem;
  padding: 15px;
  border-radius: 12px;
}

/* ======== LOJA & BRINDES ======== */
#store-item-list, #brindes-item-list {
  width: 100%;
  max-width: 400px; 
  margin: 0 auto; 
}

.store-item, .brinde-item {
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 15px;
  text-align: left;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.brinde-item {
    border: 2px solid var(--cor-secundaria);
}

.store-item h4, .brinde-item h4 {
  margin: 0 0 5px 0;
  color: var(--cor-principal);
  font-size: 1.1rem;
}

.store-item p, .brinde-item p {
  margin: 0 0 15px 0;
  font-size: 0.9rem;
  color: #555;
}

.brinde-item-data {
  font-size: 0.8rem;
  font-style: italic;
  color: #777;
}

.btn-redeem {
  background-color: var(--cor-secundaria);
  color: white;
  padding: 10px 15px;
  border-radius: 8px;
  border: none;
  font-weight: bold;
  font-size: 0.9rem;
  width: 100%;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-redeem:hover {
  background-color: #b86423;
}

.btn-redeem:disabled {
  background-color: #aaa;
  color: #eee;
  cursor: not-allowed;
}

/* ======== SCANNER ======== */
#scanner-screen .container-full {
    background-color: #222;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#reader {
  width: 90%;
  max-width: 400px;
  border: 4px solid var(--cor-principal);
  border-radius: 8px;
  overflow: hidden;
  background-color: #000;
}

#btn-stop-scan {
  margin-top: 20px;
  width: 90%;
  max-width: 400px;
}