/**
 * Evabiz Community / Club — Facebook Page-inspired shell
 * Scoped: .eb-page (do not affect home/profile)
 */

body.eb-entity-shell {
  background: #f0ebe4 !important; /* cream-tinted canvas (Evabiz) */
}

.eb-page {
  /* Align with site header rail (hashtag / cong-dong / CMS) */
  --eb-page-max: var(--eb-site-rail, 1180px);
  /* Brand tokens (plum · coral) — replace FB blue */
  --eb-page-blue: #e07a5f;
  --eb-page-blue-hover: #d4654a;
  --eb-page-plum: #3d2a32;
  --eb-page-ink: #1c1410;
  --eb-page-muted: #7a7068;
  --eb-page-line: rgba(28, 20, 16, 0.1);
  --eb-page-surface: #fff;
  --eb-page-cream: #f6f1ea;
  --eb-page-radius: 10px;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--eb-page-ink);
  padding-bottom: 3rem;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

.eb-page a {
  text-decoration: none !important;
}

/* —— Top card: cover + identity (Facebook Fanpage) —— */
.eb-page-top {
  background: var(--eb-page-surface);
  border-bottom: 1px solid var(--eb-page-line);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  margin-bottom: 1rem;
}

.eb-page-wrap,
.eb-page-cover-outer,
.eb-page-body {
  box-sizing: border-box;
  max-width: var(--eb-page-max);
  margin: 0 auto;
  padding: 0 var(--eb-gutter, 1rem);
}

@media (min-width: 768px) {
  .eb-page-wrap,
  .eb-page-cover-outer,
  .eb-page-body {
    padding-left: var(--eb-gutter-md, 1.25rem);
    padding-right: var(--eb-gutter-md, 1.25rem);
  }
}

.eb-page-cover {
  position: relative;
  width: 100%;
  height: 160px; /* mobile: leave room for feed below fold */
  border-radius: 0 0 10px 10px;
  overflow: hidden;
  background: linear-gradient(135deg, #3d2a32 0%, #5c2a2f 45%, #c9a876 100%);
}

@media (min-width: 576px) {
  .eb-page-cover {
    height: 220px;
  }
}

@media (min-width: 900px) {
  .eb-page-cover {
    height: 300px;
    border-radius: 0 0 12px 12px;
  }
}

/* Breadcrumb — ABOVE cover (never under avatar negative-margin) */
.eb-page-crumb-wrap {
  padding-top: 0.65rem;
  padding-bottom: 0.5rem;
}

.eb-page-crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  font-size: 0.84rem;
  color: var(--eb-page-muted);
  position: relative;
  z-index: 5;
}

.eb-page-crumb-back {
  color: var(--eb-page-plum) !important;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.65rem 0.3rem 0.5rem;
  border-radius: 999px;
  background: var(--eb-page-cream);
  border: 1px solid var(--eb-page-line);
  text-decoration: none !important;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.eb-page-crumb-back:hover {
  color: #fff !important;
  background: var(--eb-page-plum);
  border-color: var(--eb-page-plum);
}

.eb-page-crumb-back i {
  font-size: 0.72rem;
  opacity: 0.9;
}

.eb-page-crumb a:not(.eb-page-crumb-back) {
  color: var(--eb-page-plum) !important;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.eb-page-crumb a:not(.eb-page-crumb-back):hover {
  color: var(--eb-page-blue) !important;
}

.eb-page-crumb-sep {
  opacity: 0.4;
  user-select: none;
}

.eb-page-crumb-current {
  color: var(--eb-page-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(50vw, 16rem);
  font-weight: 500;
}

@media (min-width: 576px) {
  .eb-page-crumb-current {
    max-width: 28rem;
  }
}

.eb-page-cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
}

/* Soft brand gradient when no custom cover (avoid stretched logo default) */
.eb-page-cover-fallback {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 70% 40%, rgba(224, 122, 95, 0.35) 0%, transparent 55%),
    linear-gradient(135deg, #2a1c22 0%, #3d2a32 40%, #5c3d45 70%, #c9a876 100%);
}

.eb-page-cover-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.4) 0%, transparent 50%);
  pointer-events: none;
  z-index: 1;
}

/* Identity row under cover — avatar overlaps cover bottom */
.eb-page-identity {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  padding: 0 0 1rem;
  margin-top: -52px;
  position: relative;
  z-index: 2;
}

@media (min-width: 768px) {
  .eb-page-identity {
    margin-top: -68px;
    padding-bottom: 1.15rem;
    gap: 1rem 1.25rem;
  }
}

/* Fanpage profile pic = rounded square (not circle Group avatar) */
.eb-page-avatar {
  flex-shrink: 0;
  width: 120px;
  height: 120px;
  border-radius: 10px;
  border: 4px solid #fff;
  background: #e4e6eb;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 768px) {
  .eb-page-avatar {
    width: 168px;
    height: 168px;
    border-radius: 12px;
    border-width: 5px;
  }
}

.eb-page-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.eb-page-avatar-letter {
  font-size: 3rem;
  font-weight: 700;
  color: #5c2a2f;
  line-height: 1;
  user-select: none;
}

.eb-page-meta {
  flex: 1 1 200px;
  min-width: 0;
  padding-bottom: 0.25rem;
}

.eb-page-name {
  margin: 0 0 0.2rem !important;
  font-size: 1.75rem !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  color: var(--eb-page-ink) !important;
  /* override theme header h1 hide hack if any */
  text-indent: 0 !important;
  position: static !important;
}

@media (min-width: 768px) {
  .eb-page-name {
    font-size: 2rem !important;
  }
}

.eb-page-type {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9375rem;
  color: var(--eb-page-muted);
  font-weight: 500;
}

.eb-page-stats {
  margin-top: 0.35rem;
  font-size: 0.9375rem;
  color: var(--eb-page-muted);
}

.eb-page-stats strong {
  color: var(--eb-page-ink);
  font-weight: 600;
}

.eb-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-left: auto;
  padding-bottom: 0.35rem;
}

.eb-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 36px;
  padding: 0 1rem;
  border-radius: 6px;
  font-size: 0.9375rem;
  font-weight: 600;
  border: 0;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
  white-space: nowrap;
}

.eb-page-btn-primary {
  background: var(--eb-page-blue);
  color: #fff !important;
}

.eb-page-btn-primary:hover {
  background: var(--eb-page-blue-hover);
  color: #fff !important;
}

.eb-page-btn-secondary {
  background: var(--eb-page-cream);
  color: var(--eb-page-ink) !important;
  border: 1px solid var(--eb-page-line);
}

.eb-page-btn-secondary:hover {
  background: #ebe3d8;
  color: var(--eb-page-ink) !important;
}

.eb-page-btn-joined {
  background: rgba(224, 122, 95, 0.12);
  color: var(--eb-page-plum) !important;
}

/* Tabs — Bài viết | Giới thiệu (Fanpage-style; keep both) */
.eb-page-tabs-nav {
  border-top: 1px solid var(--eb-page-line);
  position: relative;
  z-index: 4;
  background: var(--eb-page-surface);
}

.eb-page-tabs {
  display: flex;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.eb-page-tabs > li {
  margin: 0;
  padding: 0;
}

.eb-page-tab {
  display: block;
  padding: 0.9rem 1.15rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--eb-page-muted) !important;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  white-space: nowrap;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
  position: relative;
  z-index: 1;
  pointer-events: auto;
  -webkit-appearance: none;
  appearance: none;
}

.eb-page-tab:hover {
  background: #f0f2f5;
  color: var(--eb-page-ink) !important;
  border-radius: 6px 6px 0 0;
}

.eb-page-tab.is-active {
  color: var(--eb-page-plum) !important;
  border-bottom-color: var(--eb-page-blue);
}

.eb-page-tab:focus-visible {
  outline: 2px solid var(--eb-page-blue);
  outline-offset: -2px;
}

/* Panel visibility — is-active wins (was flaky without !important) */
.eb-page-panel[hidden],
.eb-page-panel:not(.is-active) {
  display: none !important;
}

.eb-page-panel.is-active {
  display: block !important;
}

/* —— Body grid —— */
.eb-page-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: start;
}

/* Mobile: feed first (order), intro below — less scroll to content */
.eb-page-col-left {
  order: 2;
}
.eb-page-col-main {
  order: 1;
  min-width: 0;
}

@media (min-width: 900px) {
  .eb-page-grid {
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 1rem;
  }
  .eb-page-col-left {
    order: 0;
    position: sticky;
    top: 72px;
    align-self: start;
    max-height: calc(100vh - 88px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom: 1rem;
  }
  .eb-page-col-main {
    order: 0;
  }
}

/* Collapsible intro on small screens (details/summary-like via max-height) */
@media (max-width: 899.98px) {
  .eb-page-intro-card .eb-page-info-list li:nth-child(n + 3) {
    display: none;
  }
  .eb-page-intro-card.is-expanded .eb-page-info-list li {
    display: flex;
  }
}

/* Team list (Page staff — not Group member grid) */
.eb-page-team-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.eb-page-team-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.eb-page-team-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  width: 100%;
  color: inherit !important;
  text-decoration: none !important;
}

a.eb-page-team-link:hover .eb-page-team-name {
  color: var(--eb-page-blue);
}

.eb-page-team-av {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--eb-page-cream);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: #5c2a2f;
  flex-shrink: 0;
  object-fit: cover;
}

img.eb-page-team-av {
  padding: 0;
}

.eb-page-team-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.eb-page-team-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--eb-page-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eb-page-team-role {
  font-size: 0.75rem;
  color: var(--eb-page-muted);
}

/* Sidebar CTA → switches main tab to "Giới thiệu" (not a separate page) */
.eb-page-link-more {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.85rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--eb-page-line);
  border-radius: 8px;
  background: var(--eb-page-cream);
  color: var(--eb-page-plum) !important;
  font-weight: 650;
  font-size: 0.88rem;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.eb-page-link-more i {
  font-size: 0.7rem;
  opacity: 0.85;
}

.eb-page-link-more:hover {
  background: var(--eb-page-plum);
  border-color: var(--eb-page-plum);
  color: #fff !important;
  text-decoration: none !important;
}

.eb-page-link-more:hover i {
  opacity: 1;
}

.eb-page-about-text--lg {
  font-size: 1rem;
  line-height: 1.6;
}

.eb-page-url {
  word-break: break-all;
}

.eb-page-card {
  background: var(--eb-page-surface);
  border-radius: var(--eb-page-radius);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  padding: 1rem 1.1rem 1.15rem;
  margin-bottom: 0.85rem;
}

.eb-page-card-title {
  margin: 0 0 0.75rem !important;
  font-size: 1.0625rem !important;
  font-weight: 700 !important;
  color: var(--eb-page-ink) !important;
  text-indent: 0 !important;
}

.eb-page-about-text {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--eb-page-ink);
  white-space: pre-wrap;
}

.eb-page-about-empty {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--eb-page-muted);
}

.eb-page-info-list {
  list-style: none;
  margin: 0.85rem 0 0;
  padding: 0;
}

.eb-page-info-list li {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  font-size: 0.9rem;
  color: var(--eb-page-muted);
  padding: 0.35rem 0;
}

.eb-page-info-list i {
  width: 1.1rem;
  text-align: center;
  margin-top: 0.15rem;
  opacity: 0.85;
}

.eb-page-info-list strong {
  color: var(--eb-page-ink);
  font-weight: 600;
}

/* Members strip */
.eb-page-members {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.eb-page-member {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 72px;
  text-align: center;
}

.eb-page-member-av {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #e4e6eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #5c2a2f;
  margin-bottom: 0.25rem;
  overflow: hidden;
}

.eb-page-member-av img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.eb-page-member-name {
  font-size: 0.7rem;
  color: var(--eb-page-muted);
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eb-page-member-role {
  font-size: 0.65rem;
  color: var(--eb-page-blue);
  font-weight: 600;
  text-transform: capitalize;
}

/* Feed composer stub */
.eb-page-composer {
  display: flex;
  gap: 0.65rem;
  align-items: center;
}

.eb-page-composer-av {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--eb-page-cream);
  flex-shrink: 0;
}

.eb-page-composer-input {
  flex: 1;
  min-height: 40px;
  border-radius: 20px;
  background: var(--eb-page-cream);
  border: 0;
  padding: 0.55rem 1rem;
  font-size: 0.95rem;
  color: var(--eb-page-muted);
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.eb-page-composer-input:hover {
  background: #ebe3d8;
}

.eb-page-feed-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--eb-page-muted);
}

.eb-page-feed-empty i {
  font-size: 2.5rem;
  opacity: 0.35;
  display: block;
  margin-bottom: 0.75rem;
}

.eb-page-feed-empty h3 {
  margin: 0 0 0.35rem !important;
  font-size: 1.1rem !important;
  font-weight: 700 !important;
  color: var(--eb-page-ink) !important;
  text-indent: 0 !important;
}

/* Empty / private / missing states */
.eb-page-state {
  max-width: 520px;
  margin: 2rem auto;
  background: #fff;
  border-radius: 12px;
  padding: 1.75rem 1.5rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  text-align: center;
}

.eb-page-state h1 {
  font-size: 1.25rem !important;
  font-weight: 700 !important;
  margin: 0 0 0.5rem !important;
  text-indent: 0 !important;
}

@media (max-width: 575.98px) {
  .eb-page-identity {
    margin-top: -36px;
  }
  .eb-page-avatar {
    width: 96px;
    height: 96px;
    border-radius: 10px;
  }
  .eb-page-name {
    font-size: 1.35rem !important;
  }
  .eb-page-actions {
    width: 100%;
    margin-left: 0;
  }
  .eb-page-btn {
    flex: 1 1 auto;
    min-height: 40px; /* touch target */
  }
  .eb-page-tabs {
    gap: 0;
  }
  .eb-page-tab {
    padding: 0.75rem 0.9rem;
    font-size: 0.88rem;
  }
}

/* —— Feed cards (post-summary / fb-feed-card) inside entity page —— */
body.eb-entity-shell .eb-entity-feed {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

body.eb-entity-shell .eb-entity-feed .fb-feed-card,
body.eb-entity-shell .eb-entity-feed .post-item {
  margin-bottom: 0 !important;
  max-width: 100%;
  overflow: hidden;
}

/* Theme app.css sometimes hides bare h1 — force page title */
body.eb-entity-shell .eb-page h1.eb-page-name {
  display: block !important;
  visibility: visible !important;
  height: auto !important;
  width: auto !important;
  clip: auto !important;
  overflow: visible !important;
}

/* Leave / joined control */
body.eb-entity-shell .eb-page-btn-joined:hover,
body.eb-entity-shell .eb-entity-leave:hover {
  background: #fce8e6 !important;
  color: #c5221f !important;
}

/* Composer strip */
body.eb-entity-shell .eb-page-composer {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

body.eb-entity-shell .eb-page-composer-av {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #e4e6eb;
  flex-shrink: 0;
}

body.eb-entity-shell .eb-page-composer-input {
  flex: 1;
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 0.5rem 0.9rem;
  border-radius: 20px;
  background: #f0f2f5;
  color: var(--eb-page-muted) !important;
  font-size: 0.95rem;
}

body.eb-entity-shell .eb-page-composer-input:hover {
  background: #e4e6eb;
}

/* Full-bleed cover on small screens under site header */
body.eb-entity-shell .eb-page-top {
  margin-top: 0;
}

body.eb-entity-shell #app {
  overflow: visible !important;
}

/* Prefer cream canvas when entity shell active */
body.eb-entity-shell.eb-site-shell {
  background: #f0ebe4 !important;
}

/* Leave hover keeps coral family */
body.eb-entity-shell .eb-page-btn-joined:hover,
body.eb-entity-shell .eb-entity-leave:hover {
  background: #fce8e6 !important;
  color: #c5221f !important;
}
