/* ===== ตัวแปรสี: แก้ค่าตรงนี้เพื่อเปลี่ยนสีทั้งเว็บ ===== */
:root {
  --primary: #1f3a5f;
  --accent: #e8a33d;
  --danger: #c62828;
  --text: #222;
  --muted: #666;
  --bg-alt: #f5f6f8;
  --radius: 10px;
  --max: 1100px;
  --font: "Sarabun", "Noto Sans Thai", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); color: var(--text); background: #fff; line-height: 1.7; }
a { color: inherit; }
img { max-width: 100%; display: block; }
.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 720px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.muted-light { opacity: .7; font-size: 13px; }

/* ===== Header ===== */
.site-header { background: var(--primary); color: #fff; position: sticky; top: 0; z-index: 100; }
.header-inner { display: flex; justify-content: space-between; align-items: center; padding-top: 10px; padding-bottom: 10px; gap: 10px; flex-wrap: wrap; }
.logo img { height: 44px; width: auto; }
.site-nav { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.site-nav a { color: #fff; text-decoration: none; opacity: .92; }
.site-nav a:hover { opacity: 1; text-decoration: underline; }
.nav-cta { background: var(--accent); padding: 6px 14px; border-radius: 6px; opacity: 1 !important; }

/* ===== Hero ===== */
.hero { background: var(--primary); color: #fff; text-align: center; padding: 80px 0; }
.hero h1 { margin: 0 0 12px; font-size: 38px; }
.hero p { margin: 0 0 26px; font-size: 18px; opacity: .9; }

/* ===== ส่วนทั่วไป ===== */
.section { padding: 64px 0; }
.section-alt { background: var(--bg-alt); }
.section-title { margin: 0 0 22px; font-size: 28px; color: var(--primary); text-align: center; }

/* ===== ปุ่ม ===== */
.btn { display: inline-block; background: var(--accent); color: #fff; padding: 12px 26px; border-radius: var(--radius); text-decoration: none; font-weight: bold; border: none; cursor: pointer; font-family: var(--font); font-size: 16px; }
.btn:hover { opacity: .92; }
.btn-block { display: block; width: 100%; text-align: center; margin-top: 8px; }

/* ===== ตัวกรอง ===== */
.filters { display: flex; justify-content: center; gap: 8px; margin-bottom: 22px; flex-wrap: wrap; }
.chip { padding: 8px 18px; border: 1px solid var(--primary); background: #fff; border-radius: 20px; cursor: pointer; font-family: var(--font); font-size: 15px; }
.chip.active { background: var(--primary); color: #fff; }

/* ===== การ์ดประกาศ ===== */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.card { background: #fff; border-radius: var(--radius); overflow: hidden; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.08); transition: transform .15s; }
.card:hover { transform: translateY(-3px); }
.card.done { opacity: .8; }
.thumb { position: relative; height: 185px; background: #ddd; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.noimg { height: 100%; display: flex; align-items: center; justify-content: center; color: #888; min-height: 120px; }
.badge { position: absolute; top: 10px; left: 10px; color: #fff; padding: 4px 10px; border-radius: 6px; font-size: 13px; }
.badge.sale { background: #2e7d32; }
.badge.rent { background: #1565c0; }
.ribbon { position: absolute; inset: 0; background: rgba(0,0,0,.55); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: bold; }
.info { padding: 12px 14px 16px; }
.info h3 { margin: 0 0 6px; font-size: 17px; }
.info .price { margin: 4px 0; color: var(--danger); font-weight: bold; font-size: 18px; }
.info .loc { margin: 2px 0; color: var(--muted); font-size: 14px; }
.empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 30px; }

/* ===== ฟอร์มลงประกาศ ===== */
.form-box { background: #fff; padding: 28px; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.form-grid { display: grid; gap: 14px; margin-top: 16px; }
.form-grid label { display: grid; gap: 6px; font-size: 15px; }
.form-grid label.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; color: var(--muted); }
.form-grid label.check input { margin-top: 5px; }
.form-grid input[type="text"], .form-grid input[type="tel"], .form-grid select, .form-grid textarea {
  width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 6px; font-family: var(--font); font-size: 15px;
}
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.alert { padding: 12px 14px; border-radius: 8px; margin: 14px 0; font-size: 15px; }
.alert.error { background: #ffebee; color: var(--danger); }
.alert.success { background: #e8f5e9; color: #1b5e20; }

/* ===== Modal รายละเอียด ===== */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 200; }
.modal.open { display: flex; }
.modal-box { background: #fff; width: 100%; max-width: 760px; max-height: 92vh; overflow-y: auto; border-radius: 12px; position: relative; }
.modal-close { position: absolute; top: 10px; right: 10px; z-index: 5; width: 36px; height: 36px; border: none; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; font-size: 24px; cursor: pointer; line-height: 1; }
.gallery { position: relative; height: 380px; background: #111; }
.gallery img { width: 100%; height: 100%; object-fit: contain; }
.gallery .nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,.45); color: #fff; border: none; width: 38px; height: 38px; border-radius: 50%; font-size: 24px; cursor: pointer; }
.gallery .prev { left: 8px; }
.gallery .next { right: 8px; }
.gallery .counter { position: absolute; bottom: 8px; right: 8px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 4px; }
.thumbs { display: flex; gap: 6px; overflow-x: auto; padding: 8px; background: #eee; }
.thumbs img { width: 70px; height: 50px; object-fit: cover; border-radius: 4px; cursor: pointer; opacity: .6; flex: none; }
.thumbs img.sel { opacity: 1; outline: 2px solid var(--primary); }
.detail { padding: 18px 22px 24px; }
.detail h2 { margin: 8px 0 4px; color: var(--primary); }
.detail .pre { white-space: pre-line; }
.detail h4 { margin: 16px 0 6px; color: var(--primary); }
.status-tag { display: inline-block; background: var(--danger); color: #fff; padding: 4px 10px; border-radius: 6px; font-size: 14px; }
.tag-type { display: inline-block; background: var(--accent); color: #fff; padding: 2px 10px; border-radius: 4px; font-size: 13px; }
.contact-card { background: var(--bg-alt); border-radius: 8px; padding: 12px 16px; margin-top: 16px; }
.contact-card a { color: var(--primary); font-weight: bold; }
.contact-info { margin-top: 12px; }
.contact-info a { color: var(--primary); font-weight: bold; }

/* ===== Footer ===== */
.site-footer { background: var(--primary); color: #fff; padding: 26px 0; text-align: center; font-size: 14px; }
.site-footer p { margin: 4px 0; }

/* ===== มือถือ ===== */
@media (max-width: 640px) {
  .hero h1 { font-size: 26px; }
  .gallery { height: 260px; }
  .row-2 { grid-template-columns: 1fr; }
  .section { padding: 44px 0; }
}
