* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f6f7fb;
  color: #1f2a37;
}
a { text-decoration: none; color: inherit; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

.topbar {
  background: #0f172a;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 64px;
}
.logo { font-weight: 700; font-size: 20px; }
.top-actions { display: flex; gap: 8px; }
.social-icon {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 10px;
}
.social-icon svg {
  width: 20px;
  height: 20px;
  fill: #1f2937;
}

.hero.simple {
  background: linear-gradient(135deg, #1e293b, #334155);
  color: #fff;
  padding: 48px 0;
}
.hero.simple h1 { margin: 0 0 8px; font-size: 34px; }
.hero.simple p { margin: 0; opacity: 0.92; }

.section { padding: 28px 0; }
.section h2 { margin: 0 0 14px; font-size: 24px; }
.light { background: #eef2ff; }
.muted { color: #6b7280; }
.hidden { display: none; }

.btn {
  display: inline-block;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #111827;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn.small { padding: 8px 12px; font-size: 14px; }
.btn.primary {
  background: #16a34a;
  border-color: #16a34a;
  color: #fff;
}
.btn.full { width: 100%; text-align: center; }

.category-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chip {
  border: 1px solid #cbd5e1;
  background: #fff;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.chip.active {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #fff;
}

.listing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.listing-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}
.listing-image {
  width: 100%;
  height: 260px;
  object-fit: contain;
  display: block;
  background: #f3f4f6;
  cursor: default;
}
.listing-body { padding: 12px; }
.row-between {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}
.listing-title { margin: 0; font-size: 18px; }
.listing-category {
  font-size: 12px;
  background: #e0e7ff;
  color: #1e40af;
  padding: 4px 8px;
  border-radius: 999px;
}
.listing-price { margin: 10px 0 8px; font-size: 16px; font-weight: 700; color: #b45309; }
.listing-desc { margin: 0 0 12px; color: #4b5563; min-height: 44px; }

.owner-box {
  background: #fff;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  padding: 18px;
}
.owner-box p { margin: 8px 0 14px; }

.footer {
  background: #0f172a;
  color: #fff;
  margin-top: 24px;
}
.footer-inner {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* admin */
.admin-main { padding: 22px 0 34px; }
.admin-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
}
.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px;
}
.field { margin-bottom: 10px; }
.field label {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
  color: #374151;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font: inherit;
}
.field textarea { min-height: 88px; resize: vertical; }
.admin-list { display: grid; gap: 10px; }
.admin-item {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.admin-item h4 { margin: 0 0 6px; }
.admin-item p { margin: 0; color: #6b7280; font-size: 14px; }

.dropzone {
  border: 2px dashed #93c5fd;
  background: #eff6ff;
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  position: relative;
}
.dropzone.dragover {
  border-color: #2563eb;
  background: #dbeafe;
}
.dropzone p {
  margin: 0;
  color: #1e40af;
  font-size: 14px;
}
.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.image-preview-list {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.preview-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #d1d5db;
  background: #fff;
}
.preview-item img {
  width: 100%;
  height: 70px;
  object-fit: cover;
  display: block;
}
.preview-item button {
  position: absolute;
  top: 4px;
  right: 4px;
  border: none;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border-radius: 999px;
  width: 20px;
  height: 20px;
  cursor: pointer;
  line-height: 20px;
  font-size: 12px;
}

.listing-thumbs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.listing-thumb {
  width: 46px;
  height: 46px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  object-fit: contain;
  background: #f8fafc;
  cursor: pointer;
}
.listing-thumb.active {
  border-color: #1d4ed8;
  box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.2);
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
}
.image-modal.hidden {
  display: none;
}
.image-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}
.image-modal-content {
  position: relative;
  max-width: 96vw;
  max-height: 92vh;
  margin: 3vh auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.image-modal-content img {
  max-width: 100%;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 10px;
  background: #111827;
}
.image-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 24px;
  line-height: 38px;
  cursor: pointer;
}

@media (max-width: 900px) {
  .listing-grid { grid-template-columns: 1fr 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .hero.simple h1 { font-size: 26px; }
  .listing-grid { grid-template-columns: 1fr; }
  .topbar-inner, .footer-inner { flex-direction: column; justify-content: center; gap: 8px; padding: 10px 0; }
  .image-preview-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

