/* ═══════════════════════════════════════════════════════════
   ELDRAVAN BESTIARY — UI Styles
   Dark Fantasy theme matching existing panel
   ═══════════════════════════════════════════════════════════ */

/* ─── BESTIARY TAB LAYOUT ─── */
#tab-bestiary .bestiary-wrap {
  display: flex; gap: 0; height: calc(100vh - 60px);
  background: var(--bg-dark, #0a0a0a);
}

/* ─── LEFT: FILTERS + GRID ─── */
.bestiary-left {
  flex: 1; display: flex; flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.08);
  overflow: hidden;
}

.bestiary-toolbar {
  display: flex; gap: 8px; padding: 14px 16px;
  background: rgba(0,0,0,0.4);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-wrap: wrap; align-items: center;
}

.bestiary-toolbar input,
.bestiary-toolbar select {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: #e0ddd5; padding: 8px 12px;
  border-radius: 8px; font-size: 13px;
  transition: border-color 0.2s;
}
.bestiary-toolbar input:focus,
.bestiary-toolbar select:focus {
  border-color: var(--gold, #c8a94e);
  outline: none;
}
.bestiary-toolbar select option {
  background: var(--bg-dark, #1a1a1a); /* Dark solid background for the dropdown menu */
  color: #e0ddd5;
}
.bestiary-toolbar input { flex: 1; min-width: 160px; }
.bestiary-toolbar select { min-width: 100px; }

.bestiary-toolbar .bestiary-count {
  color: rgba(255,255,255,0.4); font-size: 12px;
  margin-left: auto; white-space: nowrap;
}

/* ─── CREATURE GRID ─── */
.bestiary-grid {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: flex-start;
  align-content: flex-start;
  align-items: flex-start;
}
.bestiary-grid::-webkit-scrollbar { width: 6px; }
.bestiary-grid::-webkit-scrollbar-thumb {
  background: rgba(200,169,78,0.3); border-radius: 3px;
}

/* ─── CREATURE CARD (Zindanlar Style) ─── */
.beast-card {
  display: flex; flex-direction: column;
  background: #111; /* Dark solid base for info matching layout */
  border-radius: 12px; overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.05);
  width: 200px;
  height: 280px;
  flex-shrink: 0; /* Ensures rigid card size preventing overlap */
}

.beast-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.8);
  border-color: rgba(255,255,255,0.15);
}

.beast-card.active {
  border-color: var(--gold, #c8a94e);
  box-shadow: 0 0 0 1px var(--gold, #c8a94e), 0 8px 25px rgba(200,169,78,0.2);
}

/* Card Image Area (Top 75%) */
.beast-card-img-wrapper {
  position: relative;
  flex: 1; /* Takes up remaining top space */
  width: 100%;
  overflow: hidden;
  background: #1a1a1a;
}
.beast-card-img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

/* Badges (Overlaid on Image) */
.beast-card-source {
  position: absolute; top: 10px; left: 12px;
  font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.5px;
  text-shadow: 0 2px 4px rgba(0,0,0,1);
  z-index: 2;
}
.beast-card-source.srd { color: #a0a0a0; }
.beast-card-source.homebrew { color: #d4af37; } /* Gold text */

.beast-card-cr {
  position: absolute; top: 10px; right: 10px;
  background: rgba(15, 15, 15, 0.85); /* Dark pill */
  color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 4px 10px; border-radius: 20px;
  z-index: 2;
  box-shadow: 0 2px 4px rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.05);
}

/* Card Info Area (Bottom Block) */
.beast-card-info {
  background: #111111;
  padding: 12px 14px;
  height: 64px; /* Fixed height for info block to ensure grid consistency */
  display: flex; flex-direction: column;
  justify-content: center;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.beast-card-name {
  font-size: 15px; font-weight: 800; color: #f4f4f4;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: 0.3px;
}
.beast-card-sub {
  font-size: 11px; color: #888;
  margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ─── RIGHT: DETAIL PANEL ─── */
.bestiary-detail {
  width: 480px; overflow-y: auto; padding: 0;
  background: rgba(0,0,0,0.3);
  display: flex; flex-direction: column;
}
.bestiary-detail::-webkit-scrollbar { width: 6px; }
.bestiary-detail::-webkit-scrollbar-thumb {
  background: rgba(200,169,78,0.3); border-radius: 3px;
}

.bestiary-detail-empty {
  display: flex; align-items: center; justify-content: center;
  height: 100%; color: rgba(255,255,255,0.2);
  font-size: 14px; font-style: italic;
}

/* Detail Header */
.bd-header {
  position: relative; overflow: hidden;
}
.bd-header-img {
  width: 100%; height: 320px; object-fit: cover;
  object-position: center top;
  display: block;
}
.bd-header-img-placeholder {
  width: 100%; height: 260px;
  display: flex; align-items: center; justify-content: center;
  font-size: 80px; opacity: 0.1;
  background: linear-gradient(135deg, #1a150e, #0d0a06);
}
.bd-header-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 20px 16px 14px;
  background: linear-gradient(to top, rgba(0,0,0,0.95), transparent);
}
.bd-header-name {
  font-size: 22px; font-weight: 800; color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}
.bd-header-sub {
  font-size: 12px; color: rgba(255,255,255,0.5); margin-top: 2px;
}

/* Detail Body */
.bd-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }

/* Stat Block */
.bd-stats {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px;
}
.bd-stat-mana {
  border-color: rgba(100,150,255,0.25);
  background: rgba(100,150,255,0.06);
}
.bd-stat-mana .bd-stat-label { color: #60a0ff; }
.bd-stat-mana .bd-stat-value { color: #90c0ff; }
.bd-stat {
  text-align: center; padding: 8px 4px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
}
.bd-stat-label {
  font-size: 9px; font-weight: 700; color: var(--gold, #c8a94e);
  text-transform: uppercase; letter-spacing: 1px;
}
.bd-stat-value {
  font-size: 16px; font-weight: 800; color: #e0ddd5; margin-top: 2px;
}

/* Info Rows */
.bd-info-row {
  display: flex; gap: 12px; flex-wrap: wrap;
}
.bd-info-chip {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  padding: 6px 12px; border-radius: 8px;
  font-size: 12px; color: #c0bdb5;
}
.bd-info-chip strong { color: var(--gold, #c8a94e); font-size: 11px; }

/* Section Blocks */
.bd-section {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 10px; padding: 12px 14px;
}
.bd-section-title {
  font-size: 11px; font-weight: 700; color: var(--gold, #c8a94e);
  text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 8px; padding-bottom: 6px;
  border-bottom: 1px solid rgba(200,169,78,0.15);
}
.bd-section-text {
  font-size: 13px; color: #b8b5ad; line-height: 1.6;
}

/* Lore Section */
.bd-lore {
  background: linear-gradient(135deg, rgba(200,169,78,0.04), rgba(200,169,78,0.01));
  border-color: rgba(200,169,78,0.12);
}

/* Action Button */
.bd-actions {
  display: flex; gap: 8px; padding: 14px 0 0;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.bd-actions .btn {
  flex: 1; text-align: center;
}

/* Deity Tags */
.bd-deity-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.bd-deity-tag.pyrael { background: rgba(255,100,50,0.15); color: #ff8040; }
.bd-deity-tag.thalassyn { background: rgba(50,150,255,0.15); color: #60a0ff; }
.bd-deity-tag.elyndra { background: rgba(50,200,100,0.15); color: #50c870; }
.bd-deity-tag.morveth { background: rgba(160,80,200,0.15); color: #b060d0; }

/* ─── RESPONSIVE ─── */
@media (max-width: 900px) {
  #tab-bestiary .bestiary-wrap { flex-direction: column; }
  .bestiary-detail { width: 100%; max-height: 50vh; }
  .bestiary-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
