/* ═══════════════════════════════════════════════════════════════════════════
   NANAJUNG Community Feed Layout
   3-Column Layout with Responsive Design
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────────────────
   Main Layout Structure
   ───────────────────────────────────────────────────────────────────────────── */
.feed-layout {
  display: grid;
  grid-template-columns: 280px 1fr 300px;
  gap: var(--space-lg);
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-lg);
  min-height: calc(100vh - var(--header-height));
}

/* ─────────────────────────────────────────────────────────────────────────────
   Header
   ───────────────────────────────────────────────────────────────────────────── */
.main-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-light);
  height: var(--header-height);
}

.main-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
  height: 100%;
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.header-logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--theme-primary-dark);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.header-logo span {
  color: var(--theme-accent);
}

.header-search {
  position: relative;
  width: 300px;
}

.header-search input {
  width: 100%;
  padding: var(--space-sm) var(--space-md) var(--space-sm) 40px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.header-search input:focus {
  outline: none;
  border-color: var(--theme-primary);
  background: var(--bg-tertiary);
  box-shadow: 0 0 0 3px rgba(var(--theme-primary-rgb), 0.1);
}

.header-search input::placeholder {
  color: var(--text-muted);
}

.header-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.header-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 1.1rem;
  transition: all var(--transition-fast);
  position: relative;
}

.header-icon-btn:hover {
  background: var(--theme-primary);
  color: white;
}

.header-icon-btn .badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  background: var(--color-error);
  color: white;
  font-size: 0.65rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-profile {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.header-profile:hover {
  background: var(--bg-secondary);
}

.header-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid var(--theme-primary);
}

.header-profile-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
}

.btn-login {
  display: none;
  padding: var(--space-xs) var(--space-md);
  background: var(--theme-primary);
  color: white;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.btn-login:hover {
  background: var(--theme-secondary);
  transform: translateY(-1px);
}

/* More Menu (3 dots) Dropdown */
.header-more-wrapper {
  position: relative;
}

.header-more-btn {
  font-size: 1.2rem;
  font-weight: bold;
}

.more-dropdown {
  position: absolute;
  top: calc(100% + var(--space-xs));
  right: 0;
  min-width: 180px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all var(--transition-fast);
  z-index: 1000;
}

.header-more-wrapper.open .more-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.more-dropdown-item {
  display: block;
  padding: var(--space-sm) var(--space-md);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background var(--transition-fast);
}

.more-dropdown-item:hover {
  background: var(--bg-secondary);
}

.more-dropdown-item.logout {
  color: #e53e3e;
}

.more-dropdown-item.logout:hover {
  background: rgba(229, 62, 62, 0.1);
}

.more-dropdown-divider {
  height: 1px;
  background: var(--border-light);
  margin: var(--space-xs) 0;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Left Sidebar
   ───────────────────────────────────────────────────────────────────────────── */
.sidebar-left {
  position: sticky;
  top: calc(var(--header-height) + var(--space-lg));
  height: fit-content;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.sidebar-nav {
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  border: 1px solid var(--border-light);
}

.sidebar-nav-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: var(--space-sm) var(--space-sm);
  margin-bottom: var(--space-xs);
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.sidebar-nav-item:hover {
  background: rgba(var(--theme-primary-rgb), 0.1);
  color: var(--theme-primary-dark);
  text-decoration: none;
}

.sidebar-nav-item.active {
  background: var(--gradient-primary);
  color: white;
}

.sidebar-nav-item .icon {
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
}

.sidebar-divider {
  height: 1px;
  background: var(--border-light);
  margin: var(--space-sm) 0;
}

/* Project items with color indicator */
.sidebar-nav-item.project-item {
  position: relative;
  padding-left: calc(var(--space-md) + 8px);
}

.sidebar-nav-item.project-item::before {
  content: '';
  position: absolute;
  left: var(--space-md);
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--project-color, var(--theme-primary));
}

/* Sidebar Logout */
.sidebar-nav-item.sidebar-logout {
  color: #e53e3e;
  margin-top: auto;
}

.sidebar-nav-item.sidebar-logout:hover {
  background: rgba(229, 62, 62, 0.1);
  color: #c53030;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Main Feed Area
   ───────────────────────────────────────────────────────────────────────────── */
.feed-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* Guest Prompt */
.guest-prompt {
  background: linear-gradient(135deg, var(--theme-primary), var(--theme-secondary));
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  color: white;
}

.guest-prompt-content {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.guest-prompt-icon {
  font-size: 2rem;
}

.guest-prompt-text {
  flex: 1;
  min-width: 200px;
}

.guest-prompt-text h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: white;
}

.guest-prompt-text p {
  margin: var(--space-xs) 0 0;
  font-size: 0.9rem;
  opacity: 0.9;
}

.btn-login-prompt {
  display: inline-block;
  padding: var(--space-sm) var(--space-lg);
  background: white;
  color: var(--theme-primary);
  border-radius: var(--radius-full);
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.btn-login-prompt:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Create Post Box */
.create-post-box {
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  border: 1px solid var(--border-light);
}

.create-post-header {
  display: flex;
  gap: var(--space-md);
  align-items: center;
}

.create-post-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  object-fit: cover;
}

.create-post-input {
  flex: 1;
  padding: var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  font-size: 0.95rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
}

.create-post-input:hover {
  background: var(--bg-primary);
  border-color: var(--theme-primary);
}

.create-post-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-light);
}

.create-post-action {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.create-post-action:hover {
  background: var(--bg-secondary);
}

.create-post-action .icon {
  font-size: 1.2rem;
}

.create-post-action.photo .icon { color: #10b981; }
.create-post-action.video .icon { color: #ef4444; }
.create-post-action.link .icon { color: #3b82f6; }
.create-post-action.poll .icon { color: #f59e0b; }

/* ─────────────────────────────────────────────────────────────────────────────
   Post Card
   ───────────────────────────────────────────────────────────────────────────── */
.post-card {
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  overflow: hidden;
  transition: all var(--transition-normal);
}

.post-card:hover {
  box-shadow: var(--shadow-md);
}

/* Pinned Post */
.post-card.pinned {
  border: 2px solid var(--theme-primary);
  position: relative;
}

.post-card.pinned::before {
  content: '📌 ปักหมุด';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: var(--gradient-primary);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: var(--space-xs) var(--space-md);
  text-align: center;
}

.post-card.pinned .post-header {
  margin-top: 28px;
}

/* Newsletter Post */
.post-card.newsletter {
  border-left: 4px solid var(--theme-primary);
}

.post-card.newsletter .post-header::after {
  content: '📢 จดหมายข่าว';
  background: rgba(var(--theme-primary-rgb), 0.15);
  color: var(--theme-primary-dark);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-left: auto;
}

.post-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
}

.post-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  object-fit: cover;
}

.post-author-info {
  flex: 1;
}

.post-author-name {
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.post-author-name .badge-admin {
  background: var(--gradient-primary);
  color: white;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.post-author-name .badge-mod {
  background: var(--theme-accent);
  color: white;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.post-project-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: rgba(var(--theme-primary-rgb), 0.1);
  color: var(--theme-primary-dark);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
}

.post-menu-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.post-menu-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* Post Context Menu */
.post-context-menu {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.post-menu-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
}

.post-menu-content {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-sm);
  min-width: 200px;
  box-shadow: var(--shadow-lg);
  animation: menuFadeIn 0.2s ease-out;
}

@keyframes menuFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.post-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.95rem;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
  text-align: left;
}

.post-menu-item:hover {
  background: var(--bg-secondary);
}

.post-menu-item.delete {
  color: #ef4444;
}

.post-menu-item.delete:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* Post Content */
.post-content {
  padding: 0 var(--space-lg) var(--space-md);
}

.post-text {
  color: var(--text-primary);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.post-text .hashtag {
  color: var(--theme-primary);
  cursor: pointer;
}

.post-text .hashtag:hover {
  text-decoration: underline;
}

.post-text .mention {
  color: var(--theme-primary-dark);
  font-weight: 500;
  cursor: pointer;
}

/* Read more */
.post-read-more {
  color: var(--theme-primary);
  cursor: pointer;
  font-weight: 500;
}

.post-read-more:hover {
  text-decoration: underline;
}

/* Post Media */
.post-media {
  margin-top: var(--space-md);
}

/* Single image - smart display based on orientation */
.post-media-single {
  position: relative;
  display: flex;
  justify-content: center;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.post-media-single img,
.post-media-single video {
  max-width: 100%;
  max-height: 600px;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* Portrait images - show full height with max width */
.post-media-single.portrait img {
  max-height: 650px;
  width: auto;
}

/* Landscape images - fill width with max height */
.post-media-single.landscape img {
  width: 100%;
  max-height: 450px;
  object-fit: cover;
}

/* Square images */
.post-media-single.square img {
  max-height: 500px;
}

.post-media-grid {
  display: grid;
  gap: 4px;
}

.post-media-grid.grid-2 {
  grid-template-columns: 1fr 1fr;
}

.post-media-grid.grid-3 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.post-media-grid.grid-3 .media-item:first-child {
  grid-row: span 2;
}

.post-media-grid.grid-4 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.post-media-grid .media-item {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
}

.post-media-grid .media-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-normal);
}

.post-media-grid .media-item:hover img {
  transform: scale(1.05);
}

.post-media-grid .media-item.more-overlay::after {
  content: attr(data-more);
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  font-size: 1.5rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Link Preview */
.post-link-preview {
  margin-top: var(--space-md);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  transition: all var(--transition-fast);
  text-decoration: none;
}

.post-link-preview:hover {
  border-color: var(--theme-primary);
  background: var(--bg-tertiary);
}

.post-link-preview-image {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  flex-shrink: 0;
  background: #000;
}

.post-link-preview-content {
  padding: var(--space-md) var(--space-lg);
  flex: 1;
  min-width: 0;
}

.post-link-preview-domain {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-xs);
}

.post-link-preview-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.post-link-preview-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}

/* Link Preview Loading State */
.link-preview-loading {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.link-preview-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-light);
  border-top-color: var(--theme-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Link Preview Favicon Fallback (no image) */
.link-preview-favicon-fallback {
  width: 100%;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
  flex-shrink: 0;
}

.link-preview-favicon {
  width: 48px;
  height: 48px;
  opacity: 0.8;
}

.link-preview-favicon-large {
  width: 64px;
  height: 64px;
}

.link-preview-url-display {
  font-size: 0.85rem;
  color: var(--theme-primary);
  word-break: break-all;
}

.link-preview-loading-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-top: var(--space-xs);
  color: var(--text-muted);
  font-size: 0.75rem;
}

.link-preview-spinner-small {
  width: 12px;
  height: 12px;
  border: 2px solid var(--border-light);
  border-top-color: var(--theme-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.post-link-preview.no-image .link-preview-favicon-fallback {
  display: flex;
}

/* Link Preview with image on top layout */
.post-link-preview.has-image .link-preview-favicon-fallback {
  display: none;
}

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

/* Post inline link styling */
.post-link {
  color: var(--theme-primary);
  word-break: break-all;
}

.post-link:hover {
  text-decoration: underline;
}

/* Poll */
.post-poll {
  margin-top: var(--space-md);
  padding: 0 var(--space-lg);
}

.poll-question {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
}

.poll-option {
  position: relative;
  margin-bottom: var(--space-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  cursor: pointer;
  overflow: hidden;
  transition: all var(--transition-fast);
}

.poll-option:hover {
  border-color: var(--theme-primary);
}

.poll-option.voted {
  border-color: var(--theme-primary);
}

.poll-option-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: rgba(var(--theme-primary-rgb), 0.15);
  transition: width var(--transition-normal);
}

.poll-option-content {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.poll-option-text {
  font-weight: 500;
  color: var(--text-primary);
}

.poll-option-percent {
  font-weight: 600;
  color: var(--theme-primary-dark);
}

.poll-info {
  display: flex;
  gap: var(--space-md);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: var(--space-sm);
}

/* Post Stats */
.post-stats {
  display: flex;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-lg);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.post-stats-reactions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.post-stats-reactions .reaction-icons {
  display: flex;
}

.post-stats-reactions .reaction-icons span {
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  margin-left: -4px;
}

.post-stats-reactions .reaction-icons span:first-child {
  margin-left: 0;
}

/* Post Actions */
.post-actions {
  display: flex;
  border-top: 1px solid var(--border-light);
}

.post-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.post-action-btn:hover {
  background: var(--bg-secondary);
  color: var(--theme-primary);
}

.post-action-btn.liked {
  color: #ef4444;
}

.post-action-btn .icon {
  font-size: 1.2rem;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Right Sidebar
   ───────────────────────────────────────────────────────────────────────────── */
.sidebar-right {
  position: sticky;
  top: calc(var(--header-height) + var(--space-lg));
  height: fit-content;
  max-height: calc(100vh - var(--header-height) - var(--space-lg) - var(--space-lg));
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding-right: var(--space-xs);
}

/* Custom scrollbar for sidebar */
.sidebar-right::-webkit-scrollbar {
  width: 6px;
}

.sidebar-right::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-right::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}

.sidebar-right::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.sidebar-card {
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  border: 1px solid var(--border-light);
}

.sidebar-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* User Profile Mini */
.user-profile-mini {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.user-profile-mini-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  object-fit: cover;
}

.user-profile-mini-info h4 {
  font-size: 0.95rem;
  margin: 0;
  color: var(--text-primary);
}

.user-profile-mini-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

.user-profile-mini-stats {
  display: flex;
  gap: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-light);
}

.user-profile-mini-stat {
  text-align: center;
}

.user-profile-mini-stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--theme-primary-dark);
}

.user-profile-mini-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Trending */
.trending-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.trending-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.trending-item:hover {
  background: var(--bg-secondary);
}

.trending-rank {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  width: 20px;
}

.trending-content {
  flex: 1;
}

.trending-tag {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.trending-posts {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Suggested Users */
.suggested-users {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.suggested-user {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.suggested-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  object-fit: cover;
}

.suggested-user-info {
  flex: 1;
  min-width: 0;
}

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

.suggested-user-bio {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.suggested-user-follow {
  padding: var(--space-xs) var(--space-md);
  background: var(--theme-primary);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.suggested-user-follow:hover {
  background: var(--theme-primary-dark);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Loading & Empty States
   ───────────────────────────────────────────────────────────────────────────── */
.feed-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
}

.feed-loading .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-light);
  border-top-color: var(--theme-primary);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
}

.feed-empty {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
}

.feed-empty-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Mobile Menu Toggle
   ───────────────────────────────────────────────────────────────────────────── */
.mobile-menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  background: var(--bg-secondary);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-primary);
  font-size: 1.2rem;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Responsive Design
   ───────────────────────────────────────────────────────────────────────────── */

/* Tablet */
@media (max-width: 1200px) {
  .feed-layout {
    grid-template-columns: 240px 1fr;
  }
  
  .sidebar-right {
    display: none;
  }
}

/* Mobile Landscape / Small Tablet */
@media (max-width: 900px) {
  .feed-layout {
    grid-template-columns: 1fr;
    padding: var(--space-sm);
    gap: var(--space-sm);
  }
  
  .sidebar-left {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: 280px;
    background: var(--bg-tertiary);
    z-index: 999;
    padding: var(--space-md);
    border-right: 1px solid var(--border-light);
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  .sidebar-left.open {
    display: flex;
    transform: translateX(0);
  }
  
  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    font-size: 1.4rem;
    background: var(--bg-secondary);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-primary);
  }
  
  .header-search {
    display: none;
  }
  
  .header-profile-name {
    display: none;
  }
  
  .header-right {
    gap: var(--space-sm);
  }
  
  .header-icon-btn {
    width: 36px;
    height: 36px;
  }
}

/* Mobile Portrait */
@media (max-width: 600px) {
  :root {
    --header-height: 56px;
  }
  
  .main-header-inner {
    padding: 0 var(--space-sm);
  }
  
  .header-left {
    gap: var(--space-sm);
  }
  
  .header-logo {
    font-size: 1.1rem;
  }
  
  .header-right {
    gap: var(--space-xs);
  }
  
  .header-icon-btn {
    width: 32px;
    height: 32px;
    font-size: 0.95rem;
  }
  
  .header-avatar {
    width: 32px;
    height: 32px;
  }
  
  .feed-layout {
    padding: var(--space-xs);
  }
  
  .feed-main {
    gap: var(--space-sm);
  }
  
  /* Create Post Box */
  .create-post-box {
    padding: var(--space-sm);
    border-radius: var(--radius-md);
  }
  
  .create-post-input {
    padding: var(--space-xs);
    gap: var(--space-sm);
  }
  
  .create-post-avatar {
    width: 36px;
    height: 36px;
  }
  
  .create-post-actions {
    flex-wrap: wrap;
    gap: var(--space-xs);
    padding: var(--space-xs) 0 0;
  }
  
  .create-post-action {
    flex: 1 1 auto;
    font-size: 0.8rem;
    padding: var(--space-xs) var(--space-sm);
    min-width: 80px;
    justify-content: center;
  }
  
  .create-post-action span:first-child {
    font-size: 1rem;
  }
  
  /* Post Cards */
  .post-card {
    border-radius: var(--radius-md);
  }
  
  .post-header {
    padding: var(--space-sm);
  }
  
  .post-avatar {
    width: 40px;
    height: 40px;
  }
  
  .post-author-name {
    font-size: 0.9rem;
  }
  
  .post-meta {
    font-size: 0.75rem;
  }
  
  .post-content {
    padding: 0 var(--space-sm) var(--space-sm);
  }
  
  .post-text {
    font-size: 0.9rem;
    line-height: 1.5;
  }
  
  .post-stats {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.8rem;
  }
  
  .post-actions {
    padding: var(--space-xs) var(--space-sm);
    gap: 0;
  }
  
  .post-action-btn {
    padding: var(--space-xs);
    font-size: 0.8rem;
    flex: 1;
    justify-content: center;
  }
  
  .post-action-btn .icon {
    font-size: 1rem;
  }
  
  .post-action-btn span:last-child {
    display: none;
  }
  
  /* Link Preview */
  .post-link-preview {
    flex-direction: column;
    margin: var(--space-sm);
  }
  
  .post-link-preview-image {
    width: 100%;
    height: 160px;
  }
  
  .post-link-preview-content {
    padding: var(--space-sm);
  }
  
  .post-link-preview-title {
    font-size: 0.9rem;
    -webkit-line-clamp: 2;
  }
  
  .post-link-preview-description {
    font-size: 0.8rem;
    -webkit-line-clamp: 2;
  }
  
  /* Media Grid */
  .post-media {
    padding: 0 var(--space-sm);
  }
  
  .post-media-grid {
    gap: 2px;
    border-radius: var(--radius-sm);
  }
  
  /* Comments Section */
  .comments-section {
    padding: var(--space-sm);
  }
  
  .comment-item {
    gap: var(--space-sm);
  }
  
  .comment-avatar {
    width: 32px;
    height: 32px;
  }
  
  .comment-input-form {
    gap: var(--space-sm);
    padding: var(--space-sm);
  }
  
  .comment-input-form textarea {
    font-size: 0.9rem;
    padding: var(--space-sm);
  }
  
  /* Post Context Menu (Mobile optimized) */
  .post-menu-content {
    width: calc(100% - 2rem);
    max-width: 320px;
  }
  
  .post-menu-item {
    padding: var(--space-md);
    font-size: 1rem;
  }
  
  /* Guest Prompt */
  .guest-prompt {
    padding: var(--space-md);
  }
  
  .guest-prompt-content {
    flex-direction: column;
    text-align: center;
  }
  
  .guest-prompt h3 {
    font-size: 1rem;
  }
  
  .guest-prompt-actions {
    flex-direction: column;
    width: 100%;
    gap: var(--space-sm);
  }
  
  .guest-prompt-actions .btn {
    width: 100%;
  }
}

/* Extra Small Mobile */
@media (max-width: 380px) {
  .header-logo span {
    display: none;
  }
  
  .create-post-action span:last-child {
    display: none;
  }
  
  .post-action-btn {
    padding: var(--space-xs) var(--space-sm);
  }
}

/* Safe Area for iPhone X+ */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .feed-layout {
    padding-bottom: calc(var(--space-lg) + env(safe-area-inset-bottom));
  }
  
  .sidebar-left {
    padding-bottom: calc(var(--space-md) + env(safe-area-inset-bottom));
  }
}

/* Overlay for mobile menu */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.open {
  display: block;
  opacity: 1;
}

/* Bottom Navigation for Mobile */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-light);
  padding: var(--space-xs) 0;
  padding-bottom: calc(var(--space-xs) + env(safe-area-inset-bottom, 0px));
  z-index: 1000;
}

@media (max-width: 600px) {
  .mobile-bottom-nav {
    display: flex;
    justify-content: space-around;
  }
  
  .feed-layout {
    padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
  }
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-xs) var(--space-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.65rem;
  transition: color var(--transition-fast);
  border: none;
  background: none;
  cursor: pointer;
}

.mobile-nav-item .icon {
  font-size: 1.3rem;
}

.mobile-nav-item.active,
.mobile-nav-item:hover {
  color: var(--theme-primary);
}

.mobile-nav-item.create-btn {
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  color: white;
  padding: var(--space-sm) var(--space-md);
  margin-top: -10px;
  box-shadow: 0 4px 12px rgba(var(--theme-primary-rgb), 0.3);
}

.mobile-nav-item.create-btn:hover {
  color: white;
  transform: scale(1.05);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Animations
   ───────────────────────────────────────────────────────────────────────────── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.post-card {
  animation: fadeInUp 0.3s ease forwards;
}

/* Staggered animation for posts */
.post-card:nth-child(1) { animation-delay: 0.05s; }
.post-card:nth-child(2) { animation-delay: 0.1s; }
.post-card:nth-child(3) { animation-delay: 0.15s; }
.post-card:nth-child(4) { animation-delay: 0.2s; }
.post-card:nth-child(5) { animation-delay: 0.25s; }
