/* ============================================================
   Majui Search — visual inspirado em Google
   ============================================================ */

:root {
  --g-blue: #1a73e8;
  --g-blue-hover: #1765cc;
  --g-red: #ea4335;
  --g-yellow: #fbbc04;
  --g-green: #34a853;
  --text: #202124;
  --text-secondary: #4d5156;
  --text-muted: #70757a;
  --link: #1a0dab;
  --link-visited: #681da8;
  --border: #dadce0;
  --bg: #fff;
  --bg-soft: #f8f9fa;
  --bg-hover: #f1f3f4;
  --shadow-1: 0 1px 6px rgba(32,33,36,.08);
  --shadow-2: 0 2px 10px rgba(32,33,36,.15);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
a:visited { color: var(--link-visited); }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

.hidden { display: none !important; }

/* ============================================================
   HOME (estilo google.com)
   ============================================================ */
.home {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 0 20px 100px;
}

.home-logo {
  font-family: arial, sans-serif;
  font-size: 92px;
  font-weight: 500;
  letter-spacing: -3px;
  margin-bottom: 30px;
  user-select: none;
}
.home-logo span { display: inline-block; }
.home-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: -22px;
  margin-bottom: 30px;
  letter-spacing: 1px;
}

.home-search {
  position: relative;
  width: 100%;
  max-width: 584px;
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 5px 16px;
  box-shadow: none;
  transition: box-shadow .2s, border-color .2s;
  background: #fff;
}
.home-search:hover, .home-search:focus-within {
  box-shadow: var(--shadow-1);
  border-color: rgba(223,225,229,0);
}
.home-search svg { flex-shrink: 0; }
.home-search input {
  flex: 1;
  border: none;
  outline: none;
  height: 34px;
  padding: 0 12px;
  font-size: 16px;
  color: var(--text);
  background: transparent;
}

.home-buttons {
  margin-top: 30px;
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.btn-pill {
  background: var(--bg-soft);
  border: 1px solid var(--bg-soft);
  border-radius: 4px;
  color: #3c4043;
  font-size: 14px;
  padding: 10px 18px;
  transition: all .15s;
}
.btn-pill:hover {
  box-shadow: var(--shadow-1);
  border-color: #dadce0;
  color: #202124;
}

.home-stats {
  margin-top: 60px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}
.home-stats strong { color: var(--text-secondary); font-weight: 600; }

/* ============================================================
   TOPBAR (estado SERP)
   ============================================================ */
#topbar {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 14px 28px 0;
  border-bottom: none;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-logo {
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -1px;
  text-decoration: none;
  flex-shrink: 0;
  margin-right: 8px;
}
.topbar-logo:hover { text-decoration: none; }

.topbar-search {
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 640px;
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 4px 14px;
  background: #fff;
  transition: box-shadow .2s, border-color .2s;
}
.topbar-search:hover, .topbar-search:focus-within {
  box-shadow: var(--shadow-1);
  border-color: rgba(223,225,229,0);
}
.topbar-search input {
  flex: 1;
  border: none;
  outline: none;
  height: 32px;
  font-size: 16px;
  padding: 0 10px;
  background: transparent;
}
.topbar-search button {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 50%;
}

/* ============================================================
   TABS (Tudo / WhatsApp / E-mail / ...)
   ============================================================ */
.tabs {
  display: flex;
  gap: 4px;
  padding: 0 28px;
  margin-top: 8px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  background: #fff;
  position: sticky;
  top: 60px;
  z-index: 49;
}
.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 12px 12px;
  font-size: 14px;
  color: var(--text-secondary);
  border-bottom: 3px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  background: none;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--g-blue);
  border-bottom-color: var(--g-blue);
}
.tab-icon { width: 16px; height: 16px; }

/* ============================================================
   SERP — área de resultados
   ============================================================ */
.serp {
  max-width: 900px;
  margin: 0 0 0 152px;
  padding: 20px 28px 80px;
}
.serp-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.result {
  margin-bottom: 28px;
  max-width: 660px;
}
.result-breadcrumb {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}
.result-breadcrumb .crumb-sep { color: var(--text-muted); }
.result-source-icon {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--bg-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
  color: var(--text-secondary);
  margin-right: 4px;
}
.result-title {
  font-size: 20px;
  line-height: 1.3;
  color: var(--link);
  font-weight: 400;
  margin: 0;
  cursor: pointer;
}
.result-title:hover { text-decoration: underline; }
.result-snippet {
  font-size: 14px;
  line-height: 1.58;
  color: var(--text-secondary);
  margin-top: 4px;
}
.result-snippet mark {
  background: transparent;
  font-weight: bold;
  color: var(--text);
}
.result-date {
  color: var(--text-muted);
  font-weight: normal;
}
.result-actions {
  margin-top: 6px;
  display: flex;
  gap: 14px;
  font-size: 13px;
}
.result-actions a {
  color: var(--text-secondary);
  cursor: pointer;
}
.result-actions a:hover { color: var(--g-blue); }

.result-thumb {
  display: flex;
  gap: 16px;
}
.result-thumb img {
  width: 116px;
  height: 116px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--bg-soft);
  flex-shrink: 0;
}
.result-audio {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 8px 14px;
  margin-top: 6px;
  max-width: 540px;
}
.result-audio audio { flex: 1; height: 32px; }
.result-audio-duration {
  font-size: 12px;
  color: var(--text-muted);
}

/* No-results */
.no-results {
  font-size: 14px;
  color: var(--text-secondary);
  padding: 40px 0;
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 3px solid var(--bg-soft);
  border-top-color: var(--g-blue);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   DRAWER (preview lateral)
   ============================================================ */
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(720px, 100vw);
  background: #fff;
  box-shadow: -4px 0 24px rgba(0,0,0,.15);
  z-index: 100;
  overflow-y: auto;
  transform: translateX(0);
  transition: transform .25s ease;
}
.drawer.hidden {
  transform: translateX(100%);
  display: block !important;
  pointer-events: none;
}
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.3);
  z-index: 99;
}
.drawer-close {
  position: absolute;
  top: 12px; right: 16px;
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: 24px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.drawer-close:hover { background: var(--bg-hover); }

.drawer-content {
  padding: 64px 32px 48px;
}

.drawer-kind {
  display: inline-block;
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: var(--bg-soft);
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: 4px;
  margin-bottom: 12px;
}

.drawer-breadcrumb {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 18px;
}
.drawer-title {
  font-size: 20px;
  font-weight: 500;
  margin: 0 0 6px;
  color: var(--text);
}
.drawer-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.drawer-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.drawer-actions button {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 16px;
  font-size: 12px;
  padding: 6px 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}
.drawer-actions button:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.drawer-section {
  margin-bottom: 24px;
}
.drawer-section h3 {
  font-size: 13px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin: 0 0 8px;
}

.drawer-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  background: var(--bg-soft);
  padding: 12px 16px;
  border-radius: 8px;
  max-height: 50vh;
  overflow-y: auto;
}

.drawer-audio { width: 100%; margin: 8px 0 16px; }
.drawer-img { max-width: 100%; border-radius: 8px; }
.drawer-img-wrap {
  text-align: center;
  background: var(--bg-soft);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}
.drawer-pdfpage img { width: 100%; border-radius: 8px; box-shadow: var(--shadow-1); }
.drawer-pdfpage-wrap { background: #525659; padding: 16px; border-radius: 8px; }

/* Conversa de contexto */
.context-list {
  border-left: 3px solid var(--border);
  padding-left: 16px;
  margin-top: 12px;
}
.context-msg {
  margin: 12px 0;
  font-size: 13px;
}
.context-msg.is-self { color: var(--text); }
.context-msg-head {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.context-msg-head strong { color: var(--text-secondary); font-weight: 600; }
.context-msg-body {
  background: var(--bg-soft);
  border-radius: 8px;
  padding: 8px 12px;
  white-space: pre-wrap;
}
.context-msg.is-current .context-msg-body {
  background: #fff4c2;
  border: 1px solid #fbbc04;
}

/* ============================================================
   Páginas dedicadas (pessoa, peca, fato, timeline)
   ============================================================ */
.page {
  max-width: 980px;
  margin: 24px auto;
  padding: 0 28px 80px;
}
.page h1 {
  font-size: 28px;
  font-weight: 500;
  margin: 0 0 8px;
}
.page-sub {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 24px;
}
.actor-card {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 22px;
}
.actor-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 600;
  color: #fff;
}
.actor-aliases {
  font-size: 13px;
  color: var(--text-muted);
}
.actor-contacts {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.timeline-row {
  display: grid;
  grid-template-columns: 110px 24px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--bg-soft);
  font-size: 14px;
}
.timeline-row .tl-date { color: var(--text-muted); }
.timeline-row .tl-dot {
  width: 10px; height: 10px;
  background: var(--g-blue);
  border-radius: 50%;
  margin-top: 6px;
  justify-self: center;
}
.timeline-row .tl-body { color: var(--text); }
.timeline-row .tl-meta { font-size: 12px; color: var(--text-muted); }

.facets {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.facets select, .facets input {
  font-family: inherit;
  font-size: 13px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
}

/* footer */
.footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--bg-soft);
  font-size: 12px;
  color: var(--text-muted);
  padding: 10px 28px;
  border-top: 1px solid var(--border);
  text-align: center;
  z-index: 10;
}

/* responsivo */
@media (max-width: 800px) {
  .serp { margin-left: 0; padding: 16px; }
  .home-logo { font-size: 60px; }
  #topbar { padding: 10px 12px 0; gap: 12px; }
  .tabs { padding: 0 12px; top: 56px; }
  .drawer { width: 100vw; }
}
