/* LelangPet V12.4 — shared mobile resilience for Auction, member, admin, Shop, and Sales. */
/* Every rule is breakpoint-scoped so the established desktop layout stays unchanged. */

@media (max-width:900px){
  :where(body.lp-ui-v93,body.lp-ui-v94,body.lp-shop-body,body.lp-sales-body){
    width:100%;
    max-width:100%;
  }

  /* Grid and flex children must be allowed to shrink to the viewport. */
  :where(body.lp-ui-v93,body.lp-ui-v94,body.lp-shop-body,body.lp-sales-body)
  :where(main,section,article,aside,header,footer,nav,div,form,fieldset){
    min-width:0;
  }

  :where(body.lp-ui-v93,body.lp-ui-v94,body.lp-shop-body,body.lp-sales-body)
  :where(img,video,canvas,iframe){
    max-width:100%;
  }

  :where(.table-wrap,.lp-table-wrap,.lp-fee-table-wrap,.lp-invoice-table-wrap,.kyc-table-wrap,.lp-shop-admin-table-wrap){
    width:100%;
    max-width:100%;
    overflow-x:auto;
    overscroll-behavior-inline:contain;
    -webkit-overflow-scrolling:touch;
  }

  :where(.table-wrap,.lp-table-wrap,.lp-fee-table-wrap,.lp-invoice-table-wrap,.kyc-table-wrap,.lp-shop-admin-table-wrap)
  :where(th,td){
    word-break:normal!important;
    overflow-wrap:normal!important;
  }

  :where(pre,code){max-width:100%}
  pre{overflow-x:auto}

  /* One-column tracks use minmax(0,1fr) to avoid hidden min-content overflow. */
  .detail-columns,
  .lp-product-detail-grid,
  .lp-fee-page{
    grid-template-columns:minmax(0,1fr)!important;
  }

  :where(.detail-main,.history-card,.lp-product-gallery,.lp-product-buy-card,.lp-fee-channel,.lp-error-card){
    width:100%;
    max-width:100%;
    min-width:0;
  }

  :where(.modal,.lp-modal,.gallery-lightbox,.lp-lightbox,.kyc-preview-dialog){
    max-width:calc(100vw - 24px);
    max-height:calc(100dvh - 24px);
  }
}

@media (max-width:720px){
  [data-mobile-table-wrap="true"]{
    width:100%;
    max-width:100%;
    overflow:visible!important;
    border:0!important;
    background:transparent!important;
  }

  table[data-mobile-cards="true"]{
    display:block!important;
    width:100%!important;
    min-width:0!important;
    border:0!important;
    border-spacing:0!important;
    background:transparent!important;
  }
  table[data-mobile-cards="true"]>thead{
    position:absolute!important;
    width:1px!important;
    height:1px!important;
    padding:0!important;
    margin:-1px!important;
    overflow:hidden!important;
    clip:rect(0,0,0,0)!important;
    white-space:nowrap!important;
    border:0!important;
  }
  table[data-mobile-cards="true"]>:is(tbody,tfoot){
    display:grid!important;
    width:100%!important;
    gap:12px!important;
  }
  table[data-mobile-cards="true"]>:is(tbody,tfoot)>tr{
    display:block!important;
    width:100%!important;
    overflow:hidden!important;
    border:1px solid #dfe5ef!important;
    border-radius:16px!important;
    background:#fff!important;
    box-shadow:0 5px 18px rgba(31,47,105,.045)!important;
  }
  table[data-mobile-cards="true"]>:is(tbody,tfoot)>tr>td,
  table[data-mobile-cards="true"]>:is(tbody,tfoot)>tr>th{
    display:grid!important;
    grid-template-columns:minmax(96px,38%) minmax(0,1fr)!important;
    align-items:start!important;
    gap:12px!important;
    width:100%!important;
    min-width:0!important;
    min-height:0!important;
    padding:11px 13px!important;
    border:0!important;
    border-bottom:1px solid #edf0f5!important;
    background:transparent!important;
    text-align:left!important;
    white-space:normal!important;
    word-break:normal!important;
    overflow-wrap:break-word!important;
  }
  table[data-mobile-cards="true"]>:is(tbody,tfoot)>tr>td:last-child,
  table[data-mobile-cards="true"]>:is(tbody,tfoot)>tr>th:last-child{
    border-bottom:0!important;
  }
  table[data-mobile-cards="true"]>:is(tbody,tfoot)>tr>td::before,
  table[data-mobile-cards="true"]>:is(tbody,tfoot)>tr>th::before{
    content:attr(data-mobile-label);
    color:#74819c;
    font-size:10px;
    font-weight:800;
    line-height:1.45;
    letter-spacing:.045em;
    text-transform:uppercase;
  }
  table[data-mobile-cards="true"]>:is(tbody,tfoot)>tr>[data-mobile-full="true"]{
    display:block!important;
    padding:18px!important;
    text-align:center!important;
  }
  table[data-mobile-cards="true"]>:is(tbody,tfoot)>tr>[data-mobile-full="true"]::before{
    display:none!important;
  }
  table[data-mobile-cards="true"]>:is(tbody,tfoot)>tr>td :where(.row-actions,form,.table-pet,.user-cell){
    min-width:0;
    max-width:100%;
  }
  table[data-mobile-cards="true"]>:is(tbody,tfoot)>tr>td :where(.row-actions){
    justify-content:flex-start;
    flex-wrap:wrap;
  }
}

@media (max-width:650px){
  :where(body.lp-ui-v93,body.lp-ui-v94,body.lp-shop-body,body.lp-sales-body)
  :where(h1,h2,h3,h4,p,a,strong,small,span,dt,dd,td,th,label){
    word-break:normal;
    overflow-wrap:break-word;
  }

  :where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]),select,textarea){
    min-width:0;
    max-width:100%;
  }

  :where(input[type="date"],input[type="time"],input[type="datetime-local"]){
    width:100%;
  }

  .app-header{
    padding-left:12px;
    padding-right:12px;
    gap:8px;
  }
  .app-actions{min-width:0;gap:6px}

  :where(.page-head,.section-head,.dash-card-head,.card-heading,.result-head,.lp-security-title,.lp-cart-section-head,.lp-order-section-head,.lp-listing-media-head,.lp-existing-media-head,.lp-membership-section-head,.lp-shop-admin-card-head,.lp-rule-editor-head){
    min-width:0;
  }

  :where(.head-actions,.row-actions,.wizard-actions,.lp-growth-actions,.lp-commission-actions){
    max-width:100%;
    flex-wrap:wrap;
  }

  :where(.breadcrumb,.filter-tabs,.lp-community-tabs,.lp-shop-header-nav,.lp-shop-filter-pills,.pagination-wrap){
    max-width:100%;
    overflow-x:auto;
    overscroll-behavior-inline:contain;
    scrollbar-width:thin;
  }

  :where(.profile-dropdown,.lp-public-more-menu){
    max-width:calc(100vw - 24px);
  }

  .lp-error-page{width:100%;max-width:100%}
  .lp-error-card{box-sizing:border-box}

  /* Tables that become cards may wrap their values, but never letter by letter. */
  :where(.lp-shop-admin-table,.kyc-table) tbody td>*{
    min-width:0;
    max-width:100%;
    word-break:normal;
    overflow-wrap:break-word;
  }
}

@media (max-width:520px){
  /* Keep long transaction states from squeezing the listing title into one character per line. */
  .win-card{
    grid-template-columns:68px minmax(0,1fr) 18px!important;
    grid-template-rows:auto auto;
    column-gap:10px!important;
    row-gap:8px!important;
    align-items:center;
  }
  .win-card>img{
    grid-column:1;
    grid-row:1/3;
    width:68px!important;
    height:62px!important;
  }
  .win-card>div{
    grid-column:2/-1;
    grid-row:1;
    min-width:0;
  }
  .win-card>.status-badge{
    grid-column:2;
    grid-row:2;
    justify-self:start;
    max-width:100%;
    white-space:normal!important;
    word-break:normal!important;
    overflow-wrap:break-word!important;
    text-align:left;
  }
  .win-card>span:last-child{
    grid-column:3;
    grid-row:2;
    justify-self:end;
  }
}

@media (max-width:480px){
  .hero-actions.lp-error-actions{
    width:100%;
    flex-direction:column;
    align-items:stretch;
  }
  .hero-actions.lp-error-actions .btn{width:100%}

  :where(.head-actions,.wizard-actions,.lp-growth-actions)>.btn,
  :where(.head-actions,.wizard-actions,.lp-growth-actions)>form{
    flex:1 1 100%;
  }
  :where(.head-actions,.wizard-actions,.lp-growth-actions)>form>.btn{width:100%}
}
