* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: #121218;
  color: #f2f2f5;
}

/* ---------- Cabeçalho da loja ---------- */
.loja-header {
  background: linear-gradient(135deg, var(--cor-primaria, #6C5CE7), var(--cor-secundaria, #00CEC9));
  padding: 28px 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-radius: 0 0 22px 22px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .35);
  position: relative;
  z-index: 2;
}
.loja-header-conteudo { display: flex; align-items: center; gap: 16px; max-width: 1100px; margin: 0 auto; }
.loja-logo {
  max-width: 108px;
  max-height: 84px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  flex-shrink: 0;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, .35));
}
.loja-header h1 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: .2px; text-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
.loja-header p { margin: 4px 0 0; opacity: .92; font-size: 14.5px; }

.loja-busca { display: flex; gap: 8px; max-width: 1100px; margin: 0 auto; width: 100%; }
.loja-busca-campo { position: relative; flex: 1; display: flex; align-items: center; }
.loja-busca-campo input {
  width: 100%; padding: 10px 34px 10px 14px; border-radius: 8px; border: none; font-size: 14px;
}
.loja-busca-limpar {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; border-radius: 50%; background: rgba(0,0,0,.15); color: #333;
  display: flex; align-items: center; justify-content: center; text-decoration: none;
  font-size: 16px; line-height: 1; font-weight: 700;
}
.loja-busca-limpar:hover { background: rgba(0,0,0,.3); }
.loja-busca button {
  padding: 10px 16px; border-radius: 8px; border: none; background: rgba(0,0,0,.25); color: #fff; cursor: pointer;
}

/* ---------- Categorias ---------- */
.loja-categorias {
  display: flex; gap: 8px; overflow-x: auto; padding: 14px 20px; background: #1a1a22;
  max-width: 1140px; margin: 0 auto;
}
.loja-categorias a {
  color: #cfcfe0; text-decoration: none; padding: 6px 14px; border-radius: 20px; background: #24242f; white-space: nowrap; font-size: 13px;
}
.loja-categorias a.ativo { background: var(--cor-primaria, #6C5CE7); color: #fff; }

/* ---------- Grid de apps ---------- */
.loja-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  padding: 20px;
  max-width: 1140px;
  margin: 0 auto;
}
.loja-vazio { grid-column: 1 / -1; text-align: center; color: #999; padding: 40px 0; }

.app-card {
  background: #1e1e27; border-radius: 14px; padding: 14px; position: relative;
  display: flex; flex-direction: column; gap: 8px; text-align: center;
  outline-offset: 3px; overflow: hidden;
}
/* Garante que textos digitados sem espaços (nome, descrição, código) quebrem a
   linha em vez de vazar pra fora do card e cobrir o que vem depois. */
.app-card * { overflow-wrap: anywhere; word-break: break-word; }
.app-destaque {
  position: absolute; top: 10px; right: 10px; background: #ffb020; color: #1a1a1a;
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 20px;
  z-index: 3; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); border: 2px solid #fff;
}
.app-imagem { width: 100%; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #2a2a35; display: flex; align-items: center; justify-content: center; position: relative; }
.app-imagem img { width: 100%; height: 100%; object-fit: contain; }
.app-imagem-placeholder { font-size: 40px; }

/* Galeria de imagens (quando o app tem mais de uma foto) */
.app-imagem-galeria img { display: none; position: absolute; inset: 0; }
.app-imagem-galeria img.ativa { display: block; }
.app-galeria-seta {
  position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,.45); color: #fff;
  border: none; width: 24px; height: 24px; border-radius: 50%; font-size: 16px; line-height: 1; cursor: pointer; z-index: 2;
}
.app-galeria-anterior { left: 6px; }
.app-galeria-proxima { right: 6px; }
.app-galeria-pontos { position: absolute; bottom: 6px; left: 0; right: 0; display: flex; justify-content: center; gap: 4px; z-index: 2; }
.app-galeria-pontos span { width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,.4); }
.app-galeria-pontos span.ativo { background: #fff; }
/* Nome e código do app ficam sempre em 1 linha (com "..." se for muito grande) pra
   o card não crescer sem limite — em vez disso, o valor completo sempre pode ser
   conferido/editado no painel. */
.app-nome {
  font-size: 15px; margin: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Descrição: mostra 3 linhas por padrão; se o texto for maior que isso, em vez de
   crescer o card ou cortar o final, aparece uma rolagem vertical pra pessoa arrastar
   e ler o resto. */
.app-descricao {
  font-size: 12.5px; color: #a9a9bc; margin: 0;
  line-height: 15px; max-height: 45px; overflow-y: auto;
}
.app-descricao::-webkit-scrollbar { width: 4px; }
.app-descricao::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .25); border-radius: 4px; }
.app-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; font-size: 11.5px; color: #b7b7c9; }
/* Código do downloader: quebra pra linha de baixo normalmente quando for grande
   (sem rolagem e sem cortar nada). */
.app-codigo {
  background: #24242f; padding: 6px 8px; border-radius: 6px;
  display: flex; flex-direction: column; gap: 3px;
}
.app-codigo-rotulo { font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: #9a9ab0; }
.app-codigo-valor { font-size: 13px; }
.app-baixar {
  margin-top: auto; text-align: center; text-decoration: none;
  background: var(--cor-primaria, #6C5CE7); color: #fff; padding: 10px; border-radius: 8px;
  font-weight: 600; font-size: 14px; border: none; cursor: pointer;
}
.app-baixar:hover { filter: brightness(1.1); }

/* ---------- Destaque de seleção: mouse (hover), teclado e controle remoto de TV Box (focus) ---------- */
.app-card:hover,
.app-card:focus-within {
  outline: 3px solid var(--cor-secundaria, #00CEC9);
  box-shadow: 0 0 0 6px rgba(0, 206, 201, .25);
  transform: scale(1.03);
  transition: transform .12s ease, box-shadow .12s ease;
  z-index: 3;
}
.app-baixar:hover,
.app-baixar:focus,
.loja-categorias a:hover,
.loja-categorias a:focus {
  outline: 3px solid #fff;
  outline-offset: 2px;
}
.app-baixar:hover,
.app-baixar:focus {
  background: var(--cor-secundaria, #00CEC9);
}

/* ---------- Modal de progresso de download ---------- */
.modal-download {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 100;
}
.modal-download.escondido { display: none; }
.modal-download-caixa { background: #1e1e27; border-radius: 14px; padding: 24px; max-width: 340px; width: 100%; text-align: center; }
.modal-download-caixa h3 { margin: 0 0 14px; font-size: 16px; }
.barra-progresso { background: #2a2a35; border-radius: 20px; height: 10px; overflow: hidden; margin-bottom: 10px; }
.barra-progresso-preenchida { background: var(--cor-primaria, #6C5CE7); height: 100%; width: 0%; transition: width .2s; }
#modal-download-status { font-size: 13px; color: #b7b7c9; margin: 0 0 14px; }
.modal-download-fechar { background: #2a2a35; color: #fff; border: none; padding: 8px 16px; border-radius: 8px; cursor: pointer; }

/* ---------- Tela de senha ---------- */
.pagina-senha { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.caixa-senha { background: #1e1e27; border-radius: 16px; padding: 32px; max-width: 340px; width: 100%; text-align: center; }
.caixa-senha-logo { width: 56px; height: 56px; border-radius: 12px; margin-bottom: 12px; }
.caixa-senha h1 { font-size: 18px; margin: 0 0 6px; }
.caixa-senha p { color: #a9a9bc; font-size: 13px; margin: 0 0 20px; }
.caixa-senha form { display: flex; flex-direction: column; gap: 10px; }
.caixa-senha input { padding: 12px; border-radius: 8px; border: none; font-size: 16px; text-align: center; letter-spacing: 2px; }
.caixa-senha button {
  padding: 12px; border-radius: 8px; border: none; background: var(--cor-primaria, #6C5CE7); color: #fff; font-weight: 600; cursor: pointer;
}

/* ---------- Flash messages ---------- */
.flash { margin: 12px auto; max-width: 1100px; padding: 10px 14px; border-radius: 8px; font-size: 13px; }
.flash-sucesso { background: #1f4d3a; color: #8ef0c0; }
.flash-erro { background: #4d1f27; color: #f08e9c; }

/* ---------- Rodapé ---------- */
.loja-footer { text-align: center; padding: 24px 20px 40px; color: #7d7d92; font-size: 12.5px; max-width: 1140px; margin: 0 auto; }
.loja-footer a { color: var(--cor-secundaria, #00CEC9); }
.loja-copyright { margin-top: 14px; padding-top: 14px; border-top: 1px solid #26263a; color: #55556a; font-size: 11.5px; letter-spacing: .2px; }
