/* ===== Launch layout: mobile app + real desktop site ===== */

/* Full-height app shell — kills mid-screen floating tabbar */
html, body {
  min-height: 100%;
  min-height: 100dvh;
}
.app-shell {
  min-height: 100dvh !important;
  padding: 0 !important;
  display: block !important;
  background: var(--chrome-bar, #0B0B0B) !important;
}
.desk-panel { display: none !important; }

.phone {
  width: 100% !important;
  max-width: 100% !important;
  min-height: 100dvh !important;
  max-height: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  position: relative !important;
  top: auto !important;
  overflow: visible !important;
  display: flex !important;
  flex-direction: column !important;
  background: var(--bg, #F7F5F3);
}
body[data-mode="night"] .phone {
  background: #0B0F14;
}
body[data-mode="day"] .phone,
body[data-mode="night"] .phone {
  background-color: var(--bg, #F7F5F3);
}
body[data-mode="night"] .phone {
  background-color: #0B0F14 !important;
}

#app {
  flex: 1 1 auto !important;
  display: flex !important;
  flex-direction: column !important;
  min-height: 100dvh !important;
  width: 100% !important;
  box-sizing: border-box !important;
  /* room for fixed bottom tabbar on mobile */
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
  overflow: visible !important;
}

/* Desktop header — hidden on mobile */
.desk-header { display: none !important; }

/* ---- Mobile / tablet tabbar: FIXED to bottom ---- */
.tabbar,
body[data-theme="clean"] .tabbar,
body[data-mode] .tabbar {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  top: auto !important;
  width: 100% !important;
  margin: 0 !important;
  z-index: 900 !important;
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  align-items: end !important;
  column-gap: 6px !important;
  padding: 14px 12px calc(8px + env(safe-area-inset-bottom, 0px)) !important;
  height: auto !important;
  min-height: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
  overflow: visible !important;
  box-sizing: border-box !important;
}
.tabbar a.tab {
  min-width: 0 !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 6px 4px !important;
  gap: 3px !important;
  overflow: visible !important;
  box-sizing: border-box !important;
}
.tabbar a.tab span {
  font-size: 11px !important;
  line-height: 1.15 !important;
  white-space: nowrap !important;
}
body[data-tabs="ring"] .tabbar a.tab.active:not(.post-tab),
body:not([data-tabs]) .tabbar a.tab.active:not(.post-tab),
body[data-tabs="shadow"] .tabbar a.tab.active:not(.post-tab) {
  transform: translateY(-1px) scale(1.02) !important;
}
.tabbar a.tab:active:not(.post-tab),
.tabbar a.tab.tab-pressed:not(.post-tab) {
  transform: translateY(-2px) scale(1.06) !important;
}
.tabbar a.tab.post-tab {
  justify-content: flex-end !important;
  gap: 5px !important;
  padding-bottom: 2px !important;
  overflow: visible !important;
}
.tabbar a.tab.post-tab .post-fab,
body[data-theme="clean"] .post-fab,
body[data-mode] .tabbar .post-tab .post-fab {
  width: 50px !important;
  height: 50px !important;
  margin-top: -18px !important;
  flex-shrink: 0 !important;
}
.tabbar a.tab.post-tab span {
  display: block !important;
  font-weight: 750 !important;
}
body[data-tabs="ring"] .tabbar a.post-tab.active .post-fab,
body:not([data-tabs]) .tabbar a.post-tab.active .post-fab {
  transform: translateY(-1px) scale(1.03) !important;
}

/* Screens fill space above fixed tabbar */
.screen, .legal, .map-home {
  flex: 1 1 auto;
  width: 100%;
  box-sizing: border-box;
}
.screen, .legal {
  padding-bottom: 24px !important;
}
body[data-theme="clean"] .screen {
  padding-bottom: 24px !important;
}

/* Empty list state */
.empty-state {
  text-align: center;
  padding: 48px 24px 32px;
  max-width: 360px;
  margin: 0 auto;
}
.empty-state h2 {
  margin: 0 0 8px;
  font-size: 20px;
  letter-spacing: -0.02em;
}
.empty-state p {
  margin: 0 0 20px;
  color: var(--muted, #8E8E93);
  font-size: 15px;
  line-height: 1.45;
}
.empty-state .btn { min-width: 180px; }

/* Map floats — keep search clear of (i) */
.map-home .map-brand-float {
  top: calc(36px + env(safe-area-inset-top, 0px)) !important;
  z-index: 620;
}
.map-home .map-mode-float {
  top: calc(32px + env(safe-area-inset-top, 0px)) !important;
  z-index: 620;
}
.map-home .map-search-float {
  top: calc(92px + env(safe-area-inset-top, 0px)) !important;
  left: 12px !important;
  right: 12px !important;
  z-index: 615;
}
body[data-theme="clean"] .map-attr {
  top: auto !important;
  bottom: calc(44% + 70px) !important;
  right: 14px !important;
  z-index: 640 !important;
}
@media (max-width: 899.98px) {
  body[data-theme="clean"] .map-attr {
    top: auto !important;
    bottom: calc(42% + 64px) !important;
  }
  .map-home.sheet-open ~ nothing { }
  .map-home.sheet-open .map-attr,
  body[data-theme="clean"] .map-home.sheet-open .map-attr {
    bottom: calc(68% + 64px) !important;
  }
}

@media (min-width: 600px) and (max-width: 899.98px) {
  .tabbar {
    padding-left: 20px !important;
    padding-right: 20px !important;
    column-gap: 10px !important;
  }
}

/* ===== Desktop website (>=900px) ===== */
@media (min-width: 900px) {
  :root {
    --desk-header-h: 72px;
    --desk-side: 380px;
  }

  body[data-mode="day"] .phone,
  body[data-mode="night"] .phone,
  body[data-mode="day"] .app-shell,
  body[data-mode="night"] .app-shell {
    background-color: var(--chrome-bar, #0B0B0B) !important;
  }
  body[data-mode="day"] .phone { background-color: #F7F5F3 !important; }
  body[data-mode="night"] .phone { background-color: #0B0F14 !important; }

  #app {
    padding-bottom: 0 !important;
    min-height: 100dvh !important;
  }

  /* Show desktop header */
  .desk-header {
    display: block !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 950 !important;
    background: #111111 !important;
    color: #fff !important;
    box-shadow: 0 3px 0 0 #E63946 !important;
    flex-shrink: 0 !important;
  }
  body[data-mode="night"] .desk-header {
    background: #000000 !important;
  }
  .desk-header-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 28px;
    min-height: var(--desk-header-h);
    max-width: 1440px;
    margin: 0 auto;
    box-sizing: border-box;
  }
  .desk-logo {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 999px;
    padding: 6px 14px;
    border: 2px solid #0A0A0A;
    box-shadow: 3px 3px 0 #E63946;
  }
  body[data-mode="night"] .desk-logo {
    border-color: #E63946;
  }
  .desk-logo .brand-wordmark { height: 26px !important; width: auto; display: block; }
  .desk-search {
    flex: 1 1 auto;
    min-width: 180px;
    max-width: 420px;
  }
  .desk-search .map-search {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border-radius: 999px;
    padding: 10px 16px;
    border: 2px solid #0A0A0A;
    box-shadow: 2px 2px 0 #E63946;
  }
  body[data-mode="night"] .desk-search .map-search {
    background: #161a20;
    border-color: #E63946;
    color: #E8ECF0;
  }
  .desk-search input {
    border: 0;
    outline: 0;
    width: 100%;
    background: transparent;
    font-size: 14px;
    font-weight: 550;
    color: inherit;
  }
  .desk-mode {
    flex: 0 0 auto;
  }
  .desk-mode .mode-chooser { margin: 0; }
  .desk-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    margin-left: auto;
  }
  .desk-nav a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    color: #E8ECF0;
    text-decoration: none;
    border: 2px solid transparent;
  }
  .desk-nav a:hover {
    background: rgba(255,255,255,0.08);
  }
  .desk-nav a.active {
    background: #E63946 !important;
    color: #fff !important;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.2);
  }
  .desk-nav a.desk-post {
    background: #E63946;
    color: #fff !important;
    border-color: #fff;
  }
  .desk-nav a.desk-post:not(.active) {
    box-shadow: 2px 2px 0 rgba(0,0,0,0.35);
  }
  .desk-nav a svg { width: 18px; height: 18px; }

  /* Hide mobile bottom tabbar on desktop */
  .tabbar,
  body[data-theme="clean"] .tabbar,
  body[data-mode] .tabbar {
    display: none !important;
  }

  /* Hide mobile map chrome floats — header has logo/search/mode */
  .map-home .map-brand-float,
  .map-home .map-mode-float,
  .map-home .map-search-float {
    display: none !important;
  }

  /* Map: large right + Nearby sales left panel */
  .map-home {
    position: relative !important;
    flex: 1 1 auto !important;
    min-height: calc(100dvh - var(--desk-header-h) - 3px) !important;
    height: calc(100dvh - var(--desk-header-h) - 3px) !important;
    border-radius: 0 !important;
    overflow: hidden !important;
  }
  .map-home-banner {
    display: none !important; /* header already has black+red chrome */
  }
  .home-map,
  #homeMap {
    position: absolute !important;
    top: 0 !important;
    left: var(--desk-side) !important;
    right: 0 !important;
    bottom: 0 !important;
    width: auto !important;
    height: auto !important;
    inset: 0 0 0 var(--desk-side) !important;
  }
  .bottom-sheet,
  body[data-theme="clean"] .bottom-sheet,
  .bottom-sheet.expanded,
  body[data-theme="clean"] .bottom-sheet.expanded {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: auto !important;
    bottom: 0 !important;
    width: var(--desk-side) !important;
    max-height: none !important;
    height: 100% !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    border-right: 1px solid rgba(0,0,0,0.08) !important;
    z-index: 640 !important;
    padding-top: 8px !important;
  }
  body[data-mode="night"] .bottom-sheet {
    border-right-color: rgba(255,255,255,0.08) !important;
  }
  .sheet-handle { display: none !important; }

  /* (i) on the map, clear of anything */
  body[data-theme="clean"] .map-attr,
  .map-attr {
    top: 16px !important;
    bottom: auto !important;
    right: 16px !important;
    left: auto !important;
  }
  .locate-btn,
  .map-home.sheet-open .locate-btn {
    right: 20px !important;
    bottom: 24px !important;
  }
  .pin-card-slot,
  .map-home.sheet-open .pin-card-slot {
    left: calc(var(--desk-side) + 16px) !important;
    right: auto !important;
    width: min(360px, calc(100% - var(--desk-side) - 48px)) !important;
    bottom: 24px !important;
  }

  /* List / Shop / Profile / sale: centered full-width site pages */
  .screen, .legal {
    width: 100% !important;
    max-width: 960px !important;
    margin: 0 auto !important;
    padding: 28px 32px 48px !important;
    box-sizing: border-box !important;
    flex: 1 1 auto;
  }
  .empty-state { padding-top: 72px; }

  .install-banner {
    left: 24px !important;
    right: auto !important;
    width: min(400px, calc(100vw - 48px)) !important;
    bottom: 24px !important;
  }
}

@media (min-width: 1280px) {
  :root { --desk-side: 420px; }
  .desk-header-inner { padding-left: 40px; padding-right: 40px; }
  .screen, .legal { max-width: 1040px !important; }
}
@media (min-width: 1440px) {
  :root { --desk-side: 440px; }
}


/* Map page: tabbar overlays map — no beige gap under fixed bar */
#app:has(.map-home) {
  padding-bottom: 0 !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  overflow: hidden !important;
}
.map-home {
  flex: 1 1 auto !important;
  min-height: 100dvh !important;
  height: 100dvh !important;
  position: relative !important;
}
/* Keep (i) clear of search on phone — sit above bottom sheet, not under search */
body[data-mode] .map-attr,
body[data-theme="clean"] .map-attr {
  top: auto !important;
  bottom: calc(38% + 56px) !important;
  right: 14px !important;
  left: auto !important;
  z-index: 640 !important;
}
.map-home.sheet-open .map-attr,
body[data-theme="clean"] .map-home.sheet-open .map-attr,
body[data-mode] .map-home.sheet-open .map-attr {
  bottom: calc(68% + 56px) !important;
}

/* Beat styles.css phone frame + modern sticky tabbar */
@media (min-width: 900px) {
  .app-shell {
    display: block !important;
    padding: 0 !important;
    align-items: stretch !important;
    gap: 0 !important;
    background: var(--chrome-bar, #0B0B0B) !important;
  }
  .phone {
    max-width: 100% !important;
    width: 100% !important;
    min-height: 100dvh !important;
    max-height: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
    position: relative !important;
    top: auto !important;
    box-shadow: none !important;
  }
  .desk-panel { display: none !important; }
  body[data-theme="clean"] .tabbar {
    display: none !important;
    position: fixed !important;
  }
  #app:has(.map-home) {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
  .map-home {
    min-height: calc(100dvh - var(--desk-header-h, 72px) - 3px) !important;
    height: calc(100dvh - var(--desk-header-h, 72px) - 3px) !important;
  }
  body[data-mode] .map-attr,
  body[data-theme="clean"] .map-attr {
    top: 16px !important;
    bottom: auto !important;
    right: 16px !important;
  }
  .map-home.sheet-open .map-attr,
  body[data-theme="clean"] .map-home.sheet-open .map-attr,
  body[data-mode] .map-home.sheet-open .map-attr {
    top: 16px !important;
    bottom: auto !important;
  }
}

/* Empty-state CTA polish */
.empty-state .btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 180px;
  padding: 12px 20px;
  border-radius: 14px;
  background: #E63946 !important;
  color: #fff !important;
  font-weight: 750;
  text-decoration: none;
  border: 2px solid #0A0A0A;
  box-shadow: 3px 3px 0 #0A0A0A;
}
body[data-mode="night"] .empty-state .btn-primary {
  border-color: #E63946;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.45);
}
