/* ==========================================================================
   Knowledge Base — Figma design
   ========================================================================== */

/* --- Category icons grid (mobile: wrap, desktop: row) --- */
.knowledge-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 8px 0 16px;
  justify-content: center;
}

@media (min-width: 600px) {
  .knowledge-categories { flex-wrap: nowrap; gap: 24px; }
}

.knowledge-categories--compact {
  gap: 12px;
  justify-content: center;
  margin-bottom: 24px;
}

@media (min-width: 600px) {
  .knowledge-categories--compact { gap: 16px; }
}

.knowledge-category {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--md-sys-color-on-surface);
  flex-shrink: 0;
  transition: transform 0.15s;
}

.knowledge-category:hover {
  transform: scale(1.08);
  text-decoration: none;
}

.knowledge-category__icon {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 2px solid transparent;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.knowledge-category__icon img {
  width: 80%;
  height: 80%;
  object-fit: contain;
}

.knowledge-category__icon--sm {
  width: 80px;
  height: 80px;
}

/* Active category — highlight with ring */
.knowledge-category--active .knowledge-category__icon {
  border-width: 3px;
  box-shadow: 0 0 0 4px rgba(0,0,0,0.1);
}

.knowledge-category--active .knowledge-category__name {
  font-weight: 700;
}

/* Per-category pastel colors (from Figma icon_all_lhite) */
.knowledge-category[data-cat="ram"] .knowledge-category__icon { background: #D1B3E8; }
.knowledge-category[data-cat="sheep"] .knowledge-category__icon { background: #B8D4BE; }
.knowledge-category[data-cat="bull"] .knowledge-category__icon { background: #F0C4E8; }
.knowledge-category[data-cat="cow"] .knowledge-category__icon { background: #A5D6A7; }
.knowledge-category[data-cat="goat_male"] .knowledge-category__icon { background: #BBDEFB; }
.knowledge-category[data-cat="goat_female"] .knowledge-category__icon { background: #B3E5FC; }
.knowledge-category[data-cat="horse"] .knowledge-category__icon { background: #FFE0B2; }
.knowledge-category[data-cat="camel"] .knowledge-category__icon { background: #FFF9C4; }

/* Active — darker border + shadow + bold text */
.knowledge-category--active[data-cat="ram"] .knowledge-category__icon { border-color: #7B1FA2; box-shadow: 0 0 0 4px rgba(123,31,162,0.2); }
.knowledge-category--active[data-cat="ram"] .knowledge-category__name { color: #7B1FA2; }

.knowledge-category--active[data-cat="sheep"] .knowledge-category__icon { border-color: #388E3C; box-shadow: 0 0 0 4px rgba(56,142,60,0.2); }
.knowledge-category--active[data-cat="sheep"] .knowledge-category__name { color: #388E3C; }

.knowledge-category--active[data-cat="bull"] .knowledge-category__icon { border-color: #C2185B; box-shadow: 0 0 0 4px rgba(194,24,91,0.2); }
.knowledge-category--active[data-cat="bull"] .knowledge-category__name { color: #C2185B; }

.knowledge-category--active[data-cat="cow"] .knowledge-category__icon { border-color: #2E7D32; box-shadow: 0 0 0 4px rgba(46,125,50,0.2); }
.knowledge-category--active[data-cat="cow"] .knowledge-category__name { color: #2E7D32; }

.knowledge-category--active[data-cat="goat_male"] .knowledge-category__icon { border-color: #1565C0; box-shadow: 0 0 0 4px rgba(21,101,192,0.2); }
.knowledge-category--active[data-cat="goat_male"] .knowledge-category__name { color: #1565C0; }

.knowledge-category--active[data-cat="goat_female"] .knowledge-category__icon { border-color: #1565C0; box-shadow: 0 0 0 4px rgba(21,101,192,0.2); }
.knowledge-category--active[data-cat="goat_female"] .knowledge-category__name { color: #1565C0; }

.knowledge-category--active[data-cat="horse"] .knowledge-category__icon { border-color: #E65100; box-shadow: 0 0 0 4px rgba(230,81,0,0.2); }
.knowledge-category--active[data-cat="horse"] .knowledge-category__name { color: #E65100; }

.knowledge-category--active[data-cat="camel"] .knowledge-category__icon { border-color: #F57F17; box-shadow: 0 0 0 4px rgba(245,127,23,0.2); }
.knowledge-category--active[data-cat="camel"] .knowledge-category__name { color: #F57F17; }

.knowledge-category__name {
  font: 500 16px/20px 'Roboto', sans-serif;
  text-align: center;
  letter-spacing: 0.1px;
}

.knowledge-categories--compact .knowledge-category__name {
  font-size: 14px;
}

/* Mobile: grid-friendly smaller icons */
@media (max-width: 599px) {
  .knowledge-category__icon { width: 64px; height: 64px; }
  .knowledge-category__name { font-size: 12px; }
  .knowledge-category__icon--sm { width: 52px; height: 52px; }
  .knowledge-categories--compact .knowledge-category__name { font-size: 11px; }
}

/* --- Breed selector pill --- */
.knowledge-breed-selector {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 24px;
  position: relative;
  max-width: 100%;
}

.knowledge-breed-select {
  appearance: none;
  padding: 10px 36px 10px 16px;
  border: none;
  border-radius: var(--md-sys-shape-corner-full);
  font: 500 15px/20px 'Roboto', sans-serif;
  color: var(--md-sys-color-primary);
  background-image: linear-gradient(rgba(164,161,80,0.05), rgba(164,161,80,0.05)),
                     linear-gradient(var(--md-sys-color-surface), var(--md-sys-color-surface));
  box-shadow: 0px 1px 2px rgba(0,0,0,0.15), 0px 1px 3px 1px rgba(0,0,0,0.1);
  cursor: pointer;
  outline: none;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 600px) {
  .knowledge-breed-select { font-size: 18px; padding: 12px 40px 12px 24px; }
}

.knowledge-breed-selector svg {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--md-sys-color-primary);
  pointer-events: none;
}

/* --- Breed photo --- */
.knowledge-photo {
  border-radius: var(--md-sys-shape-corner-large);
  overflow: hidden;
  margin-bottom: 24px;
  max-height: 400px;
}

.knowledge-photo img {
  width: 100%;
  height: auto;
  object-fit: cover;
  max-height: 400px;
}

/* --- Description --- */
.knowledge-description {
  font: 400 16px/28px 'Roboto', sans-serif;
  color: var(--md-sys-color-on-surface);
  text-align: justify;
  letter-spacing: 0.1px;
  margin-bottom: 24px;
  word-break: break-word;
  overflow-wrap: break-word;
}

@media (min-width: 840px) {
  .knowledge-description { font-size: 18px; line-height: 32px; }
}

.knowledge-auth-prompt {
  text-align: center;
  padding: 32px;
  margin-top: 16px;
  background: var(--md-sys-color-surface-variant);
  border-radius: var(--md-sys-shape-corner-large);
}

.knowledge-auth-prompt p {
  margin: 12px 0;
  color: var(--md-sys-color-on-surface-variant);
}

/* --- Section titles --- */
.knowledge-section-title {
  font: 500 22px/28px 'Roboto', sans-serif;
  color: var(--md-sys-color-on-surface);
  margin: 24px 0 16px;
}

.knowledge-section-title--link {
  color: var(--md-sys-color-primary);
  text-decoration: underline;
  text-align: center;
  font-size: 24px;
}

/* --- Chips row --- */
.knowledge-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.knowledge-chip--hidden { display: none; }

.knowledge-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  padding: 8px 16px;
  border: none;
  background: none;
  cursor: pointer;
  font: 500 14px/20px 'Roboto', sans-serif;
  color: var(--md-sys-color-primary);
  border-radius: var(--md-sys-shape-corner-full);
  transition: background 0.15s;
}

.knowledge-more-btn:hover { background: rgba(27,116,62,0.06); }

/* --- Q&A items --- */
.qa-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.qa-item__question {
  font: 500 18px/24px 'Roboto', sans-serif;
  color: #22231d;
  text-decoration: underline;
  display: block;
  margin-bottom: 8px;
}

.qa-item__question:hover { color: var(--md-sys-color-primary); }

.qa-item__answer {
  font: 300 16px/22px 'Roboto', sans-serif;
  color: var(--md-sys-color-on-surface);
  margin-bottom: 8px;
}

.qa-item__stats {
  display: flex;
  gap: 16px;
  font: 400 14px/20px 'Roboto', sans-serif;
  color: #564848;
}

.qa-item__stats span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* --- Ask question link --- */
.knowledge-ask-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 24px 0;
  font: 400 20px/24px 'Roboto', sans-serif;
  color: var(--md-sys-color-primary);
  text-decoration: underline;
}

.knowledge-ask-link:hover { text-decoration: none; }

/* --- Q&A form --- */
.qa-form {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.qa-form .input { flex: 1; }

/* --- Empty state --- */
.knowledge-empty {
  color: var(--md-sys-color-outline);
  text-align: center;
  padding: 16px 0;
}

.knowledge-login-prompt {
  margin-top: 12px;
  text-align: center;
}

/* --- Regional ads horizontal scroll --- */
.knowledge-listings-scroll {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 8px 0 16px;
  scrollbar-width: none;
}

.knowledge-listings-scroll::-webkit-scrollbar { display: none; }

.knowledge-listing-card {
  flex-shrink: 0;
  width: 220px;
  height: 211px;
  border-radius: var(--md-sys-shape-corner-small);
  overflow: hidden;
  background: var(--md-sys-color-surface-variant);
}

.knowledge-listing-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.knowledge-listing-card:hover img { transform: scale(1.05); }

.knowledge-listing-card__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--md-sys-color-outline);
}
