/* ============================================================
   SofIA — Stylesheet principal
   Marca: Violeta #6B3FE7 · Âmbar #F7C96E · Fundo escuro #07040f
   ============================================================ */

:root {
  --purple:       #6B3FE7;
  --purple-light: #a78bfa;
  --purple-dark:  #4a2ab0;
  --amber:        #F7C96E;
  --dark:         #07040f;
  --dark-2:       #0d0823;
  --dark-3:       #1a0a3c;
  --white:        #ffffff;
  --text-muted:   rgba(255,255,255,.55);
  --border:       rgba(107,63,231,.25);
  --radius:       10px;
  --radius-lg:    14px;
  --sidebar-w:    220px;
  --font:         -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: var(--font); color: var(--white); background: var(--dark); line-height: 1.6; }
a { color: var(--purple-light); text-decoration: none; }
a:hover { text-decoration: underline; }
input, textarea, select, button { font-family: var(--font); font-size: 14px; }

/* ── AUTH PAGES ───────────────────────────────────────────── */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--dark);
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--dark-2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
}
.auth-logo {
  display: block;
  font-size: 22px;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 24px;
  text-decoration: none;
}
.auth-logo span { color: var(--purple-light); }
.auth-title { font-size: 20px; font-weight: 600; margin-bottom: 6px; }
.auth-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-footer { text-align: center; font-size: 13px; color: var(--text-muted); margin-top: 20px; }
.terms-text { font-size: 11px; color: var(--text-muted); text-align: center; line-height: 1.5; }

/* ── FORMS ────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,.7);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.form-group input,
.form-group textarea,
.form-group select {
  background: rgba(255,255,255,.06);
  border: 0.5px solid rgba(255,255,255,.15);
  border-radius: var(--radius);
  color: var(--white);
  padding: 10px 14px;
  transition: border-color .15s;
  width: 100%;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--purple);
  background: rgba(107,63,231,.08);
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: rgba(255,255,255,.3); }
.form-group input:disabled { opacity: .5; cursor: not-allowed; }
.label-link { font-size: 11px; color: var(--purple-light); font-weight: 400; }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 8px; line-height: 1.5; }
.form-subtitle { font-size: 14px; font-weight: 500; color: var(--white); margin: 16px 0 12px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── BUTTONS ──────────────────────────────────────────────── */
.btn-primary {
  background: var(--purple);
  color: var(--white);
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, transform .1s;
  display: inline-block;
  text-align: center;
  text-decoration: none;
}
.btn-primary:hover { background: var(--purple-dark); text-decoration: none; color: white; }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-secondary {
  background: rgba(255,255,255,.06);
  color: var(--white);
  border: 0.5px solid rgba(255,255,255,.2);
  padding: 10px 18px;
  border-radius: var(--radius);
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
  display: inline-block;
  text-decoration: none;
  text-align: center;
}
.btn-secondary:hover { background: rgba(255,255,255,.1); text-decoration: none; color: white; }
.btn-secondary:disabled { opacity: .5; cursor: not-allowed; }

.btn-full { width: 100%; }
.btn-lg { padding: 13px 24px; font-size: 15px; }
.btn-icon {
  background: transparent;
  border: none;
  color: rgba(255,255,255,.5);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: color .15s, background .15s;
}
.btn-icon:hover { color: var(--white); background: rgba(255,255,255,.08); }
.btn-danger:hover { color: #ff6b6b !important; }
.btn-upgrade {
  display: block;
  background: var(--amber);
  color: #1a0a00;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  padding: 8px;
  border-radius: 8px;
  margin-top: 10px;
  text-decoration: none;
}
.btn-upgrade:hover { opacity: .9; text-decoration: none; color: #1a0a00; }

/* ── ALERTS ───────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
  border: 0.5px solid;
}
.alert-success { background: rgba(34,197,94,.1); border-color: rgba(34,197,94,.3); color: #86efac; }
.alert-error   { background: rgba(239,68,68,.1);  border-color: rgba(239,68,68,.3);  color: #fca5a5; }
.alert-warning { background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.3); color: #fcd34d; }
.alert-info    { background: rgba(107,63,231,.1); border-color: rgba(107,63,231,.3); color: var(--purple-light); }

/* ── APP LAYOUT ───────────────────────────────────────────── */
.app-body { display: flex; min-height: 100vh; background: var(--dark); }

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  background: var(--dark-2);
  border-right: 0.5px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
}
.sidebar-logo {
  font-size: 20px;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 28px;
  padding-left: 4px;
}
.sidebar-logo span { color: var(--purple-light); }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: var(--white); text-decoration: none; }
.nav-item.active { background: rgba(107,63,231,.15); color: var(--white); border: 0.5px solid var(--border); }
.sidebar-plan { margin-top: auto; padding-top: 16px; border-top: 0.5px solid var(--border); }
.plan-usage { margin: 8px 0; }
.usage-bar {
  height: 4px;
  background: rgba(255,255,255,.1);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 4px;
}
.usage-fill { height: 100%; background: var(--purple); border-radius: 2px; transition: width .3s; }
.usage-text { font-size: 11px; color: var(--text-muted); }
.nav-logout {
  display: block;
  font-size: 12px;
  color: rgba(255,255,255,.3);
  margin-top: 12px;
  text-decoration: none;
}
.nav-logout:hover { color: rgba(255,255,255,.6); }

/* MAIN CONTENT */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 28px 32px;
  max-width: calc(100% - var(--sidebar-w));
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-title { font-size: 22px; font-weight: 600; }
.page-sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ── STATS GRID ───────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 28px; }
.stat-card {
  background: var(--dark-2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
}
.stat-value { font-size: 24px; font-weight: 600; color: var(--white); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── ARTICLES TABLE ───────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.section-title { font-size: 16px; font-weight: 500; }
.articles-table {
  background: var(--dark-2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.articles-table table { width: 100%; border-collapse: collapse; }
.articles-table th {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 0.5px solid var(--border);
}
.articles-table td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 0.5px solid rgba(255,255,255,.04);
  vertical-align: middle;
}
.articles-table tr:last-child td { border-bottom: none; }
.td-title { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-date { color: var(--text-muted); white-space: nowrap; }
.keyword-pill {
  background: rgba(107,63,231,.15);
  color: var(--purple-light);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
}
.score-pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}
.score-good { background: rgba(34,197,94,.15); color: #86efac; }
.score-ok   { background: rgba(245,158,11,.15); color: #fcd34d; }
.score-bad  { background: rgba(239,68,68,.15);  color: #fca5a5; }
.status-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: 500;
}
.status-published { background: rgba(34,197,94,.15);  color: #86efac; }
.status-draft     { background: rgba(156,163,175,.15); color: #d1d5db; }
.status-error     { background: rgba(239,68,68,.15);   color: #fca5a5; }
.status-generating{ background: rgba(107,63,231,.15);  color: var(--purple-light); }

/* ── EMPTY STATES ─────────────────────────────────────────── */
.empty-state {
  background: var(--dark-2);
  border: 0.5px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  margin-bottom: 24px;
}
.empty-icon { font-size: 32px; margin-bottom: 12px; }
.empty-state h3 { font-size: 15px; font-weight: 500; margin-bottom: 8px; }
.empty-state p { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.empty-articles { font-size: 13px; color: var(--text-muted); padding: 24px 0; }

/* ── UPGRADE BANNER ───────────────────────────────────────── */
.upgrade-banner {
  background: rgba(247,201,110,.08);
  border: 0.5px solid rgba(247,201,110,.25);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
}
.upgrade-text { font-size: 13px; color: rgba(255,255,255,.8); }
.btn-upgrade-banner {
  background: var(--amber);
  color: #1a0a00;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 8px;
  white-space: nowrap;
  text-decoration: none;
}
.btn-upgrade-banner:hover { opacity: .9; text-decoration: none; color: #1a0a00; }

/* ── GENERATOR PAGE ───────────────────────────────────────── */
.generator-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.gen-panel {
  background: var(--dark-2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.gen-step { margin-bottom: 20px; padding-bottom: 20px; border-bottom: 0.5px solid rgba(255,255,255,.06); }
.gen-step:last-of-type { border-bottom: none; }
.step-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.step-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--purple);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; flex-shrink: 0;
}
.step-title { font-size: 14px; font-weight: 500; }
.step-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.step-note { font-size: 12px; color: var(--text-muted); }
.input-row { display: flex; gap: 10px; }
.input-main {
  flex: 1;
  background: rgba(255,255,255,.06);
  border: 0.5px solid rgba(255,255,255,.15);
  border-radius: var(--radius);
  color: var(--white);
  padding: 10px 14px;
  font-size: 14px;
}
.input-main:focus { outline: none; border-color: var(--purple); }
.input-main::placeholder { color: rgba(255,255,255,.3); }
.input-select {
  width: 100%;
  background: rgba(255,255,255,.06);
  border: 0.5px solid rgba(255,255,255,.15);
  border-radius: var(--radius);
  color: var(--white);
  padding: 10px 14px;
}
.input-select option { background: var(--dark-2); }
.radio-group { display: flex; gap: 16px; }
.radio-item { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.radio-item input[type=radio] { accent-color: var(--purple); }

/* Keywords grid */
.keywords-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.kw-chip {
  background: rgba(107,63,231,.12);
  border: 0.5px solid var(--border);
  color: var(--white);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.kw-chip:hover { background: rgba(107,63,231,.25); border-color: var(--purple); }
.kw-chip.selected { background: var(--purple); border-color: var(--purple); }

/* Loading */
.loading-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); margin-top: 12px; }
.spinner-sm {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(107,63,231,.3);
  border-top-color: var(--purple);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Generator loading state */
.gen-loading-center {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 60px 20px; gap: 16px;
}
.sofia-spinner {
  width: 48px; height: 48px; border-radius: 50%;
  border: 3px solid rgba(107,63,231,.2);
  border-top-color: var(--purple);
  animation: spin .9s linear infinite;
}
.gen-status-text { font-size: 14px; color: var(--text-muted); text-align: center; }

/* Meta inputs */
.meta-section { margin-bottom: 16px; display: flex; flex-direction: column; gap: 12px; }
.meta-row { display: flex; flex-direction: column; gap: 5px; }
.meta-row label { font-size: 11px; font-weight: 500; color: var(--text-muted); display: flex; justify-content: space-between; }
.meta-input {
  background: rgba(255,255,255,.05);
  border: 0.5px solid rgba(255,255,255,.12);
  border-radius: 8px;
  color: var(--white);
  padding: 8px 12px;
  font-size: 13px;
  width: 100%;
}
.meta-input:focus { outline: none; border-color: var(--purple); }
.meta-textarea { resize: vertical; min-height: 60px; }
.meta-row-inline { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.meta-half { display: flex; flex-direction: column; gap: 5px; }
.meta-half label { font-size: 11px; font-weight: 500; color: var(--text-muted); }
.char-count { font-size: 10px; color: var(--text-muted); }
.seo-score-box {
  background: rgba(255,255,255,.05);
  border: 0.5px solid rgba(255,255,255,.12);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
}

/* Article preview */
.content-preview-header {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; font-weight: 500; color: var(--text-muted);
  margin-bottom: 8px;
}
.word-count-badge {
  background: rgba(107,63,231,.15);
  color: var(--purple-light);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
}
.article-content-preview {
  background: rgba(255,255,255,.03);
  border: 0.5px solid rgba(255,255,255,.08);
  border-radius: 8px;
  padding: 16px;
  max-height: 360px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.7;
  color: rgba(255,255,255,.85);
  margin-bottom: 16px;
}
.article-content-preview h2 { font-size: 15px; font-weight: 600; margin: 16px 0 8px; color: var(--white); }
.article-content-preview h3 { font-size: 13px; font-weight: 600; margin: 12px 0 6px; }
.article-content-preview p  { margin-bottom: 10px; }
.article-content-preview ul, .article-content-preview ol { margin: 8px 0 10px 20px; }
.article-content-preview li { margin-bottom: 4px; }
.article-content-preview table { width: 100%; border-collapse: collapse; font-size: 12px; margin: 12px 0; }
.article-content-preview th, .article-content-preview td { border: 0.5px solid rgba(255,255,255,.1); padding: 6px 10px; }
.article-content-preview th { background: rgba(107,63,231,.15); font-weight: 500; }

.gen-actions { display: flex; gap: 10px; }
.pub-feedback {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 13px;
}
.pub-feedback.success {
  background: rgba(34,197,94,.1);
  border: 0.5px solid rgba(34,197,94,.3);
  color: #86efac;
}
.pub-feedback.error {
  background: rgba(239,68,68,.1);
  border: 0.5px solid rgba(239,68,68,.3);
  color: #fca5a5;
}

/* ── SETTINGS PAGE ────────────────────────────────────────── */
.settings-card {
  background: var(--dark-2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}
.settings-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.settings-card-header h2 { font-size: 15px; font-weight: 500; }
.badge-count {
  background: rgba(107,63,231,.15);
  color: var(--purple-light);
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 20px;
}
.site-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-bottom: 0.5px solid rgba(255,255,255,.06);
}
.site-row:last-of-type { border-bottom: none; }
.site-info { flex: 1; }
.site-name { font-size: 13px; font-weight: 500; }
.site-url { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.site-status { font-size: 11px; font-weight: 500; white-space: nowrap; }
.site-status.status-ok    { color: #86efac; }
.site-status.status-error { color: #fca5a5; }
.site-status.status-untested { color: var(--text-muted); }
.add-site-form { margin-top: 20px; padding-top: 20px; border-top: 0.5px solid rgba(255,255,255,.06); }
.upgrade-hint { font-size: 13px; color: var(--text-muted); padding: 12px 0; }
.plan-detail { display: flex; align-items: center; gap: 16px; }
.plan-detail-info { display: flex; gap: 16px; font-size: 13px; color: var(--text-muted); }

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .generator-layout { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
