/* Spaces v2 community chrome: official badge, member stats, Join, About.
   Scoped under the space view and prefixed per AGENTS.md §12.9. Loaded only
   on the Space route so nothing leaks into other pages. */

.spaces-official-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--color-accent-soft, #e6f7f1);
  color: var(--color-accent-strong, #0a7f5c);
  font-size: 12px;
  font-weight: 600;
  vertical-align: middle;
  white-space: nowrap;
}

.spaces-hero-community {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-top: 10px;
}

.spaces-hero-stats {
  margin: 0;
  color: var(--color-text-muted, #5b6672);
  font-size: 14px;
}

.spaces-stat-sep {
  margin: 0 6px;
}

.spaces-lifecycle-note {
  color: var(--color-text-subtle, #8a939d);
}

.spaces-hero-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.spaces-join-btn,
.spaces-about-btn {
  padding: 8px 18px;
  border-radius: 999px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
}

.spaces-join-btn {
  border: 0;
  background: var(--color-primary, #0ba8d2);
  color: #fff;
}

/* Joined is a state, not a different control: same shape, quieter styling, so
   the button does not jump when it toggles. */
.spaces-join-btn[data-joined="true"] {
  background: transparent;
  border: 1px solid var(--color-border, #e3e7ec);
  color: var(--color-text-muted, #5b6672);
}

.spaces-join-btn[disabled] {
  opacity: 0.6;
  cursor: default;
}

.spaces-about-btn {
  border: 1px solid var(--color-border, #e3e7ec);
  background: transparent;
  color: inherit;
}

.spaces-join-status {
  flex-basis: 100%;
  margin: 0;
  font-size: 13px;
  color: var(--color-text-muted, #5b6672);
}

.spaces-join-status.is-error {
  color: var(--color-danger, #c0392b);
}

.spaces-about {
  margin: 12px 0 0;
  padding: 14px 16px;
  border: 1px solid var(--color-border, #e3e7ec);
  border-radius: 12px;
}

.spaces-about-title {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted, #5b6672);
}

.spaces-about-body p {
  margin: 0 0 8px;
  line-height: 1.55;
}

.spaces-about-owner {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--color-text-muted, #5b6672);
}

/* Named -feed-empty, not -empty: `.spaces-empty` already belongs to the
   Discovery Spaces sidebar widget in style.css. Two owners for one class is
   exactly the collision §12.9 exists to prevent. */
.spaces-feed-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--color-text-muted, #5b6672);
}

.spaces-feed-empty-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
  color: inherit;
}

.spaces-feed-empty-body {
  margin: 0 auto 14px;
  max-width: 44ch;
  line-height: 1.55;
}

/* My Spaces (Joined / Managed) in the discovery sidebar. */
.spaces-group-title {
  margin: 14px 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted, #5b6672);
}

.spaces-state-label {
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--color-surface-muted, #f1f4f7);
  color: var(--color-text-muted, #5b6672);
  font-size: 11px;
  font-weight: 600;
}

@media (max-width: 640px) {
  .spaces-hero-community {
    gap: 8px 12px;
  }

  .spaces-hero-actions {
    width: 100%;
  }

  .spaces-join-btn,
  .spaces-about-btn {
    flex: 1 1 auto;
    text-align: center;
  }
}

/* Focus. Every interactive element added here must show where the keyboard is
   — :focus-visible so a mouse click does not leave a ring behind. */
.spaces-join-btn:focus-visible,
.spaces-about-btn:focus-visible,
.spaces-item:focus-visible {
  outline: 2px solid var(--color-primary, #0ba8d2);
  outline-offset: 2px;
  border-radius: 8px;
}

.spaces-join-btn:focus-visible,
.spaces-about-btn:focus-visible {
  border-radius: 999px;
}

/* The sidebar rows are links now, so cancel the default underline/colour. */
.spaces-item {
  color: inherit;
  text-decoration: none;
}

/* Owner / moderator control panel. */
.spaces-manage {
  margin: 12px 0 0;
  padding: 16px 18px;
  border: 1px solid var(--color-border, #e3e7ec);
  border-radius: 12px;
}

.spaces-manage-title {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 700;
}

.spaces-manage-note,
.spaces-manage-hint {
  margin: 0 0 12px;
  max-width: 62ch;
  color: var(--color-text-muted, #5b6672);
  font-size: 13px;
  line-height: 1.55;
}

.spaces-manage-group {
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}

.spaces-manage-legend {
  padding: 0;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted, #5b6672);
}

.spaces-manage-label {
  display: block;
  margin: 10px 0 4px;
  font-size: 13px;
  font-weight: 600;
}

.spaces-manage-input {
  display: block;
  width: 100%;
  max-width: 520px;
  padding: 9px 12px;
  border: 1px solid var(--color-border, #e3e7ec);
  border-radius: 8px;
  font: inherit;
  box-sizing: border-box;
}

.spaces-manage-checkbox {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 10px 0;
  font-size: 14px;
  cursor: pointer;
}

.spaces-manage-field {
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid var(--color-border-subtle, #eef1f4);
  border-radius: 10px;
}

.spaces-manage-field-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.spaces-manage-field-label {
  flex: 1 1 220px;
  max-width: 340px;
}

.spaces-manage-field-type {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--color-surface-muted, #f1f4f7);
  color: var(--color-text-muted, #5b6672);
  font-size: 11px;
  font-weight: 600;
}

.spaces-manage-field-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
}

.spaces-manage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
}

.spaces-manage-status {
  margin: 0;
  font-size: 13px;
  color: var(--color-text-muted, #5b6672);
}

.spaces-manage-status.is-error {
  color: var(--color-danger, #c0392b);
}

.spaces-manage-input:focus-visible {
  outline: 2px solid var(--color-primary, #0ba8d2);
  outline-offset: 1px;
}
