/* Publish studio — story, reels, postagem */
.publish-studio {
  display: grid;
  grid-template-columns: minmax(340px, 440px) 1fr;
  gap: 40px;
  align-items: start;
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 0 24px;
}

.publish-studio-left {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.publish-studio-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  position: sticky;
  top: calc(var(--topnav-h) + 16px);
  min-width: 0;
}

.publish-steps {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 2px;
}

.publish-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--dim);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.publish-step:hover {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}

.publish-step.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.publish-step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.1);
}

.publish-step.active .publish-step-num {
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  color: #fff;
}

.publish-step-line {
  flex: 1;
  height: 1px;
  min-width: 24px;
  background: rgba(255, 255, 255, 0.1);
}

.publish-type-panel {
  display: none;
}

.publish-type-panel.active {
  display: block;
}

.publish-step-view {
  display: none;
}

.publish-type-panel.active .publish-step-view.active {
  display: block;
}

.publish-personalize-panel {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 16px;
}

.publish-action-bar {
  padding: 16px 4px 0;
}

.publish-action-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.publish-action-row .btn-continue {
  width: 100%;
  padding: 14px 18px;
  font-size: 1rem;
  min-height: 48px;
}

.publish-action-row--personalize {
  flex-direction: row;
  align-items: stretch;
}

.publish-action-row--personalize .btn-back-sm {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  padding: 0 16px;
  font-size: 0.84rem;
  font-weight: 600;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--dim);
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  white-space: nowrap;
}

.publish-action-row--personalize .btn-back-sm:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.publish-action-row--personalize .btn-publish {
  flex: 1;
  width: auto;
  min-width: 0;
  padding: 14px 18px;
  font-size: 1rem;
  min-height: 48px;
}

.publish-action-row .btn-continue.hidden,
.publish-action-row .btn-publish.hidden,
.publish-action-row .btn-back-sm.hidden {
  display: none;
}

.hidden-input {
  display: none;
}

/* Preview modes */
.iphone-mockup-screen.preview-mode-post .preview-story-ui {
  display: none !important;
}

.iphone-mockup-screen.preview-mode-post .story-preview-media img,
.iphone-mockup-screen.preview-mode-post .story-preview-media video {
  object-fit: contain;
}

.iphone-mockup-screen.preview-mode-post .preview-post-frame {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 6;
  pointer-events: none;
}

.preview-post-frame {
  display: none;
  padding: 1.15em 0.95em 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent);
}

.preview-post-header {
  display: flex;
  align-items: center;
  gap: 0.6em;
}

.preview-post-avatar {
  width: 2.6em;
  height: 2.6em;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  background-size: cover;
  background-position: center;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
}

.preview-post-header span {
  font-size: 1.05em;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.story-studio {
  display: grid;
  grid-template-columns: minmax(320px, 400px) 1fr;
  gap: 36px;
  align-items: start;
  max-width: 1180px;
  margin: 0 auto;
  padding: 8px 0 24px;
}

.story-panel-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--dim);
  margin-bottom: 12px;
}

.story-studio-left {
  display: flex;
  flex-direction: column;
}

.story-editor-card {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  overflow: hidden;
}

.story-editor-section {
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.story-editor-section:last-child {
  border-bottom: none;
}

.story-editor-section h4 {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--dim);
  margin-bottom: 14px;
}

.story-drop {
  border: 2px dashed rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.story-drop:hover,
.story-drop.dragover {
  border-color: rgba(221, 42, 123, 0.45);
  background: rgba(221, 42, 123, 0.06);
}

.story-drop strong {
  display: block;
  font-size: 0.92rem;
  margin-bottom: 4px;
}

.story-drop p {
  font-size: 0.8rem;
  color: var(--dim);
}

.story-drop-icon {
  font-size: 1.6rem;
  margin-bottom: 8px;
  opacity: 0.7;
}

.story-file-info {
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--muted);
}

.story-file-info.warn { color: var(--err); }

.story-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
}

.story-toggle-row + .story-toggle-row {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.story-toggle-label strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
}

.story-toggle-label span {
  font-size: 0.78rem;
  color: var(--dim);
}

.story-switch {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}

.story-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.story-switch span {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s;
}

.story-switch span::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.story-switch input:checked + span {
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
}

.story-switch input:checked + span::after {
  transform: translateX(18px);
}

.story-highlights-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.story-highlights-hint {
  font-size: 0.8rem;
  color: var(--dim);
  line-height: 1.45;
}

.story-highlights-hint.err {
  color: var(--err);
}

.story-highlights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.story-highlight-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--muted);
  font-family: inherit;
}

.story-highlight-ring {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  padding: 2px;
  background: rgba(255, 255, 255, 0.12);
  transition: background 0.2s, transform 0.15s;
}

.story-highlight-item:hover .story-highlight-ring {
  transform: scale(1.04);
}

.story-highlight-item.selected .story-highlight-ring {
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
}

.story-highlight-ring img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #0a0a0a;
  background: #222;
}

.story-highlight-ring .story-highlight-fallback {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  background: #1a1a1a;
  border: 2px solid #0a0a0a;
  color: var(--dim);
}

.story-highlight-title {
  font-size: 0.68rem;
  font-weight: 600;
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.story-highlight-item.selected .story-highlight-title {
  color: var(--text);
}

.story-field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
}

.story-field input[type="text"],
.story-field input[type="datetime-local"] {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color 0.2s;
}

.story-field input:focus {
  outline: none;
  border-color: rgba(221, 42, 123, 0.5);
}

.story-schedule-fields {
  margin-top: 12px;
  display: none;
}

.story-schedule-fields.visible {
  display: block;
}

.story-schedule-note {
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--warn);
}

.story-publish-bar {
  padding: 18px 20px;
  background: rgba(0, 0, 0, 0.25);
}

.story-publish-bar .btn-publish {
  width: 100%;
  padding: 14px;
  font-size: 1rem;
}

@media (max-width: 960px) {
  .publish-studio {
    grid-template-columns: 1fr;
    max-width: 440px;
    gap: 28px;
  }

  .publish-studio-right {
    position: static;
    order: -1;
  }

  .iphone-mockup {
    width: min(380px, 92vw);
  }

  .publish-personalize-panel {
    max-width: 100%;
  }
}
.story-phone-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.story-phone-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 18px;
  text-align: center;
}

/* iPhone mockup — midia por baixo, PNG por cima (tela transparente) */
.iphone-mockup {
  position: relative;
  width: min(440px, 100%);
  max-width: 440px;
  aspect-ratio: 1890 / 3360;
  margin: 0 auto;
  filter: drop-shadow(0 32px 64px rgba(0, 0, 0, 0.55));
  container-type: inline-size;
  container-name: phone;
}

.iphone-mockup-screen {
  position: absolute;
  top: 1.65%;
  left: 7.14%;
  right: 8.78%;
  bottom: 2.38%;
  border-radius: 11%;
  overflow: hidden;
  z-index: 1;
  background: transparent;
  /* Escala UI interna com o tamanho do preview */
  font-size: clamp(10px, 2.75cqi, 13px);
}

.iphone-mockup-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  z-index: 2;
  user-select: none;
}

.story-phone-progress {
  position: absolute;
  top: 7.8%;
  left: 5%;
  right: 5%;
  height: 0.22em;
  min-height: 2px;
  display: flex;
  gap: 0.35em;
  z-index: 5;
}

.story-phone-progress span {
  flex: 1;
  height: 100%;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 1em;
}

.story-phone-progress span.active {
  background: #fff;
}

.story-phone-header {
  position: absolute;
  top: 11.8%;
  left: 5%;
  right: 5%;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.65em;
}

.story-phone-avatar {
  width: 3.1em;
  height: 3.1em;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
}

.story-phone-avatar-placeholder {
  width: 3.1em;
  height: 3.1em;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  flex-shrink: 0;
}

.story-phone-user {
  flex: 1;
  text-align: left;
  font-size: 1.08em;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  line-height: 1.2;
}

.story-phone-badge {
  font-size: 0.92em;
  padding: 0.35em 0.75em;
  border-radius: 0.45em;
  background: rgba(0, 0, 0, 0.45);
  color: #f5f5f5;
  font-weight: 600;
  flex-shrink: 0;
}

.story-phone-badge.hidden { display: none; }

.story-preview-media {
  position: absolute;
  inset: 0;
}

.story-preview-media img,
.story-preview-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.story-preview-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85em;
  color: #666;
  font-size: 1.05em;
  padding: 2em;
  text-align: center;
}

.story-preview-placeholder .ring {
  width: 4.8em;
  height: 4.8em;
  border-radius: 50%;
  border: 2px dashed #444;
  display: grid;
  place-items: center;
  font-size: 1.6em;
}

.story-preview-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

/* Personalizacao */
.story-personalize-card {
  width: 100%;
  max-width: 400px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  padding: 20px;
}

.story-personalize-desc {
  font-size: 0.82rem;
  color: var(--dim);
  line-height: 1.5;
  margin-bottom: 16px;
}

.story-personalize-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.story-tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 18px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.2);
  color: var(--muted);
  text-align: center;
}

.story-tool-btn.soon {
  opacity: 0.65;
}

.story-tool-icon {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
}

.story-tool-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.story-tool-tag {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--dim);
}

