/* Dark theme echoing the desktop app: #1a1a1a bg, Consolas, green/orange. */
:root {
  --bg: #1a1a1a;
  --panel: #2a2a2a;
  --fg: #cccccc;
  --muted: #888888;
  --green: #00ff66;
  --orange: #ff9900;
  --blue: #5fafff;
  --border: #3a3a3a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 14px;
  line-height: 1.45;
  padding-bottom: 44px;   /* clear the fixed status bar */
}

header {
  padding: 18px 22px 10px;
  border-bottom: 1px solid var(--border);
}

h1 { margin: 0; font-size: 22px; color: var(--green); }
h1 .tag {
  font-size: 12px;
  color: var(--bg);
  background: var(--orange);
  padding: 2px 8px;
  border-radius: 4px;
  vertical-align: middle;
}
.sub { margin: 6px 0 0; color: var(--muted); max-width: 760px; }
.sub a { color: var(--blue); }

/* header info strip — DB size, live krono rate + sync, feedback, help */
.topbar { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; font-size: 12px; }
.topbar .sep { color: var(--border); }
.topbar a { color: var(--blue); }
.topbar button { padding: 3px 10px; font-size: 12px; }
/* Ko-fi: a small outlined button — present, not pushy. Fills in on hover. */
.topbar a.kofi { border: 1px solid #ff7a85; color: #ff9aa2; padding: 2px 9px;
  border-radius: 4px; white-space: nowrap; }
.topbar a.kofi:hover { background: #ff7a85; color: #1a1a1a; text-decoration: none; }
.topbar-right { margin-left: auto; display: flex; gap: 12px; align-items: center; }
#dbCount, #kronoInfo { color: var(--muted); }

main {
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 1100px;
}

/* lookup bar above the panes (market check for any item) */
.lookup-bar { padding-bottom: 10px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.lookup-bar label { color: var(--fg); }
#lookupInput { width: 14em; }

/* two-pane: inventory (left) -> auction list (right) */
.panes { display: flex; gap: 16px; align-items: flex-start; }
.pane { flex: 1 1 0; min-width: 0; }
.pane-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.pane-head strong { color: var(--fg); }

/* tidy control inputs so the two panes' toolbars sit evenly */
#invSearch { width: 11em; }
@media (max-width: 820px) { .panes { flex-direction: column; } }

/* selectable rows */
tbody tr { cursor: pointer; }
tbody tr.sel { background: #14361f; }
tbody tr.sel:hover { background: #1a4a2a; }

/* auction row coloring (priority krono > vendor-trash > diverge), on the name cell */
tbody tr.krono   td:first-child { color: #cc99ff; }   /* krono-priced */
tbody tr.vendor  td:first-child { color: var(--orange); } /* worth more to a vendor */
tbody tr.diverge td:first-child { color: #ffd24d; }   /* recent asks running lower */

.legend { font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend .krono { color: #cc99ff; }
.legend .vendor { color: var(--orange); }
.legend .diverge { color: #ffd24d; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px;
}
.card h2 { margin: 0 0 10px; font-size: 15px; color: var(--blue); }

.field { margin: 8px 0; }
.field label { display: block; margin-bottom: 4px; color: var(--fg); }
.field.inline { margin: 0; }
.field.inline label { display: inline-block; margin: 0 6px 0 0; }

.hint { color: var(--muted); font-size: 12px; }

code {
  background: #111;
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--orange);
}

input[type="text"], input[type="number"], textarea {
  background: #111;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 13px;
  padding: 6px 8px;
}
input[type="number"] { width: 70px; }
textarea { width: 100%; resize: vertical; }

button {
  background: #333;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 13px;
  padding: 7px 11px;
  cursor: pointer;
}
button:hover:not(:disabled) { background: #444; border-color: var(--green); }
button:disabled { opacity: 0.4; cursor: not-allowed; }

/* modal overlay (web equivalent of the desktop's pop-up windows) */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-backdrop[hidden] { display: none; }
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: 6px; width: 760px; max-width: 94vw; max-height: 88vh; display: flex; flex-direction: column; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.modal-head strong { color: var(--green); }
.modal-head button { padding: 2px 9px; }
.modal-body { padding: 12px 14px; overflow: auto; }
.hint-line { margin: 0 0 8px; font-weight: bold; }
.postings { background: #111; border: 1px solid var(--border); border-radius: 4px; padding: 8px 10px; white-space: pre; overflow: auto; max-height: 320px; font-size: 12px; color: var(--fg); }
.picker { max-height: 60vh; overflow: auto; }
.picker-row { padding: 6px 8px; border-bottom: 1px solid var(--border); cursor: pointer; }
.picker-row:hover { background: #333; color: var(--green); }

/* fixed status bar — always-visible latest action + Log access (IDE-style) */
#statusbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  padding: 6px 14px; background: #222; border-top: 1px solid var(--border);
}
#statusMsg { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; }
#statusMsg.ok { color: var(--green); }
#statusMsg.err { color: #ff6666; }
#statusbar button { padding: 4px 12px; }

.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }

.table-wrap { max-height: 360px; overflow: auto; border: 1px solid var(--border); border-radius: 4px; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th, td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--border); }
th { position: sticky; top: 0; background: #222; color: var(--muted); font-weight: normal; cursor: pointer; user-select: none; }
th:hover { color: var(--fg); }
td.empty { color: var(--muted); text-align: center; padding: 18px; }
td input[type="text"] { width: 100%; padding: 3px 6px; }
.qty { color: var(--muted); }

/* column sizing (table-layout: fixed — Item flexes, the rest are sized) */
#invTable th:nth-child(2), #invTable td:nth-child(2),
#aucTable th:nth-child(2), #aucTable td:nth-child(2) { width: 3.5em; text-align: right; }   /* Qty */
#invTable th:nth-child(3), #invTable td:nth-child(3) { width: 11em; }                        /* Location */
#aucTable th:nth-child(3), #aucTable td:nth-child(3) { width: 7em; }                         /* Price */
#aucTable th:nth-child(4), #aucTable td:nth-child(4) { width: 4.8em; text-align: right; }    /* Vendor */
/* item name: ellipsis instead of wrapping or shoving the other columns around */
#invTable td:nth-child(1), #aucTable td:nth-child(1) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

pre#log {
  background: #111;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px;
  margin: 0;
  max-height: 200px;
  overflow: auto;
  white-space: pre-wrap;
  color: var(--muted);
  font-size: 12px;
}
.log-card h2 { color: var(--muted); }
