/* ═══════════════════════════════════════════════════
   Community Page — SaaS-Quality Stylesheet
   ═══════════════════════════════════════════════════ */

/* ─── Tab Bar ────────────────────────────────────── */
.com-tab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: var(--border-light);
  padding: 3px;
  border-radius: 10px;
  width: fit-content;
}

.com-tab-btn {
  padding: 7px 20px;
  border: none;
  background: transparent;
  border-radius: 7px;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .18s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
}

.com-tab-btn:hover {
  color: var(--text-secondary);
}

.com-tab-btn.active {
  background: var(--card-bg);
  color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}

.com-tab-btn i { font-size: .875rem; }

/* ─── Toolbar ────────────────────────────────────── */
.com-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
}

.com-search {
  position: relative;
  flex: 1;
  min-width: 180px;
  max-width: 320px;
}

.com-search-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: .8125rem;
  pointer-events: none;
}

.com-search-input {
  width: 100%;
  padding: 7px 36px 7px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .8125rem;
  color: var(--text-primary);
  background: var(--card-bg);
  transition: all .15s ease;
  outline: none;
  font-family: inherit;
}

.com-search-input::placeholder { color: var(--text-muted); }
.com-search-input:hover { border-color: #cbd5e1; }

.com-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

.com-filter-select {
  padding: 7px 36px 7px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .8125rem;
  color: var(--text-primary);
  background: var(--card-bg) url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") no-repeat left 10px center / 12px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: all .15s ease;
  outline: none;
  font-family: inherit;
  min-width: 130px;
}

.com-filter-select:hover { border-color: #cbd5e1; }

.com-filter-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

.com-toolbar-spacer { flex: 1; }

/* ─── Table ──────────────────────────────────────── */
.com-table { border-collapse: collapse; }

.com-table thead th {
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 10px 16px;
  white-space: nowrap;
  border: none;
  background: var(--border-light);
  border-bottom: 1px solid var(--border);
}

.com-table .th-com-identity { min-width: 300px; }
.com-table .th-com-actions  { width: 100px; text-align: center; }

.com-table tbody tr.com-row {
  border-bottom: 1px solid var(--border-light);
  transition: background .15s ease;
  cursor: default;
}

.com-table tbody tr.com-row:last-child { border-bottom: none; }

.com-table tbody tr.com-row:hover {
  background: rgba(37, 99, 235, .02);
}

.com-table tbody td {
  padding: 10px 16px;
  font-size: .8125rem;
  vertical-align: middle;
  border: none;
  color: var(--text-primary);
}

/* ─── Community Identity Cell ────────────────────── */
.com-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.com-identity-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.0625rem;
  flex-shrink: 0;
  background: #eff6ff;
  color: #2563eb;
}

.com-identity-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.com-name {
  font-size: .9375rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
  line-height: 1.4;
  cursor: pointer;
  transition: color .15s ease;
}

.com-name:hover {
  color: var(--accent);
}

.com-desc {
  font-size: .75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
  line-height: 1.4;
}

/* ─── Count Cells ────────────────────────────────── */
.com-count {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .8125rem;
  font-weight: 500;
  color: var(--text-primary);
}

.com-count-icon {
  font-size: .75rem;
  color: var(--text-muted);
}

/* ─── Visibility Badge ───────────────────────────── */
.com-vis {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .75rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 6px;
  white-space: nowrap;
}

.com-vis-public {
  background: #ecfdf5;
  color: #059669;
}

.com-vis-private {
  background: var(--border-light);
  color: var(--text-muted);
}

.com-vis-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.com-vis-public .com-vis-dot {
  background: #10b981;
}

.com-vis-private .com-vis-dot {
  background: #94a3b8;
}

/* ─── Date Cell ──────────────────────────────────── */
.com-date {
  font-size: .75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ─── Actions ────────────────────────────────────── */
.td-com-actions { text-align: center; }

.com-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  position: relative;
}

.com-action-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: .875rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .15s ease;
  padding: 0;
}

.com-action-edit:hover {
  background: #eff6ff;
  color: #2563eb;
  border-color: rgba(37, 99, 235, .12);
}

.com-action-more:hover {
  background: var(--border-light);
  color: var(--text-primary);
}

/* ─── Dropdown Menu ──────────────────────────────── */
.com-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 100;
  min-width: 180px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .1), 0 2px 8px rgba(0, 0, 0, .04);
  padding: 4px;
  display: none;
  animation: comDropIn .15s ease;
}

.com-dropdown.open { display: block; }

@keyframes comDropIn {
  from { opacity: 0; transform: translateY(-6px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.com-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  border-radius: 7px;
  font-size: .8125rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: background .12s ease;
  font-family: inherit;
  text-align: right;
}

.com-dropdown-item:hover { background: var(--border-light); }

.com-dropdown-item i {
  font-size: .875rem;
  color: var(--text-muted);
  width: 18px;
  text-align: center;
}

.com-dropdown-item.danger { color: #dc2626; }
.com-dropdown-item.danger i { color: #dc2626; }
.com-dropdown-item.danger:hover { background: #fef2f2; }

.com-dropdown-divider {
  height: 1px;
  background: var(--border-light);
  margin: 4px 8px;
}

/* ─── Empty State ────────────────────────────────── */
.com-empty-state {
  text-align: center;
  padding: 64px 24px;
}

.com-empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: linear-gradient(135deg, #eff6ff, #e0e7ff);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 1.75rem;
  color: var(--accent);
}

.com-empty-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 6px;
}

.com-empty-subtitle {
  font-size: .875rem;
  color: var(--text-muted);
  margin: 0 0 24px;
  line-height: 1.5;
}

.com-empty-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: .8125rem;
  font-weight: 600;
  text-decoration: none;
  transition: all .15s ease;
  border: none;
  cursor: pointer;
}

.com-empty-cta:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, .25);
}

/* ─── Posts Tab ───────────────────────────────────── */
.com-post-content {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.5;
}

.com-post-author {
  font-size: .8125rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.com-post-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 6px;
  background: #eff6ff;
  color: #2563eb;
  font-size: .75rem;
  font-weight: 500;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.com-post-date {
  font-size: .75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ─── Responsive ─────────────────────────────────── */
@media (max-width: 768px) {
  .com-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .com-search { max-width: 100%; }
  .com-toolbar-spacer { display: none; }
  .com-name { max-width: 180px; }
  .com-desc { max-width: 180px; }
  .com-table .th-com-identity { min-width: 220px; }
}
