/* ══════════════════════════════════════
   Feed – Premium clean design
   ══════════════════════════════════════ */

.feed-shell {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 28px;
  align-items: start;
}

.feed-main { min-width: 0; }

/* ── Space navigation ─────────────── */
.feed-space-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
}

.feed-create-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-left: auto;
  border: none;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.feed-create-btn:hover {
  background: var(--primary-dark, color-mix(in srgb, var(--primary) 85%, #000));
  transform: scale(1.08);
}

.feed-space-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-secondary);
  background: transparent;
  border: 1.5px solid var(--border);
  transition: var(--transition);
}

.feed-space-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 5%, transparent);
}

.feed-space-btn.active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.feed-space-btn.feed-space-academic.active {
  background: #4A90E2; border-color: #4A90E2;
}

.feed-space-btn.feed-space-community.active {
  background: #28A745; border-color: #28A745;
}

/* ── Feed tabs (underline style) ──── */
.feed-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 1.5px solid var(--border);
}

.feed-tabs button {
  border: none;
  color: var(--text-secondary);
  background: transparent;
  padding: 10px 18px;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
}

.feed-tabs button::after {
  content: '';
  position: absolute;
  bottom: -1.5px;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: transparent;
  transition: var(--transition);
}

.feed-tabs button:hover { color: var(--text-primary); }

.feed-tabs button.active {
  color: var(--primary);
  font-weight: 600;
}

.feed-tabs button.active::after {
  background: var(--primary);
}

/* ── Feed list ────────────────────── */
.feed-list { display: grid; gap: 16px; }

/* ── Loading ──────────────────────── */
.feed-loading {
  display: flex;
  justify-content: center;
  padding: 48px 0;
}

.feed-loading-spinner {
  width: 28px;
  height: 28px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: feed-spin 0.7s linear infinite;
}

@keyframes feed-spin { to { transform: rotate(360deg); } }

/* ── Empty state ──────────────────── */
.feed-empty {
  text-align: center;
  padding: 48px 0;
  color: var(--text-muted);
}

.feed-empty i {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 12px;
}

/* ══════════════════════════════════════
   Post card – clean premium
   ══════════════════════════════════════ */
.feed-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.feed-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07);
  transform: translateY(-1px);
}

/* Cover image */
.feed-card-cover {
  display: block;
  position: relative;
  aspect-ratio: 16 / 7;
  background: var(--background);
  overflow: hidden;
}

.feed-card-cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.feed-card:hover .feed-card-cover img {
  transform: scale(1.03);
}

.feed-card-cover-overlay {
  position: absolute;
  top: 10px;
  left: 10px;
}

/* Body */
.feed-card-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Header (avatar + author + meta) */
.feed-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.feed-card-avatar { flex-shrink: 0; text-decoration: none; }

.feed-card-avatar-img {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.feed-card-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}

.feed-card-header-info { flex: 1; min-width: 0; }

.feed-card-author-name {
  display: block;
  color: var(--text-primary);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 1.2;
}

.feed-card-author-name:hover { color: var(--primary); }

.feed-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.feed-card-dot { font-size: 0.6rem; }

.feed-card-readtime {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* Title */
.feed-card-title-link { text-decoration: none; }

.feed-card-title {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.4;
  color: var(--text-primary);
  font-weight: 700;
}

.feed-card-title-link:hover .feed-card-title { color: var(--primary); }

/* Summary */
.feed-card-summary {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Footer */
.feed-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.feed-card-footer-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

/* Category badge */
.feed-card-category {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--cat-color, #4A90E2) 10%, #fff);
  color: var(--cat-color, #4A90E2);
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
}

.feed-card-category:hover {
  background: color-mix(in srgb, var(--cat-color, #4A90E2) 20%, #fff);
}

/* Space badge */
.feed-card-space {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}

.feed-card-space--academic {
  background: color-mix(in srgb, #4A90E2 12%, #fff);
  color: #4A90E2;
}

.feed-card-space--community {
  background: color-mix(in srgb, #28A745 12%, #fff);
  color: #28A745;
}

/* Tags */
.feed-card-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.feed-card-tag {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  color: var(--text-secondary);
  background: var(--background);
  text-decoration: none;
  transition: var(--transition);
}

.feed-card-tag:hover {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, #fff);
}

.feed-card-tag--more {
  color: var(--text-muted);
  font-weight: 600;
}

/* Stats */
.feed-card-stats {
  display: flex;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.8rem;
  flex-shrink: 0;
}

.feed-card-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.feed-card-stat i { font-size: 0.88rem; }

.feed-card-date {
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* ── Load more ────────────────────── */
.feed-load-more {
  display: block;
  width: 100%;
  margin-top: 8px;
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.feed-load-more:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 4%, #fff);
}

/* ══════════════════════════════════════
   Sidebar – cards style
   ══════════════════════════════════════ */
.feed-sidebar {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sb-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.sb-card-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 12px;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-primary);
}

.sb-card-title i {
  font-size: 1rem;
  color: var(--text-muted);
}

/* Search */
.sb-search-card { padding: 12px; }

.sb-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--background);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  transition: var(--transition);
}

.sb-search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent);
}

.sb-search-box i {
  color: var(--text-muted);
  font-size: 0.9rem;
  flex-shrink: 0;
}

.sb-search-box input {
  border: none;
  background: transparent;
  outline: none;
  flex: 1;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.sb-search-box input::placeholder { color: var(--text-muted); }

/* Categories */
.sb-categories {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sb-cat {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-primary);
  text-decoration: none;
  transition: var(--transition);
}

.sb-cat:hover {
  background: var(--background);
  color: var(--cat-color, var(--primary));
}

.sb-cat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cat-color, var(--primary));
  flex-shrink: 0;
}

.sb-cat--academic .sb-cat-dot { background: var(--cat-color, #4A90E2); }
.sb-cat--community .sb-cat-dot { background: var(--cat-color, #28A745); }

/* Tags */
.sb-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sb-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  background: var(--background);
  text-decoration: none;
  transition: var(--transition);
}

.sb-tag:hover {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, #fff);
}

.sb-tag-count {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* About */
.sb-about-text {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.6;
}

/* Skeleton loading */
.sb-skeleton {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--background) 25%, var(--border) 50%, var(--background) 75%);
  background-size: 200% 100%;
  animation: sb-shimmer 1.5s infinite;
}

@keyframes sb-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.sb-empty-text {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ── Responsive ───────────────────── */
@media (max-width: 1100px) {
  .feed-shell {
    grid-template-columns: 1fr 260px;
    gap: 20px;
  }
}

@media (max-width: 992px) {
  .feed-shell { grid-template-columns: 1fr; }
  .feed-sidebar { position: static; order: -1; }
  .sb-about-card { display: none; }
}

@media (max-width: 768px) {
  .feed-card-title { font-size: 1.05rem; }
  .feed-card-body { padding: 14px; }
  .feed-card-footer { flex-direction: column; align-items: flex-start; }
  .feed-card-stats { width: 100%; }
  .feed-space-btn { padding: 6px 12px; font-size: 0.82rem; }

  .feed-create-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 52px;
    height: 52px;
    font-size: 1.4rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    z-index: 1030;
  }

  .feed-create-btn:hover {
    transform: scale(1.1);
  }
}
