/* ═══════════════════════════════════════════════════════════════
   CÂMERA UNIFICADA — Te Liga Aí
   Cobre: home (story+feed), bares (story), comércio (foto story)
   Sem efeitos/filtros
   ═══════════════════════════════════════════════════════════════ */

:root {
  --cam-bg: #090d16;
  --cam-surface: #131b2e;
  --cam-border: rgba(255, 255, 255, 0.12);
  --cam-red: #e8192c;
  --cam-gold: #f59e0b;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  background: var(--cam-bg) !important;
  min-height: 100%;
}

body {
  background: var(--cam-bg) !important;
  color: #f8fafc;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.oculto { display: none !important; }

.input-cam-oculto,
.fora {
  position: fixed;
  top: -9999px;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

/* ─── Topbar ─── */
.cam-topbar,
.topo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  padding-top: max(8px, env(safe-area-inset-top));
  background: rgba(9, 13, 22, 0.9);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--cam-border);
}

.cam-topbar-spacer,
.espaco { min-width: 78px; width: 78px; }

.cam-titulo,
.topo strong {
  font-size: 0.9rem;
  font-weight: 800;
  text-align: center;
}

.btn-cam-voltar,
.btn-voltar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 78px;
  width: 78px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--cam-border);
  color: #fff;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

.btn-cam-voltar:hover,
.btn-voltar:hover { background: rgba(255, 255, 255, 0.2); }

/* ─── Abas Story / Publicação (só home) ─── */
.cam-mode-tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.08);
  padding: 3px;
  border-radius: 24px;
  border: 1px solid var(--cam-border);
}

.cam-mode-tab {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.cam-mode-tab.active {
  background: var(--cam-red);
  color: #fff;
  box-shadow: 0 2px 8px rgba(232, 25, 44, 0.4);
}

/* ─── Área principal ─── */
.cam-main-area,
.area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 10px 30px;
  max-width: 420px;
  margin: 0 auto;
  width: 100%;
}

.aviso {
  width: 100%;
  background: #3b2a05;
  border: 1px solid #92400e;
  color: #fcd34d;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.82rem;
  line-height: 1.4;
  margin-bottom: 12px;
  text-align: center;
}

.aviso a {
  color: #fff;
  font-weight: 800;
  margin-left: 6px;
}

/* ─── Formato do post (só modo feed) ─── */
.formato-escolha {
  display: none;
  gap: 8px;
  justify-content: center;
  margin-bottom: 12px;
  width: 100%;
  flex-wrap: wrap;
}

.formato-opt {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--cam-border);
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}

.formato-opt.ativo {
  background: #fff;
  color: #090d16;
  border-color: #fff;
}

.formato-opt:disabled { opacity: 0.5; cursor: not-allowed; }

.formato-box {
  display: inline-block;
  border: 2px solid currentColor;
  border-radius: 2px;
}

.formato-box.f1x1  { width: 13px; height: 13px; }
.formato-box.f3x4  { width: 11px; height: 15px; }
.formato-box.f16x9 { width: 18px; height: 10px; }

/* ─── Palco / prévia ─── */
.cam-stage,
.palco {
  position: relative;
  width: 100%;
  max-width: 360px;
  border-radius: 20px;
  overflow: hidden;
  background: #0d1322;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.1);
  transition: max-width 0.3s ease, aspect-ratio 0.3s ease;
  contain: layout paint;
}

.cam-stage.mode-story,
.cam-stage:not(.mode-feed),
.palco {
  aspect-ratio: 9 / 16;
  height: min(64vh, 560px);
}

.palco[data-formato="comercio"] {
  aspect-ratio: 650 / 850;
  height: auto;
}

.cam-stage.mode-feed {
  max-width: 600px;
  height: auto;
  aspect-ratio: 1 / 1;
}

.cam-stage.mode-feed[data-formato="1x1"]  { aspect-ratio: 1 / 1; }
.cam-stage.mode-feed[data-formato="3x4"]  { aspect-ratio: 3 / 4; }
.cam-stage.mode-feed[data-formato="16x9"] { aspect-ratio: 16 / 9; }

#cam-preview-image,
#cam-preview-video,
#cam-live,
.palco video,
.palco img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.palco video:not(.oculto),
.palco img:not(.oculto) { display: block; }

.cam-placeholder,
.placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 24px;
  color: #94a3b8;
  font-size: 0.86rem;
  line-height: 1.4;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.cam-placeholder .big,
.placeholder .ico { font-size: 1.5rem; }
.placeholder .ico { font-size: 2.4rem; }
.cam-placeholder strong,
.placeholder strong { color: #e2e8f0; font-size: 1rem; }

.cam-botao-camera {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--cam-red);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 22px rgba(232, 25, 44, 0.55);
  cursor: pointer;
  transition: transform 0.15s;
  pointer-events: auto;
}

.cam-botao-camera:active { transform: scale(0.9); }

.cam-aviso-tempo {
  color: #fcd34d;
  padding: 9px 12px;
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.35;
  text-align: center;
}

.cam-badge-top-left {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  padding: 5px 10px;
  border-radius: 14px;
  font-size: 0.72rem;
  font-weight: 700;
  z-index: 15;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f8fafc;
  letter-spacing: 0.5px;
  display: none;
}

.cam-stage.tem-midia .cam-badge-top-left,
.palco.tem-midia .cam-badge-top-left { display: block; }

/* Controles ao vivo (comércio) */
.ctrl {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 10px 12px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
  z-index: 5;
}

.ctrl .lado { display: flex; gap: 8px; align-items: center; }
.ctrl .lado.dir { justify-content: flex-end; }

.btn-redondo {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--cam-border);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
}

.obturador {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: transparent;
  position: relative;
  cursor: pointer;
}

.obturador::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: #fff;
  transition: all 0.15s;
}

.obturador:active::after { inset: 9px; }

/* ─── Barra foto / vídeo / galeria ─── */
.cam-pick-bar,
.pick {
  width: 100%;
  max-width: 440px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.btn-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px 10px;
  border-radius: 16px;
  border: 1.5px solid var(--cam-border);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}

.btn-pick:active { transform: scale(0.96); }
.btn-pick .ico,
.btn-pick .i { font-size: 1.4rem; line-height: 1; }
.btn-pick small {
  font-weight: 400;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.7rem;
}

.btn-pick.primary {
  background: transparent;
  border-color: var(--cam-red);
  box-shadow: 0 4px 14px rgba(232, 25, 44, 0.4);
}

.btn-pick.primary small { color: rgba(255, 255, 255, 0.85); }

.btn-pick.wide {
  grid-column: 1 / -1;
  flex-direction: row;
  gap: 8px;
  padding: 12px 5px;
  font-size: 0.86rem;
}

.btn-pick.wide .ico { font-size: 1.2rem; }

.icone-video {
  filter: sepia(1) saturate(8) hue-rotate(5deg) brightness(1.1);
}

.link {
  margin-top: 10px;
  background: none;
  border: none;
  color: #93c5fd;
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
  text-decoration: underline;
}

/* ─── Revisão / formulário ─── */
.cam-review-section,
.review {
  width: 100%;
  max-width: 540px;
  margin-top: 10px;
  background: var(--cam-surface);
  border: 1px solid var(--cam-border);
  border-radius: 16px;
  padding: 16px 18px 22px;
  display: none;
  animation: fadeInReview 0.25s ease;
}

.cam-review-section.active,
.review:not(.oculto) { display: block; }

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

.cam-review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--cam-border);
}

.cam-review-header h3,
.cam-review-section h3,
.review h3 {
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--cam-border);
}

.cam-form-group,
.review label {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cam-form-group label,
.review label {
  font-size: 0.76rem;
  font-weight: 700;
  color: #cbd5e1;
  display: block;
  margin-bottom: 4px;
}

.cam-form-group input,
.cam-form-group textarea,
.cam-form-group select,
.review input {
  width: 100%;
  background: #090d16;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 0.86rem;
  color: #fff;
  outline: none;
  transition: border-color 0.15s;
}

.cam-form-group input:focus,
.cam-form-group textarea:focus,
.cam-form-group select:focus,
.review input:focus { border-color: var(--cam-red); }

.cam-form-group input::placeholder,
.cam-form-group textarea::placeholder,
.review input::placeholder { color: #64748b; }

.cam-form-linha {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.cam-nota,
.review p {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 2px;
  line-height: 1.4;
}

.cam-review-actions,
.acoes {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.btn-review-retake,
#btn-trocar {
  flex: 1;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--cam-border);
  color: #fff;
  padding: 12px;
  border-radius: 24px;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s;
}

.btn-review-retake:hover { background: rgba(255, 255, 255, 0.18); }
.btn-review-retake:disabled,
#btn-trocar:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-review-publish,
#btn-publicar {
  flex: 2;
  background: var(--cam-red);
  border: none;
  color: #fff;
  padding: 12px;
  border-radius: 24px;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 4px 14px rgba(232, 25, 44, 0.4);
  transition: transform 0.15s, background 0.15s;
}

.btn-review-publish:hover { background: #c81324; transform: translateY(-1px); }
.btn-review-publish:disabled,
#btn-publicar:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.cam-aviso-processando {
  display: none;
  margin-top: 10px;
  font-size: 0.74rem;
  color: #fbbf24;
  text-align: center;
}

/* ─── Meus stories (comércio) ─── */
.meus {
  width: 100%;
  margin-top: 18px;
}

.meus h3 {
  font-size: 0.76rem;
  font-weight: 800;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  padding: 0 4px;
}

.ms-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--cam-surface);
  border: 1px solid var(--cam-border);
  border-radius: 14px;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.ms-thumb {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  background: #0d1322;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.ms-nome {
  flex: 1;
  min-width: 0;
  font-size: 0.82rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ms-apagar {
  background: transparent;
  border: 1.5px solid var(--cam-red);
  color: #fff;
  border-radius: 18px;
  padding: 8px 14px;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.ms-apagar:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Toast ─── */
.cam-toast,
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(50px);
  background: #0f172a;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 10px 18px;
  border-radius: 24px;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.25s;
  max-width: 92vw;
  text-align: center;
}

.cam-toast.visible,
.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}