/**
 * Shared member profile side pane (Teams / Forums / Shared / Blogs).
 * Author: Dave Greenlaw
 */

.share-groups-profile-pane,
.bb-member-profile-pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border, rgba(15, 23, 42, 0.12));
  border-radius: 12px;
  background: var(--surface, #fff);
  box-shadow: -8px 0 24px rgba(15, 23, 42, 0.06);
}

.share-groups-profile-pane[hidden],
.bb-member-profile-pane[hidden] {
  display: none !important;
}

.share-groups-profile-pane__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border, rgba(15, 23, 42, 0.1));
  flex-shrink: 0;
}

.share-groups-profile-pane__label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted, #64748b);
}

.share-groups-profile-pane__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 14px 14px 18px;
}

.share-groups-profile-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.share-groups-profile-card__avatar,
.share-groups-profile-card__avatar-img {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
}

.share-groups-profile-card__avatar--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 118, 110, 0.12);
  color: #0f766e;
  font-weight: 700;
  font-size: 28px;
}

.share-groups-profile-card__name {
  margin: 4px 0 0;
  font-size: 1.25rem;
  line-height: 1.25;
}

.share-groups-profile-card__realname,
.share-groups-profile-card__motto,
.share-groups-profile-card__meta,
.share-groups-profile-card__joined {
  margin: 0;
  color: var(--text-muted, #64748b);
  font-size: 13px;
}

.share-groups-profile-card__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin: 8px 0 0;
  width: 100%;
}

.share-groups-profile-card__stats > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-muted, rgba(248, 250, 252, 0.9));
  border: 1px solid var(--border, rgba(15, 23, 42, 0.08));
}

.share-groups-profile-card__stats dt {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted, #64748b);
}

.share-groups-profile-card__stats dd {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text, inherit);
}

.share-groups-profile-card__about,
.share-groups-profile-card__section {
  margin-top: 12px;
  width: 100%;
}

.share-groups-profile-card__about h4,
.share-groups-profile-card__section h4 {
  margin: 0 0 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #64748b);
}

.share-groups-profile-card__about p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.45;
}

.share-groups-profile-card__empty {
  margin: 0;
  font-size: 13px;
}

.share-groups-profile-card__post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.share-groups-profile-card__post-list li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border, rgba(15, 23, 42, 0.08));
  background: var(--surface-muted, rgba(248, 250, 252, 0.65));
}

.share-groups-profile-card__post-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: inherit;
  text-align: left;
}

a.share-groups-profile-card__post-title,
button.share-groups-profile-card__post-title {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--accent, #0f766e);
  text-decoration: none;
  font: inherit;
  font-weight: 600;
}

a.share-groups-profile-card__post-title:hover,
button.share-groups-profile-card__post-title:hover {
  text-decoration: underline;
}

.share-groups-profile-card__post-meta {
  font-size: 11px;
  color: var(--text-muted, #64748b);
}

.share-groups-profile-card__section .bb-badges-grid {
  gap: 8px;
}

.share-groups-profile-card__actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.share-groups-profile-card__status {
  margin: 0;
  font-size: 13px;
  width: 100%;
}

.share-groups-profile-card__status--error {
  color: #b91c1c;
}

/* Forums / Shared: dock beside feed (+ reader when open) */
.pf-layout.pf-layout--profile-open {
  display: flex;
  align-items: stretch;
  gap: 12px;
  min-height: 0;
}

.pf-layout.pf-layout--profile-open > .bb-member-profile-pane {
  flex: 0 0 min(320px, 34vw);
  width: min(320px, 34vw);
  max-width: 360px;
  align-self: stretch;
  max-height: min(80vh, 100%);
}

.pf-layout.pf-layout--profile-open:not(.pf-layout--reader-open) .pf-feed {
  flex: 1 1 auto;
  min-width: 0;
}

.pf-layout.pf-layout--profile-open.pf-layout--reader-open .pf-feed {
  flex: 1 1 34%;
  max-width: 40%;
}

.pf-layout.pf-layout--profile-open.pf-layout--reader-open .pf-reader {
  flex: 0 0 32%;
  width: 32%;
  max-width: min(420px, 36vw);
}

/* Blogs: side pane beside main column */
.bb-blog-main.bb-blog-main--profile-open {
  max-width: min(1480px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 16px;
  align-items: start;
}

.bb-blog-main.bb-blog-main--profile-open > .bb-member-profile-pane {
  position: sticky;
  top: 72px;
  max-height: calc(100vh - 96px);
}

@media (max-width: 960px) {
  .pf-layout.pf-layout--profile-open {
    flex-direction: column;
  }

  .pf-layout.pf-layout--profile-open > .bb-member-profile-pane {
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
    max-height: 42vh;
  }

  .pf-layout.pf-layout--profile-open.pf-layout--reader-open .pf-feed,
  .pf-layout.pf-layout--profile-open.pf-layout--reader-open .pf-reader {
    max-width: none;
    width: 100%;
    flex: 0 0 auto;
  }

  .bb-blog-main.bb-blog-main--profile-open {
    grid-template-columns: 1fr;
  }

  .bb-blog-main.bb-blog-main--profile-open > .bb-member-profile-pane {
    position: static;
    max-height: 50vh;
  }
}

/* Phone: profile pane as bottom sheet with backdrop (Escape / Close still work) */
@media (max-width: 720px) {
  .pf-layout.pf-layout--profile-open::before,
  .bb-blog-main.bb-blog-main--profile-open::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 100045;
    background: rgba(15, 23, 42, 0.45);
    pointer-events: auto;
  }

  .pf-layout.pf-layout--profile-open > .bb-member-profile-pane,
  .bb-blog-main.bb-blog-main--profile-open > .bb-member-profile-pane {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100050;
    flex: none;
    width: 100%;
    max-width: none;
    max-height: min(88dvh, calc(100dvh - env(safe-area-inset-top, 0px) - 48px));
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.18);
  }

  .share-groups-profile-pane__head .pill-btn {
    min-height: 44px;
    min-width: 44px;
    padding-left: 14px;
    padding-right: 14px;
  }
}
