/*
 * Copyright (C) 2026 Yzapre
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

/* ── Search bar, embedded per panel/table ───────────────── */
.section-search-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.section-search-input {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.83rem;
  padding: 0.4rem 0.65rem;
  transition: border-color 0.1s;
}
.section-search-input:focus { outline: none; border-color: var(--muted); }
.section-search-input::placeholder { color: var(--muted); }
.section-search-count {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}
.section-search-clear {
  flex-shrink: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1;
  padding: 0.4rem 0.55rem;
  font-family: inherit;
  transition: background 0.1s, color 0.1s;
}
.section-search-clear:hover { background: var(--border); color: var(--text); }

/* ── Table scroll wrappers (bottom scroller + mirrored top bar) ── */
.table-scroll {
  overflow-x: auto;
}
.table-scroll::-webkit-scrollbar { height: 8px; }
.table-scroll::-webkit-scrollbar-track { background: transparent; }
.table-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.table-scroll-top {
  overflow-x: auto;
  overflow-y: hidden;
  height: 13px;
  margin: 0 0 2px;
}
.table-scroll-top.no-overflow {
  height: 0;
  margin: 0;
  overflow: hidden;
}
.table-scroll-top-spacer { height: 1px; }
.table-scroll-top::-webkit-scrollbar { height: 8px; }
.table-scroll-top::-webkit-scrollbar-track { background: transparent; }
.table-scroll-top::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ── Base ore table ───────────────────────────────────────
   Pages can still set a min-width on .ore-table (per column
   count) in their own stylesheet, this just supplies the
   shared visual language, identical to inventory.css. */
.ore-table {
  width: 100%;
  min-width: 640px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.85rem;
}
.ore-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 0.4rem 0.6rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.ore-table thead th.th-center { text-align: center; }
.ore-table tbody tr:hover { background: rgba(255,255,255,0.025); }
[data-theme="light"] .ore-table tbody tr:hover { background: rgba(0,0,0,0.03); }
.ore-table td {
  padding: 0.3rem 0.6rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}
.ore-table tbody tr:last-child td { border-bottom: none; }

/* Freeze the first (ore name) column while horizontally scrolling. */
.ore-table td:first-child,
.ore-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--panel);
  width: 1%;
  white-space: nowrap;
}
.ore-table thead th:first-child { z-index: 4; }

/* ── Ore name button (icon + label chip) ─────────────────── */
.ore-name-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  width: 170px;
  height: 40px;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.3rem 0.55rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-family: 'Source Sans 3', 'Source Sans Pro', system-ui, sans-serif;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
}
.ore-name-btn .ore-name-text { overflow: hidden; text-overflow: ellipsis; }

.ore-icon-box {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ore-icon {
  width: auto;
  height: auto;
  max-width: 30px;
  max-height: 30px;
  image-rendering: pixelated;
}

/* ── Sortable headers ─────────────────────────────────────── */
.sortable-th {
  cursor: pointer;
  user-select: none;
  transition: color 0.1s ease;
}
.sortable-th:hover { color: var(--text); }
.sort-icon {
  display: inline-block;
  margin-left: 0.25rem;
  font-size: 0.75rem;
  opacity: 0.4;
  transition: opacity 0.1s ease;
}
.sortable-th:hover .sort-icon { opacity: 0.8; }
.sortable-th.active-sort { color: var(--text); font-weight: bold; }
.sortable-th.active-sort .sort-icon { opacity: 1; }

/* ── Generic cell alignment / tone helpers ───────────────── */
.td-center {
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.td-muted { color: var(--muted); }

.table-empty {
  padding: 0.9rem 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.std-panel.compact .ore-name-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  gap: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.std-panel.compact .ore-name-btn .ore-name-text {
  display: none;
}
