/* Editorial / estúdio — evita estética “AI dashboard” (cyan, grid genérico) */

:root {
  --bg: #0f0e0d;
  --bg-elevated: #181614;
  --surface: #1f1c19;
  --border: #2e2a26;
  --border-subtle: #252220;
  --text: #ebe6df;
  --text-muted: #8a847b;
  --accent: #10b981;
  --accent-hover: #34d399;
  --accent-muted: rgba(16, 185, 129, 0.12);
  --success: #6b9b7a;
  --success-bg: rgba(107, 155, 122, 0.12);
  --warn: #c4a574;
  --warn-bg: rgba(196, 165, 116, 0.12);
  --danger: #c17c74;
  --danger-bg: rgba(193, 124, 116, 0.12);
  --radius: 10px;
  --radius-sm: 6px;
  --font-sans: "DM Sans", system-ui, sans-serif;
  --font-serif: "Source Serif 4", Georgia, serif;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 12px 40px rgba(0, 0, 0, 0.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body.theme-app {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}

/* Fundo sutil (não grid “tech”) */
body.theme-app::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(16, 185, 129, 0.06), transparent 50%),
    radial-gradient(ellipse 60% 40% at 100% 50%, rgba(255, 255, 255, 0.02), transparent 45%);
  z-index: 0;
}

.app-wrap {
  position: relative;
  z-index: 1;
}

/* Header */
.app-header {
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(15, 14, 13, 0.85);
  backdrop-filter: blur(12px);
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(145deg, #2a2622, #1a1816);
  border: 1px solid var(--border);
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
}

.brand-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.conn-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.3s ease;
}

.conn-dot.is-on {
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-bg);
}

.conn-dot.is-off {
  background: var(--danger);
}

/* Cards */
.card-surface {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-heading {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text);
  margin: 0 0 1rem;
  letter-spacing: -0.02em;
}

.section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  border: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.btn-primary {
  background: var(--accent);
  color: #141210;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: #3d3834;
  background: #22201d;
}

.btn-toggle.is-active {
  background: var(--accent-muted);
  color: var(--accent);
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.btn-toggle:not(.is-active) {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  padding: 0.35rem 0.5rem;
}

.btn-ghost:hover {
  color: var(--text);
}

/* Form */
.input-field {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-sans);
  resize: vertical;
  min-height: 88px;
  transition: border-color 0.2s;
}

.input-field:focus {
  outline: none;
  border-color: rgba(16, 185, 129, 0.45);
}

.input-label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

/* Article list row */
.article-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, background 0.2s;
}

.article-row:hover {
  border-color: #3d3834;
  background: var(--surface);
}

.article-row-meta {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Status badges (dashboard list) */
.badge-pending {
  background: #2a2825;
  color: var(--text-muted);
}
.badge-researching,
.badge-writing,
.badge-processing,
.badge-metadata,
.badge-html {
  background: rgba(90, 120, 140, 0.2);
  color: #a8c4d4;
}
.badge-image_prompt,
.badge-image_generating,
.badge-image_uploading {
  background: rgba(140, 120, 90, 0.2);
  color: #d4c4a8;
}
.badge-draft_creating,
.badge-publishing,
.badge-social_posting,
.badge-sanity_posting {
  background: var(--success-bg);
  color: #9bc4a8;
}
.badge-approval_pending {
  background: var(--warn-bg);
  color: var(--warn);
}
.badge-completed {
  background: rgba(107, 155, 122, 0.18);
  color: #a3d4b0;
}
.badge-failed {
  background: var(--danger-bg);
  color: #e8b0aa;
}

/* Article page: preview */
.article-preview-wrap {
  background: #f7f5f2;
  color: #1a1816;
  border-radius: var(--radius-sm);
  padding: 1.75rem 2rem;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.75;
  border: 1px solid #e5e0d8;
}

.article-preview-wrap a {
  color: #059669 !important;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-preview-wrap h1,
.article-preview-wrap h2,
.article-preview-wrap h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  border-bottom: 1px solid #ddd6cc;
  padding-bottom: 0.35rem;
  margin-top: 1.5em;
  color: #141210;
}

/* Blocos escuros no HTML do artigo: sem isto o texto herda #1a1816 do .article-preview-wrap → ilegível */
.article-preview-wrap blockquote.fact,
.article-preview-wrap .tldr-block {
  color: #e8edf4 !important;
  background: #0f172a !important;
  border-color: #334155 !important;
}

.article-preview-wrap .tldr-block strong,
.article-preview-wrap blockquote.fact {
  border-left-color: #00c2ff;
}

.article-preview-wrap .tldr-block p {
  color: #e8edf4 !important;
}

.article-preview-wrap .tldr-block a,
.article-preview-wrap blockquote.fact a {
  color: #7dd3fc !important;
}

/* Capa: pré-visualização local (Cloudinary usa Poppins em maiúsculas) */
.cover-overlay-input {
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cover-image-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  max-height: 13rem;
  background: #0a0a0a;
}

.cover-image-wrap .cover-image-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.cover-overlay-display {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0.75rem 1rem 0.75rem 1rem;
  box-sizing: border-box;
  font-family: "Poppins", var(--font-sans), system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(0.78rem, 2.8vw, 0.98rem);
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-align: left;
  color: #ffffff;
  text-transform: uppercase;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 100%;
  pointer-events: none;
  /* Legibilidade: vinheta à esquerda por cima da foto */
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.72) 0%,
    rgba(0, 0, 0, 0.38) 45%,
    rgba(0, 0, 0, 0.08) 72%,
    transparent 100%
  );
  text-shadow:
    0 0 24px rgba(0, 0, 0, 0.95),
    0 2px 8px rgba(0, 0, 0, 0.85);
}

/* Pipeline (article.js injeta classes) */
.pipeline-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pipeline-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13px;
  transition: background 0.2s, border-color 0.2s;
}

.pipeline-row.is-done {
  background: rgba(107, 155, 122, 0.08);
  border-color: rgba(107, 155, 122, 0.2);
  color: #b8d4c4;
}

.pipeline-row.is-active {
  background: var(--accent-muted);
  border-color: rgba(16, 185, 129, 0.35);
  color: var(--text);
}

.pipeline-row.is-failed {
  background: var(--danger-bg);
  border-color: rgba(193, 124, 116, 0.35);
  color: #e8c4c0;
}

.pipeline-row.is-upcoming {
  color: var(--text-muted);
  opacity: 0.85;
}

.pipeline-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.pipeline-row.is-done .pipeline-num {
  background: rgba(107, 155, 122, 0.25);
  border-color: transparent;
  color: #a3d4b0;
}

.pipeline-row.is-active .pipeline-num {
  background: rgba(16, 185, 129, 0.25);
  border-color: rgba(16, 185, 129, 0.4);
  color: var(--accent);
}

.pipeline-row.is-failed .pipeline-num {
  background: rgba(193, 124, 116, 0.25);
  color: #e8b0aa;
}

.pipeline-status {
  font-size: 11px;
  margin-left: auto;
  opacity: 0.9;
}

/* Logs */
.logs-panel {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  line-height: 1.55;
  background: #0a0908;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  max-height: 22rem;
  overflow-y: auto;
}

.log-info {
  color: var(--text-muted);
}
.log-warn {
  color: var(--warn);
}
.log-error {
  color: #e8a598;
}

/* Article page badges */
.badge-approval_pending {
  background: var(--warn-bg);
  color: var(--warn);
}
.badge-completed {
  background: rgba(107, 155, 122, 0.2);
  color: #a3d4b0;
}
.badge-failed {
  background: var(--danger-bg);
  color: #e8b0aa;
}
.badge-pending {
  background: #2a2825;
  color: var(--text-muted);
}

/* Actions */
.btn-approve {
  background: #3d5c48;
  color: #eef5f0;
  width: 100%;
  padding: 0.65rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-approve:hover:not(:disabled) {
  background: #4a6e56;
}

.btn-reject {
  width: 100%;
  padding: 0.65rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.btn-reject:hover {
  border-color: var(--danger);
  color: #e8b0aa;
}

.btn-retry {
  width: 100%;
  padding: 0.65rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
}

.btn-retry:hover {
  border-color: #4a4540;
}

.link-quiet {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  word-break: break-all;
}

.link-quiet:hover {
  text-decoration: underline;
}
