/* Mobile menu hard fix (cache-safe standalone file) */

/* Default: desktop keeps sidebar; dock hidden */
.rq-dock { display: none; }

/* iPad / laptop / mid desktop: hamburger so content isn't squeezed by permanent sidebar */
@media (max-width: 1600px) {
  /* Force hamburger mode on tablet / iPad landscape / smaller laptops */
  body .rq-hamburger { display: flex !important; }
  body .rq-main { margin-left: 0 !important; }
  body .rq-app { display: block !important; max-width: none !important; }

  /* Sidebar above Leaflet maps (default panes are 200–700) */
  body .rq-sidebar {
    display: none !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: min(88vw, 400px) !important;
    z-index: 10050 !important;
    overflow-y: auto !important;
    background: #F4F5F7 !important;
  }
  body .rq-sidebar.is-open {
    display: flex !important;
    box-shadow: 4px 0 24px rgba(0,0,0,0.18) !important;
  }

  /* Overlay must appear above content, below sidebar */
  body .rq-sidebar-overlay.is-visible { display: block !important; z-index: 10040 !important; }

  /* Floating dock: always centered; width animates expand ↔ shrink */
  body .rq-dock {
    display: flex !important;
    position: fixed !important;
    left: 50% !important;
    right: auto !important;
    bottom: calc(0.95rem + env(safe-area-inset-bottom)) !important;
    z-index: 10000 !important;
    width: min(520px, calc(100vw - 1.7rem)) !important;
    max-width: calc(100vw - 1.7rem) !important;
    background: #fff !important;
    border: 1px solid #E5E7EB !important;
    border-radius: 20px !important;
    padding: 0.3rem 0.45rem !important;
    justify-content: space-between !important;
    align-items: center !important;
    box-shadow: 0 10px 28px rgba(0,0,0,0.14) !important;
    overflow: visible !important;
    min-height: 56px !important;
    height: 56px !important;
    box-sizing: border-box !important;
    transform: translate3d(-50%, 0, 0) !important;
    will-change: width, height, border-radius, padding !important;
    transition:
      width .42s cubic-bezier(0.22, 1, 0.36, 1),
      max-width .42s cubic-bezier(0.22, 1, 0.36, 1),
      height .42s cubic-bezier(0.22, 1, 0.36, 1),
      min-height .42s cubic-bezier(0.22, 1, 0.36, 1),
      padding .42s cubic-bezier(0.22, 1, 0.36, 1),
      border-radius .42s cubic-bezier(0.22, 1, 0.36, 1),
      bottom .42s cubic-bezier(0.22, 1, 0.36, 1),
      box-shadow .42s ease !important;
  }
  body .dock-link {
    font-size: 0.58rem !important;
    padding: 0 !important;
    gap: 2px !important;
    justify-content: center !important;
    align-items: center !important;
    height: 100% !important;
    flex: 1 1 0 !important;
    min-width: 0 !important;
  }
  body .dock-link svg {
    width: 17px !important;
    height: 17px !important;
    transition: width .36s cubic-bezier(0.22, 1, 0.36, 1), height .36s cubic-bezier(0.22, 1, 0.36, 1) !important;
  }
  body .dock-link > span:not(.dock-plus) {
    display: block !important;
    opacity: 1 !important;
    max-height: 1.25em !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    transform: translateY(0) !important;
    transition:
      opacity .28s ease,
      max-height .36s cubic-bezier(0.22, 1, 0.36, 1),
      transform .36s cubic-bezier(0.22, 1, 0.36, 1) !important;
  }
  body .dock-link--new {
    flex: 0 0 44px !important;
    width: 44px !important;
    height: 44px !important;
    top: 0 !important;
    position: relative !important;
    margin: 0 !important;
    align-self: center !important;
    border-radius: 999px !important;
    background: #2563EB !important;
    color: #fff !important;
    border: 3px solid #fff !important;
    box-shadow: 0 6px 18px rgba(37,99,235,0.32) !important;
    padding: 0 !important;
    z-index: 10001 !important;
    transition:
      width .42s cubic-bezier(0.22, 1, 0.36, 1),
      height .42s cubic-bezier(0.22, 1, 0.36, 1),
      flex-basis .42s cubic-bezier(0.22, 1, 0.36, 1),
      border-width .42s cubic-bezier(0.22, 1, 0.36, 1),
      box-shadow .42s ease !important;
  }
  body .dock-plus {
    display: block !important;
    font-size: 24px !important;
    line-height: 1 !important;
    font-weight: 500 !important;
    color: #fff !important;
    transform: none !important;
    transition: font-size .42s cubic-bezier(0.22, 1, 0.36, 1) !important;
  }

  /* Compact pill — same center axis, only size changes */
  body .rq-dock.is-compact {
    width: min(268px, calc(100vw - 4.5rem)) !important;
    max-width: 268px !important;
    padding: 0.18rem 0.5rem !important;
    border-radius: 999px !important;
    min-height: 46px !important;
    height: 46px !important;
    bottom: calc(1.15rem + env(safe-area-inset-bottom)) !important;
    justify-content: space-evenly !important;
    box-shadow: 0 12px 30px rgba(0,0,0,0.16) !important;
  }
  body .rq-dock.is-compact .dock-link > span:not(.dock-plus) {
    opacity: 0 !important;
    max-height: 0 !important;
    transform: translateY(4px) !important;
    pointer-events: none !important;
  }
  body .rq-dock.is-compact .dock-link {
    flex: 1 1 0 !important;
    padding: 0 !important;
  }
  body .rq-dock.is-compact .dock-link svg {
    width: 16px !important;
    height: 16px !important;
  }
  body .rq-dock.is-compact .dock-link--new {
    top: 0 !important;
    width: 34px !important;
    height: 34px !important;
    flex: 0 0 34px !important;
    border-width: 2px !important;
  }
  body .rq-dock.is-compact .dock-plus {
    display: block !important;
    font-size: 20px !important;
    line-height: 1 !important;
    color: #fff !important;
    opacity: 1 !important;
  }

  /* Dashboard: stack before gauges/car become unreadable */
  body .trk-top-grid { grid-template-columns: 1fr !important; }
  body .trk-hero-inner { grid-template-columns: 1fr !important; }
  body .trk-right-col { flex-direction: row !important; }
  body .trk-right-col .trk-card { flex: 1 !important; min-width: 0 !important; }
  body .trk-bottom-grid { grid-template-columns: 1fr !important; gap: 12px !important; }
  body .trk-hero { min-height: 0 !important; padding: 18px 18px 0 !important; }
  body .trk-hero-header { padding-right: 0 !important; }
  body .trk-hero-left { padding-right: 0 !important; }
  body .trk-hero-right {
    margin-top: 12px !important;
    border-left: 0 !important;
    border-top: 1px solid #EEF2F7 !important;
    border-radius: 12px !important;
  }
  body .trk-gauges { flex-wrap: wrap !important; justify-content: center !important; }

  /* Dashboard mobile readability */
  body .trk-driver-grid { grid-template-columns: 1fr !important; gap: 8px !important; }
  body .trk-charge-row {
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    align-items: start !important;
    gap: 6px !important;
  }
  body .trk-charge-lbl { font-size: 11px !important; line-height: 1.25 !important; }
  body .trk-charge-val {
    font-size: 11.5px !important;
    text-align: right !important;
    max-width: 46vw !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
  body .trk-card { padding: 14px !important; }
  body .trk-wrap,
  body .trk-wrap--page {
    padding-bottom: calc(6rem + env(safe-area-inset-bottom)) !important;
  }
}

/* Narrower tablets: keep gauges readable while stacked */
@media (max-width: 900px) {
  body .trk-gauges { gap: 12px !important; }
  body .trk-gauge { min-width: 120px !important; }
  body .trk-gauge-svg { width: 120px !important; height: 120px !important; }
  body .trk-car-img { max-width: 100% !important; }
}
