/* ===== JS Home — Design Tokens (อัปเดตตามโลโก้แบรนด์) ===== */
:root {
  --green-900: #163B33;
  --green-800: #2D5B50;
  --green-700: #386F62;
  --green-500: #4E9384;
  --green-300: #8DC0B4;
  --green-100: #E3F0EC;
  --orange-700: #D97C0C;
  --orange-500: #F7941D;
  --orange-100: #FDEBD3;
  --bg: #F8FAF9;
  --bg-panel: #FFFFFF;
  --text: #16241D;
  --text-muted: #5B6B62;
  --border: #E1EBE3;
  --radius: 14px;
  --shadow: 0 4px 24px rgba(22, 59, 51, 0.08);
  --font-display: "Prompt", "Noto Sans Thai", sans-serif;
  --font-body: "Sarabun", "Noto Sans Thai", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

img { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(247, 250, 247, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  color: var(--green-800);
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-mark img { width: 100%; height: 100%; object-fit: cover; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
}

.nav-links a:hover { color: var(--green-800); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  padding: 12px 24px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn-primary {
  background: var(--green-800);
  color: white;
}

.btn-primary:hover {
  background: var(--green-700);
  box-shadow: 0 8px 20px rgba(27, 67, 50, 0.25);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--green-800);
  color: var(--green-800);
}

.btn-ghost:hover { background: var(--green-100); }

.btn-sm { padding: 9px 18px; font-size: 14px; }

/* ===== Hero ===== */
.hero {
  position: relative;
  overflow: hidden;
  padding: 88px 0 64px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--green-700);
  background: var(--green-100);
  padding: 7px 14px;
  border-radius: 999px;
  margin-bottom: 20px;
}

.eyebrow .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--orange-500);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.75); }
}

.hero h1 {
  font-size: clamp(34px, 4.2vw, 52px);
  font-weight: 700;
  color: var(--green-900);
}

.hero h1 span { color: var(--orange-500); }

.hero p.lead {
  font-size: 18px;
  color: var(--text-muted);
  margin: 20px 0 32px;
  max-width: 46ch;
}

.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 44px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.stat-num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(22px, 2.4vw, 30px);
  color: var(--green-800);
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Hero visual: signature live-count panel */
.hero-visual {
  position: relative;
  background: linear-gradient(165deg, var(--green-800) 0%, var(--green-700) 55%, var(--green-500) 130%);
  border-radius: 28px;
  padding: 40px 32px;
  color: white;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-visual::before {
  content: "";
  position: absolute;
  inset: -40% -20% auto auto;
  width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(247, 148, 29, 0.28), transparent 70%);
}

.hero-visual-label {
  font-size: 13px;
  letter-spacing: 0.04em;
  opacity: 0.85;
  text-transform: uppercase;
  font-weight: 600;
}

.hero-visual-count {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(56px, 7vw, 84px);
  margin: 14px 0 0;
  line-height: 1;
}

.hero-visual-sub {
  font-size: 14px;
  opacity: 0.85;
  margin-top: 10px;
}

.hero-visual-list {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hero-visual-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
}

.hero-visual-row b { font-family: var(--font-display); font-weight: 600; }

/* ===== Section ===== */
.section { padding: 72px 0; }
.section-tight { padding: 48px 0; }

.section-head {
  max-width: 640px;
  margin: 0 0 40px;
}

.section-eyebrow {
  font-size: 13px;
  font-weight: 700;
  color: var(--green-700);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
  display: block;
}

.section-head h2 {
  font-size: clamp(26px, 3vw, 34px);
  color: var(--green-900);
}

.section-head p {
  color: var(--text-muted);
  margin-top: 12px;
  font-size: 16px;
}

/* ===== Feature cards ===== */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
}

.card-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--green-100);
  display: flex; align-items: center; justify-content: center;
  color: var(--green-700);
  margin-bottom: 16px;
}

.card h3 {
  font-size: 18px;
  color: var(--green-900);
  margin-bottom: 8px;
}

.card p { color: var(--text-muted); font-size: 14.5px; margin: 0; }

/* ===== Province pills (landing → link to listing) ===== */
.pill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill {
  border: 1px solid var(--border);
  background: var(--bg-panel);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  transition: all 0.15s ease;
  cursor: pointer;
}

.pill:hover {
  border-color: var(--orange-500);
  background: var(--orange-100);
  color: var(--green-800);
}

/* ===== CTA band ===== */
.cta-band {
  background: var(--green-800);
  border-radius: 28px;
  padding: 56px 48px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
}

.cta-band h2 { font-size: 28px; max-width: 420px; }
.cta-band p { color: rgba(255,255,255,0.78); margin-top: 10px; max-width: 420px; }

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
  margin-top: 40px;
}

.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13.5px;
  color: var(--text-muted);
}

.footer-note {
  font-size: 12.5px;
  color: var(--text-muted);
  opacity: 0.8;
  margin-top: 6px;
}

/* ===== Property listing page ===== */
.filter-bar {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr auto;
  gap: 12px;
  margin-bottom: 28px;
  position: sticky;
  top: 92px;
  z-index: 20;
  box-shadow: var(--shadow);
}

.field label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}

.field input, .field select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-family: var(--font-body);
  font-size: 14.5px;
  color: var(--text);
}

.field input:focus, .field select:focus {
  outline: 2px solid var(--orange-500);
  outline-offset: 1px;
}

.result-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  color: var(--text-muted);
  font-size: 14px;
  gap: 16px;
}

.view-toggle {
  display: flex;
  gap: 6px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
}

.view-toggle-btn {
  border: none;
  background: transparent;
  padding: 8px 16px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.view-toggle-btn.active {
  background: var(--green-800);
  color: white;
}

.view-toggle-btn:not(.active):hover {
  background: var(--green-100);
  color: var(--green-800);
}

.map-note {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

#propertyMap {
  width: 100%;
  height: 640px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.map-popup {
  font-family: var(--font-body);
  font-size: 13.5px;
  line-height: 1.5;
  min-width: 180px;
}

.map-popup b {
  font-family: var(--font-display);
  color: var(--green-900);
  font-size: 14px;
}

.map-popup a {
  color: var(--green-700);
  font-weight: 600;
  display: inline-block;
  margin-top: 4px;
}

/* หมุดสีส้มตามโทนแบรนด์ (แทนหมุดน้ำเงินเริ่มต้นของ Leaflet) */
.orange-pin-wrap { background: transparent; border: none; }
.orange-pin {
  width: 20px;
  height: 20px;
  background: var(--orange-500);
  border: 3px solid white;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}

/* จุดกลุ่ม (cluster) สีส้ม เข้มขึ้นตามจำนวนทรัพย์ในกลุ่ม */
.cluster-pin-wrap { background: transparent; border: none; }
.cluster-pin {
  background: var(--orange-500);
  color: white;
  border: 3px solid white;
  border-radius: 50%;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 3px 10px rgba(217, 124, 12, 0.45);
}

@media (max-width: 860px) {
  .result-meta { flex-wrap: wrap; }
  #propertyMap { height: 460px; }
}

.property-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.property-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
}

.property-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.property-thumb {
  aspect-ratio: 4 / 3;
  background: var(--green-100);
  position: relative;
  overflow: hidden;
}

.property-thumb img {
  width: 100%; height: 100%; object-fit: cover;
}

.property-type-tag {
  position: absolute;
  top: 10px; left: 10px;
  background: rgba(27, 67, 50, 0.88);
  color: white;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
}

.property-body { padding: 16px 18px 18px; flex: 1; display: flex; flex-direction: column; }

.property-body h4 {
  font-size: 15.5px;
  color: var(--green-900);
  margin-bottom: 6px;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.property-loc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  gap: 5px;
}

.property-meta {
  display: flex;
  gap: 12px;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.property-meta span { display: flex; align-items: center; gap: 4px; }

.property-cta {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  border-radius: 9px;
  background: var(--green-100);
  color: var(--green-800);
  font-weight: 600;
  font-size: 13.5px;
}

.property-card:hover .property-cta { background: var(--green-800); color: white; }

.state-msg {
  text-align: center;
  padding: 64px 20px;
  color: var(--text-muted);
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 40px;
}

.page-btn {
  border: 1px solid var(--border);
  background: var(--bg-panel);
  border-radius: 9px;
  padding: 9px 16px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
}

.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-btn:not(:disabled):hover { border-color: var(--orange-500); }

.skeleton {
  background: linear-gradient(90deg, var(--green-100) 25%, #eef7f0 37%, var(--green-100) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}

@keyframes shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ===== Responsive ===== */
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .grid-3 { grid-template-columns: 1fr; }
  .filter-bar { grid-template-columns: 1fr 1fr; position: static; }
  .cta-band { flex-direction: column; text-align: center; }
  .hero-stats { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
