:root {
  --emerald-50: #ecfdf5;
  --emerald-100: #d1fae5;
  --emerald-400: #34d399;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-700: #047857;
  --violet-500: #8b5cf6;
  --violet-600: #7c3aed;
  --amber-400: #fbbf24;
  --ink-900: #0f172a;
  --ink-700: #334155;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-700: #334155;
  --white: #ffffff;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 10px 28px rgba(15, 23, 42, 0.12);
  --max-width: 1200px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink-900);
  background: var(--gray-50);
  line-height: 1.5;
}
img { max-width: 100%; display: block; }
a { color: var(--emerald-600); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 12px; color: var(--ink-900); }
p { margin: 0 0 14px; color: var(--gray-700); }
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  text-decoration: none !important;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn-primary {
  background: linear-gradient(135deg, var(--emerald-500), var(--emerald-600));
  color: var(--white);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary {
  background: var(--white);
  color: var(--ink-900);
  border: 1px solid var(--gray-200);
}
.btn-secondary:hover { border-color: var(--emerald-500); color: var(--emerald-600); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-danger { background: var(--white); color: #b91c1c; border: 1px solid #fecaca; }
.btn-danger:hover { background: #fef2f2; }

/* ---------- Header ---------- */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 76px;
}
.logo-link { display: flex; align-items: center; }
.logo-img { height: 40px; width: auto; }
.main-nav { display: flex; align-items: center; gap: 22px; }
.main-nav a.nav-link { color: var(--ink-700); font-weight: 600; font-size: 0.94rem; }
.main-nav a.nav-link:hover { color: var(--emerald-600); text-decoration: none; }
.header-actions { display: flex; align-items: center; gap: 14px; }
.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 8px; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--ink-900); margin: 4px 0; border-radius: 2px; }

/* ---------- Hero / Search ---------- */
.hero {
  background: linear-gradient(160deg, var(--emerald-700) 0%, var(--emerald-600) 45%, var(--violet-600) 130%);
  color: var(--white);
  padding: 64px 0 56px;
}
.hero h1 { color: var(--white); font-size: 2.4rem; margin-bottom: 10px; }
.hero p.hero-sub { color: #d7f5e8; font-size: 1.08rem; max-width: 620px; margin-bottom: 30px; }
.search-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-md);
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
}
.search-card input, .search-card select {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
  font-size: 0.95rem;
  font-family: var(--font);
  color: var(--ink-900);
}
.search-card button { white-space: nowrap; }
.hero-tags { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 10px; }
.hero-tags a {
  background: rgba(255,255,255,0.14);
  color: var(--white);
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}
.hero-tags a:hover { background: rgba(255,255,255,0.24); text-decoration: none; }

/* ---------- Category tiles ---------- */
.section { padding: 56px 0; }
.section-head { margin-bottom: 30px; }
.section-head h2 { font-size: 1.6rem; }
.section-head p { color: var(--gray-500); }
.cat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
.cat-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 22px;
  text-align: left;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.cat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); text-decoration: none; }
.cat-card .cat-icon {
  width: 44px; height: 44px; border-radius: 10px;
  background: linear-gradient(135deg, var(--emerald-400), var(--violet-500));
  display: flex; align-items: center; justify-content: center;
  color: var(--white); margin-bottom: 14px; font-size: 1.3rem;
}
.cat-card h3 { font-size: 1.02rem; margin-bottom: 4px; color: var(--ink-900); }
.cat-card span.cat-type { font-size: 0.78rem; color: var(--gray-400); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }

/* ---------- Listings grid ---------- */
.listing-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.listing-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  display: flex;
  flex-direction: column;
}
.listing-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); text-decoration: none; }
.listing-thumb {
  width: 100%;
  height: 170px;
  object-fit: cover;
  background: var(--gray-100);
}
.listing-card-body { padding: 16px 18px 18px; flex: 1; display: flex; flex-direction: column; }
.listing-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
  width: fit-content;
}
.badge-goods { background: var(--emerald-100); color: var(--emerald-700); }
.badge-service { background: #ede9fe; color: var(--violet-600); }
.badge-free { background: var(--amber-400); color: #713f12; }
.listing-card h3 { font-size: 1rem; margin-bottom: 6px; color: var(--ink-900); }
.listing-price { font-weight: 800; font-size: 1.05rem; color: var(--emerald-700); margin-bottom: 6px; }
.listing-location { font-size: 0.82rem; color: var(--gray-500); margin-top: auto; }

/* ---------- Forms ---------- */
.form-page { max-width: 640px; margin: 0 auto; }
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-sm);
}
.form-row { margin-bottom: 18px; }
.form-row label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; color: var(--ink-900); }
.form-row .hint { font-size: 0.8rem; color: var(--gray-500); margin-top: 4px; }
.form-row input[type="text"],
.form-row input[type="email"],
.form-row input[type="password"],
.form-row input[type="tel"],
.form-row input[type="number"],
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
  font-size: 0.95rem;
  font-family: var(--font);
  color: var(--ink-900);
  background: var(--white);
}
.form-row textarea { resize: vertical; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.type-toggle { display: flex; gap: 12px; margin-bottom: 22px; }
.type-toggle label {
  flex: 1;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  font-weight: 700;
  color: var(--gray-500);
}
.type-toggle input { display: none; }
.type-toggle input:checked + span { color: var(--emerald-600); }
.type-toggle label:has(input:checked) { border-color: var(--emerald-500); background: var(--emerald-50); }
.alert { padding: 14px 18px; border-radius: var(--radius-sm); margin-bottom: 20px; font-size: 0.92rem; }
.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-success { background: var(--emerald-50); color: var(--emerald-700); border: 1px solid var(--emerald-100); }

/* ---------- Listing detail ---------- */
.listing-detail { display: grid; grid-template-columns: 1.5fr 1fr; gap: 40px; align-items: start; }
.detail-gallery img { border-radius: var(--radius); width: 100%; height: 380px; object-fit: cover; margin-bottom: 10px; }
.detail-thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-thumbs img { width: 76px; height: 76px; object-fit: cover; border-radius: 8px; cursor: pointer; border: 2px solid transparent; }
.detail-thumbs img.active { border-color: var(--emerald-500); }
.detail-meta h1 { font-size: 1.5rem; }
.detail-price { font-size: 1.7rem; font-weight: 800; color: var(--emerald-700); margin: 10px 0; }
.detail-location { color: var(--gray-500); font-size: 0.92rem; margin-bottom: 20px; }
.seller-card { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 22px; margin-top: 22px; }
.seller-card h4 { margin-bottom: 4px; }
.seller-card p { font-size: 0.88rem; color: var(--gray-500); margin-bottom: 16px; }

/* ---------- Dashboard ---------- */
.dashboard-table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.dashboard-table th, .dashboard-table td { text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--gray-100); font-size: 0.9rem; }
.dashboard-table th { color: var(--gray-500); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
.status-pill { padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; }
.status-active { background: var(--emerald-100); color: var(--emerald-700); }
.status-sold, .status-completed { background: var(--gray-200); color: var(--gray-500); }
.status-removed { background: #fee2e2; color: #b91c1c; }
.action-links { display: flex; gap: 12px; }
.action-links form { display: inline; }
.action-links button.link-btn { background: none; border: none; padding: 0; color: var(--emerald-600); cursor: pointer; font-size: 0.85rem; font-weight: 600; font-family: var(--font); }
.action-links button.link-btn.danger { color: #b91c1c; }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--gray-500); }
.empty-state h3 { color: var(--ink-900); }

/* ---------- Pagination ---------- */
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 36px; }
.pagination a, .pagination span {
  padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--gray-200); font-size: 0.88rem; color: var(--ink-700);
}
.pagination a:hover { border-color: var(--emerald-500); text-decoration: none; }
.pagination .current { background: var(--emerald-600); color: var(--white); border-color: var(--emerald-600); }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink-900); color: #cbd5e1; padding: 44px 0 24px; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 30px; margin-bottom: 30px; }
.footer-grid h5 { color: var(--white); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 14px; }
.footer-grid a { display: block; color: #94a3b8; font-size: 0.88rem; margin-bottom: 10px; }
.footer-grid a:hover { color: var(--emerald-400); text-decoration: none; }
.footer-bottom { border-top: 1px solid #1e293b; padding-top: 20px; font-size: 0.82rem; color: #64748b; text-align: center; }

/* ---------- Static pages ---------- */
.static-page { max-width: 760px; margin: 0 auto; }
.static-page h2 { margin-top: 32px; }

/* ---------- Public profile & reviews ---------- */
.profile-header { margin-bottom: 30px; }
.profile-header h1 { margin: 0 0 6px; font-size: 1.8rem; }
.profile-meta { color: var(--gray-500); margin: 0; }
.profile-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; align-items: start; }
.profile-grid h2 { font-size: 1.2rem; margin-bottom: 16px; }
.muted { color: var(--gray-500); }
.stars { color: var(--amber-400); letter-spacing: 1px; }
.review-form-card { margin-bottom: 20px; }
.review-card { border-bottom: 1px solid var(--gray-200); padding: 16px 0; }
.review-card:last-child { border-bottom: none; }
.review-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.review-date { color: var(--gray-400); font-size: 0.8rem; }
.review-listing { color: var(--gray-500); font-size: 0.85rem; margin: 2px 0 6px; }
.review-comment { margin: 0; white-space: pre-line; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .listing-grid { grid-template-columns: repeat(2, 1fr); }
  .listing-detail { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .profile-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .main-nav { position: absolute; top: 76px; left: 0; right: 0; background: var(--white); flex-direction: column; align-items: flex-start; padding: 18px 24px 24px; gap: 16px; border-bottom: 1px solid var(--gray-200); display: none; }
  .main-nav.open { display: flex; }
  .nav-toggle { display: block; }
  .search-card { grid-template-columns: 1fr; }
  .cat-grid { grid-template-columns: 1fr 1fr; }
  .listing-grid { grid-template-columns: 1fr 1fr; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.8rem; }
}
@media (max-width: 480px) {
  .listing-grid { grid-template-columns: 1fr; }
  .cat-grid { grid-template-columns: 1fr; }
}
