/* โทนสี: ชมพูเด่น + เขียวกระจก + น้ำเงิน นวลตา */
:root {
  --pink-main: #c98ba3;
  --pink-soft: #d4a5b5;
  --pink-light: #f0e0e8;
  --pink-bright: #f5c6d4;
  --pink-bg: #faf5f7;
  --mint-soft: #7ecfad;
  --mint-light: #e0f2e9;
  --mint-bg: #f2faf6;
  --blue-soft: #6ba3c7;
  --blue-light: #e3eef9;
  --blue-bg: #f4f8fc;
  --text: #3d4a5c;
  --text-muted: #5c6878;
  --border-soft: #e8dce4;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Segoe UI", Tahoma, sans-serif; color: var(--text); background: var(--pink-bg); }
a { color: var(--pink-main); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header — เมนูเดียวมุมบน: ขาย เช่า โครงการใหม่ เกี่ยวกับเรา ลงประกาศ */
.header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,0.98);
  border-bottom: 1px solid var(--pink-light);
  padding: 0.6rem 1rem;
  box-shadow: 0 1px 0 rgba(0,0,0,0.03);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
}
.logo {
  font-size: 1.3rem;
  font-weight: bold;
  color: var(--pink-main);
  flex-shrink: 0;
}
.nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}
.nav a {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.nav a:hover { color: var(--pink-main); background: var(--pink-bg); }
.nav-item-post {
  background: var(--pink-main) !important;
  color: white !important;
  margin-left: 0.5rem;
}
.nav-item-post:hover { background: var(--pink-soft) !important; color: white !important; text-decoration: none; }
.header-btns { display: flex; gap: 0.5rem; align-items: center; flex-shrink: 0; }
.header-user { font-size: 0.875rem; color: var(--text-muted); margin-right: 0.25rem; }
.btn { display: inline-block; padding: 0.4rem 0.75rem; border-radius: 6px; font-weight: 500; font-size: 0.875rem; cursor: pointer; border: none; text-align: center; }
.btn-primary { background: var(--pink-main); color: white; }
.btn-primary:hover { background: var(--pink-soft); text-decoration: none; }
.btn-outline { border: 1px solid var(--pink-soft); color: var(--pink-main); background: transparent; }
.btn-outline:hover { background: var(--pink-light); text-decoration: none; }

/* Main content */
.container { max-width: 1200px; margin: 0 auto; padding: 1rem; }
main { min-height: 60vh; }

/* ========== หน้าแรก: ส่วนที่ 1 — ส่วนหัว (ภาพเคลื่อนไหวแนะนำเว็บไซต์) ========== */
.home-hero {
  position: relative;
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.home-hero-media {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.home-hero-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.home-hero-video[src=""],
.home-hero-video:not([src]) {
  opacity: 0;
  pointer-events: none;
}
.home-hero-fallback {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--pink-bg) 0%, var(--pink-light) 40%, var(--mint-bg) 70%, var(--blue-bg) 100%);
  z-index: -1;
}
.home-hero-overlay {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 2rem 1rem;
  background: linear-gradient(to bottom, rgba(255,255,255,0.75), rgba(250,245,247,0.9));
  text-align: center;
}
.home-hero-content {
  max-width: 560px;
  margin: 0 auto;
}
.home-hero-content h1 { font-size: 1.75rem; margin: 0; color: var(--text); }
.home-hero-content p { margin: 0.75rem 0 1rem; color: var(--text-muted); }
.hero-search {
  display: flex;
  max-width: 420px;
  margin: 0 auto 1.25rem;
  gap: 0.5rem;
}
.hero-search input[type="search"] {
  flex: 1;
  padding: 0.5rem 1rem;
  border: 1px solid var(--pink-light);
  border-radius: 8px;
  font-size: 1rem;
}
.hero-search input[type="search"]:focus {
  outline: none;
  border-color: var(--pink-main);
  box-shadow: 0 0 0 2px rgba(201, 139, 163, 0.3);
}
.hero-search .btn { white-space: nowrap; }
.hero-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; }
.hero-note { font-size: 0.8rem; color: var(--text-muted); margin: 0.75rem 0 0; }

/* ========== หน้าแรก: ส่วนที่ 2 — แนะนำโครงการใหม่ ========== */
.home-section { padding: 2rem 0; }
.home-section-title { font-size: 1.5rem; margin: 0 0 0.25rem; color: var(--text); }
.home-section-desc { color: var(--text-muted); font-size: 0.9rem; margin: 0 0 1.5rem; }
.home-projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}
.home-project-card {
  background: white;
  border: 1px solid var(--pink-light);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.home-project-card:hover { box-shadow: 0 4px 14px rgba(201, 139, 163, 0.15); }
.home-project-img {
  aspect-ratio: 16/10;
  background: linear-gradient(145deg, var(--pink-light), var(--mint-light));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.home-project-body { padding: 1rem; }
.home-project-body h3 { font-size: 1rem; margin: 0 0 0.25rem; color: var(--text); }
.home-project-body p { font-size: 0.8rem; margin: 0; color: var(--text-muted); }
.home-section-more { margin: 1.5rem 0 0; text-align: center; font-size: 0.9rem; }

/* ========== หน้าแรก: ส่วนที่ 3 — ประกาศล่าสุด ========== */
.home-latest { background: var(--pink-bg); padding: 2rem 0; }

/* ========== หน้าแรก: ประกาศขาย (เขียวกระจก) / ประกาศเช่า (ชมพูสว่าง) ========== */
.home-sell {
  background: var(--mint-bg);
  padding: 2rem 0;
  border-top: 2px solid var(--mint-soft);
}
.home-sell .section-title a { color: var(--mint-soft); }
.home-sell .section-title a:hover { color: #2d7a5e; }
.home-sell .card { border-color: var(--mint-light); }
.home-sell .card:hover { box-shadow: 0 4px 14px rgba(126, 207, 173, 0.2); }
.home-sell .card .badge { background: var(--mint-soft); }
.home-sell .card-price { color: var(--mint-soft); }
.home-sell .card-type { color: var(--mint-soft); }
.home-sell .card-img { background: linear-gradient(145deg, var(--mint-light), var(--mint-bg)); }

.home-rent {
  background: linear-gradient(180deg, var(--pink-bright) 0%, var(--pink-light) 100%);
  padding: 2rem 0;
  border-top: 2px solid var(--pink-main);
}
.home-rent .section-title a { color: var(--pink-main); }
.home-rent .section-title a:hover { color: #9d5a6f; }
.home-rent .card { border-color: var(--pink-light); background: white; }
.home-rent .card:hover { box-shadow: 0 4px 14px rgba(201, 139, 163, 0.2); }
.home-rent .card .badge { background: var(--pink-main); }
.home-rent .card-price { color: var(--pink-main); }
.home-rent .card-type { color: var(--pink-main); }
.home-rent .card-img { background: linear-gradient(145deg, var(--pink-light), var(--pink-bright)); }

/* ========== หน้าแรก: ส่วนที่ 4 — ส่วนท้าย ========== */
.home-bottom {
  background: linear-gradient(180deg, var(--pink-light), var(--pink-bg));
  border-top: 1px solid var(--pink-soft);
  padding: 2.5rem 1rem;
}
.home-bottom-inner {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}
.home-bottom-brand .logo { font-size: 1.5rem; font-weight: bold; color: var(--pink-main); }
.home-bottom-brand p { color: var(--text-muted); font-size: 0.9rem; margin: 0.5rem 0 1.25rem; }
.home-bottom-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.home-bottom-note { font-size: 0.8rem; color: var(--text-muted); margin: 0; }

/* Hero (legacy class สำหรับหน้าอื่น) */
.hero {
  background: linear-gradient(135deg, var(--pink-bg) 0%, var(--pink-light) 35%, var(--mint-bg) 70%, var(--blue-bg) 100%);
  border-bottom: 1px solid var(--pink-light);
  padding: 2rem 1rem;
  text-align: center;
}
.hero h1 { font-size: 1.75rem; margin: 0; color: var(--text); }
.hero p { margin: 0.75rem 0 1rem; color: var(--text-muted); }
.member-notice {
  background: var(--pink-light);
  border: 1px solid var(--pink-soft);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}
.member-notice strong { display: block; color: var(--text); margin-bottom: 0.25rem; }
.member-notice-p { margin: 0 0 0.75rem; font-size: 0.875rem; color: var(--text-muted); }
.member-notice-btns { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.login-intro, .register-intro { color: var(--text-muted); }

/* Search */
.search-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  background: white;
  border: 1px solid var(--pink-light);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}
.search-bar input[type="search"] {
  flex: 1;
  min-width: 200px;
  padding: 0.5rem 1rem;
  border: 1px solid var(--pink-light);
  border-radius: 8px;
  font-size: 1rem;
}
.search-bar input[type="search"]:focus {
  outline: none;
  border-color: var(--pink-main);
  box-shadow: 0 0 0 2px rgba(201, 139, 163, 0.3);
}
.search-bar .filter-type {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.search-bar .filter-type button {
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--pink-light);
  background: white;
  color: var(--text-muted);
  font-size: 0.875rem;
  cursor: pointer;
}
.search-bar .filter-type button:hover { background: var(--pink-light); color: var(--pink-main); }
.search-bar .filter-type button.active {
  color: white;
  border-color: transparent;
}
.search-bar .filter-type button[data-type=""].active {
  background: var(--text-muted);
  color: white;
}
.search-bar .filter-type button[data-type="ขาย"].active {
  background: var(--mint-soft);
  color: white;
}
.search-bar .filter-type button[data-type="เช่า"].active {
  background: var(--pink-main);
  color: white;
}
.filter-label { font-size: 0.875rem; color: var(--text-muted); margin-right: 0.25rem; }
.search-result-msg { margin-top: 1rem; color: var(--text-muted); font-size: 0.875rem; }
.search-no-result { display: none; text-align: center; padding: 2rem; background: var(--pink-light); border-radius: 12px; color: #8b6b7a; }
.search-no-result.visible { display: block; }

/* หน้ารายการ: แยกบล็อกประกาศขาย (เขียวกระจก) / ประกาศเช่า (ชมพูสว่าง) */
.listings-page-title { margin-bottom: 0.25rem; }
.listings-page-desc { font-size: 0.875rem; margin-bottom: 1rem; }
.listings-block { margin-top: 2rem; padding-top: 1.5rem; }
.listings-block:first-of-type { margin-top: 1rem; padding-top: 0; }
.listings-block-title { font-size: 1.2rem; margin: 0 0 1rem; color: var(--text); }
#block-sell { border-top: 2px solid var(--mint-soft); }
#block-sell .listings-block-title { color: #2d7a5e; }
#block-sell .card { border-color: var(--mint-light); }
#block-sell .card:hover { box-shadow: 0 4px 14px rgba(126, 207, 173, 0.2); }
#block-sell .card .badge { background: var(--mint-soft); }
#block-sell .card-price { color: var(--mint-soft); }
#block-sell .card-type { color: var(--mint-soft); }
#block-rent { border-top: 2px solid var(--pink-main); }
#block-rent .listings-block-title { color: var(--pink-main); }
#block-rent .card { border-color: var(--pink-light); }
#block-rent .card:hover { box-shadow: 0 4px 14px rgba(201, 139, 163, 0.2); }
#block-rent .card .badge { background: var(--pink-main); }
#block-rent .card-price { color: var(--pink-main); }
#block-rent .card-type { color: var(--pink-main); }

/* Listing grid */
.section-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.section-title h2 { font-size: 1.25rem; margin: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.card.searchable { transition: opacity 0.2s, transform 0.2s; }
.card.searchable.hidden { display: none !important; }
.card {
  background: white;
  border: 1px solid var(--pink-light);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s;
}
.card:hover { box-shadow: 0 4px 14px rgba(201, 139, 163, 0.15); }
.card-img {
  aspect-ratio: 4/3;
  background: linear-gradient(145deg, var(--pink-light), var(--mint-light));
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}
.card-body { padding: 1rem; }
.card-type { font-size: 0.75rem; color: var(--pink-main); }
.card-title { font-weight: 600; margin: 0.25rem 0; color: var(--text); font-size: 1rem; line-height: 1.3; }
.card-price { font-size: 1.125rem; font-weight: bold; color: var(--pink-main); margin-top: 0.5rem; }
.card-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.5rem; }
.badge { display: inline-block; padding: 0.2rem 0.5rem; border-radius: 4px; font-size: 0.75rem; font-weight: 500; background: var(--pink-main); color: white; position: absolute; top: 0.5rem; left: 0.5rem; }
.badge-sell { background: var(--mint-soft); }
.badge-rent { background: var(--pink-main); }
.badge-mint { background: var(--mint-soft); }
.badge-blue { background: var(--blue-soft); }
.card-wrap { position: relative; }

/* Forms */
.form-page { max-width: 400px; margin: 0 auto; padding: 2rem 1rem; }
.form-page h1 { font-size: 1.5rem; margin: 0; }
.form-page p { color: var(--text-muted); margin: 0.5rem 0 1.5rem; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 500; font-size: 0.875rem; margin-bottom: 0.25rem; color: var(--text); }
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  font-size: 1rem;
}
.form-group input:focus { outline: none; border-color: var(--pink-main); box-shadow: 0 0 0 2px rgba(201, 139, 163, 0.25); }
.form-error { background: var(--pink-light); color: #8b6b7a; padding: 0.75rem; border-radius: 6px; font-size: 0.875rem; margin-bottom: 1rem; }
.btn-block { width: 100%; padding: 0.6rem; font-size: 1rem; margin-top: 0.5rem; }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.text-muted { color: var(--text-muted); }

/* Detail page */
.detail-img { aspect-ratio: 16/10; background: linear-gradient(145deg, var(--mint-light), var(--blue-light)); display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.detail-content { background: white; border: 1px solid var(--pink-light); border-radius: 12px; overflow: hidden; margin-top: 1rem; }
.detail-body { padding: 1.5rem; }
.detail-body h1 { font-size: 1.5rem; margin: 0 0 0.5rem; }
.detail-price { font-size: 1.5rem; font-weight: bold; color: var(--pink-main); }
.detail-meta { margin: 1rem 0; font-size: 0.875rem; color: var(--text-muted); }
.detail-desc { border-top: 1px solid var(--pink-light); padding-top: 1rem; margin-top: 1rem; }
.contact-box { background: var(--pink-light); padding: 1rem; border-radius: 8px; margin-top: 1rem; }
.contact-box h3 { margin: 0 0 0.5rem; font-size: 1rem; }

/* Footer */
.footer { border-top: 1px solid var(--pink-light); background: linear-gradient(180deg, var(--pink-bg), var(--pink-light)); margin-top: 2rem; padding: 2rem 1rem; }
.footer-inner { max-width: 1200px; margin: 0 auto; text-align: center; color: var(--text-muted); font-size: 0.875rem; }

/* หน้าเกี่ยวกับเรา */
.page-about { max-width: 640px; margin: 0 auto; padding: 2rem 1rem; }
.page-about h1 { font-size: 1.75rem; margin: 0 0 0.5rem; color: var(--text); }
.about-lead { font-size: 1.05rem; color: var(--text-muted); margin: 0 0 2rem; line-height: 1.5; }
.about-block { margin-bottom: 2rem; }
.about-block h2 { font-size: 1.1rem; margin: 0 0 0.75rem; color: var(--text); }
.about-block p, .about-block ul { margin: 0 0 0.5rem; color: var(--text-muted); line-height: 1.6; font-size: 0.95rem; }
.about-block ul { padding-left: 1.25rem; }
.about-block li { margin-bottom: 0.35rem; }
.about-cta { margin-top: 1.25rem !important; }
.about-cta .btn { margin-right: 0.5rem; margin-bottom: 0.5rem; }

/* Dashboard */
.dashboard-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.empty-state { text-align: center; padding: 2rem; background: var(--pink-light); border: 1px solid var(--pink-soft); border-radius: 12px; margin-top: 1rem; }
.card-actions { margin-top: 0.5rem; font-size: 0.875rem; }
.card-actions a { margin-right: 1rem; }

/* ปุ่มโทนชมพู (ลงประกาศฟรี) */
.btn-pink-accent { background: var(--pink-main); color: white; }
.btn-pink-accent:hover { background: var(--pink-soft); text-decoration: none; }

/* ========== รองรับมือถือ (Responsive) ========== */
@media (max-width: 768px) {
  .header-inner { gap: 0.5rem; }
  .nav { order: 3; width: 100%; justify-content: flex-start; gap: 0.15rem; margin-top: 0.25rem; padding-top: 0.5rem; border-top: 1px solid var(--pink-light); }
  .nav a { min-height: 44px; display: inline-flex; align-items: center; padding: 0.5rem 0.6rem; font-size: 0.85rem; }
  .nav-item-post { margin-left: 0; }
  .header-btns { gap: 0.5rem; }
  .btn { min-height: 44px; padding: 0.5rem 1rem; display: inline-flex; align-items: center; justify-content: center; }
  .home-hero { min-height: 320px; }
  .home-hero-content h1 { font-size: 1.4rem; }
  .home-hero-overlay { padding: 1.5rem 1rem; }
  .home-projects-grid { grid-template-columns: 1fr; }
  .home-section { padding: 1.5rem 0; }
  .home-bottom { padding: 1.5rem 1rem; }
  .home-bottom-actions { flex-direction: column; }
  .home-bottom-actions .btn { width: 100%; }
  .hero { padding: 1.5rem 1rem; }
  .hero h1 { font-size: 1.4rem; }
  .hero-search { flex-direction: column; max-width: 100%; width: 100%; }
  .hero-search input[type="search"] { width: 100%; }
  .hero-search .btn { width: 100%; }
  .hero-btns { flex-direction: column; width: 100%; }
  .hero-btns .btn { width: 100%; }
  .container { padding: 0.75rem 1rem; }
  .search-bar { flex-direction: column; align-items: stretch; }
  .search-bar input[type="search"] { min-width: 0; width: 100%; }
  .search-bar .filter-type { justify-content: flex-start; }
  .grid { grid-template-columns: 1fr; gap: 0.75rem; }
  .section-title { flex-wrap: wrap; gap: 0.5rem; }
  .form-page { padding: 1.25rem 1rem; }
  .detail-body { padding: 1rem; }
  .detail-body h1 { font-size: 1.25rem; }
  .detail-price { font-size: 1.25rem; }
  .dashboard-header { flex-direction: column; align-items: flex-start; }
  .member-notice-btns { flex-direction: column; }
  .member-notice-btns .btn { width: 100%; text-align: center; }
}

@media (max-width: 480px) {
  .logo { font-size: 1.1rem; }
  .hero h1 { font-size: 1.25rem; }
  .hero p { font-size: 0.9rem; }
  .card-body { padding: 0.75rem; }
  .card-title { font-size: 0.95rem; }
  h1 { font-size: 1.35rem !important; }
}

/* Touch-friendly: ปุ่มและลิงก์กดง่ายบนมือถือ */
@media (hover: none) and (pointer: coarse) {
  .btn { min-height: 44px; }
  .nav a { min-height: 44px; padding: 0.5rem 0; display: inline-flex; align-items: center; }
  .search-bar .filter-type button { min-height: 44px; padding: 0.5rem 1rem; }
}
