/* ── Moving Sale — Facebook theme ─────────────────────────────────────────── */
:root {
  --ink:        #1c1e21;
  --paper:      #f0f2f5;
  --mid:        #e4e6eb;
  --accent:     #1877f2;
  --accent-dim: #e7f0fd;
  --accent-dark:#0d6efd;
  --green:      #2a7a3b;
  --muted:      #65676b;
  --border:     #dadde1;
  --card:       #ffffff;
  --radius:     8px;
  --shadow:     0 1px 4px rgba(0,0,0,0.1);
  --shadow-lg:  0 4px 20px rgba(0,0,0,0.15);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── HEADER ───────────────────────────────────────────────────────────────── */
.site-header {
  background: var(--accent);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-family: 'DM Sans', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
}
.logo span { color: #e7f0fd; font-style: normal; font-weight: 300; }
.header-meta { font-size: 0.78rem; color: rgba(255,255,255,0.8); }

/* ── HERO ─────────────────────────────────────────────────────────────────── */
.hero {
  background: var(--accent);
  color: #ffffff;
  padding: 3rem 1.5rem 3rem;
  text-align: center;
}
.hero-inner { max-width: 680px; margin: 0 auto; }
.eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.75);
  margin-bottom: 0.85rem;
}
.hero h1 {
  font-family: 'DM Sans', sans-serif;
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 0.85rem;
  color: #ffffff;
}
.hero h1 em { font-style: normal; color: #e7f0fd; font-weight: 300; }
.hero-sub {
  font-size: 1rem;
  color: rgba(255,255,255,0.82);
  line-height: 1.65;
  margin-bottom: 2rem;
}
.stat-strip {
  display: inline-flex;
  gap: 0;
  background: rgba(0,0,0,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  overflow: hidden;
}
.stat {
  padding: 0.7rem 1.75rem;
  text-align: center;
  border-right: 1px solid rgba(255,255,255,0.15);
}
.stat:last-child { border-right: none; }
.stat strong { display: block; font-size: 1.15rem; font-weight: 700; color: #ffffff; }
.stat span   { font-size: 0.7rem; color: rgba(255,255,255,0.7); text-transform: uppercase; letter-spacing: 0.07em; }

/* ── CONTROLS ─────────────────────────────────────────────────────────────── */
.controls-bar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 56px;
  z-index: 40;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.controls-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}
.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.search-icon {
  position: absolute;
  left: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  color: var(--muted);
  pointer-events: none;
  line-height: 1;
}
.search-wrap input {
  width: 100%;
  padding: 0.55rem 0.9rem 0.55rem 2.4rem;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  background: var(--paper);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
}
.search-wrap input:focus { border-color: var(--accent); }

.filter-pills { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.pill {
  padding: 0.38rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.pill:hover  { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.pill.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

.results-meta { font-size: 0.78rem; color: var(--muted); margin-left: auto; }

/* ── GRID ─────────────────────────────────────────────────────────────────── */
.grid-wrap {
  max-width: 1200px;
  margin: 1.75rem auto 5rem;
  padding: 0 1.5rem;
}
.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1.1rem;
}
.loading-state, .empty-state, .error-state {
  grid-column: 1/-1;
  text-align: center;
  padding: 4rem 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ── CARD ─────────────────────────────────────────────────────────────────── */
.item-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.15s;
  position: relative;
  box-shadow: var(--shadow);
}
.item-card:hover  { box-shadow: var(--shadow-lg); }
.item-card:focus  { outline: 2px solid var(--accent); outline-offset: 2px; }
.item-card.sold   { opacity: 0.5; pointer-events: none; }
.item-card.featured { border-color: var(--accent); border-width: 2px; }

.featured-badge {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  background: var(--accent);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  z-index: 2;
}

.card-img {
  width: 100%;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--mid);
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}
.item-card:hover .card-img img { transform: scale(1.04); }
.card-emoji-placeholder { font-size: 3.5rem; }

.card-content { padding: 0.95rem 1rem 1.1rem; }
.card-cat {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.3rem;
}
.card-content h3 {
  font-family: 'DM Sans', sans-serif; font-weight: 700;
  font-size: 1rem;
  line-height: 1.25;
  margin-bottom: 0.35rem;
}
.card-desc {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 0.85rem;
}
.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.card-price {
  font-size: 1.15rem;
  font-weight: 600;
}
.obo {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--muted);
  margin-left: 0.2rem;
  vertical-align: middle;
}
.badge-sold {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: var(--mid);
  color: var(--muted);
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
}
.btn-want {
  padding: 0.42rem 0.9rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.btn-want:hover { background: var(--accent-dark); }

/* ── MODAL ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.52);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--card);
  border-radius: 14px;
  width: 100%;
  max-width: 500px;
  max-height: 92vh;
  overflow-y: auto;
  position: relative;
}
.modal-close {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  z-index: 2;
  background: var(--mid);
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--ink);
}
.modal-img-wrap {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--mid);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px 14px 0 0;
}
.modal-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.modal-emoji-placeholder { font-size: 4rem; }
.modal-body { padding: 1.5rem; }
.modal-cat  { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.35rem; }
.modal-body h2 { font-family: 'DM Sans', sans-serif; font-weight: 700; font-size: 1.5rem; margin-bottom: 0.35rem; }
.modal-price { font-size: 1.3rem; font-weight: 700; color: var(--accent); margin-bottom: 0.75rem; }
.modal-desc  { font-size: 0.88rem; color: var(--muted); line-height: 1.65; padding-bottom: 1.25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; }

.modal-form label { display: block; font-size: 0.78rem; font-weight: 600; margin-bottom: 0.3rem; }
.req { color: var(--accent); }
.modal-form input,
.modal-form textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  background: var(--paper);
  color: var(--ink);
  outline: none;
  margin-bottom: 0.9rem;
  transition: border-color 0.15s;
}
.modal-form input:focus,
.modal-form textarea:focus { border-color: var(--accent); }
.modal-form textarea { resize: vertical; }

.form-actions { display: flex; gap: 0.65rem; margin-top: 0.25rem; }
.btn-primary {
  flex: 1;
  padding: 0.7rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover    { background: var(--accent-dark); }
.btn-primary:disabled { background: #bcc4d0; cursor: default; }
.btn-ghost {
  padding: 0.7rem 1.1rem;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  color: var(--muted);
  cursor: pointer;
}
.payment-note {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.85rem;
  text-align: center;
}

/* ── TOAST ────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: var(--green);
  color: white;
  padding: 0.85rem 1.5rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 200;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ── FOOTER ───────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--paper);
  border-top: 1px solid var(--border);
  color: var(--muted);
  text-align: center;
  padding: 2rem 1.5rem;
  font-size: 0.82rem;
  line-height: 2;
}

/* ── ADMIN SHARED ─────────────────────────────────────────────────────────── */
.admin-wrap   { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; }
.admin-header { background: var(--accent); color: #fff; padding: 0 1.5rem; height: 56px; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.admin-header .logo { font-family: 'DM Sans', sans-serif; font-size: 1.1rem; font-weight: 700; color: #fff; }
.admin-header .logo span { color: var(--accent); }
.admin-nav a  { color: rgba(255,255,255,0.8); text-decoration: none; font-size: 0.85rem; margin-left: 1.5rem; transition: color 0.15s; }
.admin-nav a:hover { color: #fff; }
.admin-nav a.active { color: #fff; font-weight: 600; text-decoration: underline; }

.page-title   { font-family: 'DM Sans', sans-serif; font-weight: 700; font-size: 1.8rem; margin-bottom: 1.5rem; }

.stat-cards   { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card    { background: var(--card); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.5rem; }
.stat-card strong { display: block; font-size: 2rem; font-weight: 600; line-height: 1; }
.stat-card span   { font-size: 0.8rem; color: var(--muted); }

.table-wrap   { background: var(--card); border: 1.5px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table         { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th            { background: var(--paper); font-weight: 600; font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 0.75rem 1rem; text-align: left; border-bottom: 1.5px solid var(--border); }
td            { padding: 0.75rem 1rem; border-bottom: 1px solid var(--mid); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td   { background: var(--paper); }

.badge-cat    { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 12px; font-size: 0.7rem; font-weight: 600; background: var(--mid); color: var(--muted); }
.badge-sold-sm { background: #fee; color: #a00; border-radius: 12px; padding: 0.15rem 0.55rem; font-size: 0.7rem; font-weight: 600; }
.badge-avail  { background: #efe; color: #2a5c45; border-radius: 12px; padding: 0.15rem 0.55rem; font-size: 0.7rem; font-weight: 600; }

.btn-sm       { padding: 0.3rem 0.7rem; border-radius: 6px; font-size: 0.78rem; font-weight: 600; cursor: pointer; border: 1.5px solid transparent; transition: all 0.15s; font-family: 'DM Sans', sans-serif; }
.btn-edit     { background: var(--paper); border-color: var(--border); color: var(--ink); }
.btn-edit:hover { border-color: var(--accent); }
.btn-del      { background: #fee; border-color: #fcc; color: #900; }
.btn-del:hover { background: #900; color: white; }
.btn-sold     { background: var(--green); color: white; border-color: var(--green); }
.btn-avail    { background: var(--mid); color: var(--ink); border-color: var(--border); }

/* Admin form */
.form-grid    { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group   { display: flex; flex-direction: column; gap: 0.35rem; }
.form-group.full { grid-column: 1/-1; }
.form-group label { font-size: 0.8rem; font-weight: 600; }
.form-group input, .form-group select, .form-group textarea {
  padding: 0.6rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  background: var(--paper);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--accent); }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-actions-bar { display: flex; gap: 0.75rem; margin-top: 1.5rem; }

.modal-overlay.admin-modal { z-index: 200; }
.modal-box.admin-box { max-width: 620px; padding: 2rem; }
.modal-box.admin-box h2 { font-family: 'DM Sans', sans-serif; font-weight: 700; font-size: 1.4rem; margin-bottom: 1.5rem; }

.img-preview { width: 120px; height: 90px; object-fit: cover; border-radius: 6px; border: 1.5px solid var(--border); display: none; margin-top: 0.5rem; }
.img-preview.show { display: block; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .stat-strip  { flex-direction: column; gap: 0; }
  .stat        { border-right: none; border-bottom: 1px solid rgba(255,255,255,0.08); }
  .stat:last-child { border-bottom: none; }
  .controls-inner { flex-direction: column; align-items: stretch; }
  .results-meta { margin-left: 0; }
  .form-grid   { grid-template-columns: 1fr; }
  .admin-nav a { margin-left: 0.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  .item-card, .toast, .card-img img { transition: none; }
}
