/* Teleprompter V2 styles (isolated) */
.tpv2-black-page {
  background: #000;
  min-height: 100vh;
  color: #e5e7eb;
  padding: 40px 0px 0px 0px;
}
/* Garantir largura total do primeiro wrapper */
.tpv2-black-page > div:first-child{
  max-width: 100%;
}
.tpv2-page-wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 16px 92px;
}
.tpv2-clip-editor {
  background: #0b0b0b;
  border: 1px solid #1f2937;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}
.tpv2-clip-editor textarea {
  width: 100%;
  background: transparent;
  border: 0;
  resize: vertical;
  min-height: 72px;
  color: #fff;
  font-size: 16px;
  line-height: 1.6;
  outline: none;
}
.tpv2-footer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.9);
  border-top: 1px solid #1f2937;
  padding: 12px 16px;
  display: flex;
  justify-content: center;
  z-index: 10;
}
/* ── Carousel ───────────────────────────────────── */
.tpv2-carousel {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 16px 24px 24px;
  scroll-padding-left: 24px;
  margin-top: 0;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  min-height: 60vh;
  align-items: center;
}
.tpv2-carousel::-webkit-scrollbar { display: none; }

/* ── Card base ──────────────────────────────────── */
.tpv2-card {
  flex: 0 0 50vw;
  max-width: 50vw;
  height: 50vh;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  scroll-snap-align: start;
  border: none;
  box-shadow: 0 12px 40px rgba(188,66,40,.22), 0 2px 10px rgba(0,0,0,.15);
  transition: box-shadow .25s;
}
.tpv2-card.done {
  box-shadow: none;
}

/* ── Card header ────────────────────────────────── */
.tpv2-card-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  background: linear-gradient(135deg, #bc4228 0%, #e8692b 100%);
  border-radius: 20px 20px 0 0;
  gap: 8px;
}
.tpv2-card.done .tpv2-card-header {
  background: linear-gradient(135deg, #059669 0%, #34d399 100%);
}
.tpv2-card-num {
  font-size: 21px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.3px;
}
.tpv2-card-dur {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,.8);
  background: rgba(0,0,0,.18);
  padding: 3px 9px;
  border-radius: 20px;
}
.tpv2-card-status {
  display: none;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: rgba(0,0,0,.18);
  padding: 3px 10px;
  border-radius: 20px;
  margin-left: auto;
}
.tpv2-card.done .tpv2-card-status { display: block; }

/* ── Card body (texto editável) ─────────────────── */
.tpv2-card-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
  color: #1f2937;
  background: #fff;
  font-size: 17px;
  line-height: 1.85;
  outline: none;
  height: 0vh;
}
.tpv2-card.done .tpv2-card-body { display: none; }

/* ── Card thumb (estado gravado) ────────────────── */
.tpv2-card-thumb {
  display: none;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 20px;
  background: #fff;
  cursor: pointer;
  height: 0vh;
}
.tpv2-card.done .tpv2-card-thumb { display: flex; }

.tpv2-thumb-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: calc(50vh - 170px);
  border-radius: 12px;
  overflow: hidden;
  background: #e5e7eb;
}
.tpv2-thumb-vid {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.tpv2-thumb-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.2);
}
.tpv2-thumb-play-btn {
  width: 56px;
  height: 56px;
  background: rgba(255,255,255,.95);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #059669;
  padding-left: 5px;
  box-shadow: 0 4px 16px rgba(0,0,0,.22);
}
.tpv2-thumb-label {
  font-size: 15px;
  font-weight: 700;
  color: #059669;
  letter-spacing: .2px;
}

/* ── Card footer ────────────────────────────────── */
.tpv2-card-footer {
  flex-shrink: 0;
  padding: 14px 16px;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
  border-radius: 0 0 20px 20px;
}
.tpv2-card-footer .btn { width: 100%; }

/* ── Botão gravar (pulsante) ────────────────────── */
.tpv2-card:not(.done) .tpv2-open.btn-primary {
  background: #bc4228;
  border: none;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 800;
  padding: 15px;
  color: #fff;
  animation: tpv2-pulse-record 2s ease-in-out infinite;
}
@keyframes tpv2-pulse-record {
  0%, 100% { box-shadow: 0 0 0 0 rgba(188,66,40,.6); }
  50%       { box-shadow: 0 0 0 12px rgba(188,66,40,0); }
}

/* Card concluído: botão de regravar */
.tpv2-card.done .tpv2-open {
  background: transparent;
  border: 1px solid #d1d5db;
  color: #6b7280;
  font-size: 14px;
  padding: 10px;
  border-radius: 10px;
  animation: none;
}

/* ── Botão Finalizar ────────────────────────────── */
.tpv2-final {
  flex-shrink: 0;
  align-self: center;
  background: #10b981;
  color: #fff;
  border: none;
  border-radius: 16px;
  padding: 50px 40px;
  cursor: pointer;
  font-size: 26px;
  font-weight: 800;
  text-align: center;
  white-space: normal;
  min-width: 180px;
  max-width: 220px;
  scroll-snap-align: start;
  box-shadow: 0 6px 24px rgba(16,185,129,.35);
  transition: transform .15s, box-shadow .15s;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.tpv2-final:hover, .tpv2-final:focus {
  transform: scale(1.04);
  box-shadow: 0 8px 30px rgba(16,185,129,.5);
  outline: none;
}

/* Preview modal container height */
#tpv2-preview-modal .teleprompter-container{
  height: 100vh;
}

.camera-preview video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#tpv2-cam-settings {
  background: rgb(255 255 255 / 20%);
  border: 0px solid rgba(255, 255, 255, 0.3);
  color: rgb(255, 255, 255);
  border-radius: 8px;
  padding: 13px 10px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: block;
  margin-right: 10px;
}

@media (min-width: 1024px) {
  #tpv2-cam-settings {
    margin-left: 20px;
  }
}

/* Esconder status de erro do player nativo se existir UI custom */
#tpv2-preview .media-controls-container .controls-bar .status-label {
  display: none !important;
}

/* Garantir camadas acima no container */
.teleprompter-container > div {
  position: relative;
  z-index: 9999;
}

.teleprompter-modal.is-open {
  display: flex;
  overflow-x: hidden;
  background: #1a1a1a;
}

.teleprompter-container{
  overflow-y: visible !important;
}

/* Skeleton loading for suggestions while API loads */
#tpv2-help .suggestion-card.skeleton {
  height: 92px;
  border-radius: 10px;
  opacity: 1;
  background: linear-gradient(90deg, #0a0a0a 25%, #141414 37%, #0a0a0a 63%);
  background-size: 400% 100%;
  animation: tpv2-skeleton 1.2s ease-in-out infinite;
  margin-bottom: 10px;
}
@keyframes tpv2-skeleton {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ── Painel de configurações (topo) ─────────────── */
.teleprompter-settings {
  position: fixed !important;
  top: 20px !important;
  left: 12px !important;
  right: 12px !important;
  z-index: 1000;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(0,0,0,.3);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px;
  padding: 10px 14px;
  display: flex !important;
  gap: 8px;
  align-items: center;
}

/* Controle +/- agrupado */
.tpv2-ctrl {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.1);
  border-radius: 12px;
  padding: 6px 10px;
}
.tpv2-ctrl-step {
  background: rgba(255,255,255,.18);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: background .1s;
}
.tpv2-ctrl-step:active { background: rgba(255,255,255,.35); }
.tpv2-ctrl-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 30px;
  gap: 1px;
}
.tpv2-ctrl-label {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,.55);
  line-height: 1;
  letter-spacing: .4px;
  white-space: nowrap;
}
.tpv2-ctrl-num {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
}

/* Botão de ícone (câmera, fechar, slower, faster) */
.tpv2-icon-btn {
  background: rgba(255,255,255,.12);
  border: none;
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: background .1s;
}
.tpv2-icon-btn:active { background: rgba(255,255,255,.28); }

/* Botão fechar — destaque vermelho */
.tpv2-icon-btn--close {
  background: rgba(220,53,69,.3);
  color: #ff8a94;
  font-size: 18px;
  font-weight: 700;
}
.tpv2-icon-btn--close:active { background: rgba(220,53,69,.55); }

/* ── Controles inferiores ───────────────────────── */
.teleprompter-controls {
  border-radius: 20px !important;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  width: min(90vw, 400px);
  position: fixed;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.08);
  padding: 10px 14px;
}
.teleprompter-controls > .btn {
  flex: 1 1 0;
  min-width: 0;
}
#tpv2-countdown-inline {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: #dc3545;
  color: #fff;
  font-weight: 900;
  font-size: 40px;
  border-radius: 20px;
  z-index: 1000000;
  transform-origin: center;
}

/* Animação de pulse/zoom a cada contagem */
@keyframes tpv2-countdown-pulse {
  0%   { transform: scale(1.4); opacity: .7; }
  30%  { transform: scale(1);   opacity: 1; }
  100% { transform: scale(.95); opacity: .85; }
}

/* Record/Close specific tweaks */
#tpv2-record {
  line-height: 2.8vh;
  border-radius: 10px;
  font-size: 1.8vh;
}
.tpv2-record-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex: 1 1 0;
  min-width: 0;
}
.tpv2-record-wrap #tpv2-record {
  width: 100%;
  max-height: 100px;
}
.tpv2-speed-label {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,.6);
  letter-spacing: .3px;
  white-space: nowrap;
}

/* Mobile: #tpv2-hint styling as requested */
@media (max-width: 768px) {
  #tpv2-hint {
    position: absolute;
    left: 40px;
    right: 40px;
    bottom: 90px;
    text-align: center;
    color: rgb(245 248 255);
    opacity: 0.75;
    font-size: 14px;
  }
}

/* Close overlay button styling */
#tpv2-close-overlay{
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 99999 !important;
  margin-top: 30px;
  background: #1a1a1a;
  border-radius: 60px;
  margin-right: 10px;
  padding: 10px 16px;
}

/* Trim timeline (preview) */
.tpv2-trim {
  position: relative;
  max-width: 100%;
  width: 100%;
  margin: 16px auto 0;
  height: 76px;
}
.tpv2-timeline-wrap,
#tpv2-timeline {
  max-width: 100%;
  width: calc(100% - 32px);
  overflow: hidden;
  box-sizing: border-box;
  height: 140px;
}
.tpv2-trim-track {
  position: absolute;
  inset: 0;
  background: #3A3838;
  border-radius: 9px;
  z-index: 1;
}
.tpv2-trim-selection {
  position: absolute;
  top: 0;
  bottom: 0;
  background: #777777;
  opacity: 0.9;
  border-radius: 0;
  z-index: 2;
}
.tpv2-trim-handle {
  position: absolute;
  top: -12px;
  width: 18px;
  height: 100px;
  background: #E2FF48;
  border-radius: 10px;
  box-shadow: 0 0 6px rgba(226,255,72,0.85);
  cursor: ew-resize;
  z-index: 3;
  touch-action: none;
  pointer-events: auto;
}
.tpv2-trim-label {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: #fff;
  font-weight: 700;
  font-size: 22px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  z-index: 4;
}

#tpv2-trim-in-label {
  left: 30px !important;
}

/* Desktop */
@media (min-width: 1024px) {
  .tpv2-card {
    flex: 0 0 50vw;
    max-width: 380px;
    height: 60vh;
    margin-top: -30px;
  }
  .teleprompter-container { height: 100%; }
  .tpv2-black-page > div:first-of-type { max-width: 100% !important; }
  .tpv2-carousel { gap: 20px; }
  #tpv2-hint {
    position: absolute !important;
    left: 40px !important; right: 40px !important; bottom: 90px !important;
    text-align: center !important; color: #9ca3af !important;
    opacity: .75 !important; font-size: 16px !important;
  }
}

/* Mobile: 1 card + 0.30 do próximo visível */
@media (max-width: 768px) {
  .tpv2-card {
    flex: 0 0 calc(100vw - 90px);
    max-width: calc(100vw - 90px);
    height: 50vh;
    margin-right: 0;
    margin-bottom: calc(40vw - 90px);
  }
}

@media (max-width: 480px) {
  .video-preview-frame {
    max-width: 42%;
  }
}

/* Base: ajustar cor do outline small */
.btn.btn-outline-secondary.btn--sm { color: #666; }

/* Card concluído: botão de regravar */
.tpv2-card.done .tpv2-open {
  background: transparent;
  border: 1px solid #374151;
  color: #9ca3af;
  font-size: 13px;
  padding: 10px;
  border-radius: 8px;
  animation: none;
}

.teleprompter-modal.is-open {
  display: flex;
  overflow-x: hidden;
  background: #1a1a1a;
}

#tpv2-preview-modal .teleprompter-container{
  height: 100vh;
}

#tpv2-preview-modal .btn {
  padding: 20px 30px;
}

/* Blinking dot next to "Gravar" */
.tpv2-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 8px;
  border-radius: 50%;
  background: #ffffff;
  animation: tpv2-blink 1s infinite;
  vertical-align: middle;
}
@keyframes tpv2-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

/* Page-content custom para tpv2 */
@media (max-width: 768px) {
  #page-content.page-content-tpv2 {
    padding: 30px 0 30px 20px !important;
  }
}

@media (max-width: 768px) {
  .teleprompter-container {
    grid-template-rows: 150px 1fr auto auto;
    height: 100%;
  }
}

/* Audience toggle: wrap long selected text without causing horizontal scroll */
#tpv2-acc-toggle {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  white-space: normal;
}
#tpv2-acc-label {
  flex: 1 1 auto;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.4;
}
#tpv2-acc-toggle > span:last-child {
  flex: 0 0 auto;
  white-space: nowrap;
  margin-left: 8px;
}

/* Create-post layout mobile adjustments */
@media (max-width: 768px) {
  .create-post-form, .create-post-suggestions {
    border-radius: 14px;
    padding: 10px;
    padding-bottom: 90px;
  }
}


