/**
 * AC | Topic Index — widget de busca + grid de categorias com tópicos âncora.
 * Pensado pra ficar como filho de um ac-section (que provê bg verde + mancha).
 */

.ac-topic-index {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.ac-topic-index__subheader {
  margin: 0;
  max-width: 600px;
  font-family: Arial, sans-serif;
  font-weight: 400;
  font-size: 12px;
  line-height: 170%;
  color: #808080;
}

/* --- Search wrap (relative pra ancorar o dropdown) --- */
.ac-topic-index__search-wrap {
  position: relative;
  width: 100%;
  max-width: 600px;
}

/* --- Search input (Figma: width 600 / height 40 / radius-md / border 1px) --- */
.ac-topic-index__search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 600px;
  height: 40px;
  background: #FFFFFF;
  border: 1px solid #D9D9D9;
  border-radius: 8px;
  padding: 0 8px 0 12px;
}
.ac-topic-index__search:focus-within {
  border-color: #0E5236;
  box-shadow: 0 0 0 3px rgba(14, 82, 54, 0.2);
}
.ac-topic-index__search-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #808080;
  flex: 0 0 auto;
}
.ac-topic-index__search-input {
  flex: 1 1 auto;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: Arial, sans-serif;
  font-size: 14px;
  color: #242424;
}
.ac-topic-index__search-input::placeholder { color: #808080; }
.ac-topic-index__search-input::-webkit-search-cancel-button { cursor: pointer; }

/* --- Dropdown autocomplete (Figma: bg branco / radius 12 / shadow Elevation/md) --- */
.ac-topic-index__dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  background: #FFFFFF;
  border-radius: 12px;
  box-shadow: 0 12px 16px -2px rgba(0, 0, 0, 0.08);
  max-height: 320px;
  overflow-y: auto;
  padding: 8px 0;
}
.ac-topic-index__dropdown[hidden] { display: none; }
.ac-topic-index__dropdown-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ac-topic-index__dropdown-item a {
  display: block;
  margin: 0 8px;
  padding: 6px 8px;
  border-radius: 8px;
  font-family: Arial, sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 130%;
  color: #404040;
  text-decoration: none;
  transition: background-color 0.15s ease;
}
.ac-topic-index__dropdown-item a:hover,
.ac-topic-index__dropdown-item a:focus-visible {
  background: #F0F2F5;
  color: #242424;
}
/* Scrollbar slim */
.ac-topic-index__dropdown::-webkit-scrollbar { width: 6px; }
.ac-topic-index__dropdown::-webkit-scrollbar-thumb {
  background: #D9D9D9;
  border-radius: 9999px;
}
.ac-topic-index__dropdown::-webkit-scrollbar-track { background: transparent; }

.ac-topic-index__empty {
  margin: 0;
  font-family: Arial, sans-serif;
  font-size: 14px;
  color: #404040;
}

/* --- Grid de categorias --- */
.ac-topic-index__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
}

.ac-topic-index__col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ac-topic-index__cat-title {
  margin: 0;
  font-family: Raleway, sans-serif;
  font-weight: 700;
  font-size: 18px;
  line-height: 130%;
  color: #033936;
}

.ac-topic-index__topics {
  list-style: none;
  margin: 0;
  padding: 0 0 0 16px;
  border-left: 3px solid #F6A71C;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ac-topic-index__topic a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: Raleway, sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--ac-ti-link-color, #404040);
  text-decoration: none;
  transition: color 0.2s ease;
}
.ac-topic-index__topic a:hover,
.ac-topic-index__topic a:focus-visible {
  color: #0E5236;
  text-decoration: underline;
}
.ac-topic-index__topic-chevron {
  flex: 0 0 auto;
  color: currentColor;
}

/* Mobile / tablet */
@media (max-width: 1024px) {
  .ac-topic-index__grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .ac-topic-index__grid { grid-template-columns: 1fr; gap: 24px; }
}

/* Editor-only nota */
.ac-topic-index__editor-note {
  font-family: Arial, sans-serif;
  font-size: 12px;
  color: #774900;
  background: rgba(246, 167, 28, 0.15);
  border-radius: 6px;
  padding: 8px 12px;
}
