/* ── galeria.php — captura de câmera, reconhecimento facial, galeria
   pessoal e lightbox. Depende de tokens.css + base.css + components.css. */

body.galeria-body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: linear-gradient(160deg, #04253f 0%, var(--blue) 60%, var(--blue-lt) 100%);
  min-height: 100vh;
  color: #fff;
}

/* ── Header ── */
.gal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: rgba(0,0,0,.25);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}
.gal-topbar a { display: flex; align-items: center; gap: 9px; color: #fff; }
.gal-topbar img { height: 44px; width: 44px; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); }
.gal-topbar span { font-family: 'Luckiest Guy', cursive; font-size: 1.05rem; letter-spacing: .01em; }

#btn-sair {
  display: none;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.35);
  color: #fff;
  padding: 7px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: .88rem;
  align-items: center;
  gap: 6px;
  transition: background .15s;
}
#btn-sair:hover { background: rgba(255,255,255,.28); }

/* ── Tela câmera ── */
#tela-camera {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 20px 48px;
  gap: 24px;
  min-height: calc(100vh - 64px);
  justify-content: center;
}

/* ── Steps ── */
.steps-bar { display: flex; align-items: center; width: 100%; max-width: 280px; }
.step-dot {
  width: 30px; height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(255,255,255,.15);
  border: 2px solid rgba(255,255,255,.25);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700;
  transition: .35s;
}
.step-dot.ativa { background: rgba(255,255,255,.9); color: var(--blue-dk); border-color: #fff; }
.step-dot.feita { background: var(--success); border-color: var(--success); color: #fff; }
.step-line { flex: 1; height: 2px; background: rgba(255,255,255,.2); transition: .35s; }
.step-line.feita { background: var(--success); }
.step-label { font-size: .7rem; opacity: .6; margin-top: 4px; text-align: center; white-space: nowrap; }
.step-col { display: flex; flex-direction: column; align-items: center; }

/* ── Camera ring ── */
.camera-ring {
  position: relative;
  width: 240px; height: 240px;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid rgba(255,255,255,.35);
  transition: border-color .4s, box-shadow .4s;
}
/* "pronto": câmera ao vivo, esperando o cliente tocar em "Tirar foto" —
   mesmo visual pulsante de antes, só que agora não significa "buscando",
   e sim "pronto pra capturar". "buscando": depois do toque, processando
   a única foto enviada. */
.camera-ring[data-state="pronto"] {
  border-color: rgba(255,255,255,.4);
  animation: pulse-scan 2.5s ease-in-out infinite;
}
.camera-ring[data-state="buscando"] {
  border-color: var(--blue-lt);
  box-shadow: 0 0 0 10px rgba(0,180,216,.18);
  animation: pulse-buscando 1s ease-in-out infinite;
}
.camera-ring[data-state="found"] {
  border-color: var(--success);
  box-shadow: 0 0 0 14px rgba(16,185,129,.25);
  animation: none;
}
.camera-ring[data-state="idle"] { border-color: rgba(255,255,255,.2); animation: none; }

@keyframes pulse-scan {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0,180,216,.4); }
  50%       { box-shadow: 0 0 0 22px rgba(0,180,216,0); }
}
@keyframes pulse-buscando {
  0%, 100% { opacity: 1; }
  50%      { opacity: .55; }
}

#video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }

/* Flash de "obturador" ao tocar em Tirar foto — feedback tátil de que a
   captura aconteceu, como numa câmera de verdade. */
.cam-flash {
  position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none;
}
.cam-flash.ativo { animation: flash .35s ease-out; }
@keyframes flash {
  0%   { opacity: .85; }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .cam-flash.ativo { animation: none; }
  .camera-ring[data-state="pronto"],
  .camera-ring[data-state="buscando"] { animation: none; }
  #promocoes-container { animation: none; }
  .promo-chip--selo { animation: none; }
}

.scan-line {
  position: absolute; left: 0; right: 0; height: 3px; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--blue-lt), transparent);
  animation: scan 2.5s linear infinite;
  opacity: .9;
}
@keyframes scan {
  0%   { top: 0; opacity: 1; }
  90%  { top: 100%; opacity: 1; }
  100% { top: 100%; opacity: 0; }
}
.camera-ring[data-state="pronto"] .scan-line { display: block; }
.camera-ring:not([data-state="pronto"]) .scan-line { display: none; }

.face-guide { position: absolute; inset: 0; pointer-events: none; display: flex; align-items: center; justify-content: center; }
.face-guide svg { width: 78%; height: 78%; transition: opacity .3s; opacity: .35; }
.camera-ring[data-state="pronto"] .face-guide svg { opacity: .8; }
.camera-ring[data-state="found"]    .face-guide,
.camera-ring[data-state="buscando"] .face-guide { display: none; }
.camera-ring[data-state="idle"] .face-guide svg { opacity: .15; }

/* ── Botão de captura (obturador) ── */
#btn-capturar {
  display: none;
  width: 68px; height: 68px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid rgba(255,255,255,.5);
  color: var(--blue-dk);
  font-size: 1.4rem;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0,0,0,.35);
  transition: transform .15s, opacity .15s;
}
#btn-capturar:hover:not(:disabled) { transform: scale(1.05); }
#btn-capturar:active:not(:disabled) { transform: scale(.94); }
#btn-capturar:disabled { opacity: .5; cursor: not-allowed; }

/* ── Status box ── */
.status-box { text-align: center; max-width: 300px; }
.status-spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(255,255,255,.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .75s linear infinite;
  margin: 0 auto 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }
#status-icone   { font-size: 2.4rem; margin-bottom: 8px; display: none; }
#status-texto   { font-size: 1.1rem; font-weight: 700; }
#status-detalhe { font-size: .88rem; opacity: .75; margin-top: 6px; line-height: 1.5; }

/* ── Tips ── */
#tips-wrap { display: none; max-width: 300px; width: 100%; }
.tip-card {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 14px;
  padding: 14px 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: .88rem;
  line-height: 1.5;
  text-align: left;
  animation: fadeUp .35s ease;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.tip-card i { opacity: .8; font-size: 1.1rem; margin-top: 1px; flex-shrink: 0; }
.tip-dots { display: flex; gap: 5px; justify-content: center; margin-top: 10px; }
.tip-dot  { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.3); transition: .3s; }
.tip-dot.ativa { background: rgba(255,255,255,.85); }

/* ── Retry / erro ── */
#btn-retry { display: none; }
#msg-erro {
  display: none;
  max-width: 380px;
  background: rgba(239,68,68,.18);
  border: 1px solid rgba(239,68,68,.45);
  border-radius: 14px;
  padding: 16px 20px;
  text-align: center;
  font-size: .9rem;
  line-height: 1.5;
}

a.voltar { color: rgba(255,255,255,.6); font-size: .88rem; display: flex; align-items: center; gap: 6px; }
a.voltar:hover { color: #fff; }

/* ── Galeria ── */
#tela-galeria { display: none; padding: 24px 16px 60px; }
.gal-header { text-align: center; margin-bottom: 18px; }
.gal-header h2 { font-size: 1.5rem; font-weight: 800; text-wrap: balance; }

.data-grupo { margin-bottom: 28px; }
.data-grupo-titulo {
  font-size: .8rem; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
  opacity: .65; margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
}
.data-grupo-titulo::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,.2); }

.fotos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  max-width: 1100px;
  margin: 0 auto;
}
.foto-card {
  position: relative;
  background: rgba(255,255,255,.12);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
  border: 1px solid rgba(255,255,255,.15);
}
.foto-card:hover, .foto-card:focus-visible { transform: scale(1.03); box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.foto-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }

/* Ícone de download flutuante sobre a foto — a data já aparece no título do
   grupo acima (.data-grupo-titulo), repetir por extenso em cada card só
   ocupava espaço e, no mobile (card ~120px), quebrava em várias linhas e
   empurrava o botão pra fora do card. */
.btn-dl {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 32px;
  height: 32px;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  font-size: .8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, transform .15s;
}
.btn-dl:hover { background: rgba(0,0,0,.75); transform: scale(1.08); }

/* ── Promoções (aparecem depois da grade de fotos, nunca antes) ──
   Objetivo: reforçar que é um benefício de quem já foi reconhecido (gatilho
   de fidelização), sem competir com o motivo principal da página (as fotos)
   — a pessoa vê o resultado da busca primeiro, sem nada no caminho; a
   promoção fecha a experiência como um bônus, com uma divisória sutil
   marcando que é outro bloco de conteúdo. Linguagem visual igual à do resto
   da galeria (glass card translúcido sobre o gradiente azul) — o dourado
   fica reservado só pros chips/CTA/glow, nunca a borda inteira do card.
   Em vez de um popup (mais chamativo, mas interrompe quem só quer ver as
   fotos — o oposto do que se quer num gesto de fidelização), a entrada tem
   uma animação sutil de fade+subida pra chamar o olho sem bloquear nada. */
#promocoes-container {
  position: relative;
  max-width: 1100px;
  margin: 12px auto 0;
  padding-top: 28px;
  border-top: 1px solid rgba(255,255,255,.14);
  animation: promoEntrada .6s cubic-bezier(.22,.68,0,1) both;
}

@keyframes promoEntrada {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.promo-glow {
  position: absolute;
  top: 8px; left: 50%;
  width: min(640px, 92vw); height: 160px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(244,183,64,.26), transparent 72%);
  filter: blur(6px);
  pointer-events: none;
  z-index: 0;
}

.promo-strip-header {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  text-align: center; margin-bottom: 12px;
}
.promo-strip-kicker {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .72rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
  color: #ffdb8e;
}
.promo-strip-title { font-size: 1.2rem; font-weight: 800; text-wrap: balance; }

.promo-strip {
  position: relative; z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
}
.promo-card {
  display: flex;
  flex: 1 1 440px;
  max-width: 560px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 18px;
  overflow: hidden;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.promo-card:hover { transform: translateY(-3px); box-shadow: 0 12px 36px rgba(0,0,0,.3); border-color: rgba(244,183,64,.5); }

.promo-card img {
  width: 128px;
  align-self: center;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  display: block;
}
.promo-card-body { padding: 14px 16px; flex: 1; min-width: 0; display: flex; flex-direction: column; }

.promo-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.promo-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .64rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px; line-height: 1.4;
}
.promo-chip--selo {
  background: rgba(244,183,64,.16); color: #ffdb8e; border: 1px solid rgba(244,183,64,.5);
  /* Pulsa só 3 vezes (uns 6s) depois que o banner entra, pra puxar o olho
     sem virar uma piscada irritante pra quem fica mais tempo na tela. */
  animation: promoPulso 2s ease-out 3;
  animation-delay: .5s;
}
.promo-chip--urgente { background: rgba(239,68,68,.18); color: #ffc9c9; border: 1px solid rgba(239,68,68,.42); }

@keyframes promoPulso {
  0%, 100% { box-shadow: 0 0 0 0 rgba(244,183,64,.5); }
  50%      { box-shadow: 0 0 0 5px rgba(244,183,64,0); }
}

.promo-card-body h3 { font-size: 1rem; font-weight: 800; margin-bottom: 3px; text-wrap: balance; }

/* Descrição limitada a 2 linhas — sem isso, uma descrição longa digitada no
   admin poderia esticar o card indefinidamente e empurrar as fotos (o
   conteúdo principal da página) pra bem mais longe, no mobile principalmente. */
.promo-card-body p {
  font-size: .82rem; opacity: .85; line-height: 1.4; margin-bottom: 8px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.promo-cta { align-self: flex-start; margin-top: auto; font-size: .8rem; padding: 7px 16px; }

/* Continua compacto (imagem pequena ao lado do texto) mesmo no mobile — a
   alternativa (empilhar a imagem em cima, largura total) fazia o banner
   sozinho passar de 400px de altura, empurrando as fotos pra fora da
   primeira tela. Aqui isso nunca vira um bloco alto sozinho. */
@media (max-width: 560px) {
  .promo-glow { height: 130px; }
  .promo-card { max-width: 100%; }
  .promo-card img { width: 92px; }
  .promo-card-body { padding: 10px 12px; }
  .promo-card-body h3 { font-size: .92rem; }
  .promo-card-body p { font-size: .78rem; -webkit-line-clamp: 2; margin-bottom: 6px; }
  .promo-cta { padding: 6px 14px; font-size: .76rem; }
}

.gal-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 20px; }
.gal-btn {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  padding: 9px 20px;
  border-radius: 20px;
  cursor: pointer;
  font-size: .88rem;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: background .15s;
}
.gal-btn:hover { background: rgba(255,255,255,.28); }
.gal-btn:disabled { opacity: .6; cursor: not-allowed; }

.vazio { text-align: center; padding: 60px 20px; opacity: .65; }
.vazio i { font-size: 3rem; margin-bottom: 16px; display: block; }

/* ── Lightbox ── */
#lightbox {
  display: none;
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.92);
  align-items: center; justify-content: center;
  padding: 16px;
}
#lightbox.aberto { display: flex; }
#lb-img { max-width: 100%; max-height: 85vh; border-radius: 10px; object-fit: contain; display: block; }
#lb-fechar {
  position: absolute; top: 16px; right: 20px;
  background: rgba(255,255,255,.15); border: none; color: #fff;
  width: 40px; height: 40px; border-radius: 50%; font-size: 1.1rem;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
#lb-fechar:hover { background: rgba(255,255,255,.3); }
#lb-actions {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px; align-items: center;
}
#lb-download, #lb-share {
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.3);
  color: #fff; padding: 10px 18px; border-radius: 20px; cursor: pointer;
  font-size: .88rem; display: flex; align-items: center; gap: 7px;
  transition: background .15s; white-space: nowrap;
}
#lb-download:hover, #lb-share:hover { background: rgba(255,255,255,.3); }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,.12); border: none; color: #fff;
  width: 48px; height: 48px; border-radius: 50%; font-size: 1.1rem;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.lb-nav:hover { background: rgba(255,255,255,.28); }
#lb-prev { left: 10px; }
#lb-next { right: 10px; }

@media (max-width: 640px) {
  .gal-topbar {
    padding: 10px 14px;
    gap: 10px;
  }
  .gal-topbar a {
    gap: 8px;
  }
  .gal-topbar img { height: 34px; width: 34px; }
  /* Sem espaço sobrando pra "Orla Club" + botão "Nova busca" lado a lado em
     telas estreitas (quebrava em 2 linhas) — o logo sozinho já identifica a
     marca aqui, é uma tela de utilidade (voltar/ver fotos), não um momento
     de branding. */
  .gal-topbar span { display: none; }
  #btn-sair { padding: 6px 14px; font-size: .82rem; }

  .steps-bar {
    max-width: 100%;
    min-width: 0;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }
  .step-line { min-width: 16px; }
  .step-label { font-size: .72rem; }

  .camera-ring {
    width: min(260px, 80vw);
    height: min(260px, 80vw);
  }

  #btn-capturar {
    width: 62px; height: 62px;
    font-size: 1.2rem;
  }

  #tela-camera {
    padding: 26px 14px 44px;
    gap: 18px;
    min-height: auto;
  }
  .status-box { width: min(100%, 320px); }
  #status-texto { font-size: 1rem; }
  #status-detalhe { font-size: .83rem; }

  #tips-wrap { max-width: 100%; }
  .tip-card { padding: 12px 16px; font-size: .85rem; }
  .tip-card i { font-size: 1rem; }

  #tela-galeria { padding: 16px 14px 48px; }
  .gal-header { margin-bottom: 14px; }
  .gal-header h2 { font-size: 1.15rem; }
  .gal-actions { margin-bottom: 16px; }
  .gal-btn { justify-content: center; padding: 9px 18px; font-size: .82rem; }

  .fotos-grid { grid-template-columns: repeat(2, minmax(120px, 1fr)); gap: 10px; }
  .btn-dl { width: 28px; height: 28px; right: 6px; bottom: 6px; font-size: .72rem; }

  #lightbox { padding: 12px; }
  #lb-fechar { top: 12px; right: 14px; width: 38px; height: 38px; }
  .lb-nav { width: 42px; height: 42px; }
  #lb-actions { bottom: 14px; gap: 6px; flex-wrap: wrap; max-width: calc(100% - 32px); }
  #lb-download, #lb-share { padding: 10px 14px; font-size: .82rem; }
}

@media (max-width: 480px) {
  .camera-ring { width: 200px; height: 200px; }
  .fotos-grid  { grid-template-columns: 1fr 1fr; gap: 8px; }
  #tela-camera { padding: 24px 16px 40px; gap: 18px; }
}
