/* ========================================
   Post List Styles
   ======================================== */

.post-list-loading,
.post-list-error,
.post-list-empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 16px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Skeleton Loading */
.post-list-loading {
  padding: 0;
  text-align: left;
}

.loading-skeleton {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.skeleton-item {
  padding: 28px 0;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: start;
}

.skeleton-item:first-child {
  border-top: 1px solid var(--border);
}

.skeleton-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skeleton-tag {
  width: 80px;
  height: 14px;
  background: var(--border);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.skeleton-title {
  width: 70%;
  height: 24px;
  background: var(--border);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.skeleton-excerpt {
  width: 90%;
  height: 16px;
  background: var(--border);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.skeleton-date {
  width: 80px;
  height: 16px;
  background: var(--border);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

/* Shimmer animation */
.skeleton-tag::after,
.skeleton-title::after,
.skeleton-excerpt::after,
.skeleton-date::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255,255,255,0.1),
    transparent
  );
  animation: shimmer 1.5s infinite;
}

[data-theme="light"] .skeleton-tag::after,
[data-theme="light"] .skeleton-title::after,
[data-theme="light"] .skeleton-excerpt::after,
[data-theme="light"] .skeleton-date::after {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255,255,255,0.5),
    transparent
  );
}

@keyframes shimmer {
  to { left: 100%; }
}

.post-list-error .retry-btn {
  margin-top: 16px;
  padding: 10px 24px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.post-list-error .retry-btn:hover {
  opacity: 0.85;
}

/* Post Item */
.post-item {
  padding: 28px 0;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: start;
  cursor: pointer;
  transition: opacity 0.2s;
}

.post-item:first-child {
  border-top: 1px solid var(--border);
}

.post-item:hover {
  opacity: 0.8;
}

.post-content {
  min-width: 0; /* Allow text truncation */
}

.post-category {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent2);
  margin-bottom: 8px;
}

.post-category[data-channel="thinking"] {
  color: #f59e0b;
}

.post-category[data-channel="ai"] {
  color: #8b5cf6;
}

.post-category[data-channel="explore"] {
  color: #10b981;
}

.post-category[data-channel="now"] {
  color: #ec4899;
}

.post-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.3;
  color: var(--text);
}

.post-excerpt {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.6;
  margin: 8px 0 0;
}

.post-date {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  padding-top: 4px;
}

.post-stats {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--muted);
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Responsive */
@media (max-width: 768px) {
  .post-item {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .post-date {
    padding-top: 0;
  }

  .post-title {
    font-size: 1.1rem;
  }
}

/* Card Layout (alternative style) */
.post-list-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.post-list-cards .post-item {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.2s, border-color 0.2s;
}

[data-theme="light"] .post-list-cards .post-item {
  background: #fff;
}

.post-list-cards .post-item:hover {
  transform: translateY(-4px);
  border-color: rgba(232,121,249,0.3);
  opacity: 1;
}

.post-list-cards .post-item:first-child {
  border-top: 1px solid var(--border);
}

.post-list-cards .post-date {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
