/* RishtaNama mobile app styles.
   Loaded last on the main site so these rules win on small screens.
   Admin pages do not load this file and use .ops-content, so they stay wide. */

/* ---- Base: stop sideways scrolling ---- */
html,
body {
  overflow-x: hidden;
}

img,
video,
svg {
  max-width: 100%;
}

/* ---- Desktop: use the wide design container (1240px) for main content (not admin) ---- */
@media (min-width: 768px) {
  main.container, main.container section.narrow.services-page {
    max-width: var(--container);
    margin: 0 auto;
  }
}

/* ---- Bottom navigation: mobile only ---- */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 767px) {
  .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    display: flex;
    align-items: stretch;
    background: #fff;
    border-top: 1px solid #e5ddd6;
    box-shadow: 0 -4px 16px rgba(54, 18, 31, 0.1);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .mobile-bottom-nav a {
    flex: 1 1 0;
    min-height: 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    position: relative;
    color: #6b5a61;
    text-decoration: none;
    font-size: 11px;
    line-height: 1.1;
    padding: 6px 2px;
  }

  .mobile-bottom-nav a .icon {
    width: 24px;
    height: 24px;
  }

  .mobile-bottom-nav a:active,
  .mobile-bottom-nav a:focus-visible {
    color: #36121f;
  }

  .mobile-nav-badge {
    position: absolute;
    top: 2px;
    left: calc(50% + 2px);
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #b3261e;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
  }

  /* Keep page content clear of the fixed nav. */
  body {
    padding-bottom: 64px;
  }

  /* ---- Feed: single column, large rounded cards ---- */
  .browse-layout {
    display: block;
  }

  .profile-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .card {
    border-radius: 20px;
    overflow: hidden;
  }

  /* ---- Filter trigger as a sticky pill; filters as a bottom sheet ---- */
  .filter-trigger {
    position: sticky;
    top: 8px;
    z-index: 40;
    border-radius: 999px;
    min-height: 44px;
    padding: 0 18px;
  }

  .filter-panel:not([hidden]) {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    max-height: 82vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 32px rgba(54, 18, 31, 0.18);
  }

  /* ---- Comfortable touch targets ---- */
  button,
  .button,
  a.button,
  input,
  select,
  textarea {
    min-height: 44px;
  }

  .card a,
  .card button {
    min-height: 44px;
  }

  .dm-mobile-back {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* ---- Chat: full-screen with sticky header and input ---- */
  section.dm-shell {
    display: block;
    min-height: 100vh;
    min-height: 100svh;
  }

  section.dm-shell .dm-main {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100svh;
  }

  section.dm-shell .dm-chat-header {
    position: sticky;
    top: 0;
    z-index: 30;
    background: #fff;
  }

  section.dm-shell .dm-history {
    flex: 1 1 auto;
    height: auto;
    min-height: 40svh;
    overflow-y: auto;
  }

  section.dm-shell .dm-composer {
    position: sticky;
    bottom: 64px;
    z-index: 30;
    background: #fff;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
}
