/* Bestiary — Dark FFXI theme */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #1a1a2e;
  color: #e0e0e0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
#header {
  display: flex;
  flex-direction: column;
  background: #16213e;
  border-bottom: 1px solid #0f3460;
  flex-shrink: 0;
}

#header-row1 {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(5px + env(safe-area-inset-top)) 10px 2px;
}

#header-row2 {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 10px 5px;
}

#header h1 {
  font-size: 16px;
  color: #e94560;
  white-space: nowrap;
}

.nav-icon { height: 20px; vertical-align: middle; margin-right: 4px; image-rendering: pixelated; }

#nav {
  display: flex;
  gap: 4px;
}

#nav a {
  color: #aaa;
  text-decoration: none;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 3px;
}

#nav a:hover { color: #fff; }
#nav a.nav-active { color: #e94560; font-weight: bold; }

/* Search */
#search-wrap {
  flex: 1;
  max-width: 360px;
  min-width: 120px;
}

#mob-search {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid #0f3460;
  border-radius: 4px;
  background: #1a1a2e;
  color: #e0e0e0;
  font-size: 16px;
  outline: none;
}

#mob-search:focus { border-color: #e94560; }

/* Level filter */
#level-filter {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #aaa;
  flex-shrink: 0;
}

#level-filter input[type="number"] {
  width: 40px;
  padding: 3px 4px;
  font-size: 16px;
  background: #1a1a2e;
  color: #e0e0e0;
  border: 1px solid #0f3460;
  border-radius: 3px;
  text-align: center;
  -moz-appearance: textfield;
}

#level-filter input::-webkit-inner-spin-button,
#level-filter input::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

#level-filter input:focus { border-color: #e94560; outline: none; }

#result-count {
  font-size: 11px;
  color: #888;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
}

/* Results area */
#results-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
}

#loading {
  text-align: center;
  color: #888;
  padding: 40px;
  font-size: 14px;
}

/* Family section */
.family-section {
  margin-bottom: 16px;
}

.family-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid #0f3460;
  margin-bottom: 6px;
}

.family-name {
  font-size: 14px;
  font-weight: bold;
  color: #e94560;
}

.family-eco {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  background: #0f3460;
  color: #aaa;
}

.family-count {
  font-size: 10px;
  color: #666;
}

/* Mob entry */
.mob-entry {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 3px 0 3px 8px;
  font-size: 12px;
}

.mob-name {
  color: #f0c040;
  font-weight: bold;
  white-space: nowrap;
  min-width: 140px;
  flex-shrink: 0;
}

.mob-name.is-nm { color: #4da6ff; }
.mob-name.is-bst { color: #e94560; }

.mob-zones {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.zone-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  background: #1a1a2e;
  border: 1px solid #0f3460;
  border-radius: 3px;
  font-size: 11px;
  text-decoration: none;
  color: #ccc;
  white-space: nowrap;
}

.zone-pill:hover {
  border-color: #e94560;
  color: #fff;
}

.zone-pill.no-map {
  color: #666;
  border-color: #222;
}

.zone-pill .zp-name { color: inherit; }
.zone-pill .zp-ct { color: #888; }
.zone-pill .zp-lv { color: #f5a623; }

/* Mode toggle */
#mode-toggle {
  display: flex;
  flex-shrink: 0;
}

.mode-btn {
  padding: 3px 10px;
  font-size: 11px;
  border: 1px solid #0f3460;
  background: #1a1a2e;
  color: #888;
  cursor: pointer;
  outline: none;
}

.mode-btn:first-child { border-radius: 3px 0 0 3px; }
.mode-btn:last-child { border-radius: 0 3px 3px 0; border-left: none; }
.mode-btn.active { background: #0f3460; color: #e94560; font-weight: bold; }
.mode-btn:hover:not(.active) { color: #ccc; }

/* Item search suggestions */
#search-wrap { position: relative; }

#item-search {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid #0f3460;
  border-radius: 4px;
  background: #1a1a2e;
  color: #e0e0e0;
  font-size: 16px;
  outline: none;
}

#item-search:focus { border-color: #e94560; }

#item-suggestions {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  background: #16213e;
  border: 1px solid #0f3460;
  border-top: none;
  border-radius: 0 0 4px 4px;
  z-index: 100;
}

#item-suggestions .sug-item {
  padding: 6px 10px;
  font-size: 13px;
  color: #ccc;
  cursor: pointer;
}

#item-suggestions .sug-item:hover,
#item-suggestions .sug-item.active {
  background: #0f3460;
  color: #fff;
}

/* Drop results */
.drop-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #0f3460;
  margin-bottom: 8px;
}

.drop-header .dh-name {
  font-size: 15px;
  font-weight: bold;
  color: #f0c040;
}

.drop-header .dh-count {
  font-size: 11px;
  color: #888;
}

.drop-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0 4px 8px;
  font-size: 12px;
}

.drop-entry .de-rate {
  display: inline-block;
  min-width: 50px;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: bold;
  text-align: center;
  flex-shrink: 0;
}

.de-rate.rate-high { background: #1a4d2e; color: #5fd35f; }
.de-rate.rate-mid { background: #4d4d1a; color: #e8d44d; }
.de-rate.rate-low { background: #4d3a1a; color: #e8a033; }
.de-rate.rate-rare { background: #4d1a1a; color: #e94560; }

.drop-entry .de-mob {
  color: #f0c040;
  font-weight: bold;
  white-space: nowrap;
  min-width: 120px;
  flex-shrink: 0;
}

.drop-entry .de-mob.is-nm { color: #4da6ff; }

.drop-entry .de-zone {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  background: #1a1a2e;
  border: 1px solid #0f3460;
  border-radius: 3px;
  font-size: 11px;
  text-decoration: none;
  color: #ccc;
  white-space: nowrap;
}

.drop-entry .de-zone:hover {
  border-color: #e94560;
  color: #fff;
}

.drop-entry .de-zone.no-map {
  color: #666;
  border-color: #222;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #1a1a2e; }
::-webkit-scrollbar-thumb { background: #0f3460; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #e94560; }

/* Mobile */
@media (max-width: 768px) {
  #header-row1 { padding: calc(3px + env(safe-area-inset-top)) 6px 1px; gap: 4px; }
  #header-row2 { padding: 1px 6px 3px; gap: 4px; }
  #header h1 { font-size: 13px; }
  #results-wrap { padding: 6px 8px; }
  .mob-entry { flex-direction: column; gap: 2px; }
  .mob-name { min-width: 0; }
}

@media (max-width: 480px) {
  #header h1 { display: none; }
}
