/* ── Marketplace (sàn BĐS) ── */
:root {
  --mkt-primary: #0f766e;
  --mkt-primary-dark: #0d5c56;
  --mkt-accent: #ea580c;
  --mkt-bg: #f4f6f8;
  --mkt-surface: #ffffff;
  --mkt-text: #111827;
  --mkt-muted: #6b7280;
  --mkt-border: #e5e7eb;
  --mkt-radius: 12px;
  --mkt-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  --mkt-shadow-hover: 0 12px 28px rgba(15, 23, 42, 0.12);
  --mkt-header-h: 64px;
}

body { background: var(--mkt-bg); color: var(--mkt-text); }

/* Header */
.mkt-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--mkt-border);
}
.mkt-header-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 1rem;
  height: var(--mkt-header-h);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.mkt-brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: inherit; min-width: 0; }
.mkt-brand img { height: 36px; width: auto; border-radius: 6px; }
.mkt-brand strong { font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mkt-nav { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; justify-content: flex-end; }
.mkt-nav a {
  color: var(--mkt-muted); text-decoration: none; padding: .45rem .75rem; border-radius: 8px;
  font-size: .9rem; transition: background .15s, color .15s;
}
.mkt-nav a:hover, .mkt-nav a.active { color: var(--mkt-primary); background: #ecfdf5; }
.mkt-nav-cta {
  background: var(--mkt-primary) !important; color: #fff !important;
}
.mkt-nav-cta:hover { background: var(--mkt-primary-dark) !important; }
.mkt-menu-btn {
  display: none; background: none; border: 1px solid var(--mkt-border);
  border-radius: 8px; padding: .4rem .65rem; font-size: 1.1rem; cursor: pointer;
}
@media (max-width: 768px) {
  .mkt-menu-btn { display: block; }
  .mkt-nav {
    display: none; position: absolute; top: var(--mkt-header-h); left: 0; right: 0;
    background: #fff; border-bottom: 1px solid var(--mkt-border);
    flex-direction: column; align-items: stretch; padding: .75rem 1rem 1rem;
    box-shadow: var(--mkt-shadow-hover);
  }
  .mkt-nav.open { display: flex; }
  .mkt-nav a { padding: .65rem .75rem; }
}

/* Main */
.mkt-main { max-width: 1280px; margin: 0 auto; padding: 0 1rem 2.5rem; }

/* Hero */
.mkt-hero {
  position: relative; border-radius: calc(var(--mkt-radius) + 4px);
  overflow: hidden; margin: 1.25rem 0 2rem;
  min-height: 320px; display: flex; align-items: center;
  background: linear-gradient(135deg, #0f766e 0%, #134e4a 50%, #115e59 100%);
}
.mkt-hero-bg {
  position: absolute; inset: 0; object-fit: cover; width: 100%; height: 100%; opacity: .35;
}
.mkt-hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(15,23,42,.75) 0%, rgba(15,23,42,.35) 60%, transparent 100%);
}
.mkt-hero-content {
  position: relative; z-index: 1; padding: 2.5rem 2rem; max-width: 640px; color: #fff;
}
.mkt-hero-content h1 { font-size: clamp(1.6rem, 4vw, 2.35rem); margin: 0 0 .5rem; line-height: 1.2; }
.mkt-hero-content p { margin: 0 0 1.25rem; opacity: .92; font-size: 1rem; line-height: 1.5; }
.mkt-search {
  display: flex; gap: .5rem; background: #fff; border-radius: 999px;
  padding: .35rem .35rem .35rem 1rem; box-shadow: 0 8px 24px rgba(0,0,0,.15);
  max-width: 520px;
}
.mkt-search input {
  flex: 1; border: none; outline: none; font-size: .95rem; min-width: 0; background: transparent;
}
.mkt-search button {
  border: none; background: var(--mkt-accent); color: #fff; font-weight: 600;
  padding: .7rem 1.25rem; border-radius: 999px; cursor: pointer; white-space: nowrap;
}
.mkt-search button:hover { filter: brightness(.95); }

/* Sections */
.mkt-section { margin-bottom: 2rem; }
.mkt-section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem; gap: 1rem;
}
.mkt-section-head h2 { margin: 0; font-size: 1.2rem; font-weight: 700; }
.mkt-section-head a { color: var(--mkt-primary); text-decoration: none; font-size: .9rem; font-weight: 600; }

/* Horizontal rail (MSN-style) */
.mkt-rail {
  display: flex; gap: 1rem; overflow-x: auto; padding-bottom: .5rem;
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.mkt-rail > * { flex: 0 0 auto; scroll-snap-align: start; }
.mkt-rail .msn-card { width: 280px; }
.mkt-rail .area-chip { flex: 0 0 140px; }

/* Area chips */
.area-chip {
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
  border: 1px solid var(--mkt-border); border-radius: var(--mkt-radius);
  background: var(--mkt-surface); padding: .75rem; cursor: pointer;
  transition: transform .15s, box-shadow .15s; text-align: center;
}
.area-chip:hover { transform: translateY(-2px); box-shadow: var(--mkt-shadow-hover); }
.area-chip img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; }
.area-chip span { font-size: .85rem; font-weight: 600; color: var(--mkt-text); }

/* MSN Card */
.msn-card {
  display: flex; flex-direction: column; background: var(--mkt-surface);
  border-radius: var(--mkt-radius); overflow: hidden; text-decoration: none; color: inherit;
  border: 1px solid var(--mkt-border); box-shadow: var(--mkt-shadow);
  transition: transform .2s, box-shadow .2s; height: 100%;
}
.msn-card:hover { transform: translateY(-4px); box-shadow: var(--mkt-shadow-hover); }
.msn-card-media { position: relative; aspect-ratio: 16 / 10; background: #e5e7eb; overflow: hidden; }
.msn-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.msn-card:hover .msn-card-media img { transform: scale(1.04); }
.msn-card-placeholder {
  height: 100%; display: flex; align-items: center; justify-content: center;
  color: var(--mkt-muted); font-weight: 600; background: linear-gradient(135deg, #e5e7eb, #f3f4f6);
}
.msn-badge {
  position: absolute; top: .65rem; left: .65rem;
  font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  padding: .25rem .55rem; border-radius: 6px; color: #fff;
}
.msn-badge-sale { background: #dc2626; }
.msn-badge-rent { background: #2563eb; }
.msn-badge-invest { background: #7c3aed; }
.msn-badge-project { background: var(--mkt-primary); }
.msn-card-body { padding: .9rem 1rem 1rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.msn-card-title {
  margin: 0; font-size: .95rem; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.msn-card-price { margin: 0; font-size: 1.1rem; font-weight: 800; color: var(--mkt-accent); }
.msn-card-sub { margin: 0; font-size: .82rem; color: var(--mkt-muted); }
.msn-card-meta { display: flex; flex-wrap: wrap; gap: .35rem .65rem; font-size: .78rem; color: var(--mkt-muted); }
.msn-card-meta span:not(:last-child)::after { content: "·"; margin-left: .65rem; opacity: .5; }
.msn-card-address {
  margin: .15rem 0 0; font-size: .78rem; color: var(--mkt-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Grid feed */
.mkt-grid {
  display: grid; gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
@media (min-width: 1024px) {
  .mkt-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .mkt-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Skeleton */
.mkt-skeleton {
  border-radius: var(--mkt-radius); background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
  background-size: 200% 100%; animation: mkt-shimmer 1.2s infinite;
  aspect-ratio: 16/10;
}
.mkt-skeleton-text { height: 14px; border-radius: 4px; margin-top: .5rem; }
@keyframes mkt-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Ad banner */
.mkt-ad-banner {
  display: block; border-radius: var(--mkt-radius); overflow: hidden;
  margin-bottom: 2rem; border: 1px solid var(--mkt-border);
}
.mkt-ad-banner img { width: 100%; max-height: 200px; object-fit: cover; display: block; }

/* Detail page */
.mkt-detail { display: grid; gap: 1.5rem; margin-top: 1rem; }
@media (min-width: 900px) {
  .mkt-detail { grid-template-columns: 1.2fr .8fr; align-items: start; }
}
.mkt-gallery-main {
  border-radius: var(--mkt-radius); overflow: hidden; aspect-ratio: 16/10;
  background: #e5e7eb; border: 1px solid var(--mkt-border);
}
.mkt-gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.mkt-gallery-thumbs {
  display: flex; gap: .5rem; margin-top: .5rem; overflow-x: auto;
}
.mkt-gallery-thumbs button {
  flex: 0 0 80px; height: 56px; border: 2px solid transparent; border-radius: 8px;
  overflow: hidden; padding: 0; cursor: pointer; background: none;
}
.mkt-gallery-thumbs button.active { border-color: var(--mkt-primary); }
.mkt-gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.mkt-detail-panel {
  background: var(--mkt-surface); border: 1px solid var(--mkt-border);
  border-radius: var(--mkt-radius); padding: 1.25rem; box-shadow: var(--mkt-shadow);
}
@media (min-width: 900px) {
  .mkt-detail-panel { position: sticky; top: calc(var(--mkt-header-h) + 1rem); }
}
.mkt-detail-price { font-size: 1.75rem; font-weight: 800; color: var(--mkt-accent); margin: .5rem 0; }
.mkt-detail-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin: .75rem 0; }
.mkt-tag {
  font-size: .75rem; padding: .25rem .6rem; border-radius: 999px;
  background: #f3f4f6; color: var(--mkt-muted);
}
.mkt-detail-actions { display: flex; flex-direction: column; gap: .65rem; margin-top: 1rem; }
.mkt-detail-actions .btn { width: 100%; justify-content: center; }
.mkt-share { margin-top: .25rem; padding-top: .85rem; border-top: 1px solid var(--mkt-border); }
.mkt-share-label { margin: 0 0 .5rem; font-size: .8rem; font-weight: 700; color: var(--mkt-muted); text-transform: uppercase; letter-spacing: .04em; }
.mkt-share-row { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; }
.mkt-share-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .5rem .6rem; border-radius: 8px; font-size: .82rem; font-weight: 600;
  text-decoration: none; border: 1px solid var(--mkt-border); cursor: pointer; background: #fff; color: #111827;
}
.mkt-share-btn.facebook { background: #1877f2; color: #fff; border-color: #1877f2; }
.mkt-share-btn.zalo { background: #0068ff; color: #fff; border-color: #0068ff; }
.mkt-share-btn.tiktok { background: #111827; color: #fff; border-color: #111827; }
.mkt-share-btn.copy { background: #f3f4f6; }
.mkt-share-status { margin: .45rem 0 0; font-size: .8rem; color: var(--mkt-primary); }
.mkt-book-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.mkt-book-row input { flex: 1; min-width: 160px; }
.mkt-prose { line-height: 1.7; color: #374151; margin-top: 1.5rem; }
.mkt-prose img { max-width: 100%; border-radius: 8px; }

/* Mobile sticky CTA */
.mkt-mobile-cta {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 90;
  background: #fff; border-top: 1px solid var(--mkt-border); padding: .75rem 1rem;
  box-shadow: 0 -4px 16px rgba(0,0,0,.08); gap: .5rem;
}
@media (max-width: 899px) {
  .mkt-mobile-cta { display: flex; align-items: center; justify-content: space-between; }
  .mkt-main { padding-bottom: 5rem; }
}
.mkt-mobile-cta .price { font-weight: 800; color: var(--mkt-accent); font-size: 1rem; }
.mkt-mobile-cta .btn { flex-shrink: 0; }

/* Footer */
.mkt-footer {
  background: #0f172a; color: #cbd5e1; margin-top: 2rem; padding: 2.5rem 1rem;
}
.mkt-footer-inner {
  max-width: 1280px; margin: 0 auto;
  display: grid; gap: 1.5rem;
}
@media (min-width: 768px) {
  .mkt-footer-inner { grid-template-columns: 1.5fr 1fr 1fr; }
}
.mkt-footer h4 { color: #fff; margin: 0 0 .75rem; font-size: 1rem; }
.mkt-footer p, .mkt-footer a { font-size: .9rem; line-height: 1.6; color: #94a3b8; text-decoration: none; }
.mkt-footer a:hover { color: #fff; }
.mkt-footer-bottom {
  max-width: 1280px; margin: 1.5rem auto 0; padding-top: 1rem;
  border-top: 1px solid #1e293b; font-size: .8rem; color: #64748b; text-align: center;
}

/* Empty & alerts */
.mkt-empty {
  text-align: center; padding: 3rem 1rem; background: var(--mkt-surface);
  border-radius: var(--mkt-radius); border: 1px dashed var(--mkt-border);
}
.mkt-load-more { text-align: center; margin: 2rem 0; }
.mkt-load-more button {
  background: var(--mkt-surface); border: 1px solid var(--mkt-border);
  padding: .75rem 2rem; border-radius: 999px; cursor: pointer; font-weight: 600;
}
.mkt-load-more button:hover { border-color: var(--mkt-primary); color: var(--mkt-primary); }

/* Override legacy public styles inside marketplace */
.public-main.mkt-main { max-width: 1280px; }
