/* ============================================
   FORUM STYLES - Hufeland Community Forum
   ============================================ */

/* Container */
.forum-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* Breadcrumb */
.forum-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.forum-breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}

.forum-breadcrumb a:hover {
  text-decoration: underline;
}

.forum-breadcrumb .sep {
  color: var(--border);
}

.forum-breadcrumb .current {
  color: var(--text);
}

/* Forum Header */
.forum-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 2rem;
}

.forum-header-content h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.forum-subtitle {
  color: var(--muted);
  margin: 0;
}

.forum-stats-box {
  display: flex;
  gap: 2rem;
}

.stat-item {
  text-align: center;
}

.stat-item .stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-item .stat-label {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Category */
.forum-category {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.category-header {
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 70%, purple));
  padding: 1rem 1.5rem;
}

.category-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #0a0e12;
  margin: 0;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.2);
}

.category-description {
  font-size: 0.85rem;
  color: rgba(10, 14, 18, 0.85);
  margin: 0.25rem 0 0;
}

/* Forum List */
.forum-list {
  display: flex;
  flex-direction: column;
}

.forum-row {
  display: grid;
  grid-template-columns: 60px 1fr 150px 200px;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-fast);
}

.forum-row:last-child {
  border-bottom: none;
}

.forum-row:hover {
  background: var(--surface-2);
}

.forum-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.icon-large {
  font-size: 2rem;
}

.forum-locked-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  font-size: 0.75rem;
}

.forum-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.forum-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.forum-title:hover {
  color: var(--accent);
}

.forum-description {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.25rem 0 0;
}

/* Subforums */
.subforums {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.subforums-label {
  font-size: 0.75rem;
  color: var(--muted);
}

.subforum-link {
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
  padding: 0.15rem 0.5rem;
  background: var(--surface-2);
  border-radius: 4px;
}

.subforum-link:hover {
  background: var(--accent);
  color: white;
}

.subforum-sep {
  color: var(--border);
  font-size: 0.6rem;
}

.forum-stats {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.25rem;
}

.forum-stats .stat {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.forum-stats .stat-number {
  font-weight: 600;
  color: var(--text);
}

.forum-stats .stat-text {
  font-size: 0.8rem;
  color: var(--muted);
}

.forum-last-post {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.last-post-info {
  font-size: 0.85rem;
}

.last-topic-title {
  color: var(--text);
  text-decoration: none;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.last-topic-title:hover {
  color: var(--accent);
}

.last-post-meta {
  display: flex;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.no-posts {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
}

/* Forum View Header */
.forum-view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.forum-view-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.forum-view-icon {
  font-size: 2.5rem;
}

.forum-view-info h1 {
  font-size: 1.5rem;
  margin: 0;
}

.forum-view-description {
  color: var(--muted);
  margin: 0.25rem 0 0;
}

/* Subforums Section */
.subforums-section {
  margin-bottom: 2rem;
}

.subforums-section h3 {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.subforums-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.subforum-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.subforum-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.subforum-icon {
  font-size: 1.5rem;
}

.subforum-name {
  font-weight: 600;
  color: var(--text);
}

.subforum-count {
  font-size: 0.75rem;
  color: var(--muted);
}

/* Topics Section */
.topics-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.topics-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.topics-header h3 {
  margin: 0;
  font-size: 1rem;
}

.topics-sort {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.topics-sort select {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
}

/* Topic Row */
.topics-list {
  display: flex;
  flex-direction: column;
}

.topic-row {
  display: grid;
  grid-template-columns: 40px 50px 1fr 120px 150px;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-fast);
}

.topic-row:last-child {
  border-bottom: none;
}

.topic-row:hover {
  background: var(--surface-2);
}

.topic-row.pinned {
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.05), transparent);
}

.topic-row.locked {
  opacity: 0.7;
}

.topic-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

.topic-badge {
  font-size: 0.9rem;
}

.topic-avatar .avatar,
.topic-avatar .avatar-placeholder {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, purple));
  color: white;
  font-weight: 600;
  font-size: 1rem;
}

.topic-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.topic-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.topic-title:hover {
  color: var(--accent);
}

.topic-meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.topic-meta a {
  color: var(--accent);
  text-decoration: none;
}

.topic-stats {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.25rem;
}

.stat-cell {
  text-align: center;
}

.stat-cell .stat-value {
  font-weight: 600;
  color: var(--text);
}

.stat-cell .stat-label {
  font-size: 0.7rem;
  color: var(--muted);
  display: block;
}

.topic-last-post {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.last-reply {
  font-size: 0.85rem;
}

.last-reply-user {
  display: block;
  color: var(--text);
  font-weight: 500;
}

.last-reply-time {
  font-size: 0.75rem;
  color: var(--muted);
}

.no-replies {
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
}

/* Pagination */
.forum-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  padding: 1.5rem;
  border-top: 1px solid var(--border);
}

.page-btn,
.page-num {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}

.page-btn:hover,
.page-num:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.page-current {
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: white;
  border-radius: 6px;
  font-weight: 600;
}

.page-numbers {
  display: flex;
  gap: 0.25rem;
}

.page-ellipsis {
  padding: 0.5rem;
  color: var(--muted);
}

/* Page Jump Dropdown (IPB Style) */
.page-jump-dropdown {
  position: relative;
  margin-left: 1rem;
}

.page-jump-btn {
  padding: 0.5rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.page-jump-btn:hover {
  background: var(--surface);
  border-color: var(--accent);
}

.page-jump-menu {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 0.5rem;
  padding: 0.75rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  display: none;
  gap: 0.5rem;
  z-index: 100;
}

.page-jump-menu.active {
  display: flex;
}

.page-jump-input {
  width: 100px;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.9rem;
}

.page-jump-input:focus {
  outline: none;
  border-color: var(--accent);
}

.page-jump-input.error {
  border-color: var(--danger);
  animation: shake 0.3s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.page-jump-go {
  padding: 0.5rem 1rem;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.page-jump-go:hover {
  opacity: 0.9;
}

/* Follow Topic Toggle */
.topic-actions-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.follow-topic-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 24px;
  transition: all var(--transition-fast);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  bottom: 2px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition-fast);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

.toggle-label {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Toast Notification */
.toast-notification {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 0.75rem 1.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  color: var(--text);
  font-size: 0.9rem;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
}

.toast-notification.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-notification.success {
  border-color: #4ade80;
}

.toast-notification.error {
  border-color: var(--danger);
}

/* Topic View */
.topic-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.topic-header-info h1 {
  font-size: 1.5rem;
  margin: 0 0 0.5rem;
}

.topic-header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.topic-mod-actions {
  display: flex;
  gap: 0.5rem;
}

/* Posts List */
.posts-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.post-item {
  display: grid;
  grid-template-columns: 180px 1fr;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: all var(--transition-fast);
}

.post-item.first-post {
  border-color: var(--accent);
  border-width: 2px;
}

.post-item.highlighted {
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.3);
}

.post-author-sidebar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.5rem 1rem;
  background: var(--surface-2);
  text-align: center;
}

.post-avatar .avatar-large,
.avatar-placeholder.large {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-placeholder.large {
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, purple));
  color: white;
}

.post-author-name {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.post-author-name:hover {
  color: var(--accent);
}

.post-author-rank {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  background: var(--accent);
  color: white;
  border-radius: 4px;
}

.post-author-stats {
  font-size: 0.75rem;
  color: var(--muted);
}

.post-author-stats span {
  display: block;
}

.post-content-area {
  display: flex;
  flex-direction: column;
}

.post-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
}

.post-permalink {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.post-permalink:hover {
  text-decoration: underline;
}

.post-edited {
  margin-left: auto;
  font-style: italic;
}

.post-body {
  flex: 1;
  padding: 1.5rem;
  line-height: 1.7;
  color: var(--text);
}

.post-body p {
  margin: 0 0 1rem;
}

.post-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  margin: 1rem 0;
  color: var(--muted);
  font-style: italic;
}

.post-body code {
  background: var(--surface-2);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: 'Fira Code', monospace;
  font-size: 0.9em;
}

.post-body pre {
  background: var(--surface-2);
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
}

.post-body pre code {
  background: none;
  padding: 0;
}

.post-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
}

.post-actions {
  display: flex;
  gap: 0.5rem;
}

.post-action-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  transition: all var(--transition-fast);
}

.post-action-btn:hover {
  background: var(--surface);
  color: var(--text);
}

.post-action-btn.danger:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* Reply Form */
.reply-form-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-top: 1.5rem;
}

.reply-form-section h3 {
  margin: 0 0 1rem;
}

.reply-form textarea {
  width: 100%;
  min-height: 150px;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.6;
  resize: vertical;
}

.reply-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.topic-locked-notice,
.login-to-reply {
  text-align: center;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-top: 1.5rem;
  color: var(--muted);
}

.topic-locked-notice .icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
}

.login-to-reply a {
  color: var(--accent);
}

/* New Topic Form */
.new-topic-form-container {
  max-width: 800px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
}

.new-topic-form-container h1 {
  margin: 0 0 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-subtitle {
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.new-topic-form .form-group {
  margin-bottom: 1.5rem;
}

.new-topic-form label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.new-topic-form input[type="text"],
.new-topic-form textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem;
}

.new-topic-form input[type="text"]:focus,
.new-topic-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.editor-toolbar {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
}

.editor-toolbar + textarea {
  border-radius: 0 0 8px 8px;
}

.editor-toolbar button {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
}

.editor-toolbar button:hover {
  background: var(--surface);
  border-color: var(--border);
}

.toolbar-sep {
  width: 1px;
  background: var(--border);
  margin: 0 0.5rem;
}

.form-inline {
  display: flex;
  align-items: center;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 1.5rem;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--muted);
}

.empty-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 1rem;
}

/* Online Users */
.forum-online-users {
  margin-top: 2rem;
  padding: 1rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.forum-online-users h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.online-dot {
  width: 10px;
  height: 10px;
  background: #22c55e;
  border-radius: 50%;
  animation: pulse-online 2s ease-in-out infinite;
}

@keyframes pulse-online {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.online-count {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
}

.online-list {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  line-height: 1.6;
}

.online-user {
  color: var(--accent);
  text-decoration: none;
}

.online-user:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 900px) {
  .forum-header {
    flex-direction: column;
    gap: 1.5rem;
    text-align: center;
  }
  
  .forum-row {
    grid-template-columns: 50px 1fr;
    gap: 0.75rem;
  }
  
  .forum-stats,
  .forum-last-post {
    display: none;
  }
  
  .topic-row {
    grid-template-columns: 40px 1fr;
  }
  
  .topic-status,
  .topic-stats,
  .topic-last-post {
    display: none;
  }
  
  .post-item {
    grid-template-columns: 1fr;
  }
  
  .post-author-sidebar {
    flex-direction: row;
    padding: 1rem;
    gap: 1rem;
  }
  
  .post-avatar .avatar-large,
  .avatar-placeholder.large {
    width: 50px;
    height: 50px;
    font-size: 1.25rem;
  }
  
  .post-author-stats,
  .post-author-details {
    display: none;
  }
}

@media (max-width: 600px) {
  .forum-container {
    padding: 1rem;
  }
  
  .category-header,
  .forum-row,
  .topics-header,
  .topic-row {
    padding: 0.75rem 1rem;
  }
  
  .forum-view-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  
  .topic-header {
    flex-direction: column;
    gap: 1rem;
  }
  
  .topic-actions-right {
    width: 100%;
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .follow-topic-toggle {
    order: 2;
  }
  
  .topic-mod-actions {
    width: 100%;
    justify-content: flex-end;
    order: 1;
  }
  
  .forum-pagination {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem;
  }
  
  .page-jump-dropdown {
    width: 100%;
    margin: 0.5rem 0 0;
    order: 10;
  }
  
  .page-jump-btn {
    width: 100%;
    text-align: center;
  }
  
  .page-jump-menu {
    left: 0;
    right: 0;
    bottom: auto;
    top: 100%;
    margin-top: 0.5rem;
    margin-bottom: 0;
  }
  
  .post-actions {
    flex-wrap: wrap;
  }
  
  .form-actions {
    flex-direction: column;
  }
  
  .form-actions .btn {
    width: 100%;
  }
  
  .editor-toolbar {
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px;
    justify-content: flex-start;
  }
  .editor-toolbar button,
  .editor-toolbar .toolbar-btn {
    min-width: 38px;
    min-height: 38px;
    padding: 6px 8px;
    font-size: 0.95rem;
    border-radius: 6px;
  }
  /* Drop the vertical separators on mobile — they only waste row width */
  .editor-toolbar .toolbar-sep {
    display: none;
  }
  /* Bigger reply textarea & don't let toolbar collapse weirdly */
  .new-topic-form textarea,
  textarea#replyContent {
    min-height: 160px;
    font-size: 16px;  /* prevents iOS auto-zoom on focus */
  }
}

/* ============================================
   IPB-STYLE ENHANCED SIDEBAR & QUOTE
   ============================================ */

/* Author Details in Sidebar */
.post-author-details {
  width: 100%;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.author-stat {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  padding: 0.25rem 0;
}

.author-stat-icon {
  font-size: 0.85rem;
  width: 1.2rem;
  text-align: center;
}

.author-stat-label {
  color: var(--muted);
  flex: 1;
}

.author-stat-value {
  font-weight: 500;
  color: var(--text);
}

.author-stat-value.online {
  color: #4ade80;
}

.author-stat-value.offline {
  color: var(--muted);
}

.post-author-group {
  font-size: 0.7rem;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.post-author-group.admin {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
}

.post-author-group.member {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
}

/* Online Indicator */
.post-avatar {
  position: relative;
}

.online-indicator {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 14px;
  height: 14px;
  background: #4ade80;
  border: 2px solid var(--surface);
  border-radius: 50%;
  animation: pulse-online 2s infinite;
}

@keyframes pulse-online {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ============================================
   IPB-STYLE QUOTE BOX - Preview in editor
   ============================================ */
.quote-preview {
  background: var(--surface);
  border: 0 solid color-mix(in srgb, var(--surface) 85%, var(--text));
  border-inline-start-width: 4px;
  border-radius: 6px;
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.quote-preview .quote-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1rem;
  background: transparent;
  border-bottom: none;
  font-size: 0.9rem;
}

.quote-preview .quote-header::before {
  content: '💬';
  margin-inline-end: 0.5rem;
  font-size: 1rem;
}

.quote-preview .quote-info {
  color: var(--text);
  flex: 1;
}

.quote-preview .quote-info strong {
  color: var(--accent);
  font-weight: 700;
}

.quote-preview .quote-date {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.quote-remove {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.quote-remove:hover {
  background: var(--surface-hover, rgba(255,255,255,0.1));
  color: var(--text);
}

.quote-preview .quote-content {
  padding: 0.5rem 1rem 0.75rem 1rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-style: normal;
  max-height: 100px;
  overflow-y: auto;
  line-height: 1.5;
}

/* ============================================
   IPB-STYLE QUOTE (ipsQuote)
   ============================================ */
.ipsQuote,
blockquote.ipsQuote,
.post-body blockquote,
.message-content-view blockquote {
  display: flow-root;
  width: 100%;
  overflow: hidden;
  border-radius: 6px;
  border: 0 solid color-mix(in srgb, var(--surface) 85%, var(--text));
  background: var(--surface);
  border-inline-start-width: 4px;
  position: relative;
  z-index: 1;
  padding: 0;
  margin: 1rem 0;
}

.ipsQuote_citation,
.ipsQuote .ipsQuote_citation {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.8rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  flex-wrap: wrap;
}

.ipsQuote_citation::before {
  content: '💬';
  margin-inline-end: 0.5rem;
  font-size: 1rem;
}

.ipsQuote_citation a,
.ipsQuote_citation .quote-author-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

.ipsQuote_citation a:hover,
.ipsQuote_citation .quote-author-link:hover {
  text-decoration: underline;
}

.ipsQuote_contents,
.ipsQuote .ipsQuote_contents {
  padding: 0 1rem 1rem 1rem;
  margin: 0;
  color: var(--text-secondary);
  font-style: normal;
  line-height: 1.6;
  font-size: 0.95rem;
}

/* Nested quotes */
.ipsQuote .ipsQuote {
  margin: 0.75rem 0;
  background: color-mix(in srgb, var(--surface) 80%, var(--bg));
}

/* Quote selection tooltip */
.quote-selection-tooltip {
  position: absolute;
  z-index: 1000;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  display: none;
  animation: tooltipFadeIn 0.15s ease-out;
}

.quote-selection-tooltip a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
}

.quote-selection-tooltip a:hover {
  color: var(--accent);
}

@keyframes tooltipFadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Legacy support - keep old quote-block class working */
.quote-block {
  display: flow-root;
  width: 100%;
  overflow: hidden;
  border-radius: 6px;
  border: 0 solid color-mix(in srgb, var(--surface) 85%, var(--text));
  background: var(--surface);
  border-inline-start-width: 4px;
  position: relative;
  z-index: 1;
  padding: 0;
  margin: 1rem 0;
}

.quote-block .quote-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border-bottom: none;
}

.quote-block .quote-header::before {
  content: '💬';
  margin-inline-end: 0.5rem;
  font-size: 1rem;
}

.quote-block .quote-author {
  color: var(--accent);
  font-weight: 700;
}

.quote-block .quote-wrote {
  color: var(--text-secondary);
  font-weight: 400;
}

.quote-block .quote-date {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 400;
}

.quote-block .quote-text {
  padding: 0 1rem 1rem 1rem;
  margin: 0;
  color: var(--text-secondary);
  font-style: normal;
  line-height: 1.6;
  font-size: 0.95rem;
}

/* Nested quotes */
.quote-block .quote-block {
  margin: 0.75rem 0;
  background: color-mix(in srgb, var(--surface) 80%, var(--bg));
}

/* ============================================
   RICH EDITOR TOOLBAR
   ============================================ */
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  flex-wrap: wrap;
}

.toolbar-group {
  display: flex;
  gap: 0.25rem;
}

.toolbar-sep {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 0.5rem;
}

.toolbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  color: var(--text);
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}

.toolbar-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.toolbar-select {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
}

.reply-form textarea {
  border-radius: 0 0 8px 8px !important;
  border-top: none !important;
}

.editor-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  font-size: 0.8rem;
}

.char-count {
  color: var(--muted);
}

.checkbox-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  color: var(--muted);
}

.checkbox-option input {
  accent-color: var(--accent);
}

/* Post Preview Modal */
.post-preview-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 2rem;
}

.post-preview-content {
  background: var(--surface);
  border-radius: 12px;
  max-width: 700px;
  width: 100%;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.post-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.post-preview-header h4 {
  margin: 0;
}

.post-preview-header button {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.25rem;
  padding: 0.25rem;
}

.post-preview-body {
  padding: 1.5rem;
  overflow-y: auto;
  line-height: 1.6;
}

/* ============================================
   IPB-STYLE FORUM HOMEPAGE
   ============================================ */

/* Forum Header with Actions */
.forum-header-actions {
  display: flex;
  gap: 0.75rem;
}

/* IPB Style Category */
.forum-category.ipb-style {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.forum-list-ipb {
  display: flex;
  flex-direction: column;
}

.forum-row-ipb {
  display: grid;
  grid-template-columns: 120px 280px 1fr;
  gap: 1.5rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-fast);
}

.forum-row-ipb:last-child {
  border-bottom: none;
}

.forum-row-ipb:hover {
  background: var(--surface-2);
}

/* Forum Cover */
.forum-cover {
  position: relative;
  width: 120px;
  height: 90px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}

.forum-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.forum-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
}

.forum-icon-large {
  font-size: 2.5rem;
}

.forum-cover .forum-locked-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.6);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.8rem;
}

/* Forum Info IPB */
.forum-info-ipb {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.forum-title-ipb {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  margin-bottom: 0.35rem;
}

.forum-title-ipb:hover {
  text-decoration: underline;
}

.forum-description-ipb {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.forum-meta-ipb {
  display: flex;
  gap: 1rem;
}

.forum-stat-mini {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Recent Topics Column */
.forum-recent-topics {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-width: 320px;
  overflow: hidden;
}

.recent-topic-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  transition: background var(--transition-fast);
  border: 1px solid transparent;
}

.recent-topic-row:hover {
  background: var(--surface);
  border-color: var(--border);
}

.recent-topic-avatar {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
}

.mini-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, purple));
  border: 2px solid var(--border);
}

/* Fallback quando l'immagine non carica */
.mini-avatar[alt]::after {
  content: attr(alt);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, purple));
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 50%;
}

.mini-avatar-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, purple));
  color: white;
  font-size: 0.8rem;
  font-weight: 600;
  border: 2px solid var(--border);
  text-transform: uppercase;
}

.recent-topic-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.recent-topic-title {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.recent-topic-title:hover {
  color: var(--accent);
}

.recent-topic-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.2;
}

.recent-topic-author {
  color: var(--accent);
  font-weight: 500;
}

.recent-topic-sep {
  color: var(--muted);
  opacity: 0.5;
}

.recent-topic-date {
  opacity: 0.8;
}

.recent-topic-comments {
  display: none; /* Nascosto per risparmiare spazio */
  flex-direction: column;
  align-items: center;
  padding: 0 0.5rem;
}

.comments-count {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.comments-label {
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
}

.no-recent-topics {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  gap: 0.5rem;
}

.no-topics-icon {
  font-size: 1.5rem;
  opacity: 0.5;
}

/* Forum Footer Section */
.forum-footer-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.forum-stats-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}

.stats-box {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stats-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.stats-icon {
  font-size: 1.25rem;
}

.stats-text {
  font-size: 0.9rem;
  color: var(--muted);
}

.stats-text strong {
  color: var(--accent);
  font-weight: 600;
}

/* Online Users IPB Style */
.forum-online-users-ipb {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}

.online-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.online-header h3 {
  margin: 0;
  font-size: 1rem;
  flex: 1;
}

.online-count-badge {
  background: var(--accent);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 10px;
}

.online-list-ipb {
  font-size: 0.85rem;
  line-height: 1.8;
}

.online-user-ipb {
  color: var(--text);
  text-decoration: none;
}

.online-user-ipb:hover {
  color: var(--accent);
  text-decoration: underline;
}

.online-status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #4ade80;
  border-radius: 50%;
  margin-right: 4px;
}

.online-empty {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0;
}

/* Responsive IPB Style */
@media (max-width: 1100px) {
  .forum-row-ipb {
    grid-template-columns: 120px 1fr 260px;
    gap: 1rem;
  }
  
  .forum-recent-topics {
    max-width: 260px;
  }
}

@media (max-width: 900px) {
  .forum-row-ipb {
    grid-template-columns: 100px 1fr;
    gap: 1rem;
  }
  
  .forum-recent-topics {
    display: none;
  }
  
  .forum-footer-section {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .forum-row-ipb {
    grid-template-columns: 1fr;
    padding: 1rem;
  }
  
  .forum-cover {
    width: 100%;
    height: 80px;
  }
  
  .forum-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  
  .forum-info-ipb {
    padding: 0;
  }
  
  .forum-title-ipb {
    font-size: 1rem;
  }
  
  .forum-description-ipb {
    font-size: 0.85rem;
  }
}

/* PM Badge */
.pm-badge {
  background: var(--danger, #ef4444);
  color: white;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-left: auto;
  min-width: 18px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Profile Actions */
.profile-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
}

.profile-actions .btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
}

/* Embedded Music Content */
.embedded-album,
.embedded-track,
.embedded-playlist {
  background: var(--surface-2, #1a1a2e);
  border: 1px solid var(--border, #333);
  border-radius: 12px;
  padding: 15px;
  margin: 15px 0;
  display: flex;
  align-items: center;
  gap: 15px;
  transition: background 0.2s ease;
}

.embedded-album:hover,
.embedded-track:hover,
.embedded-playlist:hover {
  background: var(--surface-3, #242444);
}

.embedded-cover {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.embedded-info {
  flex: 1;
  min-width: 0;
}

.embedded-type {
  font-size: 0.75rem;
  color: var(--accent, #6366f1);
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 4px;
}

.embedded-title {
  font-weight: 600;
  color: var(--text, #fff);
  font-size: 1rem;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.embedded-artist {
  color: var(--muted, #888);
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.embedded-play-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent, #6366f1);
  border: none;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s, background 0.2s;
}

.embedded-play-btn:hover {
  transform: scale(1.1);
  background: color-mix(in srgb, var(--accent, #6366f1) 80%, white);
}

.embedded-link {
  text-decoration: none;
  color: inherit;
}

.embedded-link:hover .embedded-title {
  color: var(--accent, #6366f1);
}

/* Embed loading/error states */
.embed-loading {
  color: var(--muted, #888);
  font-size: 0.9rem;
  padding: 10px;
}

.embed-error {
  color: var(--danger, #ef4444);
  font-size: 0.85rem;
  background: rgba(239, 68, 68, 0.1);
  padding: 8px 15px;
  border-radius: 6px;
  display: inline-block;
}

/* Image Modal */
.image-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  cursor: pointer;
}

.image-modal-img {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.image-modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.image-modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Post image styling */
.post-image {
  max-width: 100%;
  max-height: 500px;
  border-radius: 8px;
  cursor: zoom-in;
  margin: 10px 0;
  transition: opacity 0.2s;
}

.post-image:hover {
  opacity: 0.9;
}

/* Playlist cover placeholder */
.embedded-cover.playlist-cover {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent, #6366f1), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  flex-shrink: 0;
}

/* ============ POST REACTIONS ============ */

.post-reactions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.reactions-display {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.reaction-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.reaction-badge:hover {
  background: var(--surface-hover, rgba(var(--accent-rgb, 99, 102, 241), 0.1));
  border-color: var(--accent);
  transform: scale(1.05);
}

.reaction-badge.active {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  border-color: var(--accent);
}

.reaction-badge .emoji {
  font-size: 1rem;
}

.reaction-badge .count {
  font-weight: 600;
  color: var(--text-secondary);
}

.reaction-badge.active .count {
  color: var(--accent);
}

.reaction-picker-wrapper {
  position: relative;
}

.reaction-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.25rem 0.5rem;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.reaction-add-btn:hover {
  background: var(--surface);
  border-style: solid;
  border-color: var(--accent);
  color: var(--accent);
}

.reaction-add-btn .icon {
  font-size: 1rem;
}

.reaction-add-btn .icon-plus {
  font-size: 0.75rem;
  font-weight: bold;
}

.reaction-picker {
  position: absolute;
  bottom: 100%;
  left: 0;
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  z-index: 100;
  margin-bottom: 0.5rem;
}

.reaction-option {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  border-radius: 8px;
  font-size: 1.25rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.reaction-option:hover {
  background: var(--surface);
  transform: scale(1.2);
}

.reaction-option.active {
  background: color-mix(in srgb, var(--accent) 25%, transparent);
  box-shadow: 0 0 0 2px var(--accent);
}

/* Mobile adjustments for reactions */
@media (max-width: 768px) {
  .reaction-picker {
    left: auto;
    right: 0;
  }
  
  .reaction-option {
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
  }
}

/* Animate reaction badges appearing */
@keyframes reactionPop {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.reaction-badge {
  animation: reactionPop 0.3s ease-out;
}

/* ========== NOTIFICATIONS PAGE ========== */
.notifications-page-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.notification-page-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  transition: all var(--transition-fast);
}

.notification-page-item:hover {
  background: var(--surface-2);
  border-color: var(--accent);
}

.notification-page-item.unread {
  background: rgba(var(--accent-rgb, 0, 198, 255), 0.08);
  border-color: rgba(var(--accent-rgb, 0, 198, 255), 0.3);
}

.notification-page-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  width: 40px;
  text-align: center;
}

.notification-page-content {
  flex: 1;
  min-width: 0;
}

.notification-page-title {
  font-weight: 500;
  margin-bottom: 4px;
}

.notification-page-text {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.notification-page-time {
  font-size: 0.75rem;
  color: var(--muted);
}

.notification-unread-dot {
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
}

/* ========== SUBSCRIPTIONS PAGE ========== */
.subscriptions-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.subscription-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: all 0.3s ease;
}

.subscription-item:hover {
  border-color: var(--accent);
}

.subscription-info {
  flex: 1;
  min-width: 0;
}

.subscription-title {
  display: block;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  text-decoration: none;
  margin-bottom: 6px;
}

.subscription-title:hover {
  color: var(--accent);
}

.subscription-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.subscription-meta .sep {
  opacity: 0.5;
}

.subscription-forum {
  color: var(--accent);
}

.subscription-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.page-header h1 {
  margin: 0;
  font-size: 1.5rem;
}

/* Responsive Subscriptions */
@media (max-width: 600px) {
  .subscription-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  
  .subscription-actions {
    width: 100%;
  }
  
  .subscription-actions .btn {
    flex: 1;
  }
}

/* ════════════════════════════════════════════════════════════════════
   MODERN REACTIONS RESTYLE (v20260421c)
   Override classico → look glassmorphism + animazioni
   ═══════════════════════════════════════════════════════════════════ */
.reactions-display {
  gap: .4rem;
}
.reaction-badge {
  padding: .3rem .65rem;
  background: linear-gradient(145deg,
    color-mix(in srgb, var(--surface) 80%, transparent),
    color-mix(in srgb, var(--surface) 60%, transparent));
  backdrop-filter: blur(8px);
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  border-radius: 14px;
  font-size: .9rem;
  transition: transform .18s cubic-bezier(.34, 1.56, .64, 1),
              box-shadow .18s ease,
              border-color .18s ease;
  position: relative;
  overflow: hidden;
}
.reaction-badge::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%),
    color-mix(in srgb, var(--accent) 20%, transparent), transparent 60%);
  opacity: 0;
  transition: opacity .25s;
  pointer-events: none;
}
.reaction-badge:hover {
  transform: translateY(-2px) scale(1.06);
  box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--accent) 50%, transparent);
  border-color: var(--accent);
}
.reaction-badge:hover::before { opacity: 1; }
.reaction-badge.active {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--accent) 28%, transparent),
    color-mix(in srgb, var(--accent) 12%, transparent));
  border-color: color-mix(in srgb, var(--accent) 70%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent);
}
.reaction-badge .emoji {
  font-size: 1.1rem;
  display: inline-block;
  transition: transform .25s cubic-bezier(.68, -0.55, .27, 1.55);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .25));
}
.reaction-badge:hover .emoji {
  transform: scale(1.35) rotate(-8deg);
}
.reaction-badge .count {
  font-variant-numeric: tabular-nums;
  font-size: .82rem;
}

/* Add-reaction button → softer */
.reaction-add-btn {
  padding: .3rem .55rem;
  border-radius: 14px;
  border-style: dashed;
  opacity: .65;
  transition: all .18s ease;
}
.reaction-add-btn:hover {
  opacity: 1;
  transform: scale(1.08);
  border-style: solid;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

/* Reaction picker → floating panel */
.reaction-picker {
  padding: .55rem;
  gap: .3rem;
  border-radius: 16px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(14px);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  box-shadow: 0 12px 32px -10px rgba(0, 0, 0, .55),
              0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
  animation: reactionPickerIn .22s cubic-bezier(.34, 1.56, .64, 1);
}
@keyframes reactionPickerIn {
  from { opacity: 0; transform: translateY(8px) scale(.92); }
  to   { opacity: 1; transform: translateY(0)   scale(1);   }
}
.reaction-option {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-size: 1.4rem;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .25));
  transition: transform .22s cubic-bezier(.34, 1.56, .64, 1),
              background .15s ease;
}
.reaction-option:hover {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  transform: scale(1.4) translateY(-3px) rotate(-6deg);
}
.reaction-option.active {
  background: color-mix(in srgb, var(--accent) 30%, transparent);
  box-shadow: inset 0 0 0 2px var(--accent);
}

/* Pop-in animation when a new reaction appears */
@keyframes reactionPopIn {
  0%   { transform: scale(0) rotate(-180deg); opacity: 0; }
  60%  { transform: scale(1.2) rotate(10deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
.reaction-badge.just-added {
  animation: reactionPopIn .45s cubic-bezier(.34, 1.56, .64, 1);
}


/* ─── Forum file attachments (uploaded to Telegram, served via /forum/attachment/N) ─── */
.forum-attachment {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
  padding: 10px 14px;
  background: var(--bg-elev, #1c1f25);
  border: 1px solid var(--border, #2a2f38);
  border-radius: 8px;
  font-size: .92em;
  max-width: 100%;
}
.forum-attachment .att-icon {
  font-size: 1.3em;
  flex-shrink: 0;
}
.forum-attachment .att-name {
  font-weight: 500;
  color: var(--text, #e8eaed);
  word-break: break-all;
  flex: 1 1 auto;
  min-width: 0;
}
.forum-attachment .att-size {
  color: var(--text-muted, #9aa0a6);
  font-size: .9em;
  white-space: nowrap;
}
.forum-attachment .att-dl {
  background: var(--accent, #4a9eff);
  color: #fff;
  padding: 5px 12px;
  border-radius: 5px;
  text-decoration: none;
  font-size: .9em;
  white-space: nowrap;
  transition: background .15s;
}
.forum-attachment .att-dl:hover { background: #3a8de8; }

.forum-att-image {
  display: block;
  margin: 10px 0;
}
.forum-att-image img {
  display: block;
  max-width: 600px;
  max-height: 500px;
  width: auto;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--border, #2a2f38);
  cursor: zoom-in;
}
.forum-att-image .forum-att-dl {
  display: inline-block;
  margin-top: 6px;
  font-size: .85em;
  color: var(--accent, #4a9eff);
  text-decoration: none;
}
.forum-att-image .forum-att-dl:hover { text-decoration: underline; }


/* Lazy thumbnail inside non-image attachment cards. Hidden when the server
   has no thumbnail (handled by JS in app.js: error → display:none). */
.forum-attachment .att-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border, #2a2f38);
  background: #0e1218;
  flex-shrink: 0;
}
.forum-attachment .att-thumb.failed { display: none; }

/* Cancel-upload button inserted next to the placeholder while the XHR runs */
.forum-upload-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
  font-size: .85em;
}
.forum-upload-controls .cancel-btn {
  background: #c45a5a;
  color: #fff;
  border: 0;
  padding: 3px 9px;
  border-radius: 4px;
  cursor: pointer;
  font-size: .85em;
}
.forum-upload-controls .cancel-btn:hover { background: #a84747; }

/* ───── Subforum chips (forum index, IPS-style) ───── */
.subforum-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  align-items: center;
}
.subforum-label {
  color: var(--ipb-muted, #98a4b8);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-right: 4px;
}
.subforum-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  background: rgba(0, 179, 255, .08);
  border: 1px solid rgba(0, 179, 255, .25);
  border-radius: 12px;
  color: #cfe9ff;
  font-size: 12px;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
}
.subforum-chip:hover {
  background: rgba(0, 179, 255, .18);
  border-color: rgba(0, 230, 200, .55);
  color: #fff;
}
.subforum-chip .subforum-icon {
  font-size: 13px;
}
.subforum-chip .subforum-count {
  color: var(--ipb-muted, #98a4b8);
  font-size: 11px;
}
.subforum-card .subforum-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.subforum-card .subforum-desc {
  color: var(--ipb-muted, #98a4b8);
  font-size: 11px;
  font-weight: normal;
}


/* ── IPS-style: topic prefix badges + card view (v-huf-v3) ────────────── */
.topic-prefix {
  display: inline-block;
  padding: 2px 8px;
  margin-right: 8px;
  border-radius: 4px;
  font-size: 0.78em;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  vertical-align: 2px;
  background: rgba(0, 230, 200, 0.14);
  color: var(--accent, #00e6c8);
  border: 1px solid rgba(0, 230, 200, 0.35);
}
.topic-prefix[data-prefix="Recensione" i] { background:#3d2a6b33;color:#b197fc;border-color:#b197fc55; }
.topic-prefix[data-prefix="Richiesta" i]  { background:#6b4a1e33;color:#ffc078;border-color:#ffc07855; }
.topic-prefix[data-prefix="Annuncio" i]   { background:#6b1e1e33;color:#ff8787;border-color:#ff878755; }
.topic-prefix[data-prefix="Tutorial" i]   { background:#1e4a6b33;color:#74c0fc;border-color:#74c0fc55; }
.topic-prefix[data-prefix="Novità" i]     { background:#1e6b3c33;color:#8ce99a;border-color:#8ce99a55; }
.topic-prefix[data-prefix="Discussione" i]{ background:#2a2a2a66;color:#ced4da;border-color:#ced4da55; }
.topic-prefix[data-prefix="Aiuto" i]      { background:#4a1e6b33;color:#da77f2;border-color:#da77f255; }

.view-toggle { display:inline-flex; gap:2px; margin:0 10px 0 4px; }
.view-toggle .view-btn {
  background: var(--ipb-panel-2, #1a2332);
  border: 1px solid var(--ipb-border, #2a3a52);
  color: var(--ipb-muted, #98a4b8);
  padding: 4px 10px;
  font-size: 14px;
  cursor: pointer;
  border-radius: 4px;
}
.view-toggle .view-btn.active {
  background: var(--accent, #00e6c8);
  color: #06141a;
  border-color: var(--accent, #00e6c8);
}

/* Card view */
.topics-list.view-cards { display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:14px; }
.topics-list.view-cards .topic-row {
  display:flex; flex-direction:column; gap:10px; padding:14px;
  background: var(--ipb-panel-2, #151e2a);
  border: 1px solid var(--ipb-border, #2a3a52);
  border-radius: 8px;
  min-height: 140px;
}
.topics-list.view-cards .topic-status { order:1; display:flex; gap:4px; }
.topics-list.view-cards .topic-avatar { order:2; }
.topics-list.view-cards .topic-avatar .avatar { width:40px; height:40px; }
.topics-list.view-cards .topic-info { order:3; flex:1; }
.topics-list.view-cards .topic-info .topic-title { font-size:15px; line-height:1.35; display:block; }
.topics-list.view-cards .topic-stats { order:4; display:flex; gap:16px; font-size:12px; color:var(--ipb-muted,#98a4b8); border-top:1px dashed var(--ipb-border,#2a3a52); padding-top:8px; }
.topics-list.view-cards .topic-stats .stat-cell { display:flex; gap:4px; align-items:baseline; }
.topics-list.view-cards .topic-stats .stat-label { font-size:11px; }
.topics-list.view-cards .topic-last-post { order:5; font-size:12px; color:var(--ipb-muted,#98a4b8); }
/* ── Forum index: list view (default) + cards alternative (huf-v5) ─────── */
/* Default 3-col grid: cover | info | stats */
.forum-row-ipb {
  display:grid;
  grid-template-columns: 90px 1fr 180px;
  gap:16px;
  align-items:center;
  padding:14px;
  background: var(--ipb-panel-2, #151e2a);
  border-bottom: 1px solid var(--ipb-border, #2a3a52);
}
.forum-row-ipb:last-child { border-bottom:0; }
.forum-row-ipb .forum-cover {
  display:flex; align-items:center; justify-content:center;
}
.forum-row-ipb .forum-cover-placeholder {
  width:64px; height:64px;
  display:flex; align-items:center; justify-content:center;
  background: linear-gradient(135deg, #1a2540, #0f1822);
  border-radius:8px;
  font-size:32px;
  border:1px solid var(--ipb-border, #2a3a52);
}
.forum-row-ipb .forum-info-ipb { min-width:0; }
.forum-row-ipb .forum-title-ipb {
  display:inline-block;
  font-size:16px; font-weight:600; color:var(--accent, #00e6c8);
  text-decoration:none;
}
.forum-row-ipb .forum-title-ipb:hover { text-decoration:underline; }
.forum-row-ipb .forum-description-ipb {
  font-size:13px; color:var(--ipb-muted,#98a4b8); margin:4px 0;
}
.forum-row-ipb .forum-meta-ipb { font-size:12px; color:var(--ipb-muted,#98a4b8); margin-top:4px; }
.forum-row-ipb .forum-stats-col {
  display:flex; flex-direction:column; gap:4px;
  font-size:13px; color:var(--ipb-muted,#98a4b8);
  text-align:right;
}
.forum-row-ipb .forum-stats-col strong { color:var(--ipb-text,#e6e6e6); }

/* Hide the recent-topics column in list view */
.forum-row-ipb .forum-recent-col { display:none; }
.cards-subforums { display:flex; flex-wrap:wrap; gap:6px; margin-top:10px; }

/* CARDS view (IPS-style) — applied via .forum-list-ipb.view-cards */
.forum-list-ipb.view-cards {
  display:grid;
  grid-template-columns: 1fr;
  gap:0;
  background:transparent;
}
.forum-list-ipb.view-cards .forum-row-ipb {
  display:grid;
  grid-template-columns: 280px 1fr;
  gap:0;
  padding:0;
  background: var(--ipb-panel-2, #151e2a);
  border:1px solid var(--ipb-border, #2a3a52);
  border-top:3px solid var(--accent, #00e6c8);
  border-radius:8px;
  margin-bottom:14px;
  overflow:hidden;
}
.forum-list-ipb.view-cards .forum-row-ipb .forum-cover {
  padding:18px;
  background: linear-gradient(180deg, rgba(0,230,200,0.06) 0%, rgba(0,0,0,0) 60%);
  border-right: 1px solid var(--ipb-border, #2a3a52);
  align-items:flex-start;
}
.forum-list-ipb.view-cards .forum-row-ipb .forum-cover-placeholder {
  width:100%; height:auto; aspect-ratio:16/9; min-height:100px;
  font-size:48px;
}
.forum-list-ipb.view-cards .forum-row-ipb .forum-info-ipb,
.forum-list-ipb.view-cards .forum-row-ipb .forum-stats-col { display:none; }
.forum-list-ipb.view-cards .forum-row-ipb .forum-recent-col {
  display:flex; flex-direction:column; gap:6px;
  padding:14px 16px;
  min-width:0;
}
.forum-list-ipb.view-cards .forum-title-cards {
  font-size:18px; font-weight:600; color:var(--accent,#00e6c8); text-decoration:none;
}
.forum-list-ipb.view-cards .forum-title-cards:hover { text-decoration:underline; }

.forum-recent-topics { list-style:none; margin:8px 0 0; padding:0; }
.recent-topic-row {
  display:grid;
  grid-template-columns: 32px 1fr auto;
  gap:10px;
  align-items:center;
  padding:8px 4px;
  border-bottom:1px solid rgba(255,255,255,0.04);
}
.recent-topic-row:last-child { border-bottom:0; }
.recent-topic-avatar { width:32px; height:32px; border-radius:50%; object-fit:cover; }
.recent-topic-main { min-width:0; }
.recent-topic-title {
  display:block; color:var(--ipb-text,#e6e6e6); font-weight:500;
  text-decoration:none;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.recent-topic-title:hover { color:var(--accent,#00e6c8); }
.recent-topic-meta { font-size:12px; color:var(--ipb-muted,#98a4b8); margin-top:2px; }
.recent-topic-meta a { color:var(--ipb-muted,#98a4b8); text-decoration:none; }
.recent-topic-count {
  background: rgba(255,255,255,0.06);
  padding: 4px 10px;
  border-radius: 12px;
  font-size:12px;
  color:var(--ipb-muted,#98a4b8);
  min-width:28px;
  text-align:center;
}
.forum-recent-empty {
  padding: 12px; text-align:center; color:var(--ipb-muted,#98a4b8);
  font-style:italic; font-size:13px;
}

/* Header actions: keep toggle + button on same row */
.forum-header-actions { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }

@media (max-width: 760px) {
  .forum-row-ipb { grid-template-columns: 60px 1fr; }
  .forum-row-ipb .forum-stats-col { display:none; }
  .forum-list-ipb.view-cards .forum-row-ipb { grid-template-columns: 1fr; }
  .forum-list-ipb.view-cards .forum-row-ipb .forum-cover { border-right:0; border-bottom:1px solid var(--ipb-border, #2a3a52); }
}

/* ── Topic card view (per-forum page) — better grid (huf-v5) ─────────── */
.topics-list.view-cards { grid-template-columns: repeat(auto-fill, minmax(320px,1fr)); gap:14px; }
.topics-list.view-cards .topic-row {
  display:grid;
  grid-template-columns: 40px 1fr;
  grid-template-rows: auto auto auto auto;
  gap:8px 12px;
  padding:14px;
}
.topics-list.view-cards .topic-status { grid-column:1/-1; grid-row:1; display:flex; gap:4px; min-height:0; }
.topics-list.view-cards .topic-status:empty { display:none; }
.topics-list.view-cards .topic-avatar { grid-column:1; grid-row:2; }
.topics-list.view-cards .topic-avatar .avatar { width:40px; height:40px; }
.topics-list.view-cards .topic-info { grid-column:2; grid-row:2; min-width:0; }
.topics-list.view-cards .topic-info .topic-title {
  display:block; font-size:15px; line-height:1.35;
  overflow:hidden; text-overflow:ellipsis;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical;
}
.topics-list.view-cards .topic-info .topic-meta { font-size:12px; color:var(--ipb-muted,#98a4b8); margin-top:4px; }
.topics-list.view-cards .topic-stats {
  grid-column:1/-1; grid-row:3;
  display:flex; gap:14px;
  font-size:12px; color:var(--ipb-muted,#98a4b8);
  border-top:1px dashed var(--ipb-border,#2a3a52);
  padding-top:8px; margin-top:4px;
}
.topics-list.view-cards .topic-stats .stat-cell { display:flex; gap:4px; align-items:baseline; }
.topics-list.view-cards .topic-stats .stat-value { font-weight:600; color:var(--ipb-text,#e6e6e6); }
.topics-list.view-cards .topic-stats .stat-label { font-size:11px; }
.topics-list.view-cards .topic-last-post {
  grid-column:1/-1; grid-row:4;
  font-size:12px; color:var(--ipb-muted,#98a4b8);
  display:flex; flex-direction:column; gap:2px;
}
.topics-list.view-cards .topic-last-post .last-reply { display:flex; flex-direction:column; }
.topics-list.view-cards .topic-last-post .last-reply-user { color:var(--ipb-text,#e6e6e6); font-weight:500; }

/* ── Topic tag chips + IPS pagination + stat icons (huf-v5) ─────────── */
.topic-tags-row { display:flex; flex-wrap:wrap; gap:5px; margin-top:6px; }
.topic-tag-chip {
  display:inline-block;
  padding: 2px 8px;
  background: rgba(0,230,200,0.12);
  color: var(--accent, #00e6c8);
  border: 1px solid rgba(0,230,200,0.25);
  border-radius: 10px;
  font-size: 11px;
  text-decoration: none;
  line-height: 1.5;
}
.topic-tag-chip:hover { background: rgba(0,230,200,0.22); }
.topic-tag-overflow {
  display:inline-block;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--ipb-muted, #98a4b8);
  font-style: italic;
}

.topic-stats .stat-cell { display:flex; align-items:center; gap:4px; }
.topic-stats .stat-icon { font-size: 14px; opacity: 0.85; }
.topic-stats .stat-value { font-weight: 600; color: var(--ipb-text, #e6e6e6); }
.topic-stats .stat-label { font-size: 11px; color: var(--ipb-muted, #98a4b8); }

/* IPS-style pagination bar */
.ips-pagination {
  display:flex; align-items:center; gap:6px; flex-wrap:wrap;
  padding:12px 14px;
  margin-top: 14px;
  background: var(--ipb-panel-2, #151e2a);
  border: 1px solid var(--ipb-border, #2a3a52);
  border-radius: 8px;
}
.ips-pagination .page-summary {
  font-size: 11px;
  letter-spacing: 0.6px;
  color: var(--ipb-muted, #98a4b8);
  margin-right: auto;
  text-transform: uppercase;
}
.ips-pagination .page-summary strong { color: var(--ipb-text, #e6e6e6); font-weight: 700; }
.ips-pagination .page-btn,
.ips-pagination .page-num,
.ips-pagination .page-current {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 13px;
  text-decoration: none;
  border: 1px solid var(--ipb-border, #2a3a52);
  background: transparent;
  color: var(--ipb-text, #e6e6e6);
}
.ips-pagination .page-btn:hover,
.ips-pagination .page-num:hover { background: rgba(255,255,255,0.05); }
.ips-pagination .page-current {
  background: var(--accent, #00e6c8);
  color: #0b0f15;
  border-color: var(--accent, #00e6c8);
  font-weight: 700;
}
.ips-pagination .page-numbers { display: inline-flex; gap: 4px; }
.ips-pagination .page-ellipsis { color: var(--ipb-muted, #98a4b8); padding: 0 4px; }
.ips-pagination .page-jump {
  height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  background: var(--ipb-panel, #0f1822);
  color: var(--ipb-text, #e6e6e6);
  border: 1px solid var(--ipb-border, #2a3a52);
  font-size: 12px;
  margin-left: 8px;
}

/* Page jump input form (replaces dropdown) */
.ips-pagination .page-jump-form {
  display: inline-flex; gap: 6px; margin-left: 8px; align-items: center;
}
.ips-pagination .page-jump-input {
  width: 70px; height: 32px; padding: 0 8px;
  border-radius: 6px;
  background: var(--ipb-panel, #0f1822);
  color: var(--ipb-text, #e6e6e6);
  border: 1px solid var(--ipb-border, #2a3a52);
  font-size: 13px; text-align: center;
  -moz-appearance: textfield;
}
.ips-pagination .page-jump-input::-webkit-outer-spin-button,
.ips-pagination .page-jump-input::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0;
}
.ips-pagination .page-jump-go {
  height: 32px; padding: 0 12px;
  border-radius: 6px; cursor: pointer;
  background: var(--accent, #00e6c8); color: #0b0f15;
  border: 1px solid var(--accent, #00e6c8);
  font-weight: 600; font-size: 12px;
}
.ips-pagination .page-jump-go:hover { filter: brightness(1.08); }

/* =============================================================
   POST OVERFLOW FIX v20260503d
   The post-item is a CSS grid (180px 1fr on desktop, 1fr on mobile).
   Grid items default to min-width:auto, so big intrinsic content
   (embed cards inside <a class="embedded-link">) was stretching
   the right column past the viewport, hiding the post-actions row.
   ============================================================= */

.post-item {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;            /* hard stop — wraps any rogue child */
}
.post-author-sidebar,
.post-content-area {
  min-width: 0;                /* CRITICAL: lets the 1fr track shrink */
}
.post-content-area { overflow: hidden; }
.post-body,
.post-header,
.post-footer { min-width: 0; max-width: 100%; }
.post-body { overflow-wrap: anywhere; word-break: break-word; }
.posts-list { max-width: 100%; }

/* Embedded music: the JS placeholder + its rendered content */
.embedded-content,
.embedded-link {
  display: block;
  max-width: 100%;
  min-width: 0;
}
.embedded-album,
.embedded-track,
.embedded-playlist {
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
}
.embedded-info { min-width: 0; max-width: 100%; }
.embedded-title,
.embedded-artist {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Mobile: shrink embedded cards further so cover is small enough */
@media (max-width: 720px) {
  .post-item {
    grid-template-columns: 1fr !important;
  }
  .post-author-sidebar {
    flex-direction: row !important;
    padding: 0.6rem 0.8rem !important;
    gap: 0.6rem !important;
  }
  .post-avatar .avatar-large,
  .avatar-placeholder.large {
    width: 42px !important; height: 42px !important; font-size: 1rem !important;
  }
  .post-author-name { font-size: 0.95rem; }
  .post-author-group {
    font-size: 0.7rem !important;
    padding: 2px 6px !important;
  }
  .post-header { padding: 0.5rem 0.75rem !important; font-size: 0.72rem; }
  .post-body { padding: 0.9rem 0.75rem !important; font-size: 0.92rem; line-height: 1.55; }
  .post-footer { padding: 0.5rem 0.5rem !important; flex-wrap: wrap; gap: 6px !important; }

  .embedded-album,
  .embedded-track,
  .embedded-playlist {
    padding: 8px !important;
    gap: 10px !important;
    margin: 8px 0 !important;
  }
  .embedded-cover {
    width: 48px !important; height: 48px !important;
    flex: 0 0 48px !important;
  }
  .embedded-title { font-size: 0.88rem !important; margin-bottom: 2px !important; }
  .embedded-artist { font-size: 0.74rem !important; }
  .embedded-type { font-size: 0.65rem !important; margin-bottom: 1px !important; }
  .embedded-play-btn {
    width: 36px !important; height: 36px !important;
    font-size: 0.95rem !important;
  }

  /* Post action row: compact icon-only on phones */
  .post-actions {
    flex-wrap: wrap !important;
    gap: 4px !important;
    justify-content: flex-end;
  }
  .post-actions .post-action-btn,
  .post-actions button {
    padding: 5px 8px !important;
    font-size: 11.5px !important;
    min-height: 28px !important;
    line-height: 1 !important;
    white-space: nowrap;
  }
  .post-reactions {
    flex: 1 1 auto;
    min-width: 0;
  }
  .post-reactions button { font-size: 12px !important; padding: 3px 6px !important; }
}

@media (max-width: 420px) {
  .embedded-cover {
    width: 42px !important; height: 42px !important; flex: 0 0 42px !important;
  }
  .embedded-title { font-size: 0.82rem !important; }
  .embedded-artist { font-size: 0.68rem !important; }
  .embedded-play-btn { width: 32px !important; height: 32px !important; }
  .post-actions .post-action-btn,
  .post-actions button { padding: 4px 6px !important; font-size: 11px !important; }
}
