/* หน้ารวมประกาศ — เฉพาะแผงตัวกรอง · การ์ดแปลงใช้สไตล์เดิมจาก marketplace.css
   (ห้ามเขียนสไตล์การ์ดซ้ำที่นี่ ไม่งั้นการ์ดหน้านี้กับหน้าอื่นจะค่อยๆ เพี้ยนจากกัน) */

.ls-head{position:relative;background:var(--navy);color:#fff;padding:52px 0 46px;overflow:hidden}
/* ภาพพื้นหลังแถบหัว — ไฟล์ถูกครอปมาเป็นแถบยาว 1600×306 ให้ใกล้สัดส่วนแถบนี้อยู่แล้ว
   จึงไม่ต้องเล็ง object-position หนีอะไร ปล่อย center ได้ตรง ๆ และเหลือให้ cover เฉือนแค่ขอบบนล่าง
   ที่ต้องครอปเป็นไฟล์แทนการเล็งเอา เพราะแถบนี้กว้างเต็มจอเสมอ (ภาพไม่เคยถูกเฉือนด้านข้าง)
   การเลื่อน object-position จึงเลื่อนได้แต่แนวตั้ง หนีป้ายหินที่อยู่ครึ่งล่างของภาพต้นฉบับไม่พ้น */
.ls-head-bg{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:center}
/* ม่านสองชั้น — แนวตั้งกันไม่ให้ขอบบนล่างจืดจนกลืนกับแถบเมนู
   แนวนอนกันหัวข้อขาวกับคำโปรยสีฟ้าอ่อนหลุดหายไปกับพุ่มไม้สว่าง ๆ ฝั่งซ้ายของภาพ */
.ls-head-veil{
  position:absolute;inset:0;
  background:
    linear-gradient(90deg,rgba(11,31,58,0.92) 0%,rgba(11,31,58,0.74) 45%,rgba(11,31,58,0.15) 80%,rgba(11,31,58,0.08) 100%),
    linear-gradient(180deg,rgba(11,31,58,0.5) 0%,rgba(11,31,58,0.18) 45%,rgba(11,31,58,0.55) 100%);
}
.ls-head>.shell{position:relative;z-index:1}
.ls-head h1{margin:0 0 8px;font-size:27px;font-weight:700;line-height:1.35}
.ls-head p{margin:0;font-size:15px;line-height:1.7;color:#CFE0F7;max-width:58ch}
/* ทางเข้าหน้าค้นตามวัตถุประสงค์ — คนที่ยังไม่รู้ว่าจะกรองอะไร ควรมีทางเริ่มจาก "จะเอาไปทำอะไร" */
.ls-purpose-link{margin:9px 0 0;font-size:14px;line-height:1.7;color:#CFE0F7}
.ls-purpose-link a{color:#fff;font-weight:600;text-decoration:underline}

.ls-wrap{padding:22px 0 60px}

.ls-filters{background:#fff;border:1px solid var(--line);border-radius:16px;padding:16px 18px;margin-bottom:18px}
.ls-row{display:flex;flex-wrap:wrap;gap:12px;margin-bottom:12px}
.ls-field{display:flex;flex-direction:column;gap:5px;min-width:150px;flex:0 1 auto}
.ls-field.ls-grow{flex:1 1 240px}
.ls-field>span{font-size:12px;font-weight:600;color:var(--sub)}
.ls-field input,.ls-field select{
  height:40px;border:1px solid var(--line);border-radius:10px;padding:0 11px;
  font-size:14px;font-family:inherit;color:var(--ink);background:#F9FBFC;outline:none;width:100%
}
.ls-field input:focus,.ls-field select:focus{border-color:var(--blue);background:#fff}

.ls-feats{border:0;border-top:1px dashed var(--line);padding:12px 0 0;margin:0 0 12px}
.ls-feats legend{font-size:12px;font-weight:600;color:var(--sub);padding:0}
.ls-feats>div{display:flex;flex-wrap:wrap;gap:8px 16px;margin-top:8px}
.ls-feats label{display:flex;align-items:center;gap:6px;font-size:14px;color:var(--ink);cursor:pointer}

.ls-actions{display:flex;gap:10px;flex-wrap:wrap}
.ls-actions .post-btn,.ls-actions .outline-btn{cursor:pointer;font-family:inherit;font-size:14px}
.ls-actions .outline-btn{background:#fff;border:1px solid var(--line);border-radius:10px;padding:10px 16px;color:var(--sub)}

.ls-note{margin:0 0 6px;font-size:14px;font-weight:600;color:var(--ink)}
/* แปลงที่ถูกซ่อนเพราะยังไม่ได้กรอกข้อมูล — ต้องเห็นชัด ไม่ใช่ข้อความจางที่คนมองข้าม
   (แปลงหายเงียบ = ผู้ซื้อคิดว่าไม่มีของ ทั้งที่ของมีแต่ข้อมูลยังไม่ครบ) */
.ls-unknown{margin:0 0 12px;font-size:13.5px;line-height:1.7;color:#8A5A00;background:#FFF8E6;
  border:1px solid #F5E4BE;border-radius:12px;padding:10px 13px}
.ls-loading{color:var(--muted);font-size:14px;padding:20px 2px}

@media (max-width:760px){
  .ls-head{padding:34px 0 28px}
  /* จอแคบ ภาพถูกเฉือนด้านข้างจนเหลือราว 1 ใน 3 ตรงกลาง (พอดีตัวครอบครัว) ไม่ต้องเลื่อนเฟรม
     แต่ต้องเพิ่มความทึบของม่าน เพราะคำโปรยกินความกว้างเกือบเต็มจอ ไม่เหลือฝั่งที่ปล่อยให้ภาพสว่างได้ */
  .ls-head-veil{
    background:
      linear-gradient(90deg,rgba(11,31,58,0.92) 0%,rgba(11,31,58,0.84) 55%,rgba(11,31,58,0.5) 100%),
      linear-gradient(180deg,rgba(11,31,58,0.45) 0%,rgba(11,31,58,0.3) 50%,rgba(11,31,58,0.55) 100%);
  }
  .ls-head h1{font-size:22px}
  .ls-filters{padding:14px}
  /* จอแคบ: ช่องกรองเรียงสองคอลัมน์ ไม่ใช่บีบให้เตี้ยจนกดยาก */
  .ls-field{min-width:0;flex:1 1 calc(50% - 6px)}
  .ls-field.ls-grow{flex:1 1 100%}
  .ls-actions .post-btn,.ls-actions .outline-btn{flex:1 1 auto;text-align:center}
}

/* =====================================================================
 * Sprint 3 — ตัวกรอง "เฉพาะที่บันทึกไว้" + แผงตัวกรองแบบ Bottom Sheet บนจอเล็ก
 * (2026-09-20 · งานที่ 4) · ค่าสีมาจาก tokens.css
 * ===================================================================== */

.ls-saved {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-right: auto;
  font-size: var(--nj-fs-sm);
  color: var(--nj-text);
  cursor: pointer;
}
.ls-saved input { width: 18px; height: 18px; accent-color: var(--nj-navy-900); }
.ls-saved b { color: var(--nj-navy-600); }

/* ปุ่มเปิดแผงตัวกรอง — เดสก์ท็อปไม่ต้องมี เพราะแผงกางอยู่แล้ว */
.ls-open { display: none; }
.ls-sheet-head { display: none; }

@media (max-width: 860px) {
  /* ⚠️ ซ่อนแผงเฉพาะเมื่อ JS ทำงานแล้ว (`body.ls-js`) — ไม่งั้น JS พังแล้วตัวกรองหายทั้งหน้า */
  .ls-open {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 48px;
    margin-bottom: var(--nj-space-4);
    border: 1px solid var(--nj-gray-300);
    background: var(--nj-white);
    color: var(--nj-navy-900);
    font-size: var(--nj-fs-body);
    font-weight: var(--nj-fw-semi);
    cursor: pointer;
  }
  .ls-open:focus-visible { outline: 2px solid var(--nj-focus); outline-offset: 2px; }

  body.ls-js .ls-filters {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    /* ⚠️ ต่ำกว่าแบนเนอร์คุกกี้ (900) และลิ้นชักเมนู (950) — สองอย่างนั้นต้องอยู่เหนือเสมอ */
    z-index: 860;
    max-height: 86vh;
    margin: 0;
    padding: 0 var(--nj-space-4) calc(var(--nj-space-5) + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    background: var(--nj-white);
    border-top: 1px solid var(--nj-border);
    box-shadow: 0 -12px 40px rgba(11, 31, 58, 0.26);
    transform: translateY(100%);
    visibility: hidden;
    transition: transform var(--nj-dur) var(--nj-ease), visibility 0s linear var(--nj-dur);
  }
  html.ls-sheet-open body.ls-js .ls-filters,
  html.ls-sheet-open .ls-filters {
    transform: none;
    visibility: visible;
    /* ⚠️ ขาเปิดไม่มีหน่วงเวลา — เหตุผลเดียวกับเมนูย่อยบนหัวเว็บ
     *    แผงที่ "เปิดแล้วแต่ยังมองไม่เห็น" อ่านเหมือนปุ่มเสีย */
    transition: transform var(--nj-dur) var(--nj-ease), visibility 0s linear 0s;
  }

  body.ls-js .ls-sheet-head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 calc(var(--nj-space-4) * -1);
    padding: var(--nj-space-4);
    background: var(--nj-white);
    border-bottom: 1px solid var(--nj-border);
    font-size: var(--nj-fs-h4);
    color: var(--nj-text-strong);
  }
  .ls-sheet-x {
    min-width: 44px;
    min-height: 44px;
    border: 0;
    background: none;
    font-size: 20px;
    line-height: 1;
    color: var(--nj-text-muted);
    cursor: pointer;
  }
  .ls-sheet-x:focus-visible { outline: 2px solid var(--nj-focus); outline-offset: 2px; }

  /* ล็อกไม่ให้หน้าเลื่อนอยู่ข้างหลังตอนแผงเปิด */
  html.ls-sheet-open, html.ls-sheet-open body { overflow: hidden; }
  /* ⚠️ แบนเนอร์คุกกี้ (z 900) สูงกว่าแผงตัวกรอง (860) โดยตั้งใจ — แต่บนมือถือมันสูงเกือบ 200px
   *    ทับปุ่ม "ค้นหา/ล้างตัวกรอง" ที่ท้ายแผงจนกดไม่ได้ (เห็นจริงบน 390px)
   *    ซ่อนแบนเนอร์ชั่วคราวตอนแผงเปิด · ปิดแผงแล้วแบนเนอร์กลับมาเหมือนเดิม ไม่ได้ข้ามการขอความยินยอม */
  html.ls-sheet-open #nj-consent { display: none; }

  .ls-actions { position: sticky; bottom: 0; background: var(--nj-white); padding-top: var(--nj-space-3); }
  .ls-saved { margin-right: 0; flex: 1 1 100%; }
}
