/* ============================================================
   raovat.top — Giao diện rao vặt (phong cách Chợ Tốt)
   Dùng chung cho mockup HTML và WordPress theme
   ============================================================ */

:root {
  --primary: #ff6b00;
  --primary-dark: #e85d00;
  --primary-soft: #fff4ea;
  --price: #e53935;
  --vip: #ffb800;
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #6b7280;
  --line: #e7eaee;
  --green: #18a957;
  --blue: #0a5dc2;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, .12);
  --container: 1200px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; cursor: pointer; }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 600;
  transition: .15s;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: #fff; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary-soft); }
.btn-ghost { background: #fff; border: 1.5px solid var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { filter: brightness(.95); }
.btn-block { width: 100%; }
.btn-lg { padding: 13px 24px; font-size: 16px; }

/* ---------- Header ---------- */
.site-header { background: #fff; box-shadow: var(--shadow); position: sticky; top: 0; z-index: 50; }
.topbar { background: #fff7f0; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.topbar .container { display: flex; justify-content: space-between; align-items: center; height: 36px; }
.topbar a:hover { color: var(--primary); }
.topbar .links { display: flex; gap: 18px; }

.header-main .container {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 70px;
}
.logo { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 22px; letter-spacing: -.5px; }
.logo-mark {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, var(--primary), #ff9036);
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 20px;
  box-shadow: 0 4px 10px rgba(255, 107, 0, .35);
}
.logo .top { color: var(--primary); }

/* Search */
.search-wrap { flex: 1; display: flex; align-items: stretch; max-width: 640px; }
.location-pick {
  display: flex; align-items: center; gap: 6px;
  background: #fff; border: 1.5px solid var(--line); border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  padding: 0 14px; font-weight: 600; font-size: 14px; color: var(--text);
  white-space: nowrap;
}
.search-box { flex: 1; display: flex; border: 1.5px solid var(--line); border-left: 1px solid var(--line); }
.search-box input {
  flex: 1; border: none; outline: none; padding: 0 14px; font-size: 15px; min-width: 0;
}
.search-box .search-btn {
  background: var(--primary); color: #fff; border: none; padding: 0 22px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-weight: 600;
}
.search-box .search-btn:hover { background: var(--primary-dark); }
.search-wrap .location-pick { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }

.header-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.header-actions .user { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 14px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 700; }

/* Category nav bar */
.catnav { background: #fff; border-top: 1px solid var(--line); }
.catnav .container { display: flex; gap: 4px; overflow-x: auto; height: 46px; align-items: center; }
.catnav a {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px;
  border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--muted); white-space: nowrap;
}
.catnav a:hover, .catnav a.active { background: var(--primary-soft); color: var(--primary); }

/* ---------- Hero / category grid ---------- */
.hero { padding: 22px 0 6px; }
.cat-grid {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 12px;
  background: #fff; border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.cat-item { text-align: center; padding: 12px 6px; border-radius: var(--radius-sm); transition: .15s; }
.cat-item:hover { background: var(--primary-soft); transform: translateY(-2px); }
.cat-icon {
  width: 52px; height: 52px; margin: 0 auto 8px; border-radius: 15px;
  display: grid; place-items: center; font-size: 26px;
  background: var(--primary-soft);
}
.cat-item span { font-size: 13px; font-weight: 500; color: var(--text); display: block; }

/* ---------- Banner ---------- */
.banner {
  margin-top: 16px; border-radius: var(--radius); overflow: hidden;
  background: linear-gradient(120deg, #ff6b00 0%, #ff9d4d 55%, #ffb800 100%);
  color: #fff; padding: 30px 36px; box-shadow: var(--shadow); position: relative;
}
.banner h2 { margin: 0 0 6px; font-size: 26px; }
.banner p { margin: 0 0 16px; opacity: .95; }
.banner .btn { background: #fff; color: var(--primary); }

/* ---------- Sections ---------- */
.section { margin-top: 26px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-head h2 { font-size: 20px; margin: 0; display: flex; align-items: center; gap: 9px; }
.section-head .more { color: var(--primary); font-weight: 600; font-size: 14px; }
.dot-vip { color: var(--vip); }

/* ---------- Listing grid & card ---------- */
.listing-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.listing-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); transition: .18s; position: relative; display: flex; flex-direction: column;
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.card .thumb {
  aspect-ratio: 4 / 3; position: relative;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px;
}
.card .thumb .ph-label { position: absolute; bottom: 8px; right: 10px; font-size: 11px; opacity: .85; font-weight: 500; }
.badge {
  position: absolute; top: 9px; left: 9px; z-index: 2;
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 6px; color: #fff;
}
.badge-vip { background: var(--vip); color: #4a3500; }
.badge-new { background: var(--green); }
.fav-btn {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 32px; height: 32px; border-radius: 50%; border: none;
  background: rgba(255, 255, 255, .92); display: grid; place-items: center; font-size: 16px; color: var(--muted);
}
.fav-btn:hover, .fav-btn.active { color: var(--price); }

.card-body { padding: 11px 12px 13px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.card .title {
  font-size: 14px; font-weight: 500; line-height: 1.35; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 38px;
}
.card .price { color: var(--price); font-weight: 800; font-size: 16px; }
.card .meta { margin-top: auto; display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.card .meta .row { display: flex; align-items: center; gap: 5px; }
.card .tag { display: inline-block; font-size: 11px; background: var(--bg); color: var(--muted); padding: 2px 7px; border-radius: 5px; }

/* ---------- Layout with sidebar (archive) ---------- */
.layout { display: grid; grid-template-columns: 250px 1fr; gap: 20px; margin-top: 20px; align-items: start; }
.sidebar-box { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.sidebar-box h3 { font-size: 15px; margin: 0 0 12px; }
.filter-group { margin-bottom: 16px; }
.filter-group > label { font-size: 13px; font-weight: 600; display: block; margin-bottom: 7px; }
.filter-group select, .filter-group input {
  width: 100%; padding: 9px 10px; border: 1.5px solid var(--line); border-radius: 8px; font-size: 14px; outline: none;
}
.filter-group select:focus, .filter-group input:focus { border-color: var(--primary); }
.price-range { display: flex; gap: 8px; }
.check-list li { padding: 5px 0; font-size: 14px; }
.check-list input { margin-right: 7px; }

.toolbar {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px;
}
.toolbar .sort { display: flex; gap: 8px; }
.chip { padding: 6px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; font-size: 13px; font-weight: 500; }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.breadcrumb { font-size: 13px; color: var(--muted); padding: 14px 0 2px; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span { margin: 0 6px; }

/* Pagination */
.pagination { display: flex; gap: 6px; justify-content: center; margin: 24px 0; }
.pagination a, .pagination span {
  min-width: 38px; height: 38px; padding: 0 10px; border-radius: 9px; background: #fff;
  display: grid; place-items: center; font-weight: 600; box-shadow: var(--shadow); font-size: 14px;
}
.pagination .current { background: var(--primary); color: #fff; }
.pagination a:hover { color: var(--primary); }

/* ---------- Single listing ---------- */
.single { display: grid; grid-template-columns: 1fr 340px; gap: 22px; margin-top: 18px; align-items: start; }
.gallery { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.gallery .main {
  aspect-ratio: 16 / 10; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 20px;
}
.gallery .thumbs { display: flex; gap: 8px; padding: 10px; overflow-x: auto; }
.gallery .thumbs div {
  width: 76px; height: 60px; flex: none; border-radius: 8px; display: grid; place-items: center;
  color: #fff; font-size: 11px; cursor: pointer; border: 2px solid transparent;
}
.gallery .thumbs div.active { border-color: var(--primary); }

.detail-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-top: 16px; }
.detail-card h1 { font-size: 22px; margin: 0 0 10px; line-height: 1.35; }
.detail-price { color: var(--price); font-size: 28px; font-weight: 800; margin-bottom: 12px; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); font-size: 13px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.detail-meta .row { display: flex; align-items: center; gap: 5px; }
.spec-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; margin: 16px 0; }
.spec-grid .item { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.spec-grid .item b { font-weight: 600; }
.detail-desc { font-size: 15px; line-height: 1.7; color: #333; white-space: pre-line; }
.detail-card h3 { font-size: 17px; margin: 18px 0 10px; }

/* Seller box (sticky) */
.seller-box { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; position: sticky; top: 90px; }
.seller-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.seller-head .avatar { width: 52px; height: 52px; font-size: 20px; }
.seller-head .name { font-weight: 700; font-size: 16px; }
.seller-head .since { font-size: 12px; color: var(--muted); }
.seller-box .btn { margin-bottom: 9px; }
.phone-reveal { font-size: 20px; font-weight: 800; letter-spacing: .5px; }
.safety-note { font-size: 12px; color: var(--muted); background: var(--bg); padding: 10px 12px; border-radius: 9px; margin-top: 12px; line-height: 1.5; }

/* ---------- Post ad form ---------- */
.form-wrap { max-width: 760px; margin: 20px auto; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; }
.form-wrap h1 { font-size: 24px; margin: 0 0 4px; }
.form-wrap .sub { color: var(--muted); margin: 0 0 22px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 7px; }
.field label .req { color: var(--price); }
.field input[type=text], .field input[type=number], .field select, .field textarea {
  width: 100%; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: 10px; font-size: 15px; outline: none; font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); }
.field textarea { min-height: 130px; resize: vertical; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.upload-box {
  border: 2px dashed var(--line); border-radius: 12px; padding: 28px; text-align: center; color: var(--muted);
  cursor: pointer; transition: .15s;
}
.upload-box:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.upload-box .ic { font-size: 34px; margin-bottom: 6px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- Footer ---------- */
.site-footer { background: #1f2630; color: #c7ced8; margin-top: 40px; padding: 40px 0 20px; font-size: 14px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 30px; }
.site-footer h4 { color: #fff; font-size: 15px; margin: 0 0 14px; }
.site-footer a { color: #c7ced8; display: block; padding: 4px 0; }
.site-footer a:hover { color: var(--primary); }
.site-footer .brand { display: flex; align-items: center; gap: 9px; font-size: 20px; font-weight: 800; color: #fff; margin-bottom: 12px; }
.site-footer .desc { line-height: 1.7; opacity: .85; }
.footer-bottom { border-top: 1px solid #333b47; margin-top: 28px; padding-top: 18px; text-align: center; opacity: .8; font-size: 13px; }
.social { display: flex; gap: 10px; margin-top: 12px; }
.social a { width: 36px; height: 36px; border-radius: 9px; background: #2b333f; display: grid; place-items: center; font-size: 17px; }
.social a:hover { background: var(--primary); color: #fff; }

/* ---------- Mobile bottom nav (mockup) ---------- */
.mobile-nav { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .listing-grid, .listing-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
  .cat-grid { grid-template-columns: repeat(6, 1fr); }
}
@media (max-width: 900px) {
  .single { grid-template-columns: 1fr; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .seller-box { position: static; }
}
@media (max-width: 768px) {
  .header-main .container { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; gap: 10px; }
  .search-wrap { order: 3; max-width: 100%; width: 100%; }
  .listing-grid, .listing-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .cat-grid { grid-template-columns: repeat(4, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .topbar { display: none; }
  .catnav { display: none; }
  .footer-grid { grid-template-columns: 1fr; }
  body { padding-bottom: 64px; }
  .mobile-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
    background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -2px 10px rgba(0,0,0,.06);
  }
  .mobile-nav a { flex: 1; text-align: center; padding: 8px 0 6px; font-size: 11px; color: var(--muted); }
  .mobile-nav a .ic { font-size: 20px; display: block; }
  .mobile-nav a.post { color: var(--primary); }
  .mobile-nav a.active { color: var(--primary); }
}
@media (max-width: 480px) {
  .cat-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 12px; }
  .cat-icon { width: 44px; height: 44px; font-size: 22px; }
  .banner { padding: 22px; }
  .banner h2 { font-size: 20px; }
}

/* ====== Bổ sung cho WordPress (ảnh thật) ====== */
.card .thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.gallery .main img { width: 100%; height: 100%; object-fit: cover; }
.detail-desc { white-space: normal; }
.detail-desc p { margin: 0 0 12px; }
.detail-desc img { border-radius: 10px; height: auto; }
.catnav ul { display: flex; gap: 4px; align-items: center; }
.page-numbers { display: inline-grid; }
