/* === MERCHANTS / EQUIPMENT / TREASURE === */

.merch-loading {
  display: flex; align-items: center; justify-content: center; height: 10rem;
}
.merch-spinner {
  width: 40px; height: 40px; border-radius: 50%;
  border: 3px solid rgba(100,50,30,0.2); border-top-color: #a32d2d;
  animation: merch-spin 0.8s linear infinite;
}
@keyframes merch-spin { to { transform: rotate(360deg); } }

.merch-root { padding: 0 0.25rem; }

/* Tabs */
.merch-tabs {
  display: flex; gap: 4px; margin-bottom: 0.75rem; flex-wrap: wrap;
}
.merch-tab {
  padding: 5px 16px; font-size: 0.82rem; border-radius: 6px 6px 0 0;
  border: 1px solid rgba(139,92,20,0.25); border-bottom: none;
  background: transparent; color: #6b5030; cursor: pointer; font-family: inherit;
  transition: background 0.15s;
}
.merch-tab:hover { background: rgba(196,154,32,0.1); }
.merch-tab.is-active {
  background: rgba(255,250,240,0.7); border-color: rgba(139,92,20,0.35);
  color: #3a1a08; font-weight: bold;
}

/* Panels */
.merch-panel {
  border: 1px solid rgba(139,92,20,0.2); border-radius: 0 6px 6px 6px;
  padding: 0.75rem; background: rgba(255,250,240,0.25);
}
.merch-panel-hidden { display: none; }

/* Toolbar */
.merch-toolbar {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 0.6rem;
}
.merch-search {
  flex: 1; min-width: 160px; padding: 5px 8px; font-size: 0.82rem;
  border: 1px solid rgba(139,92,20,0.3); border-radius: 5px;
  background: rgba(255,250,240,0.6); color: #3a1a08; font-family: inherit;
}
.merch-search:focus { outline: none; border-color: #c49a20; }
.merch-select {
  padding: 5px 8px; font-size: 0.8rem; border-radius: 5px;
  border: 1px solid rgba(139,92,20,0.3);
  background: rgba(255,250,240,0.6); color: #3a1a08; font-family: inherit;
}
.merch-select-sm { max-width: 120px; }
.merch-label { font-size: 0.75rem; color: #6b5030; white-space: nowrap; }
.merch-btn {
  padding: 5px 14px; font-size: 0.8rem; border-radius: 5px;
  border: 1px solid rgba(139,92,20,0.3); cursor: pointer; font-family: inherit;
  background: transparent; color: #3a1a08; transition: background 0.15s;
}
.merch-btn-primary {
  background: rgba(196,154,32,0.15); border-color: #c49a20; font-weight: bold;
}
.merch-btn:hover { background: rgba(196,154,32,0.25); }

/* Item grid */
.merch-item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px; max-height: 60vh; overflow-y: auto; padding-right: 4px;
}
.merch-empty { font-size: 0.8rem; color: #8b6914; font-style: italic; padding: 0.5rem; }

/* Item card */
.merch-item-card {
  border: 1px solid rgba(139,92,20,0.15); border-radius: 6px;
  padding: 7px 9px; background: rgba(255,250,240,0.4);
  transition: background 0.15s, box-shadow 0.15s;
}
.merch-item-card:hover {
  background: rgba(255,250,240,0.8);
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.merch-shop-card { border-left: 3px solid rgba(139,92,20,0.3); }

.merch-item-top {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 6px;
  margin-bottom: 3px;
}
.merch-item-name { font-size: 0.82rem; font-weight: bold; color: #3a1a08; }
.merch-price-badge {
  font-size: 0.72rem; font-weight: bold; color: #c49a20;
  background: rgba(196,154,32,0.12); border: 1px solid rgba(196,154,32,0.3);
  padding: 1px 5px; border-radius: 4px; white-space: nowrap; flex-shrink: 0;
}
.merch-item-meta {
  display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 3px;
}
.merch-cat-tag {
  font-size: 0.65rem; padding: 1px 5px; border-radius: 8px;
  background: rgba(100,80,40,0.1); color: #6b5030; border: 1px solid rgba(100,80,40,0.2);
}
.merch-res-tag {
  font-size: 0.65rem; padding: 1px 5px; border-radius: 8px;
  background: rgba(24,95,165,0.08); color: #185fa5; border: 1px solid rgba(24,95,165,0.2);
}
.merch-weight { font-size: 0.65rem; color: #8b6914; }
.merch-item-notes { font-size: 0.68rem; color: #5a3a1a; line-height: 1.4; }

/* Quality badges */
.merch-quality-badge {
  font-size: 0.62rem; padding: 1px 5px; border-radius: 8px; font-weight: bold;
}
.merch-q1 { background: rgba(234,179,8,0.12); color: #a16207; border: 1px solid rgba(234,179,8,0.3); }
.merch-q2 { background: rgba(22,163,74,0.1);  color: #166534; border: 1px solid rgba(22,163,74,0.25); }
.merch-q3 { background: rgba(37,99,235,0.1);  color: #1e40af; border: 1px solid rgba(37,99,235,0.25); }

/* Treasure result */
.merch-treasure-result {
  border: 1px solid rgba(139,92,20,0.2); border-radius: 6px;
  overflow: hidden; background: rgba(255,250,240,0.3); margin-top: 0.5rem;
}
.merch-treasure-header {
  padding: 6px 12px; font-family: var(--font-title, serif); font-size: 1rem;
  color: #c49a20; background: rgba(139,92,20,0.06);
  border-bottom: 1px solid rgba(139,92,20,0.15);
}
.merch-treasure-section { padding: 8px 12px; }
.merch-treasure-label {
  font-size: 0.68rem; font-weight: bold; text-transform: uppercase;
  letter-spacing: 0.05em; color: #8b6914; margin-bottom: 4px;
}
.merch-treasure-list {
  margin: 0; padding-left: 1.2em; font-size: 0.82rem; color: #4a3520; line-height: 1.7;
}
.merch-treasure-list small { color: #9ca3af; }

/* Currency toggle label */
.merch-currency-note {
  font-size: 0.65rem; color: #8b6914; font-style: italic; margin-top: 2px;
}

/* Treasure selector row */
.merch-treasure-selector {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 0.75rem;
}
.merch-treasure-body {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.merch-roll-ref { color: #9ca3af; font-size: 0.68rem; }
.merch-hint { font-size: 0.72rem; color: #8b6914; font-style: italic; margin-bottom: 0.5rem; }

@media (max-width: 640px) {
  .merch-item-grid { grid-template-columns: 1fr; max-height: 50vh; }
  .merch-tabs { gap: 2px; }
  .merch-tab { padding: 4px 10px; font-size: 0.75rem; }
  .merch-treasure-body { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   HERBS & POISONS VIEW
   ═══════════════════════════════════════════════════════════════════════════ */

.herb-loading {
  display: flex; align-items: center; justify-content: center; height: 10rem;
}
.herb-spinner {
  width: 40px; height: 40px; border-radius: 50%;
  border: 3px solid rgba(59,109,17,0.2); border-top-color: #3b6d11;
  animation: merch-spin 0.8s linear infinite;
}

.herb-root { padding: 0 0.25rem; }

/* Header */
.herb-header { margin-bottom: 0.75rem; }
.herb-title {
  font-family: var(--font-title, serif); font-size: 1.5rem; color: #c49a20; margin: 0;
  text-shadow: 1px 1px 0 #1a0e04;
}
.herb-subtitle { font-size: 0.78rem; color: #6b5030; margin: 2px 0 0; }

/* Tabs */
.herb-tabs {
  display: flex; gap: 4px; margin-bottom: 0.6rem;
}
.herb-tab {
  padding: 5px 18px; font-size: 0.82rem; border-radius: 6px 6px 0 0;
  border: 1px solid rgba(139,92,20,0.25); border-bottom: none;
  background: transparent; color: #6b5030; cursor: pointer; font-family: inherit;
  transition: background 0.15s;
}
.herb-tab:hover { background: rgba(59,109,17,0.08); }
.herb-tab.is-active {
  background: rgba(255,250,240,0.7); border-color: rgba(139,92,20,0.35);
  color: #3a1a08; font-weight: bold;
}

/* Filters */
.herb-filters {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding: 8px; border: 1px solid rgba(139,92,20,0.2);
  border-radius: 0 6px 6px 6px; background: rgba(255,250,240,0.25);
  margin-bottom: 0.6rem;
}
.herb-search {
  flex: 1; min-width: 160px; padding: 5px 8px; font-size: 0.82rem;
  border: 1px solid rgba(139,92,20,0.3); border-radius: 5px;
  background: rgba(255,250,240,0.6); color: #3a1a08; font-family: inherit;
}
.herb-search:focus { outline: none; border-color: #3b6d11; }
.herb-select {
  padding: 5px 8px; font-size: 0.78rem; border-radius: 5px;
  border: 1px solid rgba(139,92,20,0.3);
  background: rgba(255,250,240,0.6); color: #3a1a08; font-family: inherit;
}
.herb-af-row {
  display: flex; align-items: center; gap: 6px;
}
.herb-af-label { font-size: 0.75rem; color: #6b5030; white-space: nowrap; }
.herb-af-slider {
  width: 80px; cursor: pointer; accent-color: #3b6d11;
}
.herb-af-reset {
  font-size: 0.75rem; width: 18px; height: 18px; border-radius: 50%;
  border: 1px solid rgba(139,92,20,0.3); background: transparent; color: #6b5030;
  cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0;
  line-height: 1;
}
.herb-af-reset:hover { background: rgba(163,45,45,0.1); color: #a32d2d; }

/* Count */
.herb-count { font-size: 0.72rem; color: #8b6914; margin-bottom: 0.4rem; }

/* Card grid */
.herb-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
}
.herb-empty { font-size: 0.8rem; color: #8b6914; font-style: italic; padding: 0.5rem; }

/* Herb card */
.herb-card {
  border: 1px solid rgba(59,109,17,0.2); border-left: 3px solid #3b6d11;
  border-radius: 6px; padding: 8px 10px;
  background: rgba(255,250,240,0.4);
  transition: background 0.15s, box-shadow 0.15s;
}
.herb-card:hover {
  background: rgba(255,250,240,0.85);
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.herb-card-poison {
  border-left-color: #a32d2d;
  border-color: rgba(163,45,45,0.2);
}

.herb-card-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px;
}
.herb-name { font-size: 0.85rem; font-weight: bold; color: #3a1a08; }
.herb-badges { display: flex; gap: 4px; align-items: center; }

.herb-af-badge {
  font-size: 0.62rem; font-weight: bold; padding: 1px 5px; border-radius: 8px;
  background: rgba(196,154,32,0.15); color: #7a5c14; border: 1px solid rgba(196,154,32,0.35);
}
.herb-poison-badge {
  font-size: 0.6rem; font-weight: bold; padding: 1px 5px; border-radius: 8px;
  background: rgba(163,45,45,0.12); color: #7a1111; border: 1px solid rgba(163,45,45,0.3);
}

.herb-meta {
  font-size: 0.65rem; color: #6b5030; font-style: italic; margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.herb-effect {
  font-size: 0.73rem; color: #4a3520; line-height: 1.45; margin-bottom: 5px;
}
.herb-footer {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  border-top: 1px solid rgba(139,92,20,0.1); padding-top: 4px;
  margin-top: 2px;
}
.herb-cost {
  font-size: 0.68rem; font-weight: bold; color: #c49a20;
}
.herb-difficulty {
  font-size: 0.65rem; color: #6b5030;
}
.herb-source {
  font-size: 0.6rem; color: #9ca3af; font-style: italic; margin-left: auto;
}

@media (max-width: 640px) {
  .herb-card-grid { grid-template-columns: 1fr; }
  .herb-filters { gap: 4px; }
}
