/* ============================================
   17-FOTO.CSS
   Editor de Foto: palco, papel, barras pill,
   lixeira, painel Aa, rodapé cápsula, cápsula marca.
============================================ */

/* ============================================
   OVERLAY DO EDITOR
============================================ */

#fotoEditorNex {
  position: fixed;
  inset: 0;
  background: #0a0a0f;
  z-index: 90000;
  display: none;
  overflow: hidden;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

#fotoEditorNex.aberto {
  display: block;
}

/* ============================================
   PALCO (mesa escura ao redor do papel)
============================================ */

#fotoPalcoNex {
  position: absolute;
  top: 60px;
  bottom: 90px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: stretch;
  justify-content: center;
  overflow: hidden;
  border-radius: 20px;
}

/* ============================================
   PAPEL (onde fica a foto em COVER)
============================================ */

#fotoPapelNex {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
  border-radius: 20px;
  overflow: hidden;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.45),
    0 2px 8px rgba(0, 0, 0, 0.2),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  animation: fotoEntrada 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes fotoEntrada {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ============================================
   CAMADA DE ELEMENTOS (textos/stickers)
============================================ */

#fotoCamadaNex {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

#fotoCamadaNex > * {
  pointer-events: auto;
}

/* ============================================
   TEXTO NO PAPEL
============================================ */

#fotoEditorNex .video-editor-text-body-mydrops-nex {
  font-family: 'Caveat', 'Comic Sans MS', cursive !important;
  font-weight: 500 !important;
  color: #ffffff !important;
  font-size: 28px !important;
  line-height: 1.35 !important;
  letter-spacing: 0.2px !important;
  padding: 8px !important;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

#fotoEditorNex .video-editor-text-body-mydrops-nex:not([class*="tema-"]) {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

#fotoEditorNex .video-editor-text-body-mydrops-nex:empty::before {
  content: '✍🏼 Escreva algo bonito...';
  color: rgba(255, 255, 255, 0.95);
  font-weight: 600;
  text-shadow:
    0 1px 3px rgba(0, 0, 0, 0.9),
    0 0 8px rgba(0, 0, 0, 0.7),
    0 2px 14px rgba(0, 0, 0, 0.6);
}

/* ============================================
   SELEÇÃO COM LINHA TRACEJADA AZUL
============================================ */

#fotoEditorNex .video-editor-text-mydrops-nex.is-selected,
#fotoEditorNex .video-editor-photo-mydrops-nex.is-selected {
  outline: 2px dashed #2563eb !important;
  outline-offset: 6px !important;
  animation: fotoSelecaoPulse 1.4s ease-in-out infinite;
}

@keyframes fotoSelecaoPulse {
  0%, 100% { outline-offset: 6px; }
  50%      { outline-offset: 8px; }
}

/* ============================================
   BARRA SUPERIOR — PILL PRINCIPAL
============================================ */

#fotoBarraTopoNex {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 20, 30, 0.82);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 6px;
  gap: 4px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  max-width: calc(100vw - 20px);
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  display: flex;
  align-items: center;
  z-index: 100001;
}

#fotoBarraTopoNex::-webkit-scrollbar {
  display: none;
}

.foto-btn-topo {
  background: transparent;
  border: none;
  box-shadow: none;
  height: 36px;
  min-width: 36px;
  border-radius: 999px;
  font-size: 14px;
  padding: 0 10px;
  color: #e2e8f0;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.foto-btn-topo:active {
  background: rgba(255, 255, 255, 0.12);
  transform: scale(0.94);
}

#fotoBtnFotoNex {
  background: rgba(255, 255, 255, 0.06);
}

#fotoBtnSalvarNex {
  background: rgba(37, 99, 235, 0.22);
  color: #bfdbfe;
}

#fotoBtnSalvarNex:active {
  background: rgba(37, 99, 235, 0.38);
}

#fotoBtnSairNex {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
  margin-left: 4px;
}

/* ============================================
   BARRA CONTEXTO (texto selecionado)
============================================ */

#fotoBarraContextoNex {
  display: none;
}

#fotoEditorNex.modo-foto-texto-selecionado #fotoBarraTopoNex {
  display: none !important;
}

#fotoEditorNex.modo-foto-texto-selecionado #fotoBarraContextoNex {
  display: flex !important;
  align-items: center;
  gap: 4px;
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 20, 30, 0.92);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 6px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  z-index: 100001;
  animation: fotoBarraEntrada 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes fotoBarraEntrada {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

#fotoEditorNex.modo-foto-texto-selecionado #fotoBtnTemaNex,
#fotoEditorNex.modo-foto-texto-selecionado #fotoBtnAaNex {
  background: rgba(37, 99, 235, 0.16) !important;
  color: #bfdbfe !important;
}

#fotoEditorNex.modo-foto-foto-selecionada #fotoBarraTopoNex,
#fotoEditorNex.modo-foto-foto-selecionada #fotoBarraContextoNex {
  display: none !important;
}

/* ============================================
   LIXEIRA DO FOTO (idêntica à do Notas)
============================================ */

#fotoLixeiraNex {
  position: absolute;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.92);
  border: 2px solid #ffffff;
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 999999;
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: auto;
  padding: 0;
  transition: transform 0.12s ease, background 0.15s ease;
}

#fotoLixeiraNex.visivel {
  display: flex;
}

#fotoLixeiraNex:active {
  transform: scale(0.9);
  background: rgba(239, 68, 68, 0.95);
}

/* ============================================
   PAINEL Aa (fonte, cor, tamanho, estilo)
============================================ */

#fotoPainelAaNex {
  position: fixed !important;
  left: 12px !important;
  right: 12px !important;
  bottom: 12px !important;
  z-index: 2147483647 !important;
  background: #1a1a24 !important;
  background-color: #1a1a24 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 24px !important;
  padding: 16px !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7) !important;
  display: none !important;
  flex-direction: column !important;
  gap: 14px !important;
  box-sizing: border-box !important;
}

#fotoPainelAaNex.aberto {
  display: flex !important;
  animation: fotoPainelSubir 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

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

#fotoPainelAaNex .foto-painel-topo {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
}

#fotoPainelAaNex .foto-painel-titulo {
  color: #f8fafc !important;
  font-size: 15px !important;
  font-weight: 900 !important;
  letter-spacing: 0.2px !important;
}

#fotoPainelAaNex .foto-painel-fechar {
  width: 34px !important;
  height: 34px !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: none !important;
  color: #fff !important;
  font-size: 14px !important;
  font-weight: 900 !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
}

#fotoPainelAaNex .foto-painel-secao {
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
}

#fotoPainelAaNex .foto-painel-label {
  display: block !important;
  color: rgba(226, 232, 240, 0.75) !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  letter-spacing: 0.6px !important;
  text-transform: uppercase !important;
}

#fotoPainelAaNex .foto-fontes-lista {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 8px !important;
}

#fotoPainelAaNex .foto-fonte-btn {
  height: 52px !important;
  border-radius: 14px !important;
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: #fff !important;
  font-size: 22px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: background 0.15s ease, transform 0.12s ease !important;
  -webkit-tap-highlight-color: transparent !important;
  padding: 0 !important;
}

#fotoPainelAaNex .foto-fonte-btn:active {
  transform: scale(0.94) !important;
}

#fotoPainelAaNex .foto-fonte-btn.ativo {
  background: rgba(37, 99, 235, 0.4) !important;
  border-color: rgba(96, 165, 250, 0.7) !important;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.35) !important;
}

#fotoPainelAaNex .foto-cores-lista {
  display: flex !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
}

#fotoPainelAaNex .foto-cor-btn {
  width: 34px !important;
  height: 34px !important;
  border-radius: 50% !important;
  border: 2px solid rgba(255, 255, 255, 0.14) !important;
  cursor: pointer !important;
  transition: transform 0.12s ease, border-color 0.15s ease !important;
  -webkit-tap-highlight-color: transparent !important;
  flex-shrink: 0 !important;
  padding: 0 !important;
}

#fotoPainelAaNex .foto-cor-btn:active {
  transform: scale(0.9) !important;
}

#fotoPainelAaNex .foto-cor-btn.ativo {
  border-color: #fff !important;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4) !important;
}

#fotoPainelAaNex .foto-tamanho-linha,
#fotoPainelAaNex .foto-estilos-linha {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

#fotoPainelAaNex .foto-tamanho-btn {
  width: 42px !important;
  height: 42px !important;
  border-radius: 12px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: none !important;
  color: #fff !important;
  font-size: 20px !important;
  font-weight: 900 !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  -webkit-tap-highlight-color: transparent !important;
  padding: 0 !important;
}

#fotoPainelAaNex .foto-tamanho-btn:active {
  background: rgba(255, 255, 255, 0.16) !important;
  transform: scale(0.94) !important;
}

#fotoPainelAaNex .foto-tamanho-valor {
  min-width: 48px !important;
  text-align: center !important;
  color: #fff !important;
  font-size: 15px !important;
  font-weight: 800 !important;
}

#fotoPainelAaNex .foto-estilo-btn {
  width: 44px !important;
  height: 44px !important;
  border-radius: 12px !important;
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: #fff !important;
  font-size: 16px !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  -webkit-tap-highlight-color: transparent !important;
  padding: 0 !important;
}

#fotoPainelAaNex .foto-estilo-btn.ativo {
  background: rgba(37, 99, 235, 0.4) !important;
  border-color: rgba(96, 165, 250, 0.7) !important;
}

/* ============================================
   RODAPÉ — LEGENDA CÁPSULA CLARA + PUBLICAR
============================================ */

#fotoLegendaRowNex {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 100000;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  box-sizing: border-box;
}

#fotoLegendaRowNex .foto-legenda-capsula {
  flex: 1;
  min-width: 0;
  background: #ffffff;
  border: 1.5px solid #ffffff;
  border-radius: 22px;
  padding: 10px 16px;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.3);
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: padding 0.2s ease;
}

#legendaMyDropsInput {
  background: transparent;
  border: none;
  outline: none;
  color: #111827;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  width: 100%;
  resize: none;
  min-height: 20px;
  max-height: 60px;
  overflow-y: auto;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  box-sizing: border-box;
  caret-color: #2563eb;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

#legendaMyDropsInput::-webkit-scrollbar {
  width: 3px;
}

#legendaMyDropsInput::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 999px;
}

#legendaMyDropsInput::placeholder {
  color: #6b7280;
  font-weight: 600;
}

#legendaContadorMyDrops {
  color: rgba(0, 0, 0, 0.35);
  font-size: 11px;
  font-weight: 700;
  text-align: right;
  display: none;          /* ← escondido por padrão */
}

#legendaContadorMyDrops.visivel {
  display: block;         /* ← só aparece se len >= 400 */
}

#fotoBtnPublicarNex {
  flex-shrink: 0;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border: none;
  border-radius: 999px;
  height: 52px;
  padding: 0 22px;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.3px;
  box-shadow:
    0 8px 20px rgba(37, 99, 235, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: flex-end;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

#fotoBtnPublicarNex:active {
  transform: scale(0.96);
  filter: brightness(1.08);
}

/* ============================================
   CÁPSULA DE MARCA (só no PNG salvo)
============================================ */
#fotoCapsulaMarcaNex {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 500;
  display: none;
  align-items: center;
  gap: 6px;
  padding: 5px 14px 5px 5px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  pointer-events: none;
  white-space: nowrap;
  max-width: calc(100% - 32px);
  overflow: hidden;
  text-overflow: ellipsis;
}

#fotoCapsulaMarcaNex.visivel {
  display: inline-flex;
}

#fotoCapsulaMarcaNex .capsula-icone {
  font-size: 12px;
  line-height: 1;
}

#fotoCapsulaMarcaNex .capsula-sep {
  opacity: 0.4;
  font-weight: 400;
  margin: 0 2px;
}

#fotoCapsulaMarcaNex .capsula-user {
  color: #93c5fd;
}

/* ============================================
   AVATAR NA CÁPSULA
============================================ */

#fotoCapsulaMarcaNex .capsula-avatar {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

#fotoCapsulaMarcaNex .capsula-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

/* ============================================
   BORDA DUPLA NO PNG SALVO
   (aplicada só durante a captura)
============================================ */

#fotoEditorNex.foto-capturando-borda #fotoPapelNex {
  box-shadow:
    0 0 0 3px #0a0a0f,
    0 0 0 4.5px #f5f0e0,
    0 20px 60px rgba(0, 0, 0, 0.45);
}

/* ============================================
   TABBAR / SCROLL LOCK
============================================ */

body.foto-aberto {
  overflow: hidden !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  padding: 0 !important;
}

body.foto-aberto .tabbar {
  display: none !important;
}

/* ============================================
   Z-INDEX DE EMPILHAMENTO
============================================ */

#fotoPapelNex {
  z-index: 1;
}

#fotoCamadaNex {
  z-index: 2;
}

#fotoCamadaNex > .video-editor-text-mydrops-nex,
#fotoCamadaNex > .video-editor-photo-mydrops-nex {
  z-index: 3;
}

.editor-alca-nex,
#fotoLixeiraNex {
  z-index: 10;
}

#fotoCapsulaMarcaNex {
  z-index: 15;
}

#fotoBarraTopoNex {
  z-index: 100;
}

#fotoLegendaRowNex {
  z-index: 100;
}

#fotoPainelAaNex {
  z-index: 200;
}

/* ============================================
   TRAVA DE SELEÇÃO DE TEXTO
============================================ */

#fotoCamadaNex .video-editor-text-mydrops-nex,
#fotoCamadaNex .video-editor-photo-mydrops-nex {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#fotoCamadaNex .video-editor-text-mydrops-nex[data-editando="1"] .video-editor-text-body-mydrops-nex {
  user-select: text;
  -webkit-user-select: text;
  -webkit-touch-callout: default;
}

/* ============================================
   CURSOR — contentEditable
============================================ */

#fotoCamadaNex .video-editor-text-body-mydrops-nex[contenteditable="true"] {
  cursor: text;
}

#fotoCamadaNex .video-editor-text-body-mydrops-nex[contenteditable="false"] {
  cursor: move;
}

/* ============================================
   FOTO STICKER no Foto
============================================ */

#fotoCamadaNex .video-editor-photo-mydrops-nex {
  width: 180px;
  z-index: 3;
}

#fotoCamadaNex .video-editor-photo-body-mydrops-nex {
  background: rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

#fotoCamadaNex .video-editor-photo-body-mydrops-nex img {
  border-radius: 14px;
}

/* ============================================
   FIX DEFINITIVO — AVATAR NA CÁPSULA
============================================ */

#fotoCapsulaMarcaNex .capsula-avatar {
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  max-width: 32px !important;
  max-height: 32px !important;
  border-radius: 50% !important;
  overflow: hidden !important;
  background: rgba(255, 255, 255, 0.12) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 18px !important;
  line-height: 1 !important;
  flex-shrink: 0 !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  padding: 0 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}

#fotoCapsulaMarcaNex .capsula-avatar img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: cover !important;
  display: block !important;
  border-radius: 50% !important;
  padding: 0 !important;
  margin: 0 !important;
}

#fotoCapsulaMarcaNex {
  padding: 6px 16px 6px 6px !important;
  gap: 8px !important;
  align-items: center !important;
}