/*
Theme Name:  Duanmak Theme
Theme URI:   https://duanmak.com
Description: Custom theme สำหรับ duanmak.com — Mobile-First, LINE-centric classified platform
Author:      Duanmak
Version:     1.0.0
Text Domain: duanmak
*/

/* ─── Design Tokens ─────────────────────────────────────────── */
:root {
  --color-primary:   #1a73e8;
  --color-danger:    #e53e3e;
  --color-success:   #38a169;
  --color-warning:   #d69e2e;
  --color-text:      #2d3748;
  --color-muted:     #718096;
  --color-border:    #e2e8f0;
  --color-bg:        #f7fafc;
  --color-white:     #ffffff;
  --color-line:      #00b900;
  --radius-sm:       6px;
  --radius-md:       10px;
  --radius-lg:       16px;
  --shadow-sm:       0 1px 3px rgba(0,0,0,.08);
  --shadow-md:       0 4px 12px rgba(0,0,0,.12);
  --font-base:       'Sarabun', 'Noto Sans Thai', sans-serif;
  --max-width:       1200px;
}

/* ─── Reset / Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-base);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
}
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
button, .button { cursor: pointer; border: none; border-radius: var(--radius-sm); padding: 10px 20px; font-family: var(--font-base); font-size: 1rem; transition: opacity .2s; }
button:hover, .button:hover { opacity: .85; }

/* ─── Layout ─────────────────────────────────────────────────── */
.dm-container { max-width: var(--max-width); margin: 0 auto; padding: 0 16px; }
.dm-section { padding: 40px 0; }
.dm-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.dm-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 768px) {
  .dm-grid-2, .dm-grid-3 { grid-template-columns: 1fr; }
}

/* ─── Header ─────────────────────────────────────────────────── */
.dm-header {
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
}
.dm-header__inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.dm-header__logo { font-size: 1.4rem; font-weight: 800; color: var(--color-primary); }
.dm-header__logo span { color: var(--color-danger); }
.dm-header__nav { display: flex; gap: 20px; align-items: center; }
.dm-btn-line {
  background: var(--color-line);
  color: #fff;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}

/* ─── Hero / Search ──────────────────────────────────────────── */
.dm-hero {
  background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%);
  color: #fff;
  padding: 60px 0;
  text-align: center;
}
.dm-hero h1 { font-size: 2.2rem; font-weight: 800; margin-bottom: 12px; }
.dm-hero p  { font-size: 1.1rem; opacity: .9; margin-bottom: 28px; }
.dm-search-box {
  display: flex; max-width: 600px; margin: 0 auto;
  background: #fff; border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow-md);
}
.dm-search-box input { flex: 1; border: none; padding: 14px 20px; font-size: 1rem; outline: none; color: var(--color-text); }
.dm-search-box button { background: var(--color-danger); color: #fff; padding: 14px 24px; font-weight: 700; border-radius: 0; }
.dm-category-icons { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 32px; }
.dm-category-icon {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: .95rem;
  transition: background .2s;
}
.dm-category-icon:hover { background: rgba(255,255,255,.25); text-decoration: none; color: #fff; }

/* ─── Listing Card ───────────────────────────────────────────── */
.dm-card {
  background: var(--color-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
}
.dm-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.dm-card--featured { border: 2px solid var(--color-warning); }
.dm-card__img { height: 160px; object-fit: cover; width: 100%; }
.dm-card__body { padding: 16px; }
.dm-card__badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.dm-badge { font-size: .75rem; padding: 2px 8px; border-radius: 99px; font-weight: 600; }
.dm-badge--urgent    { background: #fed7d7; color: #c53030; }
.dm-badge--category  { background: #bee3f8; color: #2b6cb0; }
.dm-badge--featured  { background: #fefcbf; color: #744210; }
.dm-card__title { font-size: 1rem; font-weight: 700; margin-bottom: 6px; color: var(--color-text); }
.dm-card__meta  { font-size: .85rem; color: var(--color-muted); display: flex; gap: 12px; flex-wrap: wrap; }
.dm-card__footer { padding: 12px 16px; border-top: 1px solid var(--color-border); display: flex; justify-content: space-between; align-items: center; }
.dm-unlock-bar { font-size: .82rem; color: var(--color-danger); font-weight: 600; }

/* ─── Listings Grid ──────────────────────────────────────────── */
.dm-listings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.dm-filter-bar { background: var(--color-white); padding: 16px; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); margin-bottom: 20px; display: flex; flex-wrap: wrap; gap: 12px; }
.dm-filter-bar select, .dm-filter-bar input { padding: 8px 12px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); font-family: var(--font-base); }

/* ─── Contact Box (blur) ─────────────────────────────────────── */
.dm-contact-box {
  background: var(--color-white);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
}
.dm-contact-box .dm-phone-blurred {
  font-size: 1.5rem;
  font-weight: 700;
  filter: blur(5px);
  user-select: none;
  margin-bottom: 12px;
}
.dm-contact-box .dm-phone-revealed { font-size: 1.6rem; font-weight: 800; color: var(--color-success); margin-bottom: 12px; }
.dm-btn-unlock {
  background: var(--color-primary);
  color: #fff;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 1rem;
  width: 100%;
}
.dm-btn-call {
  background: var(--color-success);
  color: #fff;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 1rem;
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}

/* ─── Form ───────────────────────────────────────────────────── */
.dm-form { background: var(--color-white); border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow-sm); }
.dm-form__group { margin-bottom: 20px; }
.dm-form__label { display: block; font-weight: 600; margin-bottom: 6px; }
.dm-form__label .required { color: var(--color-danger); }
.dm-form__input, .dm-form__select, .dm-form__textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-base);
  font-size: 1rem;
  transition: border-color .2s;
}
.dm-form__input:focus, .dm-form__select:focus, .dm-form__textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(26,115,232,.15);
}
.dm-form__textarea { resize: vertical; min-height: 120px; }
.dm-form__hint { font-size: .82rem; color: var(--color-muted); margin-top: 4px; }
.dm-form__error { font-size: .82rem; color: var(--color-danger); margin-top: 4px; display: none; }
.dm-form__step { display: none; }
.dm-form__step.active { display: block; }
.dm-steps-indicator { display: flex; gap: 8px; margin-bottom: 24px; }
.dm-step-dot { flex: 1; height: 4px; background: var(--color-border); border-radius: 2px; }
.dm-step-dot.active { background: var(--color-primary); }
.dm-btn-primary { background: var(--color-primary); color: #fff; padding: 12px 32px; border-radius: var(--radius-sm); font-weight: 700; font-size: 1rem; }
.dm-btn-secondary { background: var(--color-border); color: var(--color-text); padding: 12px 24px; border-radius: var(--radius-sm); font-weight: 600; }
.dm-no-refund-notice {
  background: #fff5f5;
  border: 1px solid #feb2b2;
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: .9rem;
  margin-bottom: 16px;
}

/* ─── Emergency Modal ────────────────────────────────────────── */
.dm-emergency-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.75);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; display: none;
}
.dm-emergency-overlay.visible { display: flex; }
.dm-emergency-box {
  background: #fff; border-radius: var(--radius-lg); padding: 32px;
  max-width: 400px; width: 90%; text-align: center;
}
.dm-emergency-box h2 { color: var(--color-danger); font-size: 1.5rem; margin-bottom: 8px; }
.dm-emergency-btn { display: flex; flex-direction: column; gap: 12px; margin: 20px 0; }
.dm-emergency-btn a {
  padding: 16px;
  border-radius: var(--radius-sm);
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
  text-decoration: none;
}
.dm-emergency-btn a.call-1669 { background: #e53e3e; }
.dm-emergency-btn a.call-199  { background: #dd6b20; }
.dm-emergency-btn a.call-191  { background: #3182ce; }

/* ─── Footer ─────────────────────────────────────────────────── */
.dm-footer { background: #2d3748; color: #a0aec0; padding: 40px 0 80px; }
.dm-footer a { color: #a0aec0; }
.dm-footer__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.dm-footer__title { color: #fff; font-weight: 700; margin-bottom: 12px; }
.dm-footer__links li { list-style: none; margin-bottom: 6px; }
@media (max-width: 768px) { .dm-footer__grid { grid-template-columns: 1fr; } }

/* ─── Sticky CTA (mobile) ────────────────────────────────────── */
.dm-sticky-cta {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--color-white);
  border-top: 1px solid var(--color-border);
  padding: 12px 16px;
  display: flex; gap: 10px;
  box-shadow: 0 -2px 8px rgba(0,0,0,.1);
  z-index: 90;
}
@media (min-width: 769px) { .dm-sticky-cta { display: none; } }
.dm-sticky-cta .dm-btn-primary, .dm-sticky-cta .dm-btn-line { flex: 1; text-align: center; }

/* ─── Utilities ──────────────────────────────────────────────── */
.text-center  { text-align: center; }
.text-muted   { color: var(--color-muted); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.hidden { display: none; }
