/* ===================================================
   Intelligence Digest — Design System
   =================================================== */

:root {
  --blue:    #1346b7;
  --magenta: #e3395a;
  --yellow:  #f6ed8c;
  --white:   #ffffff;

  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;
  --surface:        #f8fafc;
  --border:         #e2e8f0;
  --border-hover:   #cbd5e1;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:      0 4px 16px rgba(0,0,0,.08);
  --shadow-hover:   0 8px 24px rgba(0,0,0,.12);
  --radius:         12px;
  --radius-sm:      8px;
  --radius-pill:    999px;
  --transition:     .2s ease;
  --max-w:          1280px;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--surface);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ===================================================
   Header
   =================================================== */

.header {
  background: var(--blue);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(19,70,183,.3);
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-mark {
  display: block;
  width: 4px;
  height: 40px;
  background: var(--magenta);
  border-radius: 2px;
  flex-shrink: 0;
}

.header-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -.02em;
  line-height: 1.2;
}

.header-sub {
  font-size: .75rem;
  color: rgba(255,255,255,.6);
  font-weight: 400;
  margin-top: 2px;
}

.header-meta {
  font-size: .75rem;
  color: rgba(255,255,255,.55);
  text-align: right;
  flex-shrink: 0;
  white-space: nowrap;
}

/* ===================================================
   Controls bar
   =================================================== */

.controls-bar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 77px;
  z-index: 90;
}

.controls-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* Search */
.search-wrap {
  position: relative;
  flex-shrink: 0;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  height: 38px;
  padding: 0 14px 0 38px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: .875rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--surface);
  width: 220px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(19,70,183,.12);
  background: var(--white);
}

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

/* Filter pills */
.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-pill {
  height: 34px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border);
  background: transparent;
  font-size: .8125rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.filter-pill:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.filter-pill.active {
  background: var(--magenta);
  border-color: var(--magenta);
  color: var(--white);
}

/* ===================================================
   Main & Grid
   =================================================== */

.main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 20px 24px 40px;
}

.stats-bar {
  font-size: .8125rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  min-height: 20px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* ===================================================
   Card
   =================================================== */

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--card-accent, var(--border));
  transition: background var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
  border-color: var(--border-hover);
}

/* Category accent colors */
.card[data-cat="IA"]           { --card-accent: var(--blue); }
.card[data-cat="Redes Sociais"]{ --card-accent: var(--magenta); }
.card[data-cat="Comportamento"]{ --card-accent: #f59e0b; }
.card[data-cat="Estratégia"]   { --card-accent: #64748b; }
.card[data-cat="Dados & Métricas"]{ --card-accent: #0ea5e9; }

/* Card top row */
.card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.card-badge {
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

/* Badge colors per category */
.card[data-cat="IA"] .card-badge            { background: rgba(19,70,183,.1);  color: var(--blue); }
.card[data-cat="Redes Sociais"] .card-badge { background: rgba(227,57,90,.1);  color: var(--magenta); }
.card[data-cat="Comportamento"] .card-badge { background: rgba(245,158,11,.12); color: #b45309; }
.card[data-cat="Estratégia"] .card-badge    { background: rgba(100,116,139,.1); color: #475569; }
.card[data-cat="Dados & Métricas"] .card-badge { background: rgba(14,165,233,.1); color: #0369a1; }

.card-date {
  font-size: .75rem;
  color: var(--text-muted);
  margin-left: auto;
}

.card-score {
  font-size: .7rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 2px 8px;
  white-space: nowrap;
}

.card-score.high { color: #16a34a; border-color: rgba(22,163,74,.25); background: rgba(22,163,74,.06); }
.card-score.med  { color: #d97706; border-color: rgba(217,119,6,.25);  background: rgba(217,119,6,.06); }

/* Card title */
.card-title {
  font-size: .9375rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  letter-spacing: -.01em;
}

/* Card summary */
.card-summary {
  font-size: .8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Insights accordion */
.insights-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  padding: 8px 0;
  font-size: .8125rem;
  font-weight: 500;
  color: var(--blue);
  cursor: pointer;
  font-family: inherit;
  transition: color var(--transition);
  width: 100%;
  border-top: 1px solid var(--border);
}

.insights-toggle:hover { color: var(--magenta); }

.insights-toggle svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: transform var(--transition);
}

.insights-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.insights-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
  animation: slideDown .2s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.insights-section { display: flex; flex-direction: column; gap: 6px; }

.insights-label {
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.insights-label.accent { color: var(--magenta); }

.insights-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.insights-list li {
  font-size: .8rem;
  color: var(--text-secondary);
  padding-left: 14px;
  position: relative;
  line-height: 1.4;
}

.insights-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--blue);
}

.insights-list.actionable-list li::before { background: var(--magenta); }

/* Card link */
.card-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .8125rem;
  font-weight: 500;
  color: var(--blue);
  text-decoration: none;
  transition: color var(--transition), gap var(--transition);
  margin-top: auto;
}

.card-link svg { width: 14px; height: 14px; flex-shrink: 0; }

.card-link:hover {
  color: var(--magenta);
  gap: 10px;
}

/* ===================================================
   Empty state
   =================================================== */

.empty-state {
  text-align: center;
  padding: 80px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.empty-icon {
  width: 56px;
  height: 56px;
  background: var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-icon svg {
  width: 28px;
  height: 28px;
  color: var(--text-muted);
}

.empty-state h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.empty-state p {
  font-size: .875rem;
  color: var(--text-muted);
}

.empty-state code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: .8125rem;
  background: var(--border);
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--text-primary);
}

/* ===================================================
   Footer
   =================================================== */

.footer {
  border-top: 1px solid var(--border);
  background: var(--white);
  padding: 20px 24px;
  text-align: center;
}

.footer p {
  font-size: .75rem;
  color: var(--text-muted);
}

.footer a {
  color: var(--blue);
  text-decoration: none;
}

.footer a:hover { text-decoration: underline; }

/* ===================================================
   Responsive
   =================================================== */

@media (max-width: 1024px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .header-inner { padding: 14px 16px; }
  .header-title { font-size: 1.1rem; }
  .header-meta { display: none; }

  .controls-bar { top: 69px; }
  .controls-inner {
    padding: 10px 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .search-wrap { width: 100%; }
  .search-input { width: 100%; }

  .filters { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .filters::-webkit-scrollbar { display: none; }

  .main { padding: 20px 16px 40px; }

  .grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

@media (max-width: 480px) {
  .card { padding: 18px; }
  .card-title { font-size: .875rem; }
}

/* ===================================================
   Loading skeleton (não usado, mas útil para futuro)
   =================================================== */

.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--surface) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
