/**
 * BuddyBoss Child: Mobile member header
 *
 * Scope: BuddyBoss member profile header only.
 * Breakpoint: <800px (BuddyBoss mobile header breakpoint).
 *
 * This file was extracted from `assets/css/custom.css` to keep that file maintainable.
 */

/* --------------------------------------------------------------------------
   Mobile (<800px): custom member header layout (avatar left, actions inline,
   posts/followers/following row, and Active + More info expander)
   -------------------------------------------------------------------------- */

/* Default: hide custom mobile header on desktop */
#buddypress #cover-image-container .bb-mobile-member-header {
  display: none;
}

@media (max-width: 800px) {
  /* Turn OFF the previous meta stack overlay on mobile for this redesign */
  #buddypress #cover-image-container.bb-cover-meta-stack-enabled .bb-cover-meta-stack {
    display: none !important;
  }

  /* Hide the existing BuddyBoss header blocks on mobile to avoid duplicates */
  #buddypress #cover-image-container #item-header-avatar,
  #buddypress #cover-image-container #item-header-content {
    display: none !important;
  }

  /* Also hide the desktop stats overlay inside the cover */
  #buddypress #cover-image-container .bb-desktop-profile-stats {
    display: none !important;
  }

  /* Show the custom mobile header */
  #buddypress #cover-image-container .bb-mobile-member-header {
    display: block !important;
    padding: 0 0 10px !important;
    box-sizing: border-box !important;
    position: relative !important;
    width: 100% !important;
    margin: 0 !important;
    transform: none !important;
  }

  /* Top row: avatar left, actions inline right */
  #buddypress #cover-image-container .bb-mobile-member-header__top {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding-top: 4px !important;
    flex-wrap: nowrap !important;
    position: relative !important;
    --bb-mobile-avatar-overlap: 90px;
    margin: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  #buddypress #cover-image-container .bb-mobile-member-header__avatar {
    position: relative;
    flex: 0 0 auto;
    margin-top: calc(-1 * var(--bb-mobile-avatar-overlap)); /* overlap cover like default BuddyBoss avatar */
    z-index: 2;
    align-self: flex-start;
  }

  /* Avatar: MUST be large on mobile */
  #buddypress #cover-image-container .bb-mobile-member-header__avatar img.avatar {
    width: 170px;
    height: 170px;
    border-radius: 999px;
    border: 0;
    box-shadow: none;
  }

  /* Presence dot on avatar: always visible, color by activity bucket */
  #buddypress #cover-image-container .bb-mobile-member-header__avatar .member-status {
    position: absolute;
    width: 18px;
    height: 18px;
    right: 12px;
    bottom: 12px;
    top: auto;
    border-radius: 999px;
    border: 2px solid #fff;
    opacity: 1 !important;
    visibility: visible !important;
    background: #9ca3af; /* default offline */
    box-shadow: 0 0 0 4px rgba(156, 163, 175, 0.22);
  }

  /* BuddyBoss hides offline dot; override inside our header */
  #buddypress #cover-image-container .bb-mobile-member-header__avatar .member-status.offline {
    opacity: 1 !important;
    visibility: visible !important;
  }

  #buddypress #cover-image-container .bb-mobile-member-header[data-bb-activity-bucket="online"] .bb-mobile-member-header__avatar .member-status {
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18);
  }

  #buddypress #cover-image-container .bb-mobile-member-header[data-bb-activity-bucket="recent"] .bb-mobile-member-header__avatar .member-status {
    background: #84cc16;
    box-shadow: 0 0 0 4px rgba(132, 204, 22, 0.16);
  }

  #buddypress #cover-image-container .bb-mobile-member-header[data-bb-activity-bucket="away"] .bb-mobile-member-header__avatar .member-status {
    background: #f59e0b;
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.16);
  }

	  #buddypress #cover-image-container .bb-mobile-member-header__actions {
	    margin-left: auto !important;
	    display: flex !important;
	    align-items: center !important;
	    gap: 6px !important;
    padding: 0 !important;
    flex: 0 0 auto !important;
    justify-content: flex-end !important;
	    z-index: 10 !important;
	    position: relative !important;
	    isolation: isolate !important;
	    /* Don't use `contain` here: BuddyBoss "More options" uses `position: fixed`
	       for the open dropdown + overlay on mobile, and `contain: paint` turns
	       that into a scoped/incorrect containing block. */
	    contain: none !important;
	    top: 0 !important;
	    left: auto !important;
	    right: 0 !important;
	    bottom: auto !important;
    margin-top: 0 !important;
    margin-right: 0 !important;
    margin-bottom: 0 !important;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: none !important;
    max-height: none !important;
    transform: none !important;
    transition: none !important;
  }

  /* Force BuddyBoss button labels to show in this custom header */
  #buddypress #cover-image-container .bb-mobile-member-header__actions .bb-friend-button-tag {
    display: inline-block !important;
    font-size: 14px;
    font-weight: 600;
  }

  #buddypress #cover-image-container .bb-mobile-member-header__actions .member-header-actions {
    display: flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    position: static !important;
    margin: 0 !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
    isolation: isolate !important;
    align-self: center !important;
    top: 0 !important;
    left: 0 !important;
    right: auto !important;
    bottom: auto !important;
    width: auto !important;
    height: auto !important;
    transform: none !important;
    transition: none !important;
  }

  /* BuddyBoss defaults can hide the friendship icon in member headers; re-enable it here */
  #buddypress #cover-image-container .bb-mobile-member-header__actions .member-header-actions .friendship-button i {
    display: inline-block !important;
  }

	  /* Menu button: override BuddyBoss .logged-in .single-headers .member-header-actions-wrap .bb_more_options rule */
	  #buddypress #cover-image-container .bb-mobile-member-header__actions .bb_more_options {
	    display: flex !important;
	    align-items: center !important;
	    justify-content: center !important;
	    /* Keep as positioned ancestor for dropdown + overlay */
	    position: relative !important;
	    top: 0 !important;
	    right: auto !important;
	    left: auto !important;
	    bottom: auto !important;
	    margin-left: 6px !important;
    margin-top: 0 !important;
    margin-right: 0 !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
    isolation: isolate !important;
    align-self: center !important;
    will-change: auto !important;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: none !important;
    max-height: none !important;
    transform: none !important;
    transition: none !important;
  }

  /* Isolate ellipsis button from Connect button hover effects */
  #buddypress #cover-image-container .bb-mobile-member-header__actions .bb_more_options button,
  #buddypress #cover-image-container .bb-mobile-member-header__actions .bb_more_options a,
  #buddypress #cover-image-container .bb-mobile-member-header__actions .bb_more_options .bb_more_options_action {
    position: relative !important;
    z-index: 1 !important;
    transform: none !important;
    transition: none !important;
    margin: 0 !important;
    top: 0 !important;
    left: 0 !important;
    right: auto !important;
    bottom: auto !important;
    width: auto !important;
    height: auto !important;
  }
  
	  /* NUCLEAR OPTION: Override ALL BuddyBoss core CSS that could affect these buttons */
	  .logged-in .single-headers .member-header-actions-wrap .bb_more_options,
	  .logged-in .single-headers #cover-image-container .bb-mobile-member-header__actions .bb_more_options,
	  body #buddypress .member-header-actions + .bb_more_options,
	  body #buddypress #cover-image-container .bb-mobile-member-header__actions .bb_more_options {
	    position: relative !important;
	    top: 0 !important;
	    right: auto !important;
	    left: auto !important;
	    bottom: auto !important;
	    margin: 0 0 0 6px !important;
	    transform: none !important;
	    transition: none !important;
	  }

  /* Very narrow phones: hide Connect label when there's not enough room */
  @media (max-width: 360px) {
    #buddypress #cover-image-container .bb-mobile-member-header__actions {
      min-width: 0;
      gap: 6px;
    }

    /* Icon-only: visually hide label but keep it accessible */
    #buddypress #cover-image-container .bb-mobile-member-header__actions .bb-friend-button-tag {
      position: absolute !important;
      width: 1px !important;
      height: 1px !important;
      padding: 0 !important;
      margin: -1px !important;
      overflow: hidden !important;
      clip: rect(0, 0, 0, 0) !important;
      white-space: nowrap !important;
      border: 0 !important;
    }

    /* Make Connect compact (square touch target) */
    #buddypress #cover-image-container .bb-mobile-member-header__actions .member-header-actions .generic-button a.friendship-button,
    #buddypress #cover-image-container .bb-mobile-member-header__actions .member-header-actions .generic-button button.friendship-button {
      width: 44px;
      min-width: 44px;
      padding: 0;
      justify-content: center;
      display: inline-flex;
      align-items: center;
    }

    /* Center the icon when label is visually hidden */
    #buddypress #cover-image-container .bb-mobile-member-header__actions .member-header-actions .generic-button a.friendship-button i:before,
    #buddypress #cover-image-container .bb-mobile-member-header__actions .member-header-actions .generic-button button.friendship-button i:before {
      margin-right: 0;
    }

    /* Fallback: if the label isn't wrapped in `.bb-friend-button-tag`, hide any text */
    #buddypress #cover-image-container .bb-mobile-member-header__actions .member-header-actions .generic-button a.friendship-button,
    #buddypress #cover-image-container .bb-mobile-member-header__actions .member-header-actions .generic-button button.friendship-button {
      font-size: 0;
    }

    #buddypress #cover-image-container .bb-mobile-member-header__actions .member-header-actions .generic-button a.friendship-button i,
    #buddypress #cover-image-container .bb-mobile-member-header__actions .member-header-actions .generic-button button.friendship-button i {
      font-size: 18px;
    }
  }

  /* Primary Connect button: pill with text, like the reference */
  #buddypress #cover-image-container .bb-mobile-member-header__actions .member-header-actions .generic-button button,
  #buddypress #cover-image-container .bb-mobile-member-header__actions .member-header-actions .generic-button a {
    min-height: 40px !important;
    height: 40px !important;
    padding: 0 18px !important;
    border-radius: 999px !important;
    line-height: 40px !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    transition: box-shadow 0.2s ease !important;
    position: relative !important;
    z-index: 1 !important;
    will-change: box-shadow !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    vertical-align: top !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    transform: none !important;
    top: 0 !important;
    left: 0 !important;
    right: auto !important;
    bottom: auto !important;
  }

  #buddypress #cover-image-container .bb-mobile-member-header__actions .member-header-actions .generic-button button:hover,
  #buddypress #cover-image-container .bb-mobile-member-header__actions .member-header-actions .generic-button a:hover {
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15) !important;
    transform: none !important;
    margin: 0 !important;
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 18px !important;
    top: 0 !important;
    left: 0 !important;
    right: auto !important;
    bottom: auto !important;
  }

  /* Display name below avatar */
  #buddypress #cover-image-container .bb-mobile-member-header__name {
    margin-top: 8px;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
    color: rgba(15, 23, 42, 0.98);
  }

  #buddypress #cover-image-container .bb-mobile-member-header__handle {
    margin-top: 3px;
    font-size: 14px;
    font-weight: 400;
    color: rgba(15, 23, 42, 0.65);
  }

  /* 3-up row: Posts / Followers / Following */
  #buddypress #cover-image-container .bb-mobile-member-header__stats {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    text-align: center;
    padding: 12px 0;
    border-top: 1px solid rgba(15, 23, 42, 0.06);
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  }

  /* Very narrow phones: allow actions to drop below avatar without overflow */
  @media (max-width: 360px) {
    #buddypress #cover-image-container .bb-mobile-member-header__top {
      flex-wrap: wrap !important;
      align-items: flex-start !important;
      position: relative !important;
      transform: none !important;
    }
    #buddypress #cover-image-container .bb-mobile-member-header__actions {
      width: 100% !important;
      justify-content: flex-start !important;
      padding-top: 6px !important;
      margin-left: 0 !important;
      margin-top: 0 !important;
      position: relative !important;
      top: 0 !important;
      left: 0 !important;
      right: auto !important;
      transform: none !important;
    }
  }
  
  /* Lock down ALL responsive breakpoints - prevent header movement */
  @media (min-width: 361px) {
    #buddypress #cover-image-container .bb-mobile-member-header__top,
    #buddypress #cover-image-container .bb-mobile-member-header__actions,
    #buddypress #cover-image-container .bb-mobile-member-header__actions .member-header-actions {
      position: relative !important;
      top: 0 !important;
      left: auto !important;
      right: auto !important;
      bottom: auto !important;
      transform: none !important;
    }
    
	    /* Don't override bb_more_options margin - it needs margin-left: 6px */
	    #buddypress #cover-image-container .bb-mobile-member-header__actions .bb_more_options {
	      position: relative !important;
	      top: 0 !important;
	      left: auto !important;
	      right: auto !important;
	      bottom: auto !important;
	      transform: none !important;
	      /* margin-left: 6px is set above, don't override it */
	    }
	  }

	  /* Ensure BuddyBoss "More options" dropdown/overlay behave like true viewport
	     layers inside the mobile header (core CSS does this <980px, but our header
	     styles must not interfere). */
	  #buddypress #cover-image-container .bb-mobile-member-header__actions .bb_more_dropdown.open {
	    position: fixed !important;
	    z-index: 992 !important;
	  }

	  #buddypress #cover-image-container .bb-mobile-member-header__actions .bb_more_dropdown.open + .bb_more_dropdown_overlay {
	    position: fixed !important;
	    inset: 0 !important;
	    z-index: 991 !important;
	  }

  #buddypress #cover-image-container .bb-mobile-stat {
    padding: 0;
    background: transparent;
    border: 0;
  }

  #buddypress #cover-image-container .bb-mobile-stat + .bb-mobile-stat {
    border-left: 0.5px solid rgba(15, 23, 42, 0.06);
  }

  #buddypress #cover-image-container .bb-mobile-stat strong {
    font-size: 18px;
    line-height: 1.15;
    display: block;
    color: rgba(15, 23, 42, 0.98);
    font-weight: 700;
  }

  #buddypress #cover-image-container .bb-mobile-stat span,
  #buddypress #cover-image-container .bb-mobile-stat .followers-wrap,
  #buddypress #cover-image-container .bb-mobile-stat .following-wrap {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.68;
    color: rgba(15, 23, 42, 0.75);
    font-weight: 500;
  }

  /* Active bar + More info expander (no JS, accessible) */
  #buddypress #cover-image-container .bb-mobile-member-header__more {
    margin-top: 12px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid #e6e9ef;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  #buddypress #cover-image-container .bb-mobile-member-header__more-summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 16px;
    cursor: pointer;
    width: 100%;
    background: #fff;
    border-bottom: 1px solid #eef1f5 !important;
  }

  /* Hide default marker on some browsers */
  #buddypress #cover-image-container .bb-mobile-member-header__more-summary::-webkit-details-marker {
    display: none;
  }

  /* Hide marker on non-webkit too (prevents horizontal jitter) */
  #buddypress #cover-image-container .bb-mobile-member-header__more-summary::marker {
    content: "";
  }

  /* Avoid the “border, gap, border, whitespace” stacked separators */
  #buddypress #cover-image-container .bb-mobile-member-header__more[open] .bb-mobile-member-header__more-summary {
    border-bottom: 1px solid #eef1f5 !important;
    margin-bottom: 0 !important;
  }
  
  /* Remove any border or spacing between summary and panel */
  #buddypress #cover-image-container .bb-mobile-member-header__more[open] .bb-mobile-member-header__more-panel {
    border-top: 0 !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
  }

  #buddypress #cover-image-container .bb-mobile-member-header__active {
    font-weight: 600;
    color: #0f172a;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
  }

  #buddypress #cover-image-container .bb-mobile-active-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #9ca3af; /* default offline */
    box-shadow: none;
    flex: 0 0 auto;
  }

  #buddypress #cover-image-container .bb-mobile-member-header[data-bb-activity-bucket="online"] .bb-mobile-active-dot {
    background: #22c55e;
    box-shadow: none;
  }

  #buddypress #cover-image-container .bb-mobile-member-header[data-bb-activity-bucket="recent"] .bb-mobile-active-dot {
    background: #84cc16;
    box-shadow: none;
  }

  #buddypress #cover-image-container .bb-mobile-member-header[data-bb-activity-bucket="away"] .bb-mobile-active-dot {
    background: #f59e0b;
    box-shadow: none;
  }

  /* Hide label on very narrow screens, show when there's room */
  #buddypress #cover-image-container .bb-mobile-member-header__more-label {
    opacity: 0.7;
    font-weight: 600;
    color: #0f172a;
    display: none;
    align-items: center;
    gap: 6px;
    justify-content: flex-end;
    font-size: 13px;
  }

  /* Show label when there's enough room (around 360px+) */
  @media (min-width: 360px) {
    #buddypress #cover-image-container .bb-mobile-member-header__more-label {
      display: inline-flex;
    }
  }

  #buddypress #cover-image-container .bb-mobile-chevron {
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    opacity: 0.75;
    transition: transform 180ms ease;
  }

  #buddypress #cover-image-container .bb-mobile-member-header__more[open] .bb-mobile-chevron {
    transform: rotate(-135deg);
  }

  #buddypress #cover-image-container .bb-mobile-member-header__more-panel {
    padding: 10px 12px 12px;
    background: #f7f8fb;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* 2-col tile grid inside expander */
  #buddypress #cover-image-container .bb-mobile-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 14px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  #buddypress #cover-image-container .bb-mobile-meta-item {
    padding: 6px 4px;
    border-radius: 10px;
    background: transparent;
    border: 0;
    box-shadow: none;
    display: grid;
    grid-template-columns: 22px 1fr;
    grid-template-rows: auto auto;
    column-gap: 10px;
  }

  #buddypress #cover-image-container .bb-mobile-meta-item__icon {
    grid-row: 1 / span 2;
    grid-column: 1;
    color: var(--bb-primary-color);
    opacity: 0.95;
    margin-top: 2px;
  }

  #buddypress #cover-image-container .bb-mobile-meta-item__label {
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.6;
    color: #0f172a;
    font-weight: 600;
    grid-column: 2;
  }

  #buddypress #cover-image-container .bb-mobile-meta-item__value {
    margin-top: 4px;
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    grid-column: 2;
  }
}
