/* 21C Community — Hubs workspace (matches legacy §8 layout) */

.c21c-hubs {
  --c21c-card-bg: var(--auth-field-section-bg, #f8fafc);
  --c21c-card-border: var(--auth-field-section-border-color, rgba(0, 0, 0, 0.12));
  --c21c-card-radius: var(--auth-field-section-radius, 0.875rem);
  --c21c-meta: #6b7280;
  --c21c-text: #111827;
  --c21c-text-soft: #4b5563;
  --c21c-accent: var(--auth-color-primary, #2563eb);
  --c21c-accent-soft: #eff6ff;
  --c21c-accent-text: #1d4ed8;
  --c21c-btn-radius: var(--auth-primary-radius, 8px);
  box-sizing: border-box;
  color: var(--c21c-text);
  max-width: 72rem;
}

.c21c-hubs *,
.c21c-hubs *::before,
.c21c-hubs *::after {
  box-sizing: border-box;
}

.c21c-hubs__header {
  margin-bottom: 1rem;
}

.c21c-hubs__title {
  margin: 0;
  font-size: clamp(1.15rem, 2.5vw, 1.5rem);
  line-height: 1.25;
  font-weight: 600;
}

.c21c-hubs__layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: start;
}

@media (min-width: 960px) {
  .c21c-hubs__layout {
    grid-template-columns: 2fr 1fr;
  }
}

.c21c-hubs__main,
.c21c-hubs__sidebar {
  min-width: 0;
}

.c21c-hubs__sidebar-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.c21c-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--c21c-card-border);
  border-radius: var(--c21c-card-radius);
  background: var(--c21c-card-bg);
}

.c21c-card__title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.3;
  font-weight: 600;
}

.c21c-hubs__empty-title {
  margin: 0 0 0.5rem 0;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--c21c-text);
}

.c21c-hubs__empty-lead {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--c21c-text-soft);
}

.c21c-hubs__empty[hidden],
.c21c-hubs__feed-panel[hidden],
.c21c-hubs__members-card[hidden] {
  display: none !important;
}

.c21c-hubs__feed-placeholder {
  color: var(--c21c-meta);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.c21c-hubs__list {
  list-style: none;
  margin: 0.25rem 0 0 0;
  padding: 0;
}

.c21c-hubs__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.c21c-hubs__row:last-child {
  border-bottom: 0;
}

.c21c-hubs__row-main {
  flex: 1 1 auto;
  min-width: 0;
}

.c21c-hubs__row-name {
  font-weight: 600;
  line-height: 1.3;
}

.c21c-hubs__row-meta {
  margin-top: 0.15rem;
  font-size: 0.8125rem;
  color: var(--c21c-meta);
}

.c21c-hubs__row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.c21c-hubs__list--muted {
  font-size: 0.875rem;
  color: var(--c21c-meta);
  padding: 0.35rem 0 0 0;
}

/* Badges: Public grey / Private violet / Admin red */
.c21c-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.4rem;
  border-radius: 0.25rem;
  background: #e5e7eb;
  color: #374151;
}

.c21c-badge--private {
  background: #ede9fe;
  color: #5b21b6;
}

.c21c-badge--admin {
  background: #fee2e2;
  color: #991b1b;
}

/* Buttons — compact; primary can follow Frontend Styler tokens */
.c21c-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0.3rem 0.65rem;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: var(--auth-button-font-weight, 600);
  line-height: 1.2;
  border-radius: var(--c21c-btn-radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  background: #fff;
}

.c21c-btn:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.45);
  outline-offset: 2px;
}

.c21c-btn--primary {
  background: var(--c21c-accent);
  border-color: var(--auth-color-primary-border, var(--c21c-accent));
  color: var(--auth-color-on-primary, #fff);
}

.c21c-btn--primary:hover {
  background: var(--auth-color-primary-hover-bg, #1d4ed8);
  color: var(--auth-color-primary-hover-text, #fff);
}

.c21c-btn--muted {
  background: transparent;
  color: var(--c21c-meta);
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.c21c-btn--muted:hover {
  background: rgba(0, 0, 0, 0.04);
  color: #374151;
}

.c21c-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Hub members — 40px circular avatar chips */
.c21c-hubs__members-count {
  font-weight: 500;
  color: var(--c21c-meta);
}

.c21c-hubs__members-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.5rem;
  margin-top: 0.15rem;
  font-size: 0.875rem;
}

.c21c-hubs__members-list--status {
  color: var(--c21c-meta);
  display: block;
}

.c21c-hubs__member-tile {
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 9999px;
  line-height: 0;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease;
  display: inline-block;
}

.c21c-hubs__member-tile:hover .c21c-hubs__member-avatar,
.c21c-hubs__member-tile:focus-visible .c21c-hubs__member-avatar {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(37, 99, 235, 0.45);
}

.c21c-hubs__member-tile:focus-visible {
  outline: none;
}

.c21c-hubs__member-tile:active {
  transform: scale(0.96);
}

.c21c-hubs__member-avatar {
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  overflow: hidden;
  background: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
}

.c21c-hubs__member-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.c21c-hubs__member-avatar-ph {
  font-weight: 600;
  font-size: 0.95rem;
  color: #4b5563;
}

.c21c-hubs__login-prompt p {
  margin: 0;
  color: var(--c21c-text-soft);
  line-height: 1.5;
}

/* —— Feed / composer / posts / comments —— */

.c21c-hubs__feed-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.c21c-hubs__feed-status {
  margin: 0;
  font-size: 0.875rem;
  color: var(--c21c-meta);
}

.c21c-hubs__feed-status[hidden] {
  display: none !important;
}

.c21c-hubs__feed-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.c21c-hubs__feed-more {
  display: flex;
  justify-content: center;
  margin-top: 0.75rem;
}

.c21c-hubs__feed-more[hidden] {
  display: none !important;
}

.c21c-composer__textarea,
.c21c-edit__textarea {
  width: 100%;
  min-height: 4.5rem;
  resize: vertical;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 0.5rem;
  font: inherit;
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--c21c-text);
  background: #fff;
}

.c21c-composer__textarea:focus,
.c21c-edit__textarea:focus {
  outline: 2px solid rgba(37, 99, 235, 0.35);
  outline-offset: 1px;
  border-color: var(--c21c-accent);
}

.c21c-composer__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.65rem;
}

.c21c-composer__counter {
  flex: 1 1 auto;
  font-size: 0.75rem;
  color: var(--c21c-meta);
}

.c21c-composer__counter.is-over {
  color: #b91c1c;
  font-weight: 600;
}

.c21c-emoji {
  position: relative;
}

.c21c-emoji__picker {
  position: absolute;
  left: 0;
  bottom: calc(100% + 0.35rem);
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.4rem;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 0.5rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.c21c-emoji__picker[hidden] {
  display: none !important;
}

.c21c-emoji__item {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0.2rem;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 0.35rem;
}

.c21c-emoji__item:hover,
.c21c-emoji__item:focus-visible {
  background: var(--c21c-accent-soft);
}

.c21c-post {
  padding: 1rem;
}

.c21c-post__header,
.c21c-comment__header {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}

.c21c-post__avatar,
.c21c-comment__avatar {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  overflow: hidden;
  background: #e5e7eb;
}

.c21c-comment__avatar {
  width: 32px;
  height: 32px;
}

.c21c-post__avatar img,
.c21c-comment__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.c21c-post__meta,
.c21c-comment__meta {
  flex: 1 1 auto;
  min-width: 0;
}

.c21c-post__author,
.c21c-comment__author {
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1.3;
}

.c21c-post__author a,
.c21c-comment__author a {
  color: inherit;
  text-decoration: none;
}

.c21c-post__author a:hover,
.c21c-comment__author a:hover {
  color: var(--c21c-accent-text);
  text-decoration: underline;
}

.c21c-post__time,
.c21c-comment__time {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.75rem;
  color: var(--c21c-meta);
}

.c21c-post__actions,
.c21c-comment__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-left: auto;
}

.c21c-link-btn {
  appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.8125rem;
  color: var(--c21c-accent-text);
  cursor: pointer;
  text-decoration: underline;
}

.c21c-link-btn:hover {
  color: #1e40af;
}

.c21c-link-btn--danger {
  color: #b91c1c;
}

.c21c-link-btn--danger:hover {
  color: #991b1b;
}

.c21c-composer__title-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.c21c-composer__title-wrap[hidden] {
  display: none !important;
}

.c21c-composer__title-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--c21c-text);
}

.c21c-composer__required {
  color: #b91c1c;
  margin-left: 0.15rem;
}

.c21c-composer__title-input {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 0.5rem;
  font: inherit;
  font-size: 0.9375rem;
  line-height: 1.35;
  background: #fff;
  color: var(--c21c-text);
}

.c21c-composer__title-input:focus {
  outline: 2px solid var(--c21c-accent);
  outline-offset: 1px;
}

.c21c-composer__category-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.c21c-composer__category-wrap[hidden] {
  display: none !important;
}

.c21c-composer__category-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--c21c-text);
}

.c21c-composer__category-select {
  width: 100%;
  max-width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 0.5rem;
  font: inherit;
  font-size: 0.9375rem;
  line-height: 1.35;
  background: #fff;
  color: var(--c21c-text);
}

.c21c-composer__category-select:focus {
  outline: 2px solid var(--c21c-accent);
  outline-offset: 1px;
}

.c21c-post__category {
  margin: 0.45rem 0 0 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--c21c-muted, #64748b);
}

.c21c-post__title {
  margin: 0.65rem 0 0 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--c21c-text);
  word-break: break-word;
}

.c21c-post__body,
.c21c-comment__body {
  margin: 0.65rem 0 0 0;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--c21c-text);
  white-space: pre-wrap;
  word-break: break-word;
}

.c21c-post__body a,
.c21c-comment__body a {
  color: var(--c21c-accent-text);
  text-decoration: underline;
  word-break: break-all;
}

.c21c-post__body .c21c-yt-embed,
.c21c-comment__body .c21c-yt-embed {
  border-radius: 0.5rem;
}

.c21c-post__title + .c21c-post__body {
  margin-top: 0.4rem;
}

.c21c-post__edit,
.c21c-comment__edit {
  margin-top: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.c21c-post__comments {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.c21c-comment {
  padding-left: 0.15rem;
}

.c21c-comment-composer {
  margin-top: 0.25rem;
  padding: 0.65rem 0.75rem;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 0.5rem;
}

.c21c-comment-composer .c21c-composer__textarea {
  min-height: 2.75rem;
  font-size: 0.875rem;
}

.c21c-feed-empty {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--c21c-meta);
}

/* —— Shared attachment picker (posts + comments) —— */
.c21c-attach {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.c21c-attach__list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.c21c-attach__item {
  display: grid;
  grid-template-columns: 3rem 1fr auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.4rem 0.5rem;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 0.5rem;
}

.c21c-attach__preview {
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 0.35rem;
  background: #f3f4f6;
}

.c21c-attach__thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.c21c-attach__kind-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--c21c-text-soft);
}

.c21c-attach__name {
  font-size: 0.8125rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.c21c-attach__size {
  font-size: 0.75rem;
  color: var(--c21c-meta);
}

.c21c-attach__item-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
}

.c21c-attach__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.c21c-attach__add {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.c21c-attach__status {
  font-size: 0.8125rem;
  color: var(--c21c-meta);
}

.c21c-attach .c21-image-editor {
  margin-top: 0.5rem;
}

/* —— Feed attachment rendering (posts + comments) —— */
.c21c-attachments {
  margin-top: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.c21c-attachments__gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: 0.4rem;
}

.c21c-attachments__image {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 0.4rem;
  background: #f3f4f6;
}

.c21c-attachments__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.c21c-attachments__audio audio,
.c21c-attachments__video video {
  width: 100%;
  max-width: 100%;
  display: block;
}

.c21c-attachments__label,
.c21c-attachments__doc-link {
  font-size: 0.8125rem;
  color: var(--c21c-accent-text);
}

.c21c-attachments__doc-link {
  text-decoration: underline;
  word-break: break-word;
}

.c21c-comment .c21c-attachments__gallery {
  grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
}
