html,
body {
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
}

.mobile-sidebar-open,
.mobile-sidebar-close,
.mobile-sidebar-overlay {
  display: none;
}

/* =========================
   DESKTOP
   ========================= */

@media (min-width: 992px) {
  body {
    overflow: hidden;
  }

  .app-shell,
  .app-frame,
  .app-frame > .row {
    height: 100vh;
  }

  .sidebar {
    position: relative;
    width: var(--sidebar-w);
    max-width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    transform: none;
  }

  .main-panel {
    height: 100vh;
  }

  .map-layout {
    height: calc(100vh - var(--header-h));
  }

  .map-card {
    height: 100%;
    border-radius: 0;
    border: 0;
  }

  #map {
    width: 100%;
    height: 100%;
  }
}

/* =========================
   TABLET + MOBILE DRAWER
   ========================= */

@media (max-width: 991.98px) {
  body {
    overflow-y: auto;
  }

  body.sidebar-open {
    overflow: hidden !important;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
    padding: 0;
  }

  .app-frame {
    height: auto;
    min-height: 100vh;
    overflow: visible;
    border-radius: 0;
  }

  .app-frame > .row {
    height: auto !important;
  }

  .main-panel {
    width: 100%;
    max-width: 100%;
    flex: 0 0 100%;
    height: auto;
    min-height: 0;
  }

  .topbar {
    height: auto;
    min-height: 68px;
    padding: 14px 16px;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 12px;
  }

  .topbar-left {
    flex: 1;
    min-width: 0;
  }

  .page-eyebrow {
    font-size: 10px;
  }

  .page-title {
    font-size: 22px;
  }

  .mobile-sidebar-open {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    padding: 0 14px;
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 8px;
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    flex-shrink: 0;
  }

  .mobile-sidebar-close {
    display: inline-flex;
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 8px;
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-size: 24px;
    line-height: 1;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
  }

  .mobile-sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.25s ease;
    z-index: 1998;
  }

  .mobile-sidebar-overlay.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 86%;
    max-width: 360px;
    height: 100dvh;
    min-height: 100dvh;
    z-index: 1999;
    overflow: hidden;
    transform: translateX(-105%);
    transition: transform 0.28s ease;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-top {
    position: relative;
    padding: 14px 58px 14px 14px;
  }

  .brand-box {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 10px;
  }

  .brand-title {
    padding-right: 14px;
  }

  .brand-title img {
    width: 130px !important;
  }

  .brand-subtitle {
    margin-left: 0;
    font-size: 11px;
  }

  .sidebar-section {
    padding: 14px;
  }

  .search-input,
  .state-filter {
    height: 44px;
  }

  .store-list {
    max-height: calc(100dvh - 300px);
    padding: 12px 14px;
  }

  .map-layout {
    display: block;
    width: 100%;
    height: calc(100dvh - 68px);
    min-height: 520px;
    padding: 0;
    overflow: hidden;
  }

  .map-card {
    width: 100%;
    height: 100%;
    min-height: 520px;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  #map,
  .leaflet-container {
    width: 100% !important;
    height: 100% !important;
    min-height: 520px;
  }
}

/* =========================
   MOBILE
   ========================= */

@media (max-width: 575.98px) {
  .mobile-sidebar-open {
    height: 36px;
    padding: 0 12px;
    font-size: 13px;
  }

  .topbar {
    padding: 12px;
    min-height: 62px;
  }

  .page-title {
    font-size: 20px;
  }

  .sidebar {
    width: 90%;
    max-width: 340px;
  }

  .sidebar-top {
    padding: 12px 56px 12px 12px;
  }

  .brand-box {
    padding: 10px;
  }

  .brand-title {
    width: auto;
    padding-right: 12px;
    border-right: 1px solid rgba(255,255,255,0.35);
  }

  .brand-title img {
    width: 115px !important;
  }

  .brand-subtitle {
    font-size: 10px;
    line-height: 1.4;
  }

  .sidebar-section {
    padding: 12px;
  }

  .sidebar-label {
    font-size: 10px;
  }

  .search-input {
    height: 44px;
    font-size: 12px;
    padding: 0 44px 0 12px;
  }

  .search-btn {
    right: 6px;
    width: 32px;
    height: 32px;
  }

  .filter-row {
    display: block;
    margin-top: 10px;
  }

  .state-filter {
    width: 100%;
    height: 44px;
    font-size: 13px;
    padding: 0 42px 0 12px;
    background-position: right 14px center;
  }

  .count-card {
    padding: 12px;
    margin-top: 12px;
  }

  .count-value {
    font-size: 20px;
  }

  .store-list {
    max-height: calc(100dvh - 285px);
    padding: 10px 12px 12px;
  }

  .store-card {
    padding: 12px;
    margin-bottom: 10px;
  }

  .store-card-top {
    gap: 10px;
  }

  .store-name {
    font-size: 15px;
  }

  .store-meta {
    font-size: 12px;
    line-height: 1.5;
  }

  .store-footer {
    margin-top: 10px;
  }

  .store-badge {
    font-size: 11px;
    padding: 6px 9px;
  }

  .store-arrow {
    width: 30px;
    height: 30px;
    font-size: 14px;
  }

  .map-layout {
    height: calc(100dvh - 62px);
    min-height: 470px;
  }

  .map-card {
    min-height: 470px;
  }

  #map,
  .leaflet-container {
    min-height: 470px;
  }

  .popup-card {
    min-width: 230px;
    padding: 14px;
  }

  .popup-title {
    font-size: 16px;
  }

  .popup-text {
    font-size: 12px;
  }

  .pin-marker img {
    width: 36px !important;
  }
}

/* =========================
   VERY SMALL MOBILE
   ========================= */

@media (max-width: 380px) {
  .brand-title {
    border-right: 0;
    padding-right: 0;
  }

  .brand-subtitle {
    width: 100%;
  }

  .store-list {
    max-height: calc(100dvh - 275px);
  }

  .map-layout {
    min-height: 430px;
  }

  .map-card,
  #map,
  .leaflet-container {
    min-height: 430px;
  }
}



@media (max-width: 991.98px) {
  .main-panel {
    height: 100dvh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
  }

  .topbar {
    height: 68px;
    min-height: 68px;
    flex-shrink: 0;
  }

  .map-layout {
    flex: 1 1 auto;
    height: calc(100dvh - 68px);
    min-height: 0;
    padding: 0;
    overflow: hidden;
  }

  .map-card {
    width: 100%;
    height: 100%;
    min-height: 0;
    border-radius: 0;
  }

  #map,
  .leaflet-container {
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
  }
}

@media (max-width: 575.98px) {
  .topbar {
    height: 62px;
    min-height: 62px;
  }

  .map-layout {
    height: calc(100dvh - 62px);
  }

  .map-layout {
  height: 620px;
}

.map-layout {
  height: 540px;
}

.map-layout {
  height: 470px;
}

.map-layout {
  height: 430px;
}
}