/* Animals page: header, category tabs and the animal card grid.
   Everything is scoped to .animals-card / .animal-grid / .animal-card so the Crops grid (.entity-card) is untouched. */

.animals-card .card-body { padding: 1.5rem; }

/* ---- Header -------------------------------------------------------------------------------------------------- */
.animals-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
}
.animals-title { display: flex; align-items: center; gap: 0.85rem; min-width: 0; }
.animals-title-icon {
  flex: 0 0 auto;
  width: 48px; height: 48px;
  border-radius: 14px;
  background: #386641;
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
}
.animals-title .card-title { font-size: 1.5rem; font-weight: 700; color: #14281a; line-height: 1.2; }
.animals-subtitle { color: #6c757d; font-size: 0.875rem; }

.animals-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.animals-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-top: 1.1rem; }
.animals-search { position: relative; flex: 1 1 240px; min-width: 200px; max-width: 360px; }
.animals-search .mdi { position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%); color: #8a94a3; font-size: 1.15rem; pointer-events: none; }
.animals-search .form-control { padding-left: 2.4rem; }
.animals-filters .form-control,
.animals-actions .btn { height: 42px; }
.animals-select { width: auto; min-width: 130px; max-width: 200px; font-size: 0.875rem; }
.animals-toggle .btn { display: inline-flex; align-items: center; justify-content: center; width: 42px; padding: 0; }
.animals-add { white-space: nowrap; font-weight: 600; padding-left: 1.1rem; padding-right: 1.25rem; }

/* ---- Category tabs ------------------------------------------------------------------------------------------- */
.animals-subhead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin: 1rem 0 0.35rem;
}
.animals-tabs { display: flex; gap: 0.5rem; overflow-x: auto; max-width: 100%; padding-bottom: 2px; scrollbar-width: none; }
.animals-tabs::-webkit-scrollbar { display: none; }
.animals-tab {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 0.45rem;
  height: 38px;
  padding: 0 0.95rem;
  border: 0;
  border-radius: 999px;
  background: #f1f4f2;
  color: #4a5560;
  font-size: 0.875rem; font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.animals-tab:hover { background: #e4ebe6; }
.animals-tab.active { background: #386641; color: #fff; }
.animals-tab-count {
  min-width: 22px; padding: 0 6px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px;
  background: rgba(20, 40, 26, 0.1);
  font-size: 0.75rem; font-weight: 700;
}
.animals-tab.active .animals-tab-count { background: rgba(255, 255, 255, 0.22); }
.animals-farm-note { color: #8a94a3; font-size: 0.8rem; margin: 0 0 1rem; }

/* ---- Grid ---------------------------------------------------------------------------------------------------- */
.animal-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  align-items: stretch;
  min-height: 80px;
}
@media (max-width: 1439.98px) { .animal-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1099.98px) { .animal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 519.98px)  { .animal-grid { grid-template-columns: minmax(0, 1fr); } }

.animal-grid-message { grid-column: 1 / -1; text-align: center; padding: 2rem 1rem; color: #6c757d; }

/* ---- Card ---------------------------------------------------------------------------------------------------- */
.animal-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #fff;
  border: 1px solid #e3e8e5;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(20, 40, 26, 0.06);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.animal-card:hover { box-shadow: 0 10px 24px rgba(20, 40, 26, 0.12); transform: translateY(-2px); }

/* Identical image box on every card: the photo never decides the card's height */
.animal-card-media {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 15px 15px 0 0;
  background: linear-gradient(135deg, #6c757d, #343a40);
  flex: 0 0 auto;
}
.animal-card-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}
.animal-card-media img.is-stock { object-position: center 38%; }
.animal-card-placeholder {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255, 255, 255, 0.92);
  font-size: 3rem;
}

.animal-badge {
  position: absolute; top: 10px; right: 10px;
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #343a40;
  font-size: 0.72rem; font-weight: 700; line-height: 1;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  white-space: nowrap;
}
.animal-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.animal-badge.is-good { color: #1f6428; }
.animal-badge.is-watch { color: #c77700; }
.animal-badge.is-bad { color: #c62828; }
.animal-badge.is-out { color: #6c757d; }

.animal-card-body { flex: 1 1 auto; padding: 14px 16px 10px; min-width: 0; }
.animal-card-name {
  margin: 0;
  font-size: 1.05rem; font-weight: 700; line-height: 1.3;
  color: #14281a;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.animal-card-tag { font-size: 0.78rem; color: #8a94a3; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.animal-card-line {
  display: flex; align-items: center; gap: 6px;
  margin-top: 8px;
  min-height: 20px;
  font-size: 0.85rem; color: #343a40;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.animal-card-line .mdi { flex: 0 0 auto; font-size: 1rem; color: #386641; }
.animal-card-line.is-muted { font-size: 0.78rem; color: #6c757d; }
.animal-card-line.is-muted .mdi { color: #8a94a3; }
.animal-card-line span { overflow: hidden; text-overflow: ellipsis; }

.animal-card-actions {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px 14px;
  margin-top: auto;
  border-top: 1px solid #eef1ef;
}
.animal-card-actions .animal-view {
  flex: 3 1 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px;
  border-radius: 10px;
  background: #386641; color: #fff;
  font-size: 0.875rem; font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease;
}
.animal-card-actions .animal-view:hover { background: #2d5434; color: #fff; }
.animal-card-actions .dropdown { flex: 1 1 0; min-width: 44px; }
.animal-card-actions .animal-more {
  width: 100%; height: 40px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid #d8e0dc; border-radius: 10px;
  background: #fff; color: #4a5560; font-size: 1.2rem;
}
.animal-card-actions .animal-more:hover { background: #f1f4f2; }
.animal-card-actions .dropdown-item.text-danger:hover { background: #fdecea; }

@media (max-width: 767.98px) {
  .animals-card .card-body { padding: 1rem; }
  .animals-actions { width: 100%; }
  .animals-actions .animals-add { flex: 1 1 auto; }
  /* one swipeable row instead of a tall stack of dropdowns */
  .animals-filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .animals-filters::-webkit-scrollbar { display: none; }
  .animals-filters > * { flex: 0 0 auto; }
  .animals-search { flex: 0 0 220px; min-width: 220px; }
  .animals-select { min-width: 140px; }
}
