/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0d0d0d;
  --card:      #161616;
  --card2:     #1e1e1e;
  --border:    #2a2a2a;
  --border2:   #333;
  --gold:      #c8a84b;
  --gold-dim:  #8a6e2a;
  --gold-glow: rgba(200,168,75,.18);
  --text:      #e8e8e8;
  --text-dim:  #888;
  --text-muted:#555;
  --tier-s:    #f0c040;
  --tier-a:    #4caf50;
  --tier-b:    #2196f3;
  --tier-c:    #ff9800;
  --tier-d:    #f44336;
  --radius:    10px;
  --radius-sm: 6px;
  --shadow:    0 4px 24px rgba(0,0,0,.6);
  --transition: .2s ease;
}

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

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

a { color: var(--gold); text-decoration: none; transition: color var(--transition); }
a:hover { color: #e8c060; text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dim); }

/* ===== HEADER ===== */
.site-header {
  background: linear-gradient(180deg, #111 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: var(--gold);
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  flex-shrink: 0;
}
.logo:hover { color: var(--gold); text-decoration: none; }
.logo i { font-size: 1.3rem; }
.logo span { font-size: .7rem; color: var(--text-dim); font-weight: 400; display: block; }

.nav-tabs {
  display: flex;
  gap: .25rem;
}
.nav-tab {
  padding: .45rem .9rem;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 500;
  color: var(--text-dim);
  cursor: pointer;
  border: none;
  background: transparent;
  transition: all var(--transition);
}
.nav-tab:hover { color: var(--text); background: var(--card); }
.nav-tab.active { color: var(--gold); background: var(--gold-glow); }

/* ===== MAIN LAYOUT ===== */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.section { display: none; }
.section.active { display: block; }

/* ===== CARDS ===== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* ===== COMPARADOR ===== */
.compare-section { margin-bottom: 2.5rem; }

.compare-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: start;
}

.compare-vs {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 2rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-muted);
}

.autocomplete-wrap {
  position: relative;
}

.autocomplete-wrap label {
  display: block;
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: .4rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.autocomplete-input {
  width: 100%;
  background: var(--card2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: .95rem;
  font-family: 'Inter', sans-serif;
  padding: .6rem 1rem;
  outline: none;
  transition: border-color var(--transition);
  -webkit-appearance: none;
  appearance: none;
}
.autocomplete-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--card2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  max-height: 280px;
  overflow-y: auto;
  z-index: 200;
  display: none;
}
.autocomplete-dropdown.open { display: block; }

.autocomplete-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem 1rem;
  cursor: pointer;
  transition: background var(--transition);
  font-size: .88rem;
}
.autocomplete-item:hover,
.autocomplete-item.focused {
  background: var(--gold-glow);
}
.autocomplete-item .item-name { flex: 1; }
.autocomplete-item .item-name mark {
  background: transparent;
  color: var(--gold);
  font-weight: 600;
}
.autocomplete-item .item-meta {
  font-size: .75rem;
  color: var(--text-dim);
  text-align: right;
  white-space: nowrap;
}

/* ===== TIER BADGE ===== */
.tier-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 1.5px solid;
  font-size: .78rem;
  font-weight: 800;
  flex-shrink: 0;
  letter-spacing: -.5px;
}
.tier-badge--small {
  width: 22px; height: 22px;
  font-size: .68rem;
  border-radius: 4px;
}
.tier-badge--large {
  width: 40px; height: 40px;
  font-size: 1.1rem;
  border-radius: 8px;
}

/* ===== BTN COMPARAR ===== */
.compare-btn-wrap {
  display: flex;
  justify-content: center;
  margin: 1.25rem 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem 1.4rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  font-family: 'Inter', sans-serif;
}

.btn-primary {
  background: var(--gold);
  color: #0d0d0d;
}
.btn-primary:hover { background: #e8c060; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(200,168,75,.3); }

.btn-outline {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
}
.btn-outline:hover { background: var(--gold-glow); border-color: var(--gold); }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border2);
}
.btn-ghost:hover { background: var(--card2); color: var(--text); }

.btn-danger { background: #c0392b; color: #fff; }
.btn-danger:hover { background: #e74c3c; }

.btn:disabled { opacity: .4; cursor: not-allowed; transform: none !important; }
.btn-sm { padding: .35rem .8rem; font-size: .8rem; }
.btn-lg { padding: .75rem 2rem; font-size: 1rem; }

/* ===== COMPARE RESULT ===== */
.compare-result {
  margin-top: 1.5rem;
}

.result-verdict {
  text-align: center;
  padding: 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  font-size: 1.05rem;
  font-weight: 600;
}
.result-verdict.much_better { background: rgba(76,175,80,.12); border: 1px solid rgba(76,175,80,.3); color: #4caf50; }
.result-verdict.slightly_better { background: rgba(33,150,243,.12); border: 1px solid rgba(33,150,243,.3); color: #2196f3; }
.result-verdict.indifferent { background: rgba(200,168,75,.1); border: 1px solid rgba(200,168,75,.2); color: var(--gold); }

.result-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.result-card {
  background: var(--card2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 1.25rem;
  position: relative;
  transition: border-color var(--transition);
}
.result-card.winner {
  border-color: var(--gold);
  box-shadow: 0 0 20px var(--gold-glow);
}

.result-card-crown {
  position: absolute;
  top: -12px; left: 50%;
  transform: translateX(-50%);
  font-size: 1.4rem;
  line-height: 1;
}

.result-card-header {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: 1rem;
}
.result-card-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.result-stats { display: flex; flex-direction: column; gap: .45rem; }
.result-stat { display: flex; justify-content: space-between; align-items: center; font-size: .88rem; }
.result-stat-label { color: var(--text-dim); }
.result-stat-value { font-weight: 600; color: var(--text); }
.result-stat-value.gpoz { font-size: 1.1rem; color: var(--gold); }

.result-wiki-btn {
  margin-top: 1rem;
  width: 100%;
}

/* ===== RANKING ===== */
.ranking-controls {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1.25rem;
  align-items: center;
}

.search-input {
  flex: 1;
  min-width: 200px;
  background: var(--card2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: .9rem;
  font-family: 'Inter', sans-serif;
  padding: .5rem 1rem .5rem 2.2rem;
  outline: none;
  transition: border-color var(--transition);
  -webkit-appearance: none;
  appearance: none;
}
.search-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-glow); }
.search-wrap { position: relative; flex: 1; min-width: 200px; }
.search-wrap i { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: .85rem; pointer-events: none; }

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: 1rem;
}

.pill {
  padding: .3rem .85rem;
  border-radius: 99px;
  font-size: .8rem;
  font-weight: 500;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: all var(--transition);
  font-family: 'Inter', sans-serif;
}
.pill:hover { border-color: var(--gold-dim); color: var(--text); }
.pill.active { background: var(--gold-glow); border-color: var(--gold); color: var(--gold); }

.ranking-count {
  font-size: .82rem;
  color: var(--text-muted);
  margin-bottom: .75rem;
}

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}

thead th {
  padding: .6rem 1rem;
  text-align: left;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}
thead th.sortable { cursor: pointer; }
thead th.sortable:hover { color: var(--gold); }
thead th .sort-icon { margin-left: .3rem; opacity: .4; }
thead th.sorted .sort-icon { opacity: 1; color: var(--gold); }

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
tbody tr:hover { background: var(--card2); }
tbody tr:last-child { border-bottom: none; }

tbody td {
  padding: .65rem 1rem;
  vertical-align: middle;
}

.td-name { display: flex; align-items: center; gap: .5rem; }
.td-name a { color: var(--text); font-weight: 500; }
.td-name a:hover { color: var(--gold); }

.td-gpoz { font-weight: 700; color: var(--gold); font-size: .95rem; }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state i { font-size: 2.5rem; margin-bottom: .75rem; display: block; }
.empty-state p { font-size: .95rem; }

/* ===== LEGEND ===== */
.tier-legend {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1.5rem;
}
.tier-legend-item {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .75rem;
  border-radius: 99px;
  border: 1px solid;
  font-size: .78rem;
  font-weight: 500;
}

/* ===== LOADING ===== */
.loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  gap: 1rem;
  color: var(--text-dim);
}

.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  bottom: 1.5rem; right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.toast {
  background: var(--card2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: .75rem 1.1rem;
  font-size: .88rem;
  min-width: 220px;
  max-width: 340px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: .6rem;
  animation: slideIn .25s ease;
}
.toast.success { border-left: 3px solid #4caf50; }
.toast.error   { border-left: 3px solid #f44336; }
.toast.info    { border-left: 3px solid var(--gold); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: none; opacity: 1; } }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .compare-grid {
    grid-template-columns: 1fr;
  }
  .compare-vs { padding: .5rem 0; }
  .result-cards { grid-template-columns: 1fr; }
  .nav-tab span { display: none; }
  .header-inner { gap: .5rem; }
  .main { padding: 1.25rem 1rem 3rem; }
}

@media (max-width: 480px) {
  .logo .logo-sub { display: none; }
  table { font-size: .8rem; }
  thead th, tbody td { padding: .5rem .6rem; }
}

/* ===== PAGE LAYOUT COM SIDEBARS ===== */
.page-layout {
  display: flex;
  align-items: flex-start;
  gap: 0;
  max-width: 1600px;
  margin: 0 auto;
}

/* Sidebar de anúncio */
.ad-sidebar {
  width: 160px;
  flex-shrink: 0;
  position: sticky;
  top: 80px;
  padding: 1rem .5rem;
}

.ad-slot--sidebar {
  min-height: 600px;
  width: 160px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

/* Banner horizontal entre seções e abaixo da tabela */
.ad-slot--in-content {
  min-height: 90px;
  border-radius: var(--radius);
  overflow: hidden;
}

/* Banner mobile: só aparece em telas pequenas */
.ad-slot--banner-mobile {
  display: none;
  min-height: 50px;
  margin-bottom: 1rem;
}

/* Em telas menores que 1200px, esconde sidebars */
@media (max-width: 1200px) {
  .ad-sidebar { display: none; }
  .ad-slot--banner-mobile { display: block; }
}

/* ===== SEO FOOTER ===== */
.seo-footer {
  margin-top: 3rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border);
}

.seo-footer-inner {
  max-width: 860px;
}

.seo-h1 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1rem;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: .6rem;
}

.seo-lead {
  font-size: .95rem;
  color: var(--text-dim);
  line-height: 1.75;
  margin-bottom: 2rem;
  max-width: 760px;
}

.seo-lead strong { color: var(--text); }

.seo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.seo-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}

.seo-card h2 {
  font-size: .9rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: .65rem;
  display: flex;
  align-items: center;
  gap: .45rem;
}

.seo-card p {
  font-size: .84rem;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: .5rem;
}

.seo-card p:last-child { margin-bottom: 0; }

.seo-card strong { color: var(--text); }

.seo-card code {
  background: var(--card2);
  color: var(--gold);
  padding: .1rem .35rem;
  border-radius: 3px;
  font-size: .82rem;
}

.seo-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: 1.5rem;
}

.seo-tags span {
  font-size: .75rem;
  padding: .2rem .65rem;
  border-radius: 99px;
  background: var(--card2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.seo-disclaimer {
  font-size: .75rem;
  color: var(--text-muted);
  line-height: 1.6;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 768px) {
  .seo-grid { grid-template-columns: 1fr; }
  .seo-h1 { font-size: 1.1rem; }
}
