/* ==========================================
   FORUM HUB - COMPLETE STYLESHEET
   Dark Theme, Modern Design
   ========================================== */

:root {
  --primary-color: #6c63ff;
  --primary-dark: #4f46e5;
  --bg-color: #0f0f13;
  --bg-secondary: #1a1a24;
  --card-bg: #1e1e2e;
  --card-hover: #252538;
  --border-color: #2a2a3a;
  --text-color: #e2e2f0;
  --text-secondary: #a0a0b8;
  --text-muted: #6b6b85;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --info: #3b82f6;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --transition: 0.2s ease;
}

/* ==========================================
   RESET & BASE
   ========================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
* { word-break: break-word; overflow-wrap: break-word; hyphens: auto; }
body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img, video { max-width: 100%; }
ul { list-style: none; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }
h1, h2, h3, h4, h5, h6 { line-height: 1.3; color: var(--text-color); }

/* ==========================================
   CONTAINER
   ========================================== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ==========================================
   NAVBAR
   ========================================== */
nav {
  background-color: rgba(15, 15, 19, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.9rem 0;
}
nav .container { position: relative; }
nav .container {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  justify-content: space-between;
}
nav .container .logo {
  display: flex;
  align-items: center;
}
nav .container .logo img {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.logo {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary-color);
  white-space: nowrap;
}
.logo:hover { color: var(--primary-dark); }
.nav-links {
  display: flex;
  gap: 1.5rem;
  flex: 1;
}
.nav-links a {
  color: var(--text-secondary);
  font-weight: 500;
  transition: color var(--transition);
}
.nav-links a:hover { color: var(--primary-color); }
.auth-buttons, .user-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
  flex-shrink: 0;
  white-space: nowrap;
}
.username {
  font-weight: 600;
  color: var(--primary-color);
}

/* ==========================================
   BUTTONS
   ========================================== */
.btn, button.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 0.55rem 1.2rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  transition: background var(--transition), transform var(--transition);
  white-space: nowrap;
}
.btn:hover { background-color: var(--primary-dark); transform: translateY(-1px); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-secondary, button.btn-secondary {
  background-color: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 0.55rem 1.2rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all var(--transition);
}
.btn-secondary:hover { border-color: var(--primary-color); color: var(--primary-color); }
.btn-small { padding: 0.35rem 0.8rem; font-size: 0.8rem; }
.btn-danger { background-color: var(--danger); }
.btn-danger:hover { background-color: #dc2626; }

/* ==========================================
   ALERTS
   ========================================== */
.alert {
  padding: 0.85rem 1.2rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-weight: 500;
}
.alert-error { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.alert-success { background: rgba(16,185,129,0.15); border: 1px solid rgba(16,185,129,0.3); color: #6ee7b7; }

/* ==========================================
   HERO SECTION
   ========================================== */
.hero {
  background: linear-gradient(135deg, rgba(108,99,255,0.2) 0%, rgba(79,70,229,0.1) 100%);
  border: 1px solid rgba(108,99,255,0.2);
  border-radius: var(--radius-lg);
  padding: 3.5rem 2rem;
  text-align: center;
  margin-bottom: 2.5rem;
}
.hero h1 {
  font-size: 2.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 0%, var(--primary-color) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1rem;
}
.hero p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

/* ==========================================
   SEARCH BAR
   ========================================== */
.search-container { margin-bottom: 2.5rem; }
.search-bar {
  display: flex;
  gap: 0.75rem;
  max-width: 600px;
  margin: 0 auto;
}
.search-bar input {
  flex: 1;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  transition: border-color var(--transition);
}
.search-bar input:focus { outline: none; border-color: var(--primary-color); }
.search-bar input::placeholder { color: var(--text-muted); }

/* ==========================================
   GRID LAYOUTS
   ========================================== */
.grid { display: grid; gap: 1rem; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }

/* ==========================================
   CATEGORY CARDS
   ========================================== */
.category-card {
  background: #000;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  padding: 1rem 1.4rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: inset 0 0 0 2px var(--primary-color), inset 0 0 12px rgba(108,99,255,0.25);
}
.category-card:hover {
  background: #0a0a0a;
  transform: translateY(-3px);
  box-shadow: inset 0 0 0 2px var(--primary-color), inset 0 0 24px rgba(108,99,255,0.45), 0 0 16px rgba(108,99,255,0.2);
}
.category-card h3 { font-size: 1rem; margin-bottom: 0.4rem; }
.category-card p { color: var(--text-secondary); font-size: 0.85rem; margin-bottom: 0.5rem; }
.category-badge {
  display: inline-block;
  background: rgba(108,99,255,0.2);
  color: var(--primary-color);
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

/* ==========================================
   POST GRID
   ========================================== */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
  align-items: start;
}
@media (max-width: 1100px) { .posts-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px)  { .posts-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px)  { .posts-grid { grid-template-columns: 1fr; } }

/* ==========================================
   POST LIST ITEMS
   ========================================== */
.post-item {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  position: relative;
}
@media (max-width: 768px) {
  .post-item {
    aspect-ratio: unset;
    min-height: 220px;
    overflow: hidden;
  }
  .post-item-body {
    overflow-y: visible;
    flex: 1;
  }
}
/* Cover photo inside card body */
.post-card-img {
  width: 100%;
  max-height: 120px;
  object-fit: contain;
  background: var(--card-bg);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  display: block;
  flex-shrink: 0;
  transition: background var(--transition);
}

/* Sticky meta bar at bottom of card */
.post-item-meta-bar {
  padding: 0.5rem 0.75rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-wrap: nowrap;
  flex-shrink: 0;
  background: var(--card-bg);
  transition: background var(--transition);
  align-items: center;
  overflow: hidden;
}
.post-item:hover {
  background: var(--card-hover);
  border-color: var(--primary-color);
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}
.post-item:hover .post-card-img { background: var(--card-hover); }
.post-item:hover .post-item-meta-bar { background: var(--card-hover); }
.post-item-cover {
  width: 100%;
  height: 130px;
  object-fit: contain;
  background: var(--bg-color);
  display: block;
  flex-shrink: 0;
}
.post-item-cover-placeholder {
  width: 100%;
  height: 5px;
  background: linear-gradient(90deg, var(--primary-color), var(--primary-dark));
  flex-shrink: 0;
}
.post-item-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}
.post-item-body::-webkit-scrollbar { width: 4px; }
.post-item-body::-webkit-scrollbar-track { background: transparent; }
.post-item-body::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
.post-item:hover .post-item-body::-webkit-scrollbar-thumb { background: var(--primary-color); }
.post-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.post-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-color);
  transition: color var(--transition);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-item:hover .post-title { color: var(--primary-color); }
.post-excerpt {
  color: var(--text-secondary);
  font-size: 0.82rem;
  margin-bottom: 0.75rem;
  flex: 1;
}
.post-meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.post-meta-item { display: flex; align-items: center; gap: 0.3rem; }

/* ==========================================
   PAGINATION
   ========================================== */
.pagination {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  margin: 2rem 0;
}
.pagination button {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  font-weight: 600;
  transition: all var(--transition);
}
.pagination button:hover:not(.disabled):not(.active) { border-color: var(--primary-color); color: var(--primary-color); }
.pagination button.active { background: var(--primary-color); border-color: var(--primary-color); color: white; }
.pagination button.disabled { opacity: 0.4; cursor: not-allowed; }
.pagination button:not(.disabled):not(.active) { padding: 0 0.6rem; width: auto; }

/* ==========================================
   LOADING & EMPTY STATE
   ========================================== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 3rem;
  color: var(--text-secondary);
}
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary);
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border-color);
}
.empty-state h3 { margin-bottom: 0.5rem; color: var(--text-color); }

/* ==========================================
   FORMS (Login, Register, Create Post)
   ========================================== */
.form-page {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.form-container {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow);
}
.form-container h2 { font-size: 1.6rem; margin-bottom: 0.4rem; }
.form-container .subtitle { color: var(--text-secondary); margin-bottom: 2rem; font-size: 0.9rem; }
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; margin-bottom: 0.45rem; font-weight: 600; font-size: 0.9rem; }
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  transition: border-color var(--transition);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(108,99,255,0.1);
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-muted); }
.form-group textarea { resize: vertical; min-height: 120px; }
.form-group select option { background: var(--bg-secondary); }
.form-footer { margin-top: 1.5rem; }
.form-footer .btn { width: 100%; justify-content: center; padding: 0.75rem; font-size: 1rem; }
.form-link { text-align: center; margin-top: 1.2rem; color: var(--text-secondary); font-size: 0.9rem; }
.form-link a { color: var(--primary-color); font-weight: 600; }
.form-link a:hover { text-decoration: underline; }

/* Create Post Specific */
.create-post-container {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}
.create-post-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
}
.create-post-card h2 { margin-bottom: 1.5rem; font-size: 1.5rem; }
.create-post-card .form-group input,
.create-post-card .form-group textarea,
.create-post-card .form-group select {
  background: var(--bg-color);
}
.create-post-card .form-group textarea { min-height: 200px; }

/* File Upload Zone */
.upload-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-color);
  position: relative;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--primary-color);
  background: rgba(108,99,255,0.05);
}
.upload-zone p { color: var(--text-secondary); margin-bottom: 0.5rem; }
.upload-zone .upload-icon { font-size: 2.5rem; margin-bottom: 1rem; display: block; }
.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.file-preview-list { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.file-preview-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-secondary);
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
}
.file-preview-item span { flex: 1; color: var(--text-color); }
.file-preview-item .remove-file {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 1rem;
  padding: 0;
}
.file-info { display: flex; flex-direction: column; flex: 1; gap: 0.15rem; }
.file-name { font-weight: 500; color: var(--text-color); font-size: 0.88rem; }
.file-size { color: var(--text-muted); font-size: 0.78rem; }
.btn-remove {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 1.1rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background var(--transition);
}
.btn-remove:hover { background: rgba(239,68,68,0.1); }
.btn-large { width: 100%; justify-content: center; padding: 0.85rem; font-size: 1rem; margin-top: 0.5rem; }

/* ==========================================
   POST DETAIL PAGE
   ========================================== */
.post-container {
  max-width: 860px;
  margin: 0 auto;
}
.post-detail-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.5rem;
}
.post-detail-title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 1rem;
  line-height: 1.2;
}
.post-author-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem; color: white;
  flex-shrink: 0; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.2rem; }
.avatar.xl { width: 100px; height: 100px; font-size: 2rem; }
.author-info { flex: 1; }
.author-name { font-weight: 700; color: var(--text-color); }
.author-name a:hover { color: var(--primary-color); }
.post-meta-detail { color: var(--text-muted); font-size: 0.83rem; }
.post-body {
  font-size: 1rem;
  line-height: 1.85;
  color: var(--text-color);
  white-space: pre-wrap;
  margin-bottom: 1.5rem;
}

/* Media Gallery */
.media-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.media-item { border-radius: var(--radius); overflow: hidden; background: var(--bg-color); }
.media-item img {
  width: 100%; height: 240px; object-fit: cover;
  display: block; transition: transform var(--transition);
  cursor: pointer;
}
.media-item img:hover { transform: scale(1.02); }
.media-item video { width: 100%; max-height: 360px; display: block; }

/* Post Actions */
.post-actions {
  display: flex;
  gap: 0.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
}
.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius);
  font-weight: 600;
  transition: all var(--transition);
}
.like-btn:hover, .like-btn.liked {
  background: rgba(239,68,68,0.1);
  border-color: var(--danger);
  color: var(--danger);
}
.like-btn .heart { font-size: 1rem; transition: transform var(--transition); }
.like-btn.liked .heart { animation: heartBeat 0.5s ease; }
@keyframes heartBeat {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

/* ==========================================
   COMMENTS
   ========================================== */
.comments-section { margin-top: 1.5rem; }
.comments-section h3 { font-size: 1.2rem; margin-bottom: 1.2rem; }
.comment-form-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.comment-form-card textarea {
  width: 100%;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  resize: vertical;
  min-height: 110px;
  transition: border-color var(--transition);
  margin-bottom: 0.75rem;
}
.comment-form-card textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(108,99,255,0.1);
}
.comment-form-card textarea::placeholder { color: var(--text-muted); }
.comment-item {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
  margin-bottom: 0.75rem;
}
.comment-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.comment-author { font-weight: 700; }
.comment-date { color: var(--text-muted); font-size: 0.8rem; margin-left: auto; }
.comment-body { color: var(--text-color); line-height: 1.6; font-size: 0.93rem; }
.comment-delete {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  transition: background var(--transition);
}
.comment-delete:hover { background: rgba(239,68,68,0.1); }

/* ==========================================
   PROFILE PAGE
   ========================================== */
.profile-container {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}
.profile-header-card {
  background: linear-gradient(135deg, rgba(108,99,255,0.3) 0%, rgba(79,70,229,0.15) 100%);
  border: 1px solid rgba(108,99,255,0.3);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  text-align: center;
  margin-bottom: 1.5rem;
}
.profile-avatar-wrap { position: relative; display: inline-block; margin-bottom: 1rem; }
.profile-username { font-size: 1.8rem; font-weight: 800; margin-bottom: 0.5rem; }
.profile-bio-display { color: var(--text-secondary); max-width: 500px; margin: 0 auto 1.25rem; }
.profile-stats {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
}
.profile-stat strong { display: block; font-size: 1.4rem; font-weight: 800; color: var(--primary-color); }
.profile-stat span { font-size: 0.82rem; color: var(--text-muted); }
.profile-section {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.profile-section h3 { font-size: 1.1rem; margin-bottom: 1.2rem; }
.profile-edit-section {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.profile-edit-section h3 { margin-bottom: 1rem; font-size: 1.1rem; }
.profile-edit-section textarea {
  width: 100%;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  resize: vertical;
  min-height: 100px;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
  transition: border-color var(--transition);
}
.profile-edit-section textarea:focus {
  outline: none;
  border-color: var(--primary-color);
}
.profile-edit-section textarea::placeholder { color: var(--text-muted); }
.profile-picture-upload { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.profile-picture-upload input[type="file"] { display: none; }
.profile-post-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border-color);
  gap: 1rem;
}
.profile-post-item:last-child { border-bottom: none; }
.profile-post-title { font-weight: 600; color: var(--text-color); }
.profile-post-title:hover { color: var(--primary-color); }
.profile-post-meta { color: var(--text-muted); font-size: 0.82rem; white-space: nowrap; }

/* ==========================================
   CATEGORY PAGE
   ========================================== */
.category-page-container {
  max-width: 860px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}
.category-page-header {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.5rem;
  border-left: 5px solid var(--primary-color);
}
.category-page-header h1 { font-size: 1.8rem; margin-bottom: 0.4rem; }
.category-page-header p { color: var(--text-secondary); }

/* ==========================================
   POST DETAIL - EXTRA ELEMENTS
   ========================================== */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 4rem;
  color: var(--text-secondary);
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.2rem;
  transition: color var(--transition);
}
.back-link:hover { color: var(--primary-color); }
.author-info-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.post-author-name { font-weight: 700; color: var(--text-color); }
.post-author-name:hover { color: var(--primary-color); }
.post-date { color: var(--text-muted); font-size: 0.8rem; }
.meta-item { display: flex; align-items: center; gap: 0.3rem; font-size: 0.85rem; color: var(--text-muted); }
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.action-btn:hover { border-color: var(--primary-color); color: var(--primary-color); }
.action-btn.liked, .action-btn.liked:hover { border-color: var(--danger); color: var(--danger); background: rgba(239,68,68,0.08); }
.action-btn-danger { border-color: rgba(239,68,68,0.3); color: var(--danger); }
.action-btn-danger:hover { background: rgba(239,68,68,0.1); border-color: var(--danger); }
.action-btn.disabled { cursor: default; pointer-events: none; }
.heart-icon { font-size: 1rem; }

/* Comments list */
.comments-list { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1rem; }
.comment-user-info { display: flex; flex-direction: column; flex: 1; }
.comment-username { font-weight: 700; color: var(--text-color); font-size: 0.9rem; }
.comment-username:hover { color: var(--primary-color); }
.btn-link { background: none; border: none; cursor: pointer; font-size: 0.82rem; padding: 0.2rem 0.5rem; border-radius: 4px; }
.btn-danger-link { color: var(--danger); }
.btn-danger-link:hover { background: rgba(239,68,68,0.1); }

/* Profile extras */
.profile-edit-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.profile-edit-card h3 { margin-bottom: 1rem; font-size: 1.1rem; }
.profile-edit-card textarea {
  width: 100%;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  resize: vertical;
  min-height: 100px;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color var(--transition);
}
.profile-edit-card textarea:focus { outline: none; border-color: var(--primary-color); }
.profile-edit-card textarea::placeholder { color: var(--text-muted); }
.profile-edit-card small { color: var(--text-muted); font-size: 0.8rem; display: block; margin-bottom: 0.75rem; }
.profile-posts-list { display: flex; flex-direction: column; }
.profile-post-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.4rem; flex-wrap: wrap; }
.profile-post-title { font-weight: 700; color: var(--text-color); }
.profile-post-title:hover { color: var(--primary-color); }
.profile-post-meta { display: flex; gap: 1rem; font-size: 0.82rem; color: var(--text-muted); }
.stat-item { display: flex; flex-direction: column; align-items: center; }
.stat-item strong { font-size: 1.4rem; color: var(--primary-color); }
.stat-item span { font-size: 0.8rem; color: var(--text-muted); }
.profile-info { flex: 1; }

/* Category page extras */
.post-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.2rem;
  gap: 1rem;
}
.posts-count-label { color: var(--text-muted); font-size: 0.9rem; }
.posts-container { display: flex; flex-direction: column; gap: 0.75rem; }
.no-posts { color: var(--text-secondary); padding: 2rem; text-align: center; }

/* Pagination extras */
.pagination-btn {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.pagination-btn:hover { border-color: var(--primary-color); color: var(--primary-color); }
.pagination-current {
  background: var(--primary-color);
  color: white;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius);
  font-weight: 700;
}
.pagination-dots { color: var(--text-muted); padding: 0.4rem; }

/* Section headings & posts header */
.posts-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.section-heading { margin-bottom: 1.2rem; }
@media (max-width: 768px) {
  .posts-header-bar { flex-direction: column; align-items: center; text-align: center; }
  .section-heading { text-align: center; }
}

/* Sort buttons */
.sort-dropdown { display: none; }
.sort-btn-group { display: flex; gap: 0.3rem; }
@media (max-width: 768px) {
  .sort-btn-group { display: none; }
  .sort-dropdown {
    display: block;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
  }
}
.sort-btn {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  white-space: nowrap;
}
.sort-btn:hover { border-color: var(--primary-color); color: var(--primary-color); }
.sort-btn.active-sort { background: var(--primary-color); border-color: var(--primary-color); color: white; }

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 900px) {
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .grid-5 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .nav-links { display: none; }
  .hero h1 { font-size: 1.9rem; }
  .post-detail-title { font-size: 1.5rem; }
  .profile-stats { gap: 1.2rem; }
  .form-container { padding: 1.5rem; }
  .create-post-card { padding: 1.5rem; }
  /* Hide text, keep image but don't absolutely position it on mobile */
  nav .container .logo span { display: none; }
  nav .container .logo img { position: static !important; transform: none !important; width: auto !important; height: 40px !important; max-width: none !important; object-fit: contain !important; }
  nav .container .logo { position: static !important; transform: none !important; margin: 0 auto; flex-shrink: 0; }
  nav .container { justify-content: space-between; }
  /* Compact auth/user buttons on mobile */
  .auth-buttons, .user-section { gap: 0.35rem; }
  .btn-secondary.btn-small, .btn.btn-small, .user-section button, .user-section a.btn { padding: 0.45rem 0.7rem !important; font-size: 0.78rem !important; }
  /* Layout: [New Post] [Logo centered] [pfp + Logout] */
  nav .container { flex-wrap: nowrap; position: relative; justify-content: space-between; align-items: center; }
  nav .container .logo { position: absolute; left: 50%; transform: translateX(-50%); margin: 0; pointer-events: auto; }
  .user-section { flex-direction: row; margin-left: 0; }
  /* Hide New Post button inside user-section on mobile */
  .user-section a.btn { display: none !important; }
  /* Show the mobile-only New Post button when logged in */
  #mobile-new-post.mobile-new-post-visible { display: inline-flex !important; }
}
@media (max-width: 768px) {
  .category-card p,
  .category-card small,
  .category-card .category-badge { display: none; }
  .category-card {
    padding: 0.6rem 0.4rem;
    text-align: center;
  }
  .category-card h3 {
    font-size: 0.75rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .grid-5 {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
  }
  .grid-5 > * {
    flex: 0 0 calc(33.333% - 0.5rem);
    box-sizing: border-box;
  }
  /* First category (Looksmaxxing) slightly wider */
  .grid-5 > *:nth-child(1) { flex: 0 0 calc(38% - 0.5rem); }
}
@media (max-width: 480px) {
  .hero { padding: 2rem 1rem; }
  .post-detail-card { padding: 1.25rem; }
  .auth-buttons { gap: 0.4rem; }
  .profile-container { padding: 0 0.75rem; }
}
