/* ===================================================
   Simulador de reações — style.css
   Minimalist dark theme
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');

:root {
  --bg:         #0c0c0e;
  --surface:    #141417;
  --border:     rgba(255,255,255,0.07);
  --border-mid: rgba(255,255,255,0.12);
  --accent:     #00d4a0;
  --danger:     #ff4d6d;
  --warning:    #ffb400;
  --purple:     #8b7cf8;
  --muted:      #666677;
  --subdued:    #999aaa;
  --text:       #e2e2ea;
  --radius:     10px;

  /* sentiment */
  --s-pos: #00d4a0;
  --s-crit: #ff4d6d;
  --s-neu: #ffb400;
  --s-mix: #8b7cf8;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  font-size: 15px;
}

/* ——— TOP BAR ——————————————————————————————————————— */
.topbar {
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  position: sticky; top: 0; z-index: 100;
  background: rgba(12,12,14,0.9);
  backdrop-filter: blur(16px);
}
.topbar-inner {
  max-width: 1080px; margin: 0 auto;
  height: 52px;
  display: flex; align-items: center; gap: 16px;
}
.topbar-brand {
  font-weight: 700; font-size: 1rem; color: var(--text);
  text-decoration: none; letter-spacing: -0.3px;
}
.topbar-brand .dot { color: var(--accent); }
.topbar-tag {
  font-size: 0.7rem; letter-spacing: 0.5px;
  color: var(--muted);
  border: 1px solid var(--border-mid);
  border-radius: 20px; padding: 2px 9px;
}
.topbar-back {
  margin-left: auto;
  font-size: 0.8rem; color: var(--muted);
  text-decoration: none; transition: color 0.18s;
}
.topbar-back:hover { color: var(--accent); }

/* ——— HERO —————————————————————————————————————————— */
.hero {
  max-width: 1080px; margin: 0 auto;
  padding: 64px 32px 48px;
  border-bottom: 1px solid var(--border);
}
.hero h1 {
  font-size: clamp(1.7rem, 3.5vw, 2.4rem);
  font-weight: 700; letter-spacing: -0.8px;
  line-height: 1.15; margin-bottom: 14px;
  color: var(--text);
}
.hero h1 span { color: var(--accent); }
.hero p {
  font-size: 0.95rem; color: var(--subdued);
  max-width: 600px; line-height: 1.7;
}
.hero-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  margin-left: 8px;
  border-bottom: 1px solid rgba(0, 212, 160, 0.2);
  transition: border-color 0.18s;
}
.hero-link:hover {
  border-bottom-color: var(--accent);
}
.disclaimer a {
  color: var(--subdued);
  text-decoration: underline;
  text-decoration-color: var(--border-mid);
  transition: color 0.18s;
}
.disclaimer a:hover {
  color: var(--accent);
}

/* ——— LAYOUT ————————————————————————————————————————— */
.layout {
  max-width: 1080px; margin: 0 auto;
  padding: 48px 32px 96px;
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 64px;
  align-items: start;
}
@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; gap: 40px; }
  .hero, .layout, .disclaimer { padding-left: 20px; padding-right: 20px; }
}

/* ——— FORM COLUMN ——————————————————————————————————— */
.form-col { display: flex; flex-direction: column; gap: 0; }

.form-section { padding: 24px 0; }
.form-section:first-child { padding-top: 0; }

.section-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 20px;
}

.divider {
  height: 1px;
  background: var(--border);
}

.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }

.form-label {
  font-size: 0.82rem; font-weight: 500; color: var(--subdued);
}
.required { color: var(--accent); font-weight: 400; margin-left: 2px; }
.optional { font-weight: 400; color: var(--muted); font-style: italic; }

.form-input, .form-textarea, .form-select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit; font-size: 0.875rem;
  padding: 9px 13px;
  transition: border-color 0.18s, box-shadow 0.18s;
  resize: vertical; width: 100%;
  appearance: none;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: rgba(0,212,160,0.4);
  box-shadow: 0 0 0 3px rgba(0,212,160,0.06);
}
.form-textarea { min-height: 130px; }
.form-textarea.short { min-height: 76px; }
.form-input::placeholder, .form-textarea::placeholder { color: var(--muted); }
.form-hint { font-size: 0.73rem; color: var(--muted); line-height: 1.5; }

/* ——— Checkbox / Toggles ———————————————————————————— */
.checkbox-container {
  display: flex;
  align-items: flex-start;
  position: relative;
  padding-left: 35px;
  cursor: pointer;
  user-select: none;
  margin: 15px 0;
}
.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0; width: 0;
}
.checkmark {
  position: absolute;
  top: 2px; left: 0;
  height: 20px; width: 20px;
  background-color: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: 6px;
  transition: all 0.2s;
}
.checkbox-container:hover input ~ .checkmark {
  border-color: var(--accent);
}
.checkbox-container input:checked ~ .checkmark {
  background-color: var(--accent);
  border-color: var(--accent);
}
.checkmark:after {
  content: "";
  position: absolute;
  display: none;
}
.checkbox-container input:checked ~ .checkmark:after {
  display: block;
}
.checkbox-container .checkmark:after {
  left: 6px; top: 2px;
  width: 5px; height: 10px;
  border: solid #0c0c0e;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.checkbox-label {
  display: flex;
  flex-direction: column;
}
.checkbox-label strong {
  font-size: 0.95rem;
  color: var(--text);
}
.checkbox-help {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
}

.key-wrap { position: relative; display: flex; }
.key-wrap .form-input { padding-right: 40px; font-family: monospace; letter-spacing: 0.5px; }
.key-toggle {
  position: absolute; right: 0; top: 0; bottom: 0; width: 38px;
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.18s;
}
.key-toggle:hover { color: var(--accent); }

/* ——— PERSONAS ——————————————————————————————————————— */
.persona-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  font-size: 0.72rem; font-weight: 500;
  padding: 4px 10px; border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border-mid);
  color: var(--subdued);
  white-space: nowrap;
}
.chip-red    { border-color: rgba(255,77,109,0.25); color: #ff8099; }
.chip-yellow { border-color: rgba(255,180,0,0.25);  color: #ffc840; }
.chip-blue   { border-color: rgba(139,124,248,0.25); color: #a89df9; }
.chip-dark   { border-color: rgba(255,255,255,0.06); color: var(--muted); }
.chip-section {
  width: 100%;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  background: none;
  border: none;
  padding: 6px 0 2px;
  margin-top: 4px;
}

/* ——— LOADER STATE —————————————————————————————————————— */
.loader-state {
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 16px;
}
.loader-header {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.78rem;
}
.loader-label { color: var(--subdued); transition: color 0.3s; }
.loader-count  { color: var(--muted); font-variant-numeric: tabular-nums; }
.loader-bar-track {
  height: 2px; background: var(--border);
  border-radius: 2px; overflow: hidden;
}
.loader-bar-fill {
  height: 100%; width: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.7s ease;
}

/* ——— SIMULATE BUTTON ———————————————————————————————— */
.btn-simulate {
  margin-top: 28px;
  width: 100%;
  padding: 12px 20px;
  font-size: 0.9rem; font-weight: 600;
  background: var(--accent);
  color: #0c0c0e;
  border: none; border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.18s, transform 0.15s;
  letter-spacing: 0.1px;
}
.btn-simulate:hover:not(:disabled) { opacity: 0.88; transform: translateY(-1px); }
.btn-simulate:active:not(:disabled) { transform: translateY(0); opacity: 1; }
.btn-simulate:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ——— RESULTS COLUMN ————————————————————————————————— */
.results-col { display: flex; flex-direction: column; gap: 24px; }

/* Post preview */
.post-preview {
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  overflow: hidden;
}
.post-outlet {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.outlet-badge {
  font-size: 0.68rem; font-weight: 800; letter-spacing: 1px;
  text-transform: uppercase;
  background: #bb1919; color: #fff;
  padding: 2px 7px; border-radius: 3px;
}
.post-preview-label {
  font-size: 0.72rem; color: var(--muted); letter-spacing: 0.3px;
}
.post-title {
  font-size: 1rem; font-weight: 700; line-height: 1.4;
  padding: 14px 16px 6px; color: var(--text);
}
.post-lead {
  font-size: 0.82rem; color: var(--subdued); line-height: 1.65;
  padding: 0 16px 14px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ——— EMPTY STATE ———————————————————————————————————— */
.results-area { display: flex; flex-direction: column; gap: 16px; }
.empty-state {
  padding: 56px 24px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.empty-icon { font-size: 2rem; opacity: 0.4; }
.empty-title { font-size: 0.9rem; font-weight: 600; color: var(--subdued); }
.empty-desc { font-size: 0.8rem; color: var(--muted); max-width: 300px; line-height: 1.65; }

/* ——— SKELETON ——————————————————————————————————————— */
.skeleton-feed { display: flex; flex-direction: column; gap: 12px; }
.skeleton-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; display: flex; gap: 12px;
}
.skeleton-avatar {
  width: 36px; height: 36px; min-width: 36px;
  background: var(--surface); border-radius: 50%;
  animation: shimmer 1.5s ease-in-out infinite;
}
.skeleton-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.skeleton-line {
  height: 10px; border-radius: 5px;
  background: var(--surface);
  animation: shimmer 1.5s ease-in-out infinite;
}
.skeleton-line.s { width: 35%; }
.skeleton-line.m { width: 60%; }
.skeleton-line.l { width: 88%; }
.skeleton-line.f { width: 100%; }
.skeleton-card:nth-child(2) * { animation-delay: 0.2s; }
.skeleton-card:nth-child(3) * { animation-delay: 0.4s; }
.skeleton-card:nth-child(4) * { animation-delay: 0.6s; }
@keyframes shimmer { 0%,100% { opacity:0.35; } 50% { opacity: 0.7; } }

/* ——— COMMENT CARDS ————————————————————————————————— */
.comments-header {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.78rem; font-weight: 600; color: var(--subdued);
  letter-spacing: 0.3px;
}
.comments-count {
  font-size: 0.7rem; padding: 2px 8px; border-radius: 20px;
  background: rgba(0,212,160,0.1); color: var(--accent);
  border: 1px solid rgba(0,212,160,0.2);
}

.comments-feed { display: flex; flex-direction: column; gap: 10px; }

.comment-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 15px;
  display: flex; gap: 12px;
  position: relative; overflow: hidden;
  transition: border-color 0.18s;
  animation: fadeUp 0.35s ease both;
}
.comment-card:hover { border-color: var(--border-mid); }

.comment-card:nth-child(1) { animation-delay: 0.04s; }
.comment-card:nth-child(2) { animation-delay: 0.08s; }
.comment-card:nth-child(3) { animation-delay: 0.12s; }
.comment-card:nth-child(4) { animation-delay: 0.16s; }
.comment-card:nth-child(5) { animation-delay: 0.2s;  }
.comment-card:nth-child(6) { animation-delay: 0.24s; }
.comment-card:nth-child(7) { animation-delay: 0.28s; }
.comment-card:nth-child(8) { animation-delay: 0.32s; }
.comment-card:nth-child(9) { animation-delay: 0.36s; }
.comment-card:nth-child(10){ animation-delay: 0.4s;  }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Sentiment left accent */
.comment-card::before {
  content: '';
  position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 2px; border-radius: 2px;
}
.comment-card[data-sentiment="positive"]::before { background: var(--s-pos); }
.comment-card[data-sentiment="critical"]::before  { background: var(--s-crit); }
.comment-card[data-sentiment="neutral"]::before   { background: var(--s-neu); }
.comment-card[data-sentiment="mixed"]::before     { background: var(--s-mix); }

.comment-avatar {
  font-size: 1.3rem; width: 36px; height: 36px; min-width: 36px;
  display: flex; align-items: center; justify-content: center;
}
.comment-body { flex: 1; min-width: 0; }
.comment-meta {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  margin-bottom: 5px;
}
.comment-name { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.comment-role {
  font-size: 0.68rem; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border);
  padding: 1px 6px; border-radius: 8px;
}
.comment-text { font-size: 0.84rem; color: var(--subdued); line-height: 1.6; }

/* Likes */
.comment-likes {
  margin-top: 8px;
  font-size: 0.72rem; color: var(--muted);
  display: flex; align-items: center; gap: 4px;
}

/* Top comment badge */
.top-badge {
  font-size: 0.65rem; font-weight: 600;
  background: rgba(255,180,0,0.12);
  color: #ffc840;
  border: 1px solid rgba(255,180,0,0.25);
  padding: 1px 7px; border-radius: 20px;
}
.comment-card--top {
  border-color: rgba(255,180,0,0.25);
  background: rgba(255,180,0,0.03);
}

/* Thread replies */
.thread-block {
  margin: 4px 0 8px 40px;
  border-left: 2px solid var(--border-mid);
  padding-left: 14px;
  display: flex; flex-direction: column; gap: 10px;
  animation: fadeUp 0.35s ease both;
}
.thread-header {
  font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.3px; color: var(--muted);
  text-transform: uppercase; margin-bottom: 2px;
}
.thread-reply {
  display: flex; gap: 9px; align-items: flex-start;
}
.thread-avatar { font-size: 1rem; line-height: 1.4; }
.thread-reply-body { flex: 1; }
.thread-reply-name { font-size: 0.78rem; font-weight: 600; color: var(--text); margin-right: 6px; }
.thread-reply-role { font-size: 0.65rem; color: var(--muted); }
.thread-reply-text { font-size: 0.8rem; color: var(--subdued); line-height: 1.55; margin-top: 3px; }

/* ——— LEGEND ————————————————————————————————————————— */
.legend {
  display: flex; flex-wrap: wrap; gap: 12px;
  font-size: 0.72rem; color: var(--muted);
}
.legend-item { display: flex; align-items: center; gap: 5px; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; }

/* ——— ERROR STATE ———————————————————————————————————— */
.error-state {
  padding: 32px 20px; text-align: center;
  border: 1px solid rgba(255,77,109,0.15);
  border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.error-state .err-icon { font-size: 1.5rem; }
.error-state .err-title { font-size: 0.85rem; font-weight: 600; color: var(--danger); }
.error-state .err-desc  { font-size: 0.78rem; color: var(--muted); max-width: 320px; line-height: 1.6; }

/* ——— DISCLAIMER ————————————————————————————————————— */
.disclaimer {
  max-width: 1080px; margin: 0 auto;
  padding: 0 32px 56px;
  font-size: 0.75rem; color: var(--muted); line-height: 1.65;
  border-top: 1px solid var(--border); padding-top: 24px;
}

/* ——— CORS warning ——————————————————————————————————————— */
.cors-warning {
  font-size: 0.78rem;
  color: #ffc840;
  background: rgba(255,180,0,0.06);
  border: 1px solid rgba(255,180,0,0.2);
  border-radius: var(--radius);
  padding: 10px 13px;
  line-height: 1.6;
  margin-bottom: 8px;
}

/* ——— UTILS —————————————————————————————————————————— */
.hidden { display: none !important; }
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }

/* ——— CUSTOM PERSONAS ———————————————————————————————— */
.custom-personas-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}
.custom-persona-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: var(--radius);
  position: relative;
  animation: fadeUp 0.3s ease both;
}
.btn-remove-persona {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  font-size: 0.75rem;
  transition: color 0.18s;
}
.btn-remove-persona:hover { color: var(--danger); }

.btn-add-persona {
  width: 100%;
  padding: 10px;
  background: none;
  border: 1px dashed var(--border-mid);
  color: var(--subdued);
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-add-persona:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0,212,160,0.03);
}

/* ——— TOOLTIPS —————————————————————————————————————— */
.info-icon {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 14px; height: 14px;
  background: var(--border-mid);
  color: var(--muted);
  font-size: 0.65rem; font-weight: 700;
  border-radius: 50%;
  margin-left: 6px;
  cursor: help;
  transition: all 0.18s;
  position: relative;
}
.info-icon:hover {
  background: var(--accent);
  color: #0c0c0e;
}

.tooltip {
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%) translateY(5px);
  width: 220px;
  background: var(--surface);
  border: 1px solid var(--border-mid);
  padding: 12px;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--subdued);
  font-weight: 400;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  white-space: normal;
  text-align: left;
  backdrop-filter: blur(8px);
}
.tooltip::after {
  content: '';
  position: absolute;
  top: 100%; left: 50%;
  border: 6px solid transparent;
  border-top-color: var(--border-mid);
  margin-left: -6px;
}
.info-icon:hover .tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Adjust tooltip position if it hits the edge */
.persona-chips .tooltip {
  bottom: auto;
  top: 130%;
}
.persona-chips .tooltip::after {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: var(--border-mid);
}


/* ——— ANALYSIS REPORT DASHBOARD ———————————————————————— */
.analysis-report {
  background: linear-gradient(135deg, rgba(0, 212, 160, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 32px;
  box-shadow: 0 15px 35px rgba(0,212,160,0.08);
  animation: slideDown 0.4s ease-out;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

.report-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(0, 212, 160, 0.2);
  padding-bottom: 12px;
}
.report-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0;
}

.report-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 768px) {
  .report-grid { grid-template-columns: 1fr; }
}

.report-card {
  background: rgba(255, 255, 255, 0.03);
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--border-mid);
}
.report-card h4 {
  margin: 0 0 12px 0;
  color: var(--subdued);
  font-size: 0.8rem;
  text-transform: uppercase;
}
.report-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.report-card li {
  font-size: 0.9rem;
  margin-bottom: 8px;
  position: relative;
  padding-left: 20px;
  line-height: 1.4;
  color: var(--subdued);
}
.report-card li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--accent);
}

.report-verdict {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--border-mid);
}
.report-verdict h4 { color: var(--accent); margin-bottom: 8px; font-size: 0.85rem; text-transform: uppercase; }
.report-verdict p { font-size: 0.95rem; line-height: 1.6; color: var(--text); font-style: italic; margin: 0; }
