/* CMEA-approved VRental mobile UX v1.6 integration. Scoped; no backend state changes.
   Source of truth: real PHP/SQLite marketplace, never prototype product arrays. */
:root{
  --ux-primary:#2457F5;
  --ux-ink:#111318;
  --ux-border:#dfe5f1;
  --ux-muted:#53617a;
  --ux-soft:#f5f7ff;
}
.ux-home{margin-top:12px}
.ux-home-heading{margin:0 0 10px}
.ux-home-kicker,.ux-kicker{font-size:10px;font-weight:780;letter-spacing:.11em;color:var(--ux-primary);margin:0 0 3px}
.ux-home-heading h1{font-size:clamp(22px,2.1vw,31px);font-weight:820;letter-spacing:-.04em;line-height:1.17;margin:0;color:var(--ink)}
.ux-period-trigger{
  display:flex;align-items:center;gap:12px;width:100%;border:1px solid #dbe4f4;
  border-radius:15px;padding:9px 13px;min-height:55px;background:#f8faff;
  color:var(--ux-ink);text-align:left;margin:9px 0 0;
}
.ux-period-trigger-icon{display:grid;place-items:center;flex:none;width:37px;height:37px;border-radius:10px;background:#e8efff;color:var(--ux-primary);font-size:23px}
.ux-period-trigger-copy{display:grid;gap:1px;min-width:0}
.ux-period-trigger-copy strong{font-size:13px;font-weight:800}
.ux-period-trigger-copy small{font-size:12px;color:#4f5f77;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ux-period-chevron{font-size:25px;color:var(--ux-primary);margin-left:auto}
.ux-period-trigger:hover{background:#edf3ff;border-color:#bccfff}
.ux-subcategory-section{margin:15px 0 8px}
.ux-subcategory-heading{display:flex;align-items:baseline;justify-content:space-between;gap:8px;margin-bottom:7px}
.ux-subcategory-heading h2{margin:0;font-size:17px;line-height:1.3;letter-spacing:-.02em}
.ux-subcategory-heading a{font-size:12px;color:var(--ux-primary);font-weight:740;white-space:nowrap}
.ux-subcategory-rail{display:flex;gap:8px;overflow-x:auto;scrollbar-width:thin;scrollbar-color:#c7d7f5 transparent;overscroll-behavior-x:contain;padding:2px 0 9px;-webkit-overflow-scrolling:touch}
.ux-facet-chip{flex:0 0 auto;border:1px solid #dbe3ef;border-radius:999px;background:#fff;color:#26364e;font-size:12px;font-weight:700;white-space:nowrap;display:inline-flex;align-items:center;justify-content:center;padding:9px 15px;min-height:44px}
.ux-facet-chip:hover,.ux-facet-chip:focus-visible,.ux-facet-chip.is-selected{border-color:#9cb7ff;background:#e9f0ff;color:#1747cc}
.ux-feed-city{display:inline}
.ux-account-mode{display:flex;align-items:stretch;gap:4px;padding:4px;border:1px solid #dfe5f1;background:#f7f9ff;border-radius:15px;margin:10px 0 16px;max-width:480px}
.ux-account-mode a{display:grid;place-items:center;flex:1;min-height:46px;padding:10px 12px;font-size:14px;font-weight:760;border-radius:11px;color:#53627b;text-align:center}
.ux-account-mode a[aria-current=page]{color:#1747cc;background:#fff;box-shadow:0 2px 9px #304c8315}
.ux-mobile-booking-cta{display:none}

/* The dialog is real UI: native <dialog> isolates background and restores focus. */
.ux-period-dialog{width:min(525px,calc(100vw - 26px));max-height:min(90dvh,750px);padding:0;border-radius:22px;border:1px solid #dbe2f0;box-shadow:0 26px 90px #1324426a;background:#fff;color:#172238}
.ux-period-dialog[open]{display:flex;flex-direction:column}
.ux-period-dialog::backdrop{background:rgba(12,25,48,.63);backdrop-filter:blur(4px)}
.ux-period-dialog-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;padding:20px 20px 5px}
.ux-period-dialog-head h2{margin:0;font-size:26px;letter-spacing:-.04em}
.ux-icon-button{border:1px solid #dbe2ef;display:grid;place-items:center;min-width:44px;min-height:44px;border-radius:12px;background:#fff;color:#28354c;font-size:20px}
.ux-dialog-description{margin:0;padding:4px 20px 15px;color:#56647a;font-size:13px;line-height:1.5}
.ux-period-dialog-body{overflow-y:auto;min-height:0;overscroll-behavior:contain;padding:0 20px 15px;flex:1}
.ux-period-dialog fieldset{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px;border:1px solid #dce5f5;background:#f9fbff;border-radius:15px;padding:12px 14px;margin:0 0 10px;min-width:0}
.ux-period-dialog legend{font-size:15px;font-weight:800;color:#233452;padding:0 5px}
.ux-period-dialog label{font-size:12px;font-weight:730;color:#45556e;display:grid;gap:6px;min-width:0}
.ux-period-dialog input{box-sizing:border-box;min-height:45px;width:100%;min-width:0;border-radius:10px;border:1px solid #cbd7e9;background:#fff;color:#1e2940;padding:8px;font-size:15px}
.ux-period-dialog .ux-period-rule{font-size:12px;color:#586981;line-height:1.5;margin:10px 0}
.ux-period-error{color:#a32a27;font-weight:700;font-size:13px;padding:10px 12px;border-radius:9px;background:#fff0ef;margin:8px 0}
.ux-period-error[hidden]{display:none}
.ux-period-dialog-foot{display:flex;gap:10px;justify-content:stretch;background:#fff;border-top:1px solid #e3e8f1;padding:13px 20px max(14px,env(safe-area-inset-bottom))}
.ux-period-dialog-foot button{min-height:49px;border-radius:12px;font-size:14px;font-weight:790;flex:1}
.ux-primary{background:#2457F5;border:1px solid #2457F5;color:#fff}
.ux-secondary{background:#f3f6fc;border:1px solid #dce4ef;color:#24426d}
.ux-period-dialog :focus-visible,.ux-facet-chip:focus-visible,.ux-account-mode a:focus-visible,.ux-period-trigger:focus-visible,.market-tabbar a:focus-visible{outline:3px solid #ff9a50;outline-offset:2px}

/* Approved five-item, consistent vector bottom navigation. */
.market-tabbar .tab-icon{display:grid;place-items:center;width:27px;height:27px}
.market-tabbar .tab-icon svg{width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.market-tabbar a.tab-new .tab-icon{width:36px;height:36px}
.market-tabbar a.tab-new .tab-icon svg{width:23px;height:23px;stroke-width:2.2}
.market-tabbar a[aria-current=page]{font-weight:800}
.market-listing .market-listing-info h3,.market-listing .market-listing-link h3{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;overflow:hidden}
.market-listing-price,.market-listing-info .market-listing-price{white-space:normal}

@media(max-width:1023px){
 .market-tabbar{display:grid!important;grid-template-columns:repeat(5,minmax(0,1fr));padding-bottom:max(7px,env(safe-area-inset-bottom));height:calc(70px + env(safe-area-inset-bottom));z-index:80}
 .market-tabbar a{min-width:0;min-height:58px;gap:2px;font-size:11px;display:flex;align-items:center;flex-direction:column;justify-content:center;padding:4px 2px}
 .market-tabbar a>span:last-of-type{font-size:11px;line-height:1.2}
 body{padding-bottom:calc(78px + env(safe-area-inset-bottom))}
 .footer{margin-bottom:0}
}
@media(min-width:761px) and (max-width:1023px){
 .market-listings{grid-template-columns:repeat(3,minmax(0,1fr))}
 .ux-subcategory-section{margin-top:17px}
 .ux-home-heading h1{font-size:27px}
}
@media(max-width:760px){
 .shell{width:calc(100% - 28px)}
 .topline{display:none}
 .header-line{min-height:58px}
 .header .city-pill{display:flex!important;align-items:center;min-height:44px;max-width:120px}
 .header .theme-toggle{min-width:44px;min-height:44px}
 .brand-descriptor{font-size:10px;max-width:125px;line-height:1.16}
 .ux-home{margin:8px 0 0}
 .ux-home-heading h1{font-size:21px;line-height:1.18;margin:0 0 9px}
 .ux-home-kicker{font-size:9px}
 .market-search-main{display:grid!important;grid-template-columns:minmax(0,1fr) 44px 62px!important;gap:7px}
 .market-query,.market-search-btn,.market-filter-toggle{height:46px!important;min-height:46px!important}
 .market-query{min-width:0}
 .market-query input{font-size:16px!important}
 .market-query input::placeholder{font-size:13px}
 .market-filter-toggle{padding:0!important;width:44px!important;display:grid;place-items:center}
 .market-search-btn{width:62px!important;font-size:13px}
 .market-filters-panel{top:52px}
 .ux-period-trigger{min-height:51px;padding:7px 10px;margin-top:8px}
 .ux-period-trigger-icon{width:34px;height:34px}
 .ux-period-trigger-copy strong{font-size:12px}
 .ux-period-trigger-copy small{font-size:11px}
 .ux-subcategory-section{margin:11px 0 5px}
 .ux-subcategory-heading h2{font-size:16px}
 .ux-subcategory-rail{gap:6px;margin-right:-14px;padding-right:14px}
 .ux-facet-chip{font-size:12px;min-height:44px;padding:8px 13px}
 .market-categories{margin-top:7px!important}
 .market-category-rail{margin-right:-14px;padding-right:14px}
 .market-category-rail .market-group{min-height:82px!important;flex-basis:84px!important;border-radius:15px!important;padding:6px 4px!important;gap:4px!important;font-size:10px!important}
 .market-category-rail .market-group-icon{height:39px!important;width:39px!important;font-size:20px!important;border-radius:10px!important}
 .market-feed{margin-top:8px}
 .market-feed-title{margin-bottom:7px}
 .ux-feed-city{display:none}
 .market-listing .market-listing-info{padding:9px}
 .market-listing .market-listing-info h3{font-size:12px!important;line-height:1.28;min-height:31px}
 .market-listing .market-listing-price{font-size:15px!important}
 .market-listing .market-listing-owner,.market-listing .market-listing-deposit{font-size:10px}
 .market-listings{grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
 .ux-account-mode{margin:8px 0 11px}
 .detail-layout{padding-bottom:calc(71px + env(safe-area-inset-bottom))}
 .ux-mobile-booking-cta{display:flex;position:fixed;bottom:calc(70px + env(safe-area-inset-bottom));left:0;right:0;z-index:75;min-height:55px;background:#2457f5;color:#fff;align-items:center;justify-content:space-between;padding:12px max(18px,env(safe-area-inset-left));font-size:14px;font-weight:800;box-shadow:0 -7px 25px rgba(30,64,150,.16)}
 #vrental-booking{scroll-margin-top:80px}
}
@media(max-width:560px){
 .ux-period-dialog{width:100%;height:min(94dvh,700px);max-height:94dvh;border-radius:20px 20px 0 0;margin:auto 0 0 0;max-width:100vw}
 .ux-period-dialog-head{padding:18px 15px 3px}
 .ux-dialog-description{padding:3px 15px 12px}
 .ux-period-dialog-body{padding:0 15px 12px}
 .ux-period-dialog-foot{padding:10px 15px max(12px,env(safe-area-inset-bottom))}
 .ux-period-dialog fieldset{padding:10px;gap:8px}
 .ux-period-dialog input{font-size:16px}
}
@media(max-width:340px){
 .brand-descriptor{font-size:9px;max-width:90px}
 .header .city-pill{max-width:64px}
 .ux-period-dialog-head h2{font-size:23px}
 .ux-period-dialog fieldset{grid-template-columns:1fr}
 .market-tabbar a>span:last-of-type{font-size:10px}
}
@media(prefers-reduced-motion:reduce){
 .ux-period-trigger,.ux-facet-chip,.ux-account-mode a{transition:none}
}
body[data-theme="dark"] .ux-period-trigger,body[data-theme="dark"] .ux-period-dialog,body[data-theme="dark"] .ux-period-dialog-foot{background:#1a2438;color:#eef3ff;border-color:#45577e}
body[data-theme="dark"] .ux-period-dialog fieldset,body[data-theme="dark"] .ux-account-mode{background:#25324c;border-color:#45577e}
body[data-theme="dark"] .ux-facet-chip,body[data-theme="dark"] .ux-icon-button,body[data-theme="dark"] .ux-period-dialog input{background:#263550;color:#ecf2ff;border-color:#536788}
body[data-theme="dark"] .ux-period-trigger-copy small,body[data-theme="dark"] .ux-dialog-description,body[data-theme="dark"] .ux-period-rule,body[data-theme="dark"] .ux-period-dialog label{color:#c9d7f2}
body[data-theme="dark"] .ux-home-heading h1,body[data-theme="dark"] .ux-subcategory-heading h2,body[data-theme="dark"] .ux-period-dialog-head h2,body[data-theme="dark"] .ux-period-dialog legend{color:#f3f6ff}

/* CMEA tablet P0: hidden desktop links must be replaced by a FIXED,
   discoverable lower navigation even at 768–1023 px, not a footer-only nav. */
@media (min-width:761px) and (max-width:1023px){
  .market-tabbar{
    display:grid!important;position:fixed!important;bottom:0!important;left:0;right:0;
    margin:0;width:100%;height:calc(70px + env(safe-area-inset-bottom));
    background:#fff;border-top:1px solid #dce3ee;z-index:80;
  }
}
/* CMEA compact 320×568: make first listing visible before the bottom nav. */
@media (max-width:340px) and (max-height:650px){
  .ux-home-kicker{display:none}
  .ux-home-heading{margin:0 0 4px}
  .ux-home-heading h1{font-size:19px;margin-bottom:4px}
  .ux-subcategory-section{margin:6px 0 3px}
  .ux-subcategory-heading{margin-bottom:3px}
  .market-categories{margin-top:2px!important}
  .market-category-rail .market-group{min-height:63px!important;padding:3px 2px!important;gap:3px!important}
  .market-category-rail .market-group-icon{width:31px!important;height:31px!important;font-size:16px!important}
  .market-feed{margin-top:4px}
}
