/* sale2027 (S3, SALE2027-S3.md 6.5): only what the rent design system has no component for. Loaded on /buy and
   /sale/{id} only, after rental2027.css; every rule sits under a sale- class or body[data-page=buy|sale]. */

/* Market badge on the card photo (the photo-count chip size) and inline in the Listing eyebrow */
.sale-badge{position:absolute;top:12px;left:12px;z-index:1;display:inline-flex;align-items:center;border-radius:7px;padding:4px 8px;font-size:11px;font-weight:600;line-height:1.4;letter-spacing:0;color:#fff;background:var(--blue)}
.sale-badge--resale{color:var(--ink);background:var(--blue-soft)}
.sale-page .eyebrow>.sale-badge{position:static;width:auto;height:auto;border-radius:6px;padding:1px 8px;font-size:12px}
.sale-page .eyebrow>.sale-badge--first{background:var(--blue)}
.sale-page .eyebrow>.sale-badge--resale{background:var(--blue-soft)}

/* The short price ("4.5 ล้านบาท") after the full price; on its own line on narrow cards */
.sale-card .card-price span{white-space:nowrap}
@container card (max-width:330px){.sale-card .card-price span{display:block;margin:0;line-height:1.3}}
.sale-card .card-facts{flex-wrap:wrap;row-gap:4px}

/* The five-field filter grid: one row from 1180 px (the fifth select, whose default label "New build and resale" is the
   longest, a little wider), three columns on tablets, two fields a row on phones */
.sale-search{grid-template-columns:repeat(4,minmax(0,1fr)) minmax(0,1.25fr) 150px}
.sale-search .search-field{padding-left:16px;padding-right:16px}
.sale-search .search-field select{text-overflow:ellipsis}
/* buylive2027: the keyword box is a full row above the selects (so the selects keep their place: nth-child + 1) */
.sale-search .sale-query{grid-column:1/-1;border-right:0;border-bottom:1px solid var(--line);margin-bottom:6px;padding-bottom:8px}
.sale-search-clear{margin-top:10px;font-size:14px}
.sale-search-clear a{display:inline-flex;align-items:center;min-height:44px;color:var(--blue);text-decoration:underline}
body[data-page=buy] .listings-section{border-top:0}
@media(max-width:1179px){
  .sale-search{grid-template-columns:repeat(3,minmax(0,1fr));row-gap:6px}
  .sale-search .search-field{min-height:66px;padding:5px 15px;border-right:1px solid var(--line)}
  .sale-search .search-field:nth-child(4){border-right:0}
  .sale-search .sale-query{border-right:0}
  .sale-search .search-submit{grid-column:auto;min-height:56px;margin:0 0 0 8px}
}
/* Up to 760 px a third of the row is too narrow for the fifth select's label: two fields a row on a six-column grid.
   The fifth select takes two thirds of the last row and the button the rest, so the button stays on that row (clear of
   the floating assistant at the bottom right of a 390 px phone) and the label reads in full. */
@media(max-width:760px){
  .sale-search{grid-template-columns:repeat(6,minmax(0,1fr))}
  .sale-search .search-field{grid-column:span 3}
  .sale-search .search-field:nth-child(4){border-right:1px solid var(--line)}
  .sale-search .search-field:nth-child(odd){border-right:0}
  .sale-search .search-field:nth-child(6){grid-column:span 4;border-right:0}
  .sale-search .sale-query{grid-column:1/-1}
  .sale-search .search-submit{grid-column:span 2;align-self:center;gap:8px;padding-left:8px;padding-right:8px}
}
@media(max-width:560px){
  .sale-search{row-gap:2px}
  .sale-search .search-field{min-height:64px;padding:2px 8px}
  .sale-search .search-submit{min-height:48px;margin:0 0 0 8px}
  .sale-search-clear{margin-top:4px}
}
/* Under 375 px two thirds are still too narrow (EN): the fifth select and the button each take a full row. On those
   small phones (320x568, 360x640) the button is below the first screen (under the phone LINE bar) in either layout. */
@media(max-width:374px){
  .sale-search .search-field:nth-child(6){grid-column:1/-1}
  .sale-search .search-submit{grid-column:1/-1;margin:6px 0 0}
}

/* Empty state: the LINE button in the LINE green of the rent pages */
.sale-empty .sale-empty-line{gap:8px;border-radius:999px;background:#00803b;color:#fff;font-weight:600}
.sale-empty .sale-empty-line svg{width:22px;height:22px}

/* Fact tiles: a house or townhome adds a fourth tile (land) */
.sale-facts[data-count="4"]{grid-template-columns:repeat(4,minmax(0,1fr))}
@media(max-width:560px){.sale-facts[data-count="4"]{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* Project and sale blocks: the same two columns on wide screens (the rent three would leave a half-empty row); an odd
   last row (facilities, the foreign quota) takes the full width. One column on phones, as on the rent page. */
.sale-project,.sale-terms{grid-template-columns:repeat(2,minmax(0,1fr))}
.sale-project>div:last-child:nth-child(odd),.sale-terms>div:last-child:nth-child(odd){grid-column:1/-1}
@media(max-width:560px){.sale-project,.sale-terms{grid-template-columns:1fr}}

/* Foreign quota line: the unknown quota asks the team on LINE (link names the SALE id) */
.sale-quota-line dd{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px}
.sale-quota-ask{display:inline-flex;align-items:center;gap:5px;min-height:36px;padding:0 12px 0 8px;border-radius:999px;background:#00803b;color:#fff;font-size:14px;font-weight:600;line-height:1.4;white-space:nowrap}
.sale-quota-ask svg{width:18px;height:18px;flex:none}

/* The Inquiry message: a SALE id (and the URL tail ending in it) never breaks at its hyphen (sale.blade.php) */
.inquiry-text .sale-id{white-space:nowrap}

/* The buyer pays no fee: one line in the contact panel */
.sale-contact>p.sale-fee-note{display:flex;align-items:center;gap:8px;margin:4px 0 12px;color:var(--ink);font-weight:500}
.sale-fee-note svg{width:20px;height:20px;flex:none;color:#00803b}

@media(hover:hover){.sale-empty .sale-empty-line:hover,.sale-quota-ask:hover{background:#006b31}}

/* Prices: a seven or eight digit price never breaks inside the number (rent prices are short, so rent never needed
   this). On a phone the button moves under the price when both do not fit on one line. */
.sale-page .mobile-property-price,.sale-page .detail-price{overflow-wrap:normal;word-break:normal}
.sale-page .mobile-property-price{white-space:nowrap}
.sale-page .mobile-property-price>span{white-space:normal}
.sale-page .detail-price>span{display:inline-block}
.sale-page .mobile-property-summary{flex-wrap:wrap;row-gap:12px}

/* Fact tiles: break between words ("1 bedrooms" reads "1" / "bedrooms"); a word wider than the tile (a phone at
   320 px) is hyphenated in the page language instead of cut at any letter */
.sale-facts dd{overflow-wrap:break-word;hyphens:auto}
@media(max-width:560px){.property-page .sale-facts>div{padding-left:10px;padding-right:10px}}
@media(max-width:360px){.sale-facts[data-count="3"]{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* A Thai Listing name breaks at its spaces, not inside a transliterated word the browser does not know: each word is
   one box (sale.blade.php), which still wraps inside when it alone is wider than the line */
.sale-page .detail-heading h1 .sale-word{display:inline-block;max-width:100%}
