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

:root {
  --bg:        #0d0f14;
  --surface:   #161a24;
  --card:      #1e2333;
  --border:    #2a3045;
  --text:      #e8eaf0;
  --muted:     #8891a8;
  --accent:    #4f8ef7;
  --radius:    12px;

  --left-5:    #c0392b;
  --left-3:    #e74c3c;
  --left-1:    #f39c9c;
  --center:    #7f8c8d;
  --right-1:   #a0b4f7;
  --right-3:   #3498db;
  --right-5:   #1a5fa8;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
  padding: 0 16px 60px;
  line-height: 1.6;
}

/* ── Header ─────────────────────────────────────────────── */
header {
  text-align: center;
  padding: 48px 16px 32px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #e74c3c, #3498db);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.logo h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

header p {
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 480px;
  margin: 0 auto;
}

/* ── Card ────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

/* ── Search box ─────────────────────────────────────────── */
.search-wrap {
  max-width: 720px;
  margin: 0 auto 32px;
}

.search-label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.search-row {
  display: flex;
  gap: 10px;
}

.search-row input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  padding: 12px 16px;
  outline: none;
  transition: border-color .2s;
}

.search-row input:focus {
  border-color: var(--accent);
}

.search-row input::placeholder { color: var(--muted); }

.btn-analyze {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 22px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .2s, transform .1s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-analyze:hover  { opacity: .85; }
.btn-analyze:active { transform: scale(.97); }
.btn-analyze:disabled { opacity: .5; cursor: not-allowed; }

/* ── Spinner ─────────────────────────────────────────────── */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Estado ─────────────────────────────────────────────── */
#state-area {
  max-width: 720px;
  margin: 0 auto;
}

.state-loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

.state-loading .big-spinner {
  width: 48px; height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto 16px;
}

.state-error {
  background: rgba(231,76,60,.12);
  border: 1px solid rgba(231,76,60,.3);
  border-radius: var(--radius);
  padding: 20px 24px;
  color: #f1948a;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.state-error .icon { font-size: 1.4rem; flex-shrink: 0; }

/* ── Resultado ───────────────────────────────────────────── */
#result { display: none; }

.result-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.result-meta {
  flex: 1;
  min-width: 200px;
}

.result-meta .titulo {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 4px;
}

.result-meta .veiculo {
  font-size: 0.82rem;
  color: var(--muted);
}

/* ── Espectro político ───────────────────────────────────── */
.spectrum-section { margin-bottom: 24px; }

.spectrum-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.spectrum-bar {
  position: relative;
  height: 12px;
  border-radius: 100px;
  background: linear-gradient(to right,
    #c0392b 0%,
    #e74c3c 20%,
    #f39c9c 38%,
    #7f8c8d 50%,
    #a0b4f7 62%,
    #3498db 80%,
    #1a5fa8 100%
  );
}

.spectrum-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 22px;
  height: 22px;
  background: #fff;
  border: 3px solid #0d0f14;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,.5);
  transition: left .6s cubic-bezier(.34,1.56,.64,1);
}

.spectrum-values {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 6px;
}

/* ── Confiança ───────────────────────────────────────────── */
.confidence-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.confidence-bar-wrap {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 100px;
  overflow: hidden;
}

.confidence-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 100px;
  transition: width .7s ease;
}

.confidence-val {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

/* ── Seções de texto ─────────────────────────────────────── */
.section-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 10px;
}

.text-block {
  font-size: 0.9rem;
  color: #c8cfe0;
  line-height: 1.7;
  margin-bottom: 20px;
}

/* ── Indicadores ─────────────────────────────────────────── */
.indicators {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.indicators li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 0.875rem;
  color: #c8cfe0;
  line-height: 1.5;
}

/* ── Link original ───────────────────────────────────────── */
.original-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: 0.85rem;
  text-decoration: none;
  margin-top: 4px;
  opacity: .8;
  transition: opacity .2s;
}
.original-link:hover { opacity: 1; }

/* ── Histórico ───────────────────────────────────────────── */
#history-section { max-width: 720px; margin: 32px auto 0; }

.history-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 12px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: border-color .2s;
}

.history-item:hover { border-color: var(--accent); }

.history-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.history-text {
  flex: 1;
  min-width: 0;
}

.history-domain {
  font-size: 0.75rem;
  color: var(--muted);
}

.history-url-preview {
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Responsivo ──────────────────────────────────────────── */
@media (max-width: 560px) {
  .search-row { flex-direction: column; }
  .btn-analyze { justify-content: center; }
  .result-header { flex-direction: column; }
}
