/* ============================================================
   eBay Listing Assistant — Design System
   Palette: graphite/charcoal surfaces with a brass appraisal-tag
   accent. Signature element: the "ticket" card — every item is
   rendered like a pricing tag/appraisal ticket, with a perforated
   edge and a rotated price chip, tying the UI to its domain
   (valuing and listing secondhand goods) instead of a generic
   dashboard-card look.
   Type: Space Grotesk (display/numerals — geometric, tag-like),
   Inter (UI/body), IBM Plex Mono (SKUs, prices, timestamps).
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  /* Surfaces */
  --bg: #101216;
  --surface: #1a1d24;
  --surface-raised: #21252e;
  --surface-hover: #262b35;
  --border: #2c313c;
  --border-soft: #22262f;

  /* Text */
  --text-primary: #edeef2;
  --text-secondary: #9aa1b0;
  --text-tertiary: #656c7a;

  /* Accent — brass appraisal-tag gold */
  --accent: #d9a544;
  --accent-hover: #e6b75c;
  --accent-dim: rgba(217, 165, 68, 0.14);
  --accent-text: #1a1508;

  /* Semantic */
  --success: #4fa672;
  --success-dim: rgba(79, 166, 114, 0.14);
  --danger: #e5586080;
  --danger-solid: #e55860;
  --danger-dim: rgba(229, 88, 96, 0.14);
  --warning: #e0a53e;

  /* Radius / motion */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);

  /* Type */
  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: inherit; }
button { font-family: inherit; }

::selection { background: var(--accent-dim); color: var(--accent-hover); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---------- Layout shell ---------- */
#app { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  padding: 20px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 22px;
}
.brand-mark {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: linear-gradient(155deg, var(--accent), #a97a2e);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; color: var(--accent-text);
  font-size: 14px;
  transform: rotate(-4deg);
}
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 15px; }
.brand-name span { color: var(--text-tertiary); font-weight: 500; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px; font-weight: 500;
  cursor: pointer; border: none; background: none; width: 100%; text-align: left;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.nav-item:hover { background: var(--surface-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent-dim); color: var(--accent-hover); }
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-divider { height: 1px; background: var(--border-soft); margin: 10px 4px; }

.main {
  flex: 1;
  min-width: 0;
  padding: 28px 32px 80px;
  max-width: 1180px;
}

.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 22px; gap: 16px; flex-wrap: wrap;
}
.page-title { font-size: 22px; }
.page-subtitle { color: var(--text-secondary); font-size: 13.5px; margin-top: 4px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.1s var(--ease), background 0.15s var(--ease), border-color 0.15s var(--ease);
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface-raised); color: var(--text-primary); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-hover); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text-primary); }
.btn-danger { background: var(--danger-dim); color: var(--danger-solid); }
.btn-danger:hover { background: var(--danger-solid); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-lg { padding: 13px 22px; font-size: 14.5px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-icon { padding: 8px; }

/* ---------- Cards / Ticket motif ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 20px;
}

/* The signature element: a ticket-stub item card with a perforated
   edge (radial-gradient notches) between the image and the details,
   echoing a physical price/appraisal tag. */
.ticket {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  overflow: visible;
  position: relative;
  transition: border-color 0.15s var(--ease), transform 0.15s var(--ease);
}
.ticket:hover { border-color: #3a4150; }
.ticket-image {
  width: 108px; flex-shrink: 0;
  background: var(--surface-raised);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  overflow: hidden;
  position: relative;
}
.ticket-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ticket-perf {
  width: 0;
  position: relative;
  border-left: 1px dashed var(--border);
}
.ticket-perf::before, .ticket-perf::after {
  content: ''; position: absolute; left: -7px;
  width: 14px; height: 14px; border-radius: 50%; background: var(--bg);
}
.ticket-perf::before { top: -7px; }
.ticket-perf::after { bottom: -7px; }
.ticket-body { flex: 1; padding: 14px 16px; min-width: 0; }
.ticket-price {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 15px;
  color: var(--accent-hover);
  background: var(--accent-dim);
  padding: 3px 9px;
  border-radius: 20px;
  display: inline-block;
  transform: rotate(-1.5deg);
}

/* ---------- Forms ---------- */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
input, select, textarea {
  width: 100%;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 10px 12px;
  font-size: 13.5px;
  font-family: inherit;
  transition: border-color 0.15s var(--ease);
}
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }
input::placeholder, textarea::placeholder { color: var(--text-tertiary); }
.field { margin-bottom: 14px; }
.field-row { display: flex; gap: 12px; }
.field-row > .field { flex: 1; }
.hint { font-size: 11.5px; color: var(--text-tertiary); margin-top: 5px; }

/* ---------- Badges / chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em;
}
.badge-draft { background: var(--surface-raised); color: var(--text-secondary); }
.badge-published { background: var(--success-dim); color: var(--success); }
.badge-review { background: var(--warning-dim, rgba(224,165,62,0.14)); color: var(--warning); }

/* ---------- Grid / stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat-card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-lg); padding: 16px 18px; }
.stat-label { font-size: 11.5px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.stat-value { font-family: var(--font-display); font-size: 24px; margin-top: 6px; }

/* ---------- Empty states ---------- */
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--text-secondary);
  border: 1px dashed var(--border); border-radius: var(--radius-lg);
}
.empty-state h3 { color: var(--text-primary); margin-bottom: 6px; font-size: 16px; }
.empty-state p { font-size: 13.5px; max-width: 340px; margin: 0 auto; }

/* ---------- Dropzone ---------- */
.dropzone {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.dropzone:hover, .dropzone.drag-over { border-color: var(--accent); background: var(--accent-dim); }
.dropzone svg { width: 30px; height: 30px; color: var(--text-tertiary); margin-bottom: 10px; }

/* ---------- Toast ---------- */
.toast-stack { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 999; }
.toast {
  background: var(--surface-raised); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 12px 16px; font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: toast-in 0.2s var(--ease);
  max-width: 320px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger-solid); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Loading ---------- */
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.2); border-top-color: currentColor;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface-raised) 25%, var(--surface-hover) 37%, var(--surface-raised) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- Utility ---------- */
.flex { display: flex; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.mono { font-family: var(--font-mono); }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }

/* ---------- Mobile ---------- */
.mobile-topbar { display: none; }
@media (max-width: 860px) {
  #app { flex-direction: column; }
  .sidebar {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto; height: auto;
    width: 100%; flex-direction: row; padding: 6px 8px; z-index: 100;
    border-right: none; border-top: 1px solid var(--border-soft);
    padding-bottom: max(6px, env(safe-area-inset-bottom));
  }
  .brand { display: none; }
  .nav { flex-direction: row; justify-content: space-around; }
  .nav-item { flex-direction: column; gap: 3px; font-size: 10px; padding: 6px 8px; }
  .nav-item svg { width: 20px; height: 20px; }
  .nav-divider { display: none; }
  .main { padding: 16px 16px 90px; max-width: 100%; }
  .mobile-topbar {
    display: flex; align-items: center; gap: 10px; padding: 4px 0 18px; position: sticky; top: 0;
  }
  .ticket { flex-direction: row; }
  .grid-cards { grid-template-columns: 1fr; }
}
