:root {
  --bg-app: #000000;
  --bg-pane-top: #050508;
  --bg-pane-bottom: #000000;
  --glass-bg: rgba(15, 17, 26, 0.85);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-shadow: 0 8px 28px rgba(0, 0, 0, 0.65);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  --primary: #10b981;
  --primary-hover: #059669;
  --primary-glow: rgba(16, 185, 129, 0.35);
  --dark-btn: #1e293b;
  --dark-btn-hover: #334155;
  --accent-blue: #0ea5e9;
  --accent-rose: #f43f5e;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --safe-top: env(safe-area-inset-top, 12px);
  --safe-bottom: env(safe-area-inset-bottom, 16px);
}

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

input, textarea {
  user-select: text;
  -webkit-user-select: text;
  color-scheme: dark;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background-color: #000000;
  color: var(--text-main);
  font-family: var(--font);
  color-scheme: dark;
}

/* Container de Tela Cheia 100dvh */
.studio-viewport {
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: 500px;
  margin: 0 auto;
  position: relative;
  display: flex;
  flex-direction: column;
  background: #000000;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.9);
}

/* Metades da Tela Dividida (Ajustável) */
.split-pane {
  flex: none;
  height: 50%;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: #000000;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.top-pane {
  background: #050508;
  border-bottom: 1.5px solid rgba(255, 255, 255, 0.14);
  z-index: 2;
}

.bottom-pane {
  background: #000000;
  z-index: 1;
}

/* Vídeos de Fundo nas Metades */
.split-pane video {
  position: absolute;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
  pointer-events: none;
}

/* Mistura no ponto de encontro: cada vídeo avança --feather px além da linha
   e o de cima vai ficando transparente, revelando o de baixo por trás. */
.studio-viewport.is-feathered .split-pane {
  overflow: visible;
}
.studio-viewport.is-feathered .top-pane {
  border-bottom: none;
  background: transparent;
}
#playerTop {
  top: 0;
  height: calc(100% + var(--feather, 0px));
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 2 * var(--feather, 0px)), transparent 100%);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 2 * var(--feather, 0px)), transparent 100%);
}
#playerBottom {
  top: calc(-1 * var(--feather, 0px));
  height: calc(100% + var(--feather, 0px));
}

/* Empty State (Instrução de Toque - Label Nativo) */
.pane-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 24px;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  z-index: 2;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
}

.split-pane:active .pane-empty-state {
  transform: scale(0.96);
}

.empty-icon-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.2);
}

.bottom-pane .empty-icon-circle {
  background: rgba(14, 165, 233, 0.14);
  border: 1px solid rgba(14, 165, 233, 0.3);
  color: var(--accent-blue);
  box-shadow: 0 4px 20px rgba(14, 165, 233, 0.2);
}

.empty-title {
  font-size: 15px;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: -0.2px;
}

.empty-subtitle {
  font-size: 12px;
  font-weight: 500;
  color: #94a3b8;
}

/* Botão estilo pílula no Empty State */
.btn-picker-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--accent-blue);
  color: #ffffff;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(14, 165, 233, 0.35);
  margin-top: 6px;
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn-picker-pill:active {
  transform: scale(0.95);
  background: #0284c7;
}

/* Input de arquivo invisível e acessível */
.visually-hidden-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
}

/* Divisor Central Ajustável com Drag Handle */
.center-seam {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 52px;
  margin-top: -26px;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  touch-action: none;
}

.seam-drag-handle {
  pointer-events: auto;
  cursor: row-resize;
  touch-action: none;
  width: 100%;
  max-width: 260px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
}

.seam-pill {
  background: rgba(10, 12, 18, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  gap: 5px;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.seam-drag-handle:active .seam-pill,
.seam-drag-handle.dragging .seam-pill {
  transform: scale(1.15);
  background: var(--primary);
  border-color: #ffffff;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

/* Barras Flutuantes em Cima de Cada Vídeo */
.pane-floating-bar {
  position: absolute;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.top-floating-bar {
  bottom: 12px;
  left: 12px;
  right: 12px;
  justify-content: space-between;
}

.bottom-floating-bar {
  top: 12px;
  left: 12px;
  right: 12px;
  justify-content: space-between;
}

/* Pílulas Flutuantes Estilo Apple Escuro */
.floating-pill {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.floating-pill:active {
  transform: scale(0.96);
  background: rgba(30, 41, 59, 0.95);
}

.floating-pill strong {
  color: var(--primary);
  font-weight: 800;
}

.btn-icon-pill {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  justify-content: center;
}

/* ============================================================
   DOCK LATERAL FLUTUANTE (CENTRALIZADO NA ALTURA)
   ============================================================ */
.floating-sidebar-dock {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 60;
  pointer-events: auto;
}

.dock-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.dock-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(15, 17, 26, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6);
  color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.dock-btn:active {
  transform: scale(0.92);
}

.dock-btn.btn-dock-video3 {
  background: rgba(15, 17, 26, 0.9);
  color: #34d399;
  border: 2px dashed rgba(16, 185, 129, 0.65);
}

.dock-btn.btn-dock-video3.has-video {
  border: 2px solid var(--primary);
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.dock-btn.btn-dock-delay {
  background: rgba(15, 17, 26, 0.9);
  color: #2dd4bf;
}

.dock-btn.btn-dock-delay .dock-badge-pill {
  background: #0d9488;
}

.dock-btn.btn-dock-seam {
  background: rgba(15, 17, 26, 0.9);
  color: #38bdf8;
}

.dock-btn.btn-dock-preview {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.dock-btn.btn-dock-preview.is-playing {
  background: #ef4444;
  color: #ffffff;
  border-color: #ffffff;
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}

.dock-btn.btn-dock-preview:active {
  background: var(--dark-btn-hover);
}

.dock-btn.btn-dock-render {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.dock-btn.btn-dock-calendar {
  background: rgba(15, 17, 26, 0.9);
  color: #38bdf8;
}

.dock-btn.btn-dock-calendar .dock-badge-pill {
  background: #0284c7;
}

.dock-btn.btn-dock-saved {
  background: rgba(15, 17, 26, 0.9);
  color: #818cf8;
}

.dock-btn.btn-dock-reset {
  background: rgba(15, 17, 26, 0.9);
  color: #fbbf24;
}

.dock-btn.btn-dock-config {
  background: rgba(15, 17, 26, 0.9);
  color: #94a3b8;
}

.dock-badge-pill {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--primary);
  color: #ffffff;
  font-size: 8.5px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

/* Transição de Divisão Esfumaçada (Feathered Seam) */
.seam-feather-overlay {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 12;
  transition: height 0.2s ease, opacity 0.2s ease;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0.85) 50%,
    rgba(0, 0, 0, 0) 100%
  );
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
}

/* Mini preview de thumbnail do vídeo 3 dentro do botão redondo */
.dock-thumb-video {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

/* Overlay do Terceiro Vídeo em Tela Cheia durante prévia */
.fullscreen-outro-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000000;
  z-index: 30;
  display: none;
  cursor: pointer;
}

.fullscreen-outro-overlay video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Indicador de Fase da Prévia no Topo */
.preview-phase-pill {
  position: absolute;
  top: calc(var(--safe-top) + 18px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 12, 18, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 999px;
  z-index: 60;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  animation: fadeInDown 0.2s ease;
}

/* Modais e Bottom Sheets Estilo iOS Dark */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.bottom-sheet {
  background: #0b0d13;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  width: 100%;
  max-width: 500px;
  border-radius: 24px 24px 0 0;
  padding: 20px 20px calc(var(--safe-bottom) + 16px) 20px;
  box-shadow: 0 -10px 45px rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 85vh;
  overflow-y: auto;
  color: #f8fafc;
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  margin: 0 auto -6px auto;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sheet-title {
  font-size: 16px;
  font-weight: 800;
  color: #f8fafc;
  letter-spacing: -0.3px;
}

.sheet-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 14px;
  color: #cbd5e1;
  cursor: pointer;
}

/* Controles Deslizantes e Presets */
.slider-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slider-val-badge {
  font-size: 13px;
  font-weight: 800;
  color: #34d399;
}

.range-light {
  -webkit-appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #1e293b;
  outline: none;
}

.range-light::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #0f172a;
  border: 2.5px solid var(--primary);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.presets-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.preset-chip {
  flex: 1;
  text-align: center;
  padding: 8px 12px;
  border-radius: 10px;
  background: #151923;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  font-weight: 700;
  color: #e2e8f0;
  cursor: pointer;
  transition: all 0.15s;
}

.preset-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

/* Campos de Texto */
.input-light {
  width: 100%;
  background: #12151e;
  border: 1.5px solid #262c3a;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  color: #f8fafc;
  outline: none;
  transition: border-color 0.2s;
}

.input-light::placeholder {
  color: #64748b;
}

.input-light:focus {
  border-color: var(--primary);
  background: #161a26;
}

/* Botões Modernos */
.btn-solid-primary {
  width: 100%;
  height: 46px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--primary-glow);
  transition: all 0.15s;
}

.btn-solid-primary:active {
  transform: scale(0.98);
  background: var(--primary-hover);
}

.btn-solid-secondary {
  width: 100%;
  height: 46px;
  background: #181c28;
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

/* Seletor Reels Normal vs Trial */
.post-type-selector-light {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: #141822;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 4px;
  border-radius: 12px;
}

.post-type-btn-light {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 12.5px;
  font-weight: 700;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.post-type-btn-light.active {
  background: #222838;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Toast */
.mobile-toast {
  position: fixed;
  top: calc(var(--safe-top) + 12px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 18, 28, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(16px);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 9999;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.7);
  animation: fadeInDown 0.2s ease-out;
  pointer-events: none;
  max-width: 90vw;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================================
   CALENDÁRIO DE AGENDAMENTO (5 EM 5 DIAS) - MODO ESCURO
   ============================================================ */
.schedule-box {
  background: #11141d;
  border: 1px solid #222838;
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.schedule-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cal-nav-mini {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cal-nav-btn {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid #2d3548;
  background: #181c28;
  color: #f8fafc;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cal-nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.cal-range-label {
  font-size: 11px;
  font-weight: 700;
  color: #cbd5e1;
  min-width: 72px;
  text-align: center;
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #11141d;
  border: 1px solid #222838;
  border-radius: 12px;
  padding: 8px 10px;
}

.cal-step-btn {
  background: #181c28;
  border: 1px solid #2d3548;
  border-radius: 9px;
  padding: 6px 12px;
  font-size: 11.5px;
  font-weight: 800;
  color: #f8fafc;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cal-step-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.cal-step-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.calendar-5day-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.cal-day-card {
  background: #151924;
  border: 1.5px solid #252b3b;
  border-radius: 12px;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
}

.cal-day-card.has-posts {
  border-color: rgba(16, 185, 129, 0.55);
  background: rgba(16, 185, 129, 0.1);
}

.cal-day-card.active {
  border-color: #38bdf8;
  background: rgba(14, 165, 233, 0.18);
  box-shadow: 0 3px 12px rgba(14, 165, 233, 0.25);
}

.cal-day-dow {
  font-size: 9.5px;
  font-weight: 800;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.cal-day-card.active .cal-day-dow {
  color: #38bdf8;
}

.cal-day-num {
  font-size: 13px;
  font-weight: 900;
  color: #f8fafc;
}

.cal-day-count {
  font-size: 9.5px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 999px;
  background: #1e2433;
  color: #94a3b8;
  white-space: nowrap;
}

.cal-day-count.positive {
  background: #10b981;
  color: #ffffff;
}

.time-presets-mini {
  display: flex;
  gap: 4px;
}

.time-chip {
  background: #181c28;
  border: 1px solid #2d3548;
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 700;
  color: #cbd5e1;
  cursor: pointer;
}

.time-chip.active {
  background: #0284c7;
  border-color: #38bdf8;
  color: #ffffff;
}
