/* PostEditor.module.css — dark theme, consistent with CreatorDashboard */

.layout {
  display: flex;
  gap: 0;
  min-height: 60vh;
}

.content {
  flex: 1;
  min-width: 0;
  padding: 2rem 2.5rem;
}

.header {
  margin-bottom: 1.5rem;
}

.pageTitle {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text-primary);
  margin: 0;
}

.loadingText {
  color: var(--color-text-secondary);
  font-size: 0.95rem;
  padding: 2rem;
}

/* ── Error Banner ──────────────────────────────────────────────────────────── */

.errorBanner {
  background: var(--color-error-bg);
  color: var(--color-error);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

/* ── Title Input ───────────────────────────────────────────────────────────── */

.titleInput {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text-primary);
  background: var(--color-bg-input);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s;
  margin-bottom: 1rem;
}

.titleInput:focus {
  border-color: var(--color-border-active);
}

.titleInput::placeholder {
  color: var(--color-text-muted);
}

/* ── Editor Wrapper ────────────────────────────────────────────────────────── */

.editorWrapper {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--color-bg-input);
  margin-bottom: 1.5rem;
}

/* ── Toolbar ───────────────────────────────────────────────────────────────── */

.toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0.5rem 0.75rem;
  background: var(--color-bg-surface);
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.toolbarBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  font-family: inherit;
}

.toolbarBtn:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-surface-hover);
}

.toolbarBtnActive {
  color: var(--color-accent);
  background: var(--color-accent-subtle);
  border-color: var(--color-accent);
}

.toolbarSep {
  width: 1px;
  height: 20px;
  background: var(--color-border);
  margin: 0 0.375rem;
}

/* ── Editor Content ────────────────────────────────────────────────────────── */

.editorContent {
  min-height: 300px;
  padding: 1rem;
}

/* ProseMirror styles inside the editor */
.proseMirror {
  outline: none;
  min-height: 280px;
  color: var(--color-text-primary);
  font-size: 0.9375rem;
  line-height: 1.7;
}

.proseMirror h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 1.5rem 0 0.5rem;
  color: var(--color-text-primary);
}

.proseMirror h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 1.25rem 0 0.375rem;
  color: var(--color-text-primary);
}

.proseMirror p {
  margin: 0 0 0.75rem;
}

.proseMirror ul,
.proseMirror ol {
  padding-left: 1.5rem;
  margin: 0 0 0.75rem;
}

.proseMirror code {
  background: var(--color-bg-surface);
  padding: 0.15em 0.35em;
  border-radius: 4px;
  font-size: 0.875em;
}

.proseMirror pre {
  background: var(--color-bg-surface);
  padding: 0.875rem 1rem;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.8125rem;
  margin: 0 0 0.75rem;
}

.proseMirror pre code {
  background: none;
  padding: 0;
  border-radius: 0;
}

.proseMirror a,
.editorLink {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Tiptap placeholder */
.proseMirror p.is-editor-empty:first-child::before {
  color: var(--color-text-muted);
  content: attr(data-placeholder);
  float: left;
  height: 0;
  pointer-events: none;
}

/* ── Attachments Section ───────────────────────────────────────────────────── */

.attachmentsSection {
  margin-bottom: 1.5rem;
}

.attachmentsTitle {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin: 0 0 0.75rem;
}

.fileList {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.fileItem {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 0.8125rem;
}

.fileIcon {
  flex-shrink: 0;
}

.fileName {
  color: var(--color-text-primary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fileSize {
  color: var(--color-text-secondary);
  flex-shrink: 0;
}

.fileRemoveBtn {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 0.875rem;
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.fileRemoveBtn:hover {
  color: var(--color-error);
  background: var(--color-error-bg);
}

/* ── Drop Zone ─────────────────────────────────────────────────────────────── */

.dropZone {
  border: 2px dashed var(--color-border);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.dropZone:hover,
.dropZoneActive {
  border-color: var(--color-accent);
  background: var(--color-accent-subtle);
}

.dropZoneText {
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  margin: 0 0 0.25rem;
}

.dropZoneHint {
  color: var(--color-text-muted);
  font-size: 0.75rem;
  margin: 0;
}

.hiddenFileInput {
  display: none;
}

/* ── Footer Controls ───────────────────────────────────────────────────────── */

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.publishToggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
}

.publishToggle input[type="checkbox"] {
  accent-color: var(--color-accent);
  width: 16px;
  height: 16px;
}

.footerActions {
  display: flex;
  gap: 0.75rem;
}

.cancelBtn {
  padding: 0.5rem 1.25rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.cancelBtn:hover {
  color: var(--color-text-primary);
  border-color: var(--color-text-secondary);
}

.saveBtn {
  padding: 0.5rem 1.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #000;
  background: var(--color-accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.saveBtn:hover {
  background: var(--color-accent-hover);
}

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

/* ── Responsive ────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }

  .content {
    padding: 1.25rem 1rem;
  }

  .footer {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }

  .footerActions {
    justify-content: flex-end;
  }
}
