/**
 * Grid Theme — Recon / Sniffies aesthetic
 * Dark, map-first discovery with profile cards and working feed.
 */

:root {
  --grid-bg: #050505;
  --grid-surface: rgba(255, 255, 255, 0.04);
  --grid-surface-2: rgba(255, 255, 255, 0.07);
  --grid-glass: rgba(255, 255, 255, 0.06);
  --grid-glass-border: rgba(255, 255, 255, 0.12);
  --grid-border: rgba(255, 255, 255, 0.1);
  --grid-text: #f8f8f8;
  --grid-muted: #9ca3af;
  --grid-accent: #ffffff;
  --grid-accent-soft: rgba(255, 255, 255, 0.08);
  --grid-online: #34d399;
  --grid-shine: linear-gradient(135deg, rgba(255,255,255,0.14) 0%, rgba(255,255,255,0.02) 40%, rgba(255,255,255,0.08) 100%);
}

/* ---- Base ---- */
body.theme-grid {
  background: var(--grid-bg) !important;
  color: var(--grid-text);
}

body.theme-grid::before {
  display: none !important;
}

body.theme-grid.night-mode,
body.theme-grid {
  --body-bg: var(--grid-bg);
  --body-bg-dark: var(--grid-bg);
  --border-divider: var(--grid-border);
  --main-link: #fff;
  --card-dark-color: rgba(255, 255, 255, 0.05);
  --card-dark-divider: rgba(255, 255, 255, 0.1);
  --card-dark-hover: rgba(255, 255, 255, 0.08);
}

/* ---- Header: Recon-style center nav ---- */
body.theme-grid .main-header {
  background: #000 !important;
  border-bottom: 1px solid var(--grid-border);
  box-shadow: none !important;
}

body.theme-grid .grid-header-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.25rem;
  height: 100%;
  flex-wrap: nowrap;
}

@media (min-width: 1400px) {
  body.theme-grid .grid-header-nav {
    gap: 1.75rem;
  }
}

@media (min-width: 992px) and (max-width: 1399px) {
  body.theme-grid .grid-header-nav {
    gap: 0.5rem;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  body.theme-grid .grid-header-nav::-webkit-scrollbar {
    display: none;
  }

  body.theme-grid .grid-header-nav__link {
    padding: 8px 8px;
    font-size: 0.62rem;
    flex-shrink: 0;
  }
}

body.theme-grid .grid-header-nav__link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--grid-muted);
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 8px 12px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

body.theme-grid .grid-header-nav__link:hover {
  color: var(--grid-text);
}

body.theme-grid .grid-header-nav__link.is-active {
  color: var(--grid-text);
  border-bottom-color: var(--grid-text);
}

body.theme-grid .grid-header-nav__link svg,
body.theme-grid .grid-header-nav__link .header-icon {
  width: 22px;
  height: 22px;
  opacity: 0.85;
}

body.theme-grid .grid-header-nav__badge {
  position: absolute;
  top: -4px;
  right: -8px;
  background: var(--grid-accent);
  color: #111;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

body.theme-grid .grid-header-nav__icon-wrap {
  position: relative;
  display: flex;
}

@media (max-width: 991px) {
  body.theme-grid .grid-header-nav {
    display: none;
  }
}

body.theme-grid .main-header .search-wrapper {
  display: flex;
  align-items: center;
  flex: 0 1 240px;
  max-width: 300px;
  width: 100%;
  margin: 0 auto;
  background: transparent;
  backdrop-filter: none;
  border: none;
  border-radius: 0;
  padding: 0;
}

body.theme-grid .main-header .search-wrapper form {
  position: relative;
  width: 100%;
}

body.theme-grid .main-header .search-input-icon {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  pointer-events: none;
  display: flex;
  align-items: center;
  opacity: 0.75;
  margin: 0;
}

body.theme-grid .main-header .search-wrapper .form-control {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--grid-text);
  height: 38px;
  margin: 0;
  padding: 0 38px 0 14px;
  border-radius: 10px;
  font-size: 0.875rem;
  line-height: 1.4;
  box-shadow: none;
}

body.theme-grid .main-header .search-wrapper .form-control:focus {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.28);
  color: var(--grid-text);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

body.theme-grid .main-header .search-wrapper .form-control::placeholder {
  color: rgba(255, 255, 255, 0.45);
  opacity: 1;
}

@media (min-width: 992px) {
  body.theme-grid .main-header .col-md-7 {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
  }

  body.theme-grid .main-header .search-wrapper {
    flex: 0 1 200px;
    max-width: 240px;
    margin: 0;
    order: 2;
  }

  body.theme-grid .grid-header-nav {
    order: 1;
    flex: 0 0 auto;
  }
}

/* ---- Sub-nav tabs (NEARBY / FEED / etc) ---- */
.grid-subnav {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--grid-border);
  margin-bottom: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.grid-subnav::-webkit-scrollbar {
  display: none;
}

.grid-subnav__tab {
  flex-shrink: 0;
  padding: 14px 20px;
  color: var(--grid-muted);
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.grid-subnav__tab:hover {
  color: var(--grid-text);
}

.grid-subnav__tab.is-active {
  color: var(--grid-text);
  border-bottom-color: var(--grid-text);
}

/* ---- Map strip (Sniffies-style) ---- */
.grid-map-wrap {
  position: relative;
  width: 100%;
  background: #0d1117;
  border-bottom: 1px solid var(--grid-border);
  overflow: hidden;
}

.grid-map-wrap--strip {
  height: min(32vh, 280px);
  min-height: 200px;
}

.grid-map-wrap--tall {
  height: min(32vh, 280px);
  min-height: 200px;
}

.grid-map-wrap--compact {
  height: 180px;
  min-height: 160px;
}

@media (min-width: 992px) {
  .grid-feed-layout .grid-map-wrap--compact {
    height: 260px;
    min-height: 220px;
    max-height: 300px;
  }
}

#js_grid-map,
#js-grid-map,
#js_grid-map-compact,
#js-feed-map-preview {
  width: 100%;
  height: 100%;
  min-height: 160px;
}


.grid-map-wrap .leaflet-container {
  background: #0a0a0a !important;
  font-family: inherit;
}

.grid-map-wrap .leaflet-tile-pane {
  filter: none;
}

.grid-map-wrap .leaflet-tile {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

.grid-map-wrap .leaflet-control-zoom a {
  background: rgba(0, 0, 0, 0.75) !important;
  color: #fff !important;
  border-color: var(--grid-border) !important;
}

.grid-map-marker {
  background: transparent !important;
  border: none !important;
}

.grid-map-marker__avatar {
  display: block;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  max-width: 44px;
  max-height: 44px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  object-fit: cover;
  object-position: center center;
}

.grid-map-marker__avatar.is-online {
  border-color: var(--grid-online);
}

.grid-map-marker__avatar.is-you {
  border-color: #fff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35);
}

.grid-map-marker__you-label {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.92);
  color: #000;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  white-space: nowrap;
}

.grid-map-controls {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.grid-map-controls button,
.grid-map-controls__link {
  width: 36px;
  height: 36px;
  border: 1px solid var(--grid-border);
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  text-decoration: none;
}

.grid-map-controls button:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ---- Layout shell ---- */
.grid-page {
  min-height: calc(100dvh - 60px);
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

.grid-page__body {
  display: flex;
  gap: 0;
  max-width: 1600px;
  margin: 0 auto;
}

.grid-filters {
  width: 280px;
  flex-shrink: 0;
  background: var(--grid-surface);
  border-right: 1px solid var(--grid-border);
  padding: 20px 16px;
  overflow-y: auto;
  max-height: calc(100dvh - 120px);
  position: sticky;
  top: 60px;
}

.grid-main {
  flex: 1;
  min-width: 0;
  padding: 16px 20px 40px;
}

@media (max-width: 991px) {
  .grid-page__body {
    flex-direction: column;
  }

  .grid-filters {
    width: 100%;
    max-height: none;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--grid-border);
  }
}

/* ---- Filter panel ---- */
.grid-filter-section {
  margin-bottom: 24px;
}

.grid-filter-section__title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--grid-muted);
  margin-bottom: 12px;
}

.grid-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.grid-filter-pill {
  padding: 8px 14px;
  border-radius: 20px;
  border: 1px solid var(--grid-border);
  background: transparent;
  color: var(--grid-text);
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.grid-filter-pill:hover,
.grid-filter-pill.is-active {
  background: var(--grid-accent-soft);
  border-color: var(--grid-accent);
  color: var(--grid-text);
}

.grid-filter-apply {
  width: 100%;
  padding: 12px;
  background: var(--grid-surface-2);
  border: 1px solid var(--grid-border);
  color: var(--grid-text);
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 8px;
}

.grid-filter-apply:hover {
  background: #252525;
}

.grid-my-type {
  background: var(--grid-surface-2);
  border-radius: 8px;
  padding: 12px;
  font-size: 0.85rem;
  line-height: 1.5;
}

.grid-my-type__change {
  color: var(--grid-accent);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  float: right;
}

/* ---- Profile card grid (Recon-style) ---- */
body.theme-grid .nearby-grid,
.grid-profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

body.theme-grid .nearby-grid-tile,
.grid-profile-card {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: var(--grid-surface-2);
  cursor: pointer;
  aspect-ratio: 3 / 4;
  transition: transform 0.15s, box-shadow 0.15s;
}

body.theme-grid .nearby-grid-tile:hover,
.grid-profile-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

body.theme-grid .nearby-grid-tile.is-active {
  outline: 2px solid var(--grid-accent);
  outline-offset: 2px;
}

body.theme-grid .nearby-tile-avatar,
.grid-profile-card__photo {
  position: absolute;
  inset: 0;
}

body.theme-grid .nearby-tile-avatar img,
.grid-profile-card__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

body.theme-grid .nearby-grid-tile.is-placeholder .nearby-tile-avatar {
  background: linear-gradient(135deg, #141414, #262626);
}

body.theme-grid .nearby-tile-overlay,
.grid-profile-card__info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 10px 10px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
}

body.theme-grid .nearby-tile-name,
.grid-profile-card__name {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.theme-grid .nearby-tile-meta,
.grid-profile-card__meta {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.75);
  margin-top: 2px;
}

body.theme-grid .nearby-tile-distance,
.grid-profile-card__distance {
  margin-bottom: 4px;
}

body.theme-grid .nearby-distance-badge {
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
}

body.theme-grid .nearby-tile-verified {
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  color: #000;
  font-size: 0.55rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 0, 0, 0.2);
  z-index: 3;
}

body.theme-grid .nearby-online-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 10px;
  height: 10px;
  background: var(--grid-online);
  border-radius: 50%;
  border: 2px solid #000;
  z-index: 2;
}

/* ---- Strip glass from Grid pages ---- */
body.theme-grid .card,
body.theme-grid .main-side-nav-card {
  background: var(--grid-surface) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: 1px solid var(--grid-border) !important;
  border-radius: 8px !important;
  box-shadow: none !important;
}

body.theme-grid .card::before {
  display: none !important;
}

body.theme-grid .card-header {
  background: transparent !important;
  border-bottom: 1px solid var(--grid-border) !important;
  color: var(--grid-text);
}

body.theme-grid .post,
body.theme-grid .publisher {
  background: var(--grid-surface) !important;
  border: 1px solid var(--grid-border) !important;
  border-radius: 8px !important;
}

body.theme-grid .post .post-header,
body.theme-grid .post .post-footer {
  border-color: var(--grid-border) !important;
}

/* ---- Feed layout ---- */
.grid-feed-layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px 40px;
}

.grid-feed-layout .grid-subnav {
  margin: 0 -16px 16px;
  padding: 0 16px;
}

/* ---- Nearby page overrides ---- */
body.theme-grid.page-grid .nearby-page {
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

body.theme-grid .nearby-page .card {
  background: transparent !important;
  border: none !important;
}

body.theme-grid .nearby-tray-content {
  background: var(--grid-surface) !important;
  border-top: 1px solid var(--grid-border);
}

body.theme-grid .btn-primary {
  background: #fff !important;
  border-color: rgba(255,255,255,0.9) !important;
  color: #000 !important;
  font-weight: 700;
}

body.theme-grid .grid-header-nav__badge {
  background: #ef4444;
}

body.theme-grid .text-muted {
  color: var(--grid-muted) !important;
}

/* ---- Hide legacy sidebar on Grid main views (desktop) ---- */
@media (min-width: 768px) {
  body.theme-grid.grid-no-sidebar .sg-offcanvas-sidebar {
    display: none !important;
  }
}

body.theme-grid.grid-no-sidebar .sg-offcanvas-mainbar {
  flex: 0 0 100%;
  max-width: 100%;
}

/* Mobile: allow in-page offcanvas on messages (conversation list) */
@media (max-width: 767px) {
  body.theme-grid.grid-no-sidebar.page-messages .sg-offcanvas.active .sg-offcanvas-sidebar {
    display: block !important;
  }
}

/* ---- Mobile nav drawer (hamburger) — mobile only ---- */
body.theme-grid .dg-mobile-nav {
  display: none !important;
}

@media (max-width: 767.98px) {
  body.theme-grid.dg-mobile-nav-open {
    overflow: hidden;
  }

  body.theme-grid .dg-mobile-nav {
    display: block !important;
    position: fixed;
    inset: 0;
    z-index: 1200;
    pointer-events: none;
    visibility: hidden;
  }

  body.theme-grid .dg-mobile-nav.is-open {
    pointer-events: auto;
    visibility: visible;
  }

  body.theme-grid .dg-mobile-nav__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    transition: opacity 0.22s ease;
  }

  body.theme-grid .dg-mobile-nav.is-open .dg-mobile-nav__backdrop {
    opacity: 1;
  }

  body.theme-grid .dg-mobile-nav__panel {
    position: absolute;
    top: 0;
    left: 0;
    width: min(88vw, 320px);
    max-width: 320px;
    height: 100%;
    background: #0a0a0a;
    border-right: 1px solid var(--grid-border);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.45);
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  body.theme-grid .dg-mobile-nav.is-open .dg-mobile-nav__panel {
    transform: translateX(0);
  }

  body.theme-grid .dg-mobile-nav__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--grid-border);
    flex-shrink: 0;
  }

  body.theme-grid .dg-mobile-nav__title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--grid-text);
  }

  body.theme-grid .dg-mobile-nav__close {
    background: transparent;
    border: none;
    color: var(--grid-muted);
    font-size: 1.25rem;
    line-height: 1;
    padding: 4px 8px;
    cursor: pointer;
  }

  body.theme-grid .dg-mobile-nav__close:hover {
    color: var(--grid-text);
  }

  body.theme-grid .dg-mobile-nav__body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 0 calc(16px + env(safe-area-inset-bottom, 0px));
  }

  body.theme-grid .dg-mobile-nav__body .main-side-nav-card {
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  body.theme-grid .dg-mobile-nav__body .main-side-nav-card .card-body {
    padding: 8px 12px;
  }

  body.theme-grid .dg-mobile-nav__primary {
    padding: 4px 12px 12px;
    border-bottom: 1px solid var(--grid-border);
    margin-bottom: 4px;
  }

  body.theme-grid .dg-mobile-nav__extras {
    border-bottom: 0;
    margin-bottom: 0;
    padding-top: 12px;
  }

  body.theme-grid .dg-mobile-nav__section-label {
    margin: 0 12px 5px;
    color: var(--grid-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  body.theme-grid .dg-mobile-nav__primary-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  body.theme-grid .dg-mobile-nav__primary-item > a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--grid-muted);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 600;
    transition: background 0.15s ease, color 0.15s ease;
  }

  body.theme-grid .dg-mobile-nav__primary-item > a svg,
  body.theme-grid .dg-mobile-nav__primary-item > a .header-icon {
    flex-shrink: 0;
    opacity: 0.85;
  }

  body.theme-grid .dg-mobile-nav__primary-item.is-active > a,
  body.theme-grid .dg-mobile-nav__primary-item > a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
  }

  body.theme-grid .dg-mobile-nav__primary-item.is-active > a svg,
  body.theme-grid .dg-mobile-nav__primary-item.is-active > a .header-icon {
    opacity: 1;
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.35));
  }
}

/* ---- Messages: Recon-style split pane ---- */
body.theme-grid.page-messages .sg-offcanvas-sidebar .card,
body.theme-grid.page-messages .sg-offcanvas-mainbar .card {
  min-height: calc(100dvh - 180px);
}

body.theme-grid.page-messages .sg-offcanvas-sidebar {
  border-right: 1px solid var(--grid-border);
}

body.theme-grid.page-messages .feeds-item {
  border-bottom: 1px solid var(--grid-border);
}

body.theme-grid.page-messages .feeds-item:hover,
body.theme-grid.page-messages .feeds-item.active {
  background: var(--grid-surface-2);
}

/* ---- Kill legacy blue-grey palette ---- */
body.theme-grid,
body.theme-grid .card,
body.theme-grid .main-side-nav-card,
body.theme-grid .publisher,
body.theme-grid .post {
  --card-dark-color: rgba(255, 255, 255, 0.05);
  --card-dark-divider: rgba(255, 255, 255, 0.1);
  --card-dark-hover: rgba(255, 255, 255, 0.08);
  --card-dark-input: rgba(255, 255, 255, 0.06);
  background-color: transparent;
}

body.theme-grid [style*="#192228"],
body.theme-grid [style*="#2b3843"],
body.theme-grid [style*="#1E252B"],
body.theme-grid [style*="#262D34"] {
  background-color: transparent !important;
}

/* ---- Glass cards ---- */
.grid-glass-card,
body.theme-grid .card {
  background: var(--grid-glass) !important;
  backdrop-filter: blur(20px) saturate(160%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(160%) !important;
  border: 1px solid var(--grid-glass-border) !important;
  border-radius: 16px !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}

.grid-glass-card__head {
  padding: 14px 16px;
  font-weight: 700;
  border-bottom: 1px solid var(--grid-border);
  background: var(--grid-shine);
}

body.theme-grid .grid-filters {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--grid-border);
}

.grid-filter-hint {
  font-size: 0.72rem;
  color: var(--grid-muted);
  margin: 8px 0 0;
  line-height: 1.4;
}

.grid-radius-select {
  background: rgba(0, 0, 0, 0.35) !important;
  border: 1px solid var(--grid-glass-border) !important;
  color: var(--grid-text) !important;
  border-radius: 10px !important;
}

.grid-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  font-size: 0.88rem;
  cursor: pointer;
}

.grid-toggle-row input {
  width: 44px;
  height: 24px;
  accent-color: #fff;
}

.grid-filter-apply {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--grid-glass-border);
  color: #fff;
  border-radius: 999px;
  font-weight: 600;
}

.grid-filter-apply:hover {
  background: rgba(255, 255, 255, 0.16);
}

.grid-filter-pill.is-active {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.35);
}

/* ---- Fullscreen map mode (Map tab — same panel as Nearby strip) ---- */
.grid-page--map {
  padding-bottom: 0;
}

.grid-map-panel--fullscreen {
  position: fixed;
  top: var(--dg-header-height, 70px);
  left: 0;
  right: 0;
  bottom: var(--dg-nav-height, 56px);
  z-index: 100;
  background: transparent;
  border: none;
  margin: 0;
  pointer-events: none;
}

.grid-map-panel--fullscreen .grid-map-panel__inner,
.grid-map-panel--fullscreen .grid-map-wrap--fullscreen,
.grid-map-panel--fullscreen .grid-map-hud,
.grid-map-panel--fullscreen .grid-map-controls,
.grid-map-panel--fullscreen .grid-map-empty,
.grid-map-panel--fullscreen .grid-map-profile-strip,
.grid-map-panel--fullscreen .dg-map-filter-sheet,
.grid-map-panel--fullscreen #js_grid-map,
.grid-map-panel--fullscreen #js-grid-map,
.grid-map-panel--fullscreen .leaflet-container {
  pointer-events: auto;
}

.grid-map-panel--fullscreen .grid-map-panel__inner {
  height: 100%;
  width: 100%;
}

.grid-map-wrap--fullscreen {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100%;
  border-bottom: none;
}

.grid-map-wrap--fullscreen .grid-map-stage {
  width: 100%;
  height: 100%;
  min-height: 100%;
}

.grid-map-wrap--fullscreen #js_grid-map,
.grid-map-wrap--fullscreen #js-grid-map,
.grid-map-wrap--fullscreen .leaflet-container {
  width: 100% !important;
  height: 100% !important;
  min-height: 100% !important;
}

body.theme-grid.nearby-map-mode {
  overflow: hidden !important;
  padding-bottom: var(--dg-nav-height, 56px) !important;
}

body.theme-grid.nearby-map-mode .main-wrapper {
  min-height: 0;
}

body.theme-grid.nearby-map-mode .chat-sidebar,
body.theme-grid.page-grid.nearby-map-mode .chat-sidebar {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

body.theme-grid.nearby-map-mode .grid-page--map,
body.theme-grid.page-map .grid-page--map {
  padding: 0;
  margin: 0;
  min-height: 0;
  height: 100%;
}

body.theme-grid.nearby-map-mode .grid-map-panel--fullscreen {
  z-index: 200;
  pointer-events: auto;
}

.grid-map-location-prompt.x-hidden {
  display: none !important;
  pointer-events: none !important;
}

.grid-page__body--map-overlay {
  display: none !important;
}

/* ---- Sniffies-style browsing pulse on map ---- */
.grid-map-marker {
  position: relative;
}

.grid-map-marker__ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid transparent;
  pointer-events: none;
}

.grid-map-marker__ring.is-browsing {
  border-color: rgba(52, 211, 153, 0.55);
  animation: grid-browse-pulse 1.8s ease-in-out infinite;
}

@keyframes grid-browse-pulse {
  0%, 100% { transform: scale(0.92); opacity: 0.45; }
  50% { transform: scale(1.12); opacity: 1; }
}

.grid-map-marker__avatar.is-online {
  border-color: var(--grid-online);
}

.grid-map-controls button {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ---- Feed glass widgets ---- */
body.theme-grid .dg-feed-people {
  background: var(--grid-glass) !important;
  backdrop-filter: blur(20px);
  border: 1px solid var(--grid-glass-border) !important;
}

body.theme-grid .publisher,
body.theme-grid .post {
  background: var(--grid-glass) !important;
  backdrop-filter: blur(16px) !important;
  border: 1px solid var(--grid-glass-border) !important;
}

@media (max-width: 991px) {
  .grid-page--grid .grid-page__body {
    flex-direction: column;
  }

  .grid-filters {
    border-right: none;
    border-bottom: 1px solid var(--grid-border);
    max-height: none;
  }
}

/* ---- Kill glassmorphism blue/purple bleed on Grid ---- */
body.theme-grid.night-mode:not(.index-body):not(.has-profile-background),
body.theme-grid:not(.index-body):not(.has-profile-background) {
  background: var(--grid-bg) !important;
  background-image: none !important;
}

body.theme-grid.night-mode:not(.index-body):not(.has-profile-background)::before,
body.theme-grid:not(.index-body):not(.has-profile-background)::before {
  display: none !important;
  background: none !important;
  content: none !important;
}

body.theme-grid.has-profile-background {
  background-color: #000 !important;
}

body.theme-grid.has-profile-background::before {
  display: none !important;
}

body.theme-grid {
  --body-bg-color-dark: #050505;
  --body-color-dark: #e5e7eb;
  --link-color: #e5e7eb;
  --header-bg-color-dark: #000;
  --card-dark-color: rgba(255, 255, 255, 0.05);
  --card-dark-divider: rgba(255, 255, 255, 0.1);
  --card-dark-hover: rgba(255, 255, 255, 0.08);
  --card-dark-input: rgba(255, 255, 255, 0.06);
  --plyr-color-main: #fff;
}

body.theme-grid.night-mode .post,
body.theme-grid .post {
  background-color: rgba(10, 10, 10, 0.88) !important;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}

body.theme-grid .publisher {
  background-color: rgba(10, 10, 10, 0.88) !important;
}

body.theme-grid a:not(.btn):not(.dropdown-item):not(.user-box) {
  color: #d1d5db;
}

body.theme-grid a:not(.btn):not(.dropdown-item):not(.user-box):hover {
  color: #fff;
}

body.theme-grid .alert-info,
body.theme-grid .alert-info.see-more {
  background: rgba(255, 255, 255, 0.06) !important;
  border-color: var(--grid-border) !important;
  color: var(--grid-text) !important;
}

body.theme-grid .js_sticky-sidebar .card,
body.theme-grid .col-lg-4 .card {
  background-color: rgba(10, 10, 10, 0.75) !important;
}

/* ---- Map panel (Feed + Nearby strip) ---- */
.grid-feed-map-shell {
  width: 100%;
  max-width: 100%;
}

.grid-map-panel {
  position: relative;
  width: 100%;
  background: #000;
  border-bottom: 1px solid var(--grid-border);
}

.grid-map-panel__inner {
  position: relative;
}

.grid-map-panel__reopen {
  display: none;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: none;
  border-bottom: 1px solid var(--grid-border);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.grid-map-panel__reopen:hover {
  background: rgba(255, 255, 255, 0.1);
}

.grid-map-panel--collapsed .grid-map-panel__inner {
  display: none;
}

.grid-map-panel--collapsed .grid-map-panel__reopen {
  display: flex;
}

.grid-map-panel--expanded {
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  bottom: calc(56px + env(safe-area-inset-bottom));
  z-index: 900;
  background: #000;
}

.grid-map-panel--expanded .grid-map-wrap {
  height: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
}

body.grid-map-fs-open {
  overflow: hidden;
}

@media (min-width: 992px) {
  body.grid-map-fs-open .grid-map-panel--expanded {
    bottom: 0;
  }
}

.grid-map-panel:not(.grid-map-panel--expanded) .js_grid-map-expand .fa-compress {
  display: none;
}

.grid-map-panel--expanded .js_grid-map-expand .fa-expand {
  display: none;
}

/* ---- Sniffies-style map HUD ---- */
.grid-map-hud {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 1000;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.grid-map-hud--top {
  top: 12px;
  bottom: auto;
  right: 12px;
  left: 12px;
  justify-content: flex-start;
}

.grid-map-hud--bottom {
  top: auto;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  left: 12px;
  right: auto;
  justify-content: flex-start;
}

.grid-map-hud__btn,
.grid-map-hud__select {
  pointer-events: auto;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #fff;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.grid-map-hud__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  cursor: pointer;
}

.grid-map-hud__btn--icon {
  width: 40px;
  height: 40px;
  padding: 0;
  justify-content: center;
  border-radius: 50%;
}

.grid-map-hud__btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.grid-map-hud__select {
  padding: 8px 12px;
  min-width: 96px;
}

.grid-map-controls--map {
  display: none;
}

/* ---- You marker ---- */
.grid-map-marker--you {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.grid-map-marker__you-label {
  position: static;
  transform: none;
  margin-top: 0;
  line-height: 1;
  font-size: 0.55rem;
  padding: 2px 6px;
}

/* ---- Map-only page (height must be explicit — fixed map panel is out of flow) ---- */
.nearby-page.nearby-page--map-only,
.nearby-page--map-only {
  padding-bottom: 0 !important;
  min-height: calc(100dvh - var(--dg-header-height, 56px) - var(--dg-nav-height, 56px)) !important;
  height: calc(100dvh - var(--dg-header-height, 56px) - var(--dg-nav-height, 56px)) !important;
  overflow: hidden;
  background: transparent !important;
}

@media (min-width: 992px) {
  body.theme-grid.page-map .nearby-page--map-only,
  body.theme-grid.nearby-map-mode .nearby-page--map-only,
  body.theme-grid.page-map.nearby-page--map-only,
  body.theme-grid.nearby-map-mode.nearby-page--map-only {
    min-height: calc(100dvh - var(--dg-header-height, 74px)) !important;
    height: calc(100dvh - var(--dg-header-height, 74px)) !important;
  }

  body.theme-grid.page-map .grid-map-panel--fullscreen,
  body.theme-grid.nearby-map-mode .grid-map-panel--fullscreen {
    bottom: 0 !important;
  }
}

.nearby-page--map-only .grid-map-panel--fullscreen {
  z-index: 100;
}

.grid-map-location-prompt {
  position: fixed;
  top: var(--dg-header-height, 70px);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: auto;
}

.grid-map-location-prompt__card {
  text-align: center;
  padding: 24px;
  background: rgba(10, 10, 10, 0.92);
  border: 1px solid var(--grid-border);
  border-radius: 16px;
  max-width: 320px;
}

/* ---- Map profile strip (fullscreen map) — mobile cruise row only ---- */
@media (min-width: 992px) {
  body.theme-grid.page-map .grid-map-profile-strip,
  body.theme-grid.page-map .dg-map-cruise-strip,
  body.theme-grid.page-map #js_map-profile-strip,
  body.theme-grid.nearby-map-mode.page-map .grid-map-profile-strip {
    display: none !important;
  }
}

body.theme-grid.nearby-map-mode .grid-map-wrap--fullscreen .grid-map-profile-strip {
  bottom: calc(var(--dg-nav-height, 56px) + 12px);
}

@media (max-width: 991px) {
  .grid-map-profile-strip,
  .dg-map-cruise-strip {
    position: absolute;
    left: 50%;
    right: auto;
    bottom: 16px;
    z-index: 1000;
    display: flex;
    flex-wrap: nowrap;
    gap: 0;
    max-height: 64px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 12px;
    pointer-events: auto;
    scrollbar-width: none;
    contain: layout paint;
    transform: translateX(-50%);
    border-radius: 999px;
    background: rgba(8, 8, 8, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.12);
  }
}

.grid-map-profile-strip::-webkit-scrollbar {
  display: none;
}

.grid-map-profile-strip__item,
.dg-map-cruise-strip__item {
  flex: 0 0 44px;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  max-width: 44px;
  max-height: 44px;
  border-radius: 50%;
  border: 2px solid #fff;
  overflow: hidden;
  padding: 0;
  background: #111;
  cursor: pointer;
  pointer-events: auto;
  aspect-ratio: 1 / 1;
  line-height: 0;
  font-size: 0;
}

.grid-map-profile-strip__item img,
.dg-map-cruise-strip__item img {
  display: block;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  max-width: 44px;
  max-height: 44px;
  object-fit: cover;
  object-position: center center;
  border-radius: 50%;
}

.grid-page--grid .grid-page__body {
  margin-top: 0;
}

/* ---- Watch: full video browse grid ---- */
body.theme-grid .dg-watch-head {
  padding: 1.25rem 1.5rem;
}

body.theme-grid .dg-watch-head__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

body.theme-grid .dg-watch-head__title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  color: var(--grid-text);
}

body.theme-grid .dg-watch-reels-link {
  flex-shrink: 0;
  border-color: rgba(255, 255, 255, 0.2) !important;
  color: var(--grid-text) !important;
}

body.theme-grid .dg-watch-cats {
  list-style: none;
  margin: 0;
  padding: 0;
}

body.theme-grid .dg-watch-cats li a {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  color: var(--grid-muted);
  text-decoration: none;
}

body.theme-grid .dg-watch-cats li.is-active a,
body.theme-grid .dg-watch-cats li a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--grid-text);
}

body.theme-grid .dg-watch-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--grid-border);
}

body.theme-grid .dg-watch-toolbar__title {
  font-weight: 600;
  color: var(--grid-text);
}

body.theme-grid .dg-watch-toolbar__filter {
  color: var(--grid-muted);
  text-decoration: none;
  font-size: 0.9rem;
}

body.theme-grid .dg-watch-grid {
  --bs-gutter-x: 12px;
  --bs-gutter-y: 12px;
}

body.theme-grid .dg-watch-card {
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

body.theme-grid .dg-watch-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  color: inherit;
}

body.theme-grid .dg-watch-card__thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #111;
  overflow: hidden;
}

body.theme-grid .dg-watch-card__thumb img,
body.theme-grid .dg-watch-card__thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

body.theme-grid .dg-watch-card__play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  font-size: 1.25rem;
  opacity: 0;
  transition: opacity 0.2s;
}

body.theme-grid .dg-watch-card:hover .dg-watch-card__play {
  opacity: 1;
}

body.theme-grid .dg-watch-card__meta {
  padding: 0.65rem 0.75rem 0.75rem;
}

body.theme-grid .dg-watch-card__title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--grid-text);
  line-height: 1.35;
  margin-bottom: 0.2rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

body.theme-grid .dg-watch-card__author {
  font-size: 0.75rem;
  color: var(--grid-muted);
}


/* ==== hide nearby sidebar filters mobile 2026-08-01 ==== */
@media (max-width: 991.98px) {
  .grid-page--grid .grid-filters {
    display: none !important;
  }
}
