/* eBay Listing Assistant — mobile queue UI
   Material Design 3, dark theme: tonal elevated surfaces (no hairline
   borders separating cards — elevation does that job instead), a single
   type family (Roboto, Material's own) at varying weights, filled/pill
   buttons for primary actions, tonal containers for chips and states. */

@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;600;700&display=swap');

:root {
  /* Surface elevation ramp — each step lighter, standing in for Material's
     tonal-overlay-at-elevation system without needing real box-shadow blur
     stacks (kept a couple of true shadows for actually-raised elements). */
  --bg: #121212;
  --surface-1: #1E1E1E;
  --surface-2: #262626;
  --surface-3: #2F2F2F;

  --on-surface: #E6E1E5;
  --on-surface-var: #9C9995;

  --primary: #E8B84B;
  --on-primary: #3A2E00;
  --primary-container: #4A3B12;
  --on-primary-container: #FFDF9C;

  --error: #F2B8B5;
  --on-error: #601410;
  --error-container: #3D1613;
  --on-error-container: #F2B8B5;

  --success: #B7CDA0;
  --on-success-container: #B7CDA0;
  --success-container: #232D19;

  --outline: #3A3835;

  --elevation-1: 0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
  --elevation-2: 0 3px 6px rgba(0,0,0,.4), 0 2px 4px rgba(0,0,0,.3);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 20px 16px 48px;
  background: var(--bg);
  color: var(--on-surface);
  font-family: 'Roboto', -apple-system, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  max-width: 560px;
  margin-inline: auto;
}
/* Forms (edit/settings/login) stay narrow at any viewport width — a
   single-column form stretched wide just looks like empty space with long
   input fields. Only the queue page (queue-page below) widens, because it
   has something worth spreading out: a grid of cards. */
body.queue-page { max-width: 900px; }
@media (min-width: 960px) {
  body.queue-page { max-width: 1180px; }
}

h1, h2 {
  font-family: 'Roboto', sans-serif;
  font-weight: 500;
  margin: 0;
}
h1 { font-size: 24px; }
h2 { font-size: 20px; }

a { color: inherit; }

/* ── Top bar & stat chips ─────────────────────────────────────────────── */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.topbar-nav { display: flex; gap: 18px; }
.topbar-nav a {
  font-weight: 500;
  font-size: 14px;
  color: var(--on-surface-var);
  text-decoration: none;
}
.topbar-nav a:hover { color: var(--primary); }
.back-link {
  display: inline-block;
  font-weight: 500;
  font-size: 14px;
  color: var(--on-surface-var);
  text-decoration: none;
  margin-bottom: 12px;
}
.back-link:hover { color: var(--primary); }

.stats { display: flex; gap: 8px; margin: 12px 0 20px; flex-wrap: wrap; }
.chip {
  font-weight: 500;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--on-surface-var);
}
.chip strong { color: var(--on-surface); font-weight: 700; }
.chip--on { background: var(--success-container); color: var(--on-success-container); }
.chip--off { background: var(--error-container); color: var(--on-error-container); }

.sort-toggle {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  background: var(--surface-1);
  border-radius: 24px;
  padding: 4px;
  width: fit-content;
}
.sort-toggle a {
  font-weight: 500;
  font-size: 13px;
  color: var(--on-surface-var);
  text-decoration: none;
  padding: 7px 16px;
  border-radius: 20px;
}
.sort-toggle a.is-active { color: var(--on-primary); background: var(--primary); }

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0 24px;
  flex-wrap: wrap;
  gap: 8px;
}
.pagination-links { display: flex; gap: 8px; }

/* ── Bulk select ───────────────────────────────────────────────────────── */

.bulk-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.bulk-select-all {
  font-weight: 500;
  font-size: 13.5px;
  color: var(--on-surface-var);
  display: flex;
  align-items: center;
  gap: 8px;
}
.bulk-actions { display: flex; align-items: center; gap: 8px; }

/* ── Cards ─────────────────────────────────────────────────────────────── */

/* Single column on phone; more columns as the viewport grows — this is
   what actually fixes "too much empty space," not just widening the page.
   Gap handles spacing, so .card's own margin-bottom is dropped below. */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
@media (min-width: 680px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
  .card-grid { grid-template-columns: repeat(3, 1fr); }
}

.card {
  background: var(--surface-1);
  border-radius: 16px;
  box-shadow: var(--elevation-1);
  padding: 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.card .card-select { margin-top: 4px; }
.card.is-skipped { opacity: 0.55; box-shadow: none; }
.card.is-failed { background: var(--error-container); }

.card img {
  width: 68px;
  height: 68px;
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
  background: var(--surface-3);
}
.card-body { flex: 1; min-width: 0; }
.card-title {
  font-weight: 500;
  font-size: 14.5px;
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.title-input {
  display: block;
  width: 100%;
  resize: none;
  overflow: hidden;
  padding: 3px 5px;
  margin: -3px -5px 3px;
  font-weight: 500;
  font-size: 14.5px;
  font-family: 'Roboto', sans-serif;
  color: var(--on-surface);
  background: transparent;
  border-radius: 6px;
  line-height: 1.35;
}
.title-input:hover, .title-input:focus { background: var(--surface-2); }
.title-input.saved-flash { background: var(--success-container); color: var(--on-success-container); }
.card-meta { font-size: 12.5px; color: var(--on-surface-var); line-height: 1.6; }
.price-input {
  width: 52px;
  padding: 2px 4px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: 'Roboto', sans-serif;
  color: var(--primary);
  background: transparent;
  border-radius: 6px;
  outline: none;
}
.price-input:hover, .price-input:focus { background: var(--surface-2); }
.price-input.saved-flash { background: var(--success-container); color: var(--on-success-container); }
.card-meta .cat-repeat { color: var(--error); }

/* ── Buttons ───────────────────────────────────────────────────────────── */

.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }

button, .btn {
  font-family: 'Roboto', sans-serif;
  font-weight: 500;
  font-size: 13.5px;
  border-radius: 20px;
  border: none;
  padding: 8px 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  line-height: 1.2;
  transition: filter .15s ease;
}
button:hover, .btn:hover { filter: brightness(1.12); }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:disabled { background: var(--surface-3); color: var(--on-surface-var); cursor: default; filter: none; }
.btn-ghost { background: var(--surface-2); color: var(--on-surface); }
.btn-danger { background: transparent; color: var(--error); box-shadow: inset 0 0 0 1px var(--outline); }
.btn-danger:hover { background: var(--error-container); filter: none; }
.btn-icon { padding: 8px 10px; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }

/* ── Error box ─────────────────────────────────────────────────────────── */

.err-box { margin-top: 10px; }
.err-box textarea {
  width: 100%;
  box-sizing: border-box;
  background: var(--surface-3);
  color: var(--on-error-container);
  border: none;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 11.5px;
  font-family: ui-monospace, monospace;
  resize: vertical;
  min-height: 46px;
  user-select: all;
}
.err-box .btn { margin-top: 6px; }

/* ── Empty / section states ───────────────────────────────────────────── */

.empty {
  color: var(--on-surface-var);
  text-align: center;
  padding: 48px 0;
  font-size: 15px;
}
.section-label {
  font-weight: 500;
  font-size: 13px;
  color: var(--on-surface-var);
  margin: 28px 0 10px;
}

/* ── Forms (edit / settings / login) ──────────────────────────────────── */

.field { display: block; margin-top: 16px; }
.field label, .checkbox-row label {
  display: block;
  font-weight: 500;
  font-size: 12.5px;
  color: var(--on-surface-var);
  margin-bottom: 5px;
}
input, textarea, select {
  width: 100%;
  box-sizing: border-box;
  background: var(--surface-2);
  color: var(--on-surface);
  border: none;
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 14.5px;
  font-family: 'Roboto', sans-serif;
}
/* Checkboxes don't want any of the text-input styling above — reset to a
   normal small checkbox regardless of where one appears. */
input[type="checkbox"] {
  width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 4px;
  background: var(--surface-3);
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
textarea { min-height: 80px; font-family: ui-monospace, monospace; font-size: 13px; }
/* flex-wrap: rows with more than 2 fields (e.g. the package dimensions
   L/W/H/weight rows) need to drop to 2-per-line on phone width rather than
   squeezing 4 inputs into ~360px. */
.field-row { display: flex; gap: 10px; flex-wrap: wrap; }
.field-row .field { flex: 1 1 120px; margin-top: 16px; }
.hint { color: var(--on-surface-var); font-size: 11.5px; margin-top: 5px; line-height: 1.5; }
.checkbox-row { display: flex; align-items: center; gap: 10px; margin-top: 18px; }
.checkbox-row label { margin: 0; font-weight: 400; font-size: 14.5px; color: var(--on-surface); }
.saved-msg { color: var(--success); font-size: 13px; margin-top: 10px; font-weight: 500; }
form .btn-primary { margin-top: 24px; padding: 11px 22px; font-size: 15px; }

/* ── Photo reorder strip (edit page) ──────────────────────────────────── */
/* Same ◀/▶-per-thumbnail convention as the desktop app's ListingGroup mini
   strip (2026-09-13) — order matters because the first photo becomes the
   primary/gallery photo on the published eBay listing. */
.photo-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px;
}
.photo-cell {
  flex-shrink: 0;
  width: 72px;
  text-align: center;
}
.photo-cell img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  background: var(--surface-3);
  display: block;
}
.photo-nav {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 4px;
}
.photo-move {
  padding: 3px 7px;
  font-size: 11px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--on-surface);
}

/* ── Searchable Category combobox (edit page) ─────────────────────────── */
/* Click/focus browses the full category list, typing filters it — same
   pattern as the desktop app's CategoryPicker widget (2026-09-10). */
.cat-picker { position: relative; }
.cat-dropdown {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  background: var(--surface-2);
  border-radius: 10px;
  box-shadow: var(--elevation-2);
  padding: 4px;
}
.cat-option {
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13.5px;
  cursor: pointer;
  color: var(--on-surface);
}
.cat-option:hover, .cat-option.is-active { background: var(--surface-3); }
.cat-option.is-selected { color: var(--primary); font-weight: 600; }

/* ── Login ─────────────────────────────────────────────────────────────── */

.login-card {
  max-width: 300px;
  margin: 90px auto;
  text-align: center;
}
.login-card h1 { margin-bottom: 24px; }
.login-card form { text-align: left; }
.login-error { color: var(--error); font-size: 13px; margin-top: 10px; }
