/* ============================================================
   PRIME FIDELIDADE - Design System
   Estilo mobile-first, inspirado em apps de fidelidade modernos
   ============================================================ */

/* ---------- VARIÁVEIS GLOBAIS (CORES, ESPAÇOS, SOMBRAS) ---------- */
:root {
  /* Cores da marca */
  --roxo:        #6C4CF1;
  --roxo-escuro: #4F35C9;
  --roxo-claro:  #EFEBFF;
  --lima:        #B6FF3C;
  --lima-escuro: #8FE01F;

  /* Neutras */
  --fundo:      #F7F7FB;
  --branco:     #FFFFFF;
  --texto:      #1A1A2E;
  --texto-2:    #6B6B80;
  --borda:      #E5E5EF;

  /* Feedback */
  --erro:    #FF5C5C;
  --sucesso: #22C55E;
  --aviso:   #F59E0B;

  /* Espaçamentos */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-xl: 32px;

  /* Sombras */
  --sombra-1: 0 2px 8px rgba(15, 15, 26, 0.06);
  --sombra-2: 0 8px 24px rgba(108, 76, 241, 0.18);
  --sombra-3: 0 16px 40px rgba(15, 15, 26, 0.12);

  /* Tipografia */
  --fonte: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
           'Helvetica Neue', Arial, sans-serif;
}

/* ---------- RESET ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html { font-size: 16px; }

body {
  font-family: var(--fonte);
  background: var(--fundo);
  color: var(--texto);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: var(--roxo); text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ---------- CONTAINER PRINCIPAL (mobile-first) ---------- */
.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 18px 100px;   /* espaço extra embaixo para a tab bar */
  min-height: 100dvh;
}

/* ---------- HEADER DO APP ---------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-top: 8px;
}

.app-header .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--texto);
}

.logo-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--roxo) 0%, var(--roxo-escuro) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: var(--sombra-2);
  overflow: hidden;
}
.logo-mark img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- TIPOGRAFIA ---------- */
h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 6px; }
h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 6px; }
h3 { font-size: 1rem;    font-weight: 700; margin-bottom: 4px; }

.subtitulo { color: var(--texto-2); font-size: 0.95rem; margin-bottom: 24px; }
.label { font-size: 0.8rem; font-weight: 600; color: var(--texto-2); text-transform: uppercase; letter-spacing: 0.06em; }

/* ---------- CARD BASE ---------- */
.card {
  background: var(--branco);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--sombra-1);
  margin-bottom: 16px;
}

/* ---------- FORMULÁRIOS ---------- */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--texto-2);
  margin-bottom: 6px;
}

.input, input[type="text"], input[type="email"],
input[type="password"], input[type="tel"], input[type="number"], select {
  width: 100%;
  padding: 14px 16px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--fundo);
  border: 2px solid transparent;
  border-radius: var(--r-md);
  color: var(--texto);
  transition: border-color 0.15s, background 0.15s;
}
.input:focus, input:focus, select:focus {
  outline: none;
  background: var(--branco);
  border-color: var(--roxo);
}

/* ---------- BOTÕES ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px 20px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--r-md);
  transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
  text-align: center;
}
.btn:active { transform: scale(0.97); }

.btn-primario {
  background: var(--roxo);
  color: #fff;
  box-shadow: var(--sombra-2);
}
.btn-primario:hover { background: var(--roxo-escuro); }

.btn-secundario {
  background: var(--roxo-claro);
  color: var(--roxo);
}

.btn-limpar {
  background: transparent;
  color: var(--texto-2);
  font-weight: 600;
}

.btn-bloco { display: flex; }

/* ---------- ALERTAS ---------- */
.alerta {
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 0.9rem;
  margin-bottom: 16px;
  font-weight: 500;
}
.alerta-erro    { background: #FFE9E9; color: #B42318; }
.alerta-sucesso { background: #E7F8EE; color: #067647; }
.alerta-info    { background: var(--roxo-claro); color: var(--roxo-escuro); }

/* ---------- TAB BAR (navegação inferior estilo app) ---------- */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  background: var(--branco);
  border-top: 1px solid var(--borda);
  display: flex;
  justify-content: space-around;
  padding: 10px 8px calc(10px + env(safe-area-inset-bottom));
  z-index: 50;
}
.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--texto-2);
  padding: 6px;
  border-radius: var(--r-sm);
  transition: color 0.15s;
}
.tabbar a.ativo { color: var(--roxo); }
.tabbar a svg { width: 22px; height: 22px; }

/* ---------- CARTÃO DE FIDELIDADE (coração do app) ---------- */
.cartao-fidelidade {
  background: linear-gradient(135deg, var(--roxo) 0%, var(--roxo-escuro) 100%);
  border-radius: var(--r-xl);
  padding: 24px;
  color: #fff;
  box-shadow: var(--sombra-2);
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}
.cartao-fidelidade::after {
  content: '';
  position: absolute;
  top: -60px;
  right: -60px;
  width: 180px;
  height: 180px;
  background: rgba(182, 255, 60, 0.15);
  border-radius: 50%;
  pointer-events: none;
}
.cartao-fidelidade .nome-negocio {
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0.85;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.cartao-fidelidade .contador {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}
.cartao-fidelidade .contador span { font-size: 1rem; font-weight: 600; opacity: 0.8; }

/* Grade de selos */
.grade-selos {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-top: 12px;
}
.selo {
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  transition: transform 0.2s, background 0.2s;
}
.selo.cheio {
  background: var(--lima);
  color: var(--texto);
  transform: scale(1.05);
  box-shadow: 0 0 0 3px rgba(182, 255, 60, 0.3);
}

/* ---------- ESTADO VAZIO ---------- */
.vazio {
  text-align: center;
  padding: 40px 20px;
  color: var(--texto-2);
}
.vazio svg { width: 64px; height: 64px; opacity: 0.4; margin-bottom: 16px; }

/* ---------- BADGE / PILL ---------- */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--roxo-claro);
  color: var(--roxo);
}
.badge-sucesso { background: #E7F8EE; color: #067647; }

/* ---------- LISTAS ---------- */
.lista-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--borda);
}
.lista-item:last-child { border-bottom: none; }
.lista-item .info { flex: 1; }
.lista-item .nome { font-weight: 600; font-size: 0.95rem; }
.lista-item .meta { font-size: 0.8rem; color: var(--texto-2); }

/* ---------- SPLASH / LOGIN ---------- */
.tela-login {
  max-width: 480px;
  margin: 0 auto;
  padding: 60px 24px 40px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.tela-login .logo-grande {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--roxo) 0%, var(--roxo-escuro) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 1.6rem;
  margin-bottom: 20px;
  box-shadow: var(--sombra-2);
  overflow: hidden;
}
.tela-login .logo-grande img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- RESPONSIVO (telas maiores) ---------- */
@media (min-width: 600px) {
  .app { padding-top: 32px; }
  h1 { font-size: 2rem; }
}

/* ---------- ANIMAÇÕES SUAVES ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp 0.3s ease-out; }