/* ═══════════════════════════════════════════════════════════════════════════
   Arterra — community.css
   Shared styles for Members / Community pages (all portal types).
   Pair with portal.css.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Layout ─────────────────────────────────────────────────────────────── */
.community-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-top: 20px;
}

/* ── Groups panel ───────────────────────────────────────────────────────── */
.groups-panel {
  width: 216px;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  position: sticky;
  top: 20px;
}

.groups-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px 10px;
  border-bottom: 1px solid var(--border);
}

.groups-panel-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.groups-panel-body { padding: 6px 0; }

.group-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  cursor: pointer;
  transition: background 0.1s;
  position: relative;
}

.group-item:hover { background: var(--bg); }
.group-item.active { background: var(--accent-light); }
.group-item.active .group-item-name { color: var(--accent); font-weight: 600; }

.group-item-icon { font-size: 0.875rem; flex-shrink: 0; }

.group-item-name {
  flex: 1;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.group-item-count {
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1px 6px;
  flex-shrink: 0;
}

.group-item-actions {
  display: none;
  gap: 2px;
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
}

.group-item:hover .group-item-actions { display: flex; }
.group-item:hover .group-item-count   { display: none; }

.group-item-btn {
  background: none;
  border: none;
  padding: 3px 5px;
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-radius: 4px;
  line-height: 1;
  transition: background 0.1s, color 0.1s;
}

.group-item-btn:hover { background: rgba(0,0,0,0.07); color: var(--text-primary); }
.group-item-btn.danger:hover { color: #DC2626; }

.groups-empty {
  padding: 20px 14px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* ── Community main panel ───────────────────────────────────────────────── */
.community-main {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* ── Tabs ───────────────────────────────────────────────────────────────── */
.community-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
}

.community-tab {
  background: none;
  border: none;
  padding: 14px 16px 11px;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}

.community-tab:hover { color: var(--text-primary); }
.community-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* ── Filter bar ─────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.filter-search {
  flex: 1;
  min-width: 150px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  color: var(--text-primary);
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s;
}

.filter-search:focus { border-color: var(--accent); }

.filter-select {
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  background: var(--bg);
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}

.filter-select:focus { border-color: var(--accent); }

.filter-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  margin-left: auto;
}

/* ── Member list header ─────────────────────────────────────────────────── */
.member-list-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.checkbox-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.checkbox-wrap input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.member-list-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: auto;
}

/* ── Member rows ────────────────────────────────────────────────────────── */
.member-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
  cursor: pointer;
}

.member-row:last-child { border-bottom: none; }
.member-row:hover { background: var(--bg); }
.member-row.selected { background: var(--accent-light); }

.member-row-cb {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.member-avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.member-row-info { flex: 1; min-width: 0; }

.member-row-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-row-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-row-type {
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 20px;
  flex-shrink: 0;
  white-space: nowrap;
}

.type-founding-member { background: var(--accent-light); color: var(--accent); }
.type-member          { background: var(--bg); border: 1px solid var(--border); color: var(--text-muted); }
.type-supporter       { background: #ECFDF5; color: #059669; }
.type-follower        { background: #EFF4FE; color: #2B5BA8; }
.type-collaborator    { background: #EAF5F5; color: #2C7A7B; }
.type-visitor         { background: #FFFBEB; color: #D97706; }
.type-booking-contact { background: #FEF3EB; color: #C0622C; }
.type-new-inquiry     { background: #FEF3EB; color: #C0622C; }

.member-row-activity {
  font-size: 0.6875rem;
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 52px;
  text-align: right;
}

.activity-active { color: #059669; font-weight: 600; }
.activity-new    { color: #2B5BA8; font-weight: 600; }

.member-row-joined {
  font-size: 0.6875rem;
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 70px;
  text-align: right;
}

/* ── Empty state ────────────────────────────────────────────────────────── */
.empty-state {
  padding: 48px 20px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state-icon  { font-size: 2rem; margin-bottom: 12px; }
.empty-state-title { font-size: 0.9375rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state-text  { font-size: 0.8125rem; line-height: 1.55; }

/* ── Floating action bar ────────────────────────────────────────────────── */
.action-bar {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--sidebar-bg);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  padding: 11px 18px;
  border-radius: 40px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.35);
  z-index: 200;
  white-space: nowrap;
  animation: abSlideUp 0.2s ease;
}

@keyframes abSlideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.action-bar-count { font-size: 0.875rem; font-weight: 600; opacity: 0.8; }
.action-bar-btns  { display: flex; gap: 7px; }

.action-bar .btn-outline {
  border-color: rgba(255,255,255,0.28);
  color: #fff;
}

.action-bar .btn-outline:hover {
  border-color: rgba(255,255,255,0.6);
  background: rgba(255,255,255,0.09);
}

/* ── Modals ─────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-box {
  background: #fff;
  border-radius: 14px;
  padding: 0;
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.22);
}

.modal-box-sm { max-width: 420px; }

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: #fff;
  border-radius: 14px 14px 0 0;
  z-index: 1;
}

.modal-title    { font-size: 1rem; font-weight: 700; color: var(--text-primary); letter-spacing: -0.01em; }
.modal-subtitle { font-size: 0.8125rem; color: var(--text-muted); margin-top: 3px; }

.modal-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0 2px;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.12s;
}

.modal-close:hover { color: var(--text-primary); }

.modal-body { padding: 20px 24px; }

.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  bottom: 0;
  background: #fff;
  border-radius: 0 0 14px 14px;
  z-index: 1;
}

/* ── Recipient avatars strip ────────────────────────────────────────────── */
.recipient-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.recipient-avatars { display: flex; }

.recipient-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 700;
  margin-left: -7px;
  flex-shrink: 0;
}

.recipient-avatar:first-child { margin-left: 0; }

.recipient-more {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.5625rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-left: -7px;
}

.recipient-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-left: 4px;
}

.recipient-label strong { color: var(--text-primary); }

/* ── Form fields ────────────────────────────────────────────────────────── */
.form-field { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.form-input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  color: var(--text-primary);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

/* ── Rich text editor ───────────────────────────────────────────────────── */
.rte-wrapper {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.rte-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

.rte-toolbar {
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 6px 8px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.rte-btn {
  background: none;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  line-height: 1;
  transition: background 0.1s, color 0.1s;
}

.rte-btn:hover { background: var(--border); color: var(--text-primary); }
.rte-sep { width: 1px; height: 16px; background: var(--border); margin: 0 3px; flex-shrink: 0; }

.rte-body {
  min-height: 120px;
  padding: 11px 12px;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  color: var(--text-primary);
  outline: none;
  line-height: 1.65;
}

.rte-body:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
}

.rte-body ul, .rte-body ol { padding-left: 18px; }

.word-count {
  text-align: right;
  font-size: 0.6875rem;
  color: var(--text-muted);
  padding: 4px 10px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

/* ── Delivery toggles ───────────────────────────────────────────────────── */
.delivery-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  gap: 12px;
  transition: border-color 0.15s;
}

.delivery-option:last-child { margin-bottom: 0; }

.delivery-info   { flex: 1; }
.delivery-label  { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }
.delivery-desc   { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

.toggle-switch {
  width: 40px;
  height: 22px;
  background: var(--accent);
  border-radius: 11px;
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  top: 3px;
  right: 3px;
  transition: right 0.2s, left 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}

.toggle-switch.off { background: var(--border); }
.toggle-switch.off::after { right: auto; left: 3px; }

/* ── Schedule section ───────────────────────────────────────────────────── */
.schedule-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.schedule-option {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg);
  text-align: center;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  font-family: 'Inter', sans-serif;
}

.schedule-option.active {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

.schedule-option.locked { opacity: 0.5; cursor: not-allowed; }

.schedule-datetime {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.schedule-datetime input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  color: var(--text-primary);
  background: var(--bg);
  outline: none;
}

.schedule-datetime input:focus { border-color: var(--accent); }

.pro-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ── Preview section ────────────────────────────────────────────────────── */
.preview-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.preview-tab {
  padding: 7px 13px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: 'Inter', sans-serif;
  transition: color 0.12s;
}

.preview-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.preview-frame {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  min-height: 70px;
}

/* ── Confirmation banner ────────────────────────────────────────────────── */
.confirm-banner {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #1C1C1C;
  color: #fff;
  padding: 11px 22px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 600;
  box-shadow: 0 6px 24px rgba(0,0,0,0.28);
  white-space: nowrap;
  animation: cbDown 0.2s ease;
}

@keyframes cbDown {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Sent messages ──────────────────────────────────────────────────────── */
.sent-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.sent-row:last-child { border-bottom: none; }
.sent-row:hover { background: var(--bg); }

.sent-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9375rem;
  flex-shrink: 0;
}

.sent-info    { flex: 1; min-width: 0; }
.sent-subject { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }
.sent-meta    { font-size: 0.75rem; color: var(--text-muted); margin-top: 3px; }
.sent-actions { display: flex; gap: 6px; flex-shrink: 0; margin-top: 1px; }

/* ── Upgrade prompt ─────────────────────────────────────────────────────── */
.upgrade-box { padding: 32px 24px; text-align: center; }
.upgrade-icon  { font-size: 2.5rem; margin-bottom: 14px; }
.upgrade-title { font-size: 1.0625rem; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; letter-spacing: -0.01em; }
.upgrade-text  { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.55; margin-bottom: 24px; max-width: 340px; margin-left: auto; margin-right: auto; }

.upgrade-tiers {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  text-align: left;
}

.upgrade-tier {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}

.upgrade-tier-name {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.upgrade-tier-feature {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── Group name prompt ──────────────────────────────────────────────────── */
.prompt-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 6px; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .community-layout  { flex-direction: column; }
  .groups-panel      { width: 100%; position: static; }
}

@media (max-width: 640px) {
  .member-row-type     { display: none; }
  .member-row-joined   { display: none; }
  .member-row-activity { display: none; }
  .filter-select       { display: none; }
}
