/* ForumBeta - Modern Reddit Dark Mode Style */

/* RTL Support */
html[dir="rtl"] {
    direction: rtl;
    font-family: 'Almarai', 'Segoe UI', Tahoma, Arial, sans-serif;
}

html[dir="rtl"] .forum-container {
    padding-left: 336px;
    padding-right: 332px;
    z-index: 1;
    position: relative;
}

html[dir="rtl"] .forum-container.sidebar-collapsed {
    padding-left: 336px;
    padding-right: 20px;
    z-index: 1;
    position: relative;
}

html[dir="rtl"] .forum-sidebar-right {
    z-index: 0;
}

html[dir="rtl"] .forum-sidebar-left {
    left: auto;
    right: 0;
    border-right: none;
    border-left: 1px solid var(--reddit-border);
}

html[dir="rtl"] .forum-sidebar-right {
    right: auto;
    left: 0;
}

html[dir="rtl"] .forum-header-content {
    flex-direction: row-reverse;
}

html[dir="rtl"] .forum-header-right {
    flex-direction: row-reverse;
}

html[dir="rtl"] .forum-header-dropdown-menu {
    right: auto;
    left: 0;
}

html[dir="rtl"] .forum-mobile-sidebar-toggle {
    margin-right: 0;
    margin-left: 8px;
    order: 999; /* Ensure button is on the right side in RTL */
}

html[dir="rtl"] .forum-post-vote {
    margin-left: 0;
    margin-right: 12px;
}

html[dir="rtl"] .forum-reply-thread-line {
    right: auto;
    left: 20px;
}

html[dir="rtl"] .forum-reply-content-wrapper {
    margin-right: 0;
    margin-left: 8px;
}

html[dir="rtl"] .forum-image-carousel-nav.prev {
    left: auto;
    right: 12px;
}

html[dir="rtl"] .forum-image-carousel-nav.next {
    right: auto;
    left: 12px;
}

html[dir="rtl"] .forum-search {
    direction: ltr; /* Keep search LTR for better UX */
}

html[dir="rtl"] .forum-search-field {
    direction: ltr;
}

html[dir="rtl"] .forum-search-input {
    direction: ltr;
    text-align: left;
}

html[dir="rtl"] .forum-sidebar-left.collapsed .forum-sidebar-header-area {
    left: 0;
    right: 25px;
}

html[dir="rtl"] .forum-sidebar-left.collapsed::before {
    left: auto;
    right: 25px;
}

html[dir="rtl"] .forum-sidebar-collapse-btn {
    right: auto;
    left: -16px;
}

html[dir="rtl"] .forum-sidebar-left.collapsed .forum-sidebar-collapse-btn {
    left: auto;
    right: 50%;
    transform: translateX(50%);
}

html[dir="rtl"] .forum-main {
    margin-left: 0;
    margin-right: 25px;
    transition: margin-right 0.3s ease;
}

html[dir="rtl"] .forum-post-title {
    margin-left: 0;
    margin-right: 40px;
}

html[dir="rtl"] .forum-post-body {
    margin-left: 0;
    margin-right: 40px;
}

html[dir="rtl"] .forum-post-image-container {
    margin-left: 0;
    margin-right: 40px;
}

html[dir="rtl"] .forum-post-content {
    padding-right: 0 !important;
    padding-left: 10px !important;
}

html[dir="rtl"] #postsContainer.forum-view-card .forum-post-content {
    padding-right: 0 !important;
    padding-left: 10px !important;
}

html[dir="rtl"] #postsContainer.forum-view-classic .forum-post-content {
    padding-right: 0 !important;
    padding-left: 8px !important;
}

html[dir="rtl"] #postsContainer.forum-view-compact .forum-post-content {
    padding-right: 0 !important;
    padding-left: 8px !important;
}

@media (max-width: 768px) {
    html[dir="rtl"] #postsContainer.forum-view-card .forum-post-content {
        padding-right: 0 !important;
        padding-left: 0 !important;
    }
}

html[dir="rtl"] .forum-post-follow-btn {
    margin-left: 0;
    margin-right: auto;
}

html[dir="rtl"] .forum-post-media-container {
    margin: 12px 0;
}

html[dir="rtl"] .forum-container.sidebar-collapsed {
    padding-left: 336px;
    padding-right: 20px;
}

/* Language Switcher */
.forum-language-switcher {
    display: flex;
    gap: 8px;
    padding: 8px;
}

.forum-lang-link {
    flex: 1;
    padding: 8px 12px;
    text-align: center;
    background: var(--reddit-input);
    border: 1px solid var(--reddit-border);
    border-radius: 4px;
    color: var(--reddit-text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.forum-lang-link:hover {
    background: var(--reddit-hover);
    border-color: var(--reddit-border-hover);
    color: var(--reddit-text);
}

.forum-lang-link.active {
    background: var(--reddit-upvote);
    border-color: var(--reddit-upvote);
    color: white;
}

/* Prevent horizontal scroll */
/* Arabic/RTL Font */
html[dir="rtl"] body,
html[dir="rtl"] {
    font-family: 'Almarai', 'Segoe UI', Tahoma, Arial, sans-serif;
}

html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

* {
    box-sizing: border-box;
}

:root {
    /* Reddit Dark Mode Colors - Exact Match */
    --reddit-bg: #1a1a1b;
    --reddit-bg-page: #030303;
    --reddit-card: #1a1a1b;
    --reddit-card-hover: #272729;
    --reddit-border: #343536;
    --reddit-border-hover: #464749;
    --reddit-text: #d7dadc;
    --reddit-text-muted: #818384;
    --reddit-link: #4fbcff;
    /* Dynamic colors - overridden by inline styles from database */
    --reddit-upvote: #ff4500;
    --reddit-downvote: #5a75cc;
    --reddit-hover: #272729;
    --reddit-input: #272729;
    --reddit-button: #ff4500;
    --reddit-button-hover: #ff5414;
    --reddit-button-secondary: #d7dadc;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--reddit-bg-page);
    color: var(--reddit-text);
    line-height: 1.6;
    font-size: 14px;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding-top: 56px; /* Account for fixed header */
}

/* Arabic/RTL Font */
html[dir="rtl"] body {
    font-family: 'Almarai', 'Segoe UI', Tahoma, Arial, sans-serif;
}

/* Layout */
/* Prevent sidebar animation on initial load if collapsed state is saved */
html.forum-sidebar-state-loading .forum-sidebar-left,
html.forum-sidebar-state-loading .forum-container {
    transition: none !important;
}

/* Hide sidebar content immediately on initial load if it should be collapsed */
html.forum-sidebar-state-loading .forum-sidebar-left.forum-sidebar-initial-load {
    width: 1px;
    background-color: transparent;
    border-right: none;
}

html.forum-sidebar-state-loading .forum-sidebar-left.forum-sidebar-initial-load .forum-sidebar-scrollable {
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}

.forum-container {
    margin: 0 auto;
    display: flex;
    gap: 24px;
    padding: 10px 20px 20px 20px;
    padding-left: 332px; /* Account for fixed sidebar width (312px + 20px gap) */
    padding-right: 336px; /* Account for fixed right sidebar width (312px + 24px gap) */
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

.forum-sidebar-left {
    position: fixed;
    left: 0;
    top: 56px; /* Below header */
    width: 312px;
    height: calc(100vh - 56px);
    background-color: var(--reddit-bg-page);
    border-right: 1px solid var(--reddit-border);
    z-index: 90;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    overflow: visible; /* Changed to visible so button can extend beyond when collapsed */
}

.forum-sidebar-header-area {
    position: relative;
    flex-shrink: 0;
    height: 48px;
    padding: 12px;
    min-width: 48px;
    width: 100%;
}

.forum-sidebar-scrollable {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    transition: opacity 0.3s ease;
}

.forum-sidebar-left.collapsed {
    width: 1px;
    background-color: transparent;
    border-right: none; /* Remove border, using ::before instead */
}

.forum-sidebar-left.collapsed .forum-sidebar-scrollable {
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
    width: 0;
    min-width: 0;
}

.forum-sidebar-left.collapsed .forum-sidebar-header-area {
    padding: 0;
    width: 100%;
    height: 48px;
    min-width: 1px;
    position: absolute;
    top: 0;
    left: 25px;
    right: 0;
    overflow: visible;
    z-index: 100;
}

/* Collapsed sidebar - container padding adjusted via JavaScript */
.forum-container.sidebar-collapsed {
    padding-left: 20px;
    padding-right: 336px; /* Still account for right sidebar even when left is collapsed */
}

/* Vertical line visible when collapsed */
.forum-sidebar-left.collapsed::before {
    content: '';
    position: absolute;
    left: 25px;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: var(--reddit-border);
    z-index: 1;
    pointer-events: none;
    transform: translateX(0); /* Ensure line is exactly at left edge */
}

.forum-main {
    flex: 1;
    min-width: 0;
    margin-left: 25px;
    transition: margin-left 0.3s ease;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

.forum-sidebar-right {
    width: 312px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    right: 0;
    top: 60px;
    height: calc(100vh - 60px);
    max-height: calc(100vh - 60px);

    overflow-y: auto;
    overflow-x: hidden;
    background-color: var(--reddit-bg-page);
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
}

.forum-ads-fixed {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: var(--reddit-bg-page);
    margin-bottom: 2px;
}

.forum-sidebar-scrollable {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    min-height: 0;
}

.forum-sidebar-scrollable::-webkit-scrollbar {
    width: 6px;
}

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

.forum-sidebar-scrollable::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 3px;
    transition: background 0.2s ease;
}

.forum-sidebar-scrollable:hover::-webkit-scrollbar-thumb {
    background: var(--reddit-border);
}

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

/* Firefox */
.forum-sidebar-scrollable {
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
    transition: scrollbar-color 0.2s ease;
}

.forum-sidebar-scrollable:hover {
    scrollbar-color: var(--reddit-border) transparent;
}

.forum-following-section {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.forum-following-section.scrolled {
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
    height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* Header */
.forum-header {
    background-color: var(--reddit-bg-page);
    border-bottom: 1px solid var(--reddit-border);
    padding: 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 100%;
}

.forum-header-content {
    max-width: 1248px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    height: 56px;
    gap: 12px;
    padding: 0 16px;
    position: relative;
}

.forum-mobile-sidebar-toggle {
    display: none; /* Hidden by default on desktop */
    background: none;
    border: none;
    color: var(--reddit-text);
    cursor: pointer;
    padding: 8px;
    margin-right: 8px;
    border-radius: 4px;
    transition: background-color 0.15s ease;
    font-size: 18px;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.forum-mobile-sidebar-toggle:hover {
    background-color: var(--reddit-hover);
}

.forum-mobile-sidebar-toggle:active {
    transform: scale(0.95);
}

.forum-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--reddit-text);
    font-weight: 700;
    font-size: 20px;
    margin-right: 8px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.15s ease;
    flex-shrink: 0;
    height: 100%;
}

.forum-logo:hover {
    background-color: var(--reddit-hover);
}

.forum-logo img {
    height: 80%;
    width: auto;
    margin-right: 8px;
    object-fit: contain;
}

.forum-logo span {
    display: inline;
}

.forum-search {
    flex: 1;
    max-width: 680px;
    position: relative;
    min-width: 0;
    overflow: visible;
    z-index: 200;
}

.forum-search-desktop {
    display: block;
}

.forum-search-mobile {
    display: none;
}

.forum-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}

.forum-header-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    color: var(--reddit-text);
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.15s ease;
    text-decoration: none;
    font-size: 18px;
    position: relative;
}

.forum-header-icon-btn:hover {
    background-color: var(--reddit-hover);
}

/* Header Dropdown */
.forum-header-dropdown {
    position: relative;
}

.forum-header-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    background: var(--reddit-card);
    border: 1px solid var(--reddit-border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    overflow: hidden;
    padding: 4px;
}

html[dir="rtl"] .forum-header-dropdown-menu {
    right: auto;
    left: 0;
}

.forum-header-dropdown-menu .forum-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 14px;
    background: none;
    border: none;
    color: var(--reddit-text);
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    text-align: left;
    border-radius: 4px;
}

html[dir="rtl"] .forum-header-dropdown-menu .forum-dropdown-item {
    text-align: right;
}

.forum-header-dropdown-menu .forum-dropdown-item:hover {
    background-color: var(--reddit-hover);
}

.forum-header-dropdown-menu .forum-dropdown-item.active {
    background-color: var(--reddit-hover);
    color: var(--reddit-link);
    font-weight: 500;
}

.forum-header-dropdown-menu .forum-dropdown-item i.fa-check {
    width: 16px;
    color: var(--reddit-link);
    font-size: 12px;
}

.forum-header-dropdown-menu .forum-dropdown-item i:not(.fa-check) {
    width: 18px;
    text-align: center;
    color: var(--reddit-text-muted);
    font-size: 16px;
}

.forum-header-dropdown-menu .forum-dropdown-item span {
    flex: 1;
}

/* Hide mobile search toggle on desktop */
.forum-search-mobile-toggle {
    display: none;
    position: relative;
}

/* Green circle indicator on mobile search toggle button */
.forum-search-mobile-toggle i.fas.fa-search {
    position: relative;
}

.forum-search-mobile-toggle i.fas.fa-search::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background-color: #46d160;
    border-radius: 50%;
    border: 2px solid var(--reddit-bg-page);
    display: none;
    z-index: 11;
}

.forum-search-mobile-toggle.has-active-search i.fas.fa-search::after {
    display: block;
}

.forum-header-icon-btn:hover {
    background-color: var(--reddit-hover);
}

/* Level Filter Button in Header */
.forum-level-filter-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px !important;
    min-width: auto;
    white-space: nowrap;
}

.forum-level-filter-text {
    font-size: 12px;
    font-weight: 500;
}

@media (max-width: 768px) {
    .forum-level-filter-text {
        display: none;
    }
    .forum-level-filter-btn {
        padding: 6px !important;
    }
}

/* Quick Filters Section */
.forum-quick-filters {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--reddit-border);
    flex-wrap: nowrap;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

.forum-quick-filters-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--reddit-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .forum-quick-filters-label {
        display: none;
    }
}

.forum-quick-filters-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    align-items: center;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    scroll-behavior: auto; /* Disable smooth scroll for manual control */
}

.forum-quick-filters-buttons::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.forum-quick-filters-buttons.dragging {
    cursor: grabbing;
    cursor: -webkit-grabbing;
    /* React-like visual feedback */
    transition: none; /* Disable transitions during drag for smoothness */
}

.forum-quick-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background-color: var(--reddit-card);
    border: 1px solid var(--reddit-border);
    border-radius: 16px;
    color: var(--reddit-text);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.15s ease;
    white-space: nowrap;
    flex-shrink: 0;
    /* Make buttons draggable too */
    pointer-events: auto;
    touch-action: pan-y; /* Allow vertical touch but handle horizontal drag */
}

.forum-quick-filter-btn i {
    font-size: 11px;
}

.forum-quick-filter-btn:hover {
    background-color: var(--reddit-card-hover);
    border-color: var(--reddit-border-hover);
    color: var(--reddit-link);
}

.forum-quick-filter-btn.active {
    background-color: var(--reddit-button);
    border-color: var(--reddit-button);
    color: white;
}

.forum-quick-filter-btn.active:hover {
    background-color: var(--reddit-button-hover);
    border-color: var(--reddit-button-hover);
    color: white;
}

.forum-quick-filter-clear {
    background-color: transparent;
    border-color: var(--reddit-border);
}

.forum-quick-filter-clear:hover {
    background-color: var(--reddit-hover);
    border-color: var(--reddit-border-hover);
}

@media (max-width: 768px) {
    .forum-quick-filters {
        gap: 8px;
    }
    
    .forum-quick-filters-buttons {
        padding-bottom: 4px;
    }
}

.forum-user-avatar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 50%;
    padding: 0;
    position: relative;
}

.forum-user-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--reddit-button);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    border: 2px solid var(--reddit-border);
    transition: border-color 0.15s ease;
}

.forum-user-avatar-btn:hover .forum-user-avatar-small {
    border-color: var(--reddit-link);
}

.forum-notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background-color: var(--reddit-upvote);
    color: white;
    border-radius: 10px;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    padding: 0 4px;
    border: 2px solid var(--reddit-bg-page);
}

.forum-mobile-search-overlay {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    background-color: var(--reddit-bg-page);
    border-bottom: 1px solid var(--reddit-border);
    z-index: 1000;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: none;
}

.forum-mobile-search-container {
    max-width: 1248px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.forum-mobile-search-overlay .forum-search {
    position: relative;
}

.forum-mobile-search-overlay .forum-search-icon {
    z-index: 10;
    display: block !important;
}

.forum-mobile-search-close {
    background: none;
    border: none;
    color: var(--reddit-text);
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    font-size: 18px;
    transition: background-color 0.15s ease;
    flex-shrink: 0;
}

.forum-mobile-search-close:hover {
    background-color: var(--reddit-hover);
}

.forum-search-field {
    width: 100%;
    background-color: var(--reddit-input);
    border: 1px solid var(--reddit-border);
    border-radius: 20px;
    padding: 6px 12px 6px 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    transition: all 0.15s ease;
    position: relative;
}

.forum-search-field:focus-within {
    border-color: var(--reddit-border-hover);
    background-color: var(--reddit-bg-page);
    box-shadow: 0 0 0 3px rgba(79, 188, 255, 0.1);
}

.forum-search input {
    flex: 1;
    min-width: 120px;
    background: transparent;
    border: none;
    color: var(--reddit-text);
    font-size: 14px;
    font-weight: 400;
    outline: none;
    padding: 4px 0;
    position: relative;
    z-index: 1;
}

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

.forum-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--reddit-text-muted);
    font-size: 16px;
    pointer-events: none;
    z-index: 10;
    display: block !important;
}

/* Green circle indicator when search/filter is active */
.forum-search-icon::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background-color: #46d160;
    border-radius: 50%;
    border: 2px solid var(--reddit-bg-page);
    display: none;
    z-index: 11;
}

.forum-search-icon.has-active-search::after {
    display: block;
}

.forum-search-chips {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    position: relative;
    z-index: 1;
}

.forum-search-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background-color: rgba(79, 188, 255, 0.12);
    border: 1px solid var(--reddit-border);
    color: var(--reddit-text);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.forum-search-chip:hover {
    background-color: var(--reddit-hover);
    border-color: var(--reddit-border-hover);
}

.forum-search-chip-remove {
    background: none;
    border: none;
    color: var(--reddit-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.forum-search-chip-remove:hover {
    color: var(--reddit-text);
    background-color: rgba(255, 255, 255, 0.08);
}

.forum-search-suggestions {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background-color: var(--reddit-card);
    border: 1px solid var(--reddit-border);
    border-radius: 12px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.45);
    padding: 8px 0;
    z-index: 250;
    display: none;
    max-height: 360px;
    overflow-y: auto;
    margin-top: 4px;
}

.forum-search-suggestions.active {
    display: block !important;
}

.forum-search-suggestion {
    padding: 10px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.forum-search-suggestion:hover,
.forum-search-suggestion:focus {
    background-color: var(--reddit-hover);
}

.forum-search-suggestion-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--reddit-text);
}

.forum-search-suggestion-meta {
    font-size: 12px;
    color: var(--reddit-text-muted);
}

.forum-search-suggestions-empty {
    padding: 10px 16px;
    font-size: 12px;
    color: var(--reddit-text-muted);
}

.forum-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.forum-header-icon-btn {
    padding: 6px 10px !important;
    min-width: 36px;
    justify-content: center;
}

.forum-btn {
    background-color: transparent;
    border: 1px solid var(--reddit-border);
    color: var(--reddit-text);
    padding: 6px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
    line-height: 1.5;
}

.forum-btn:hover {
    border-color: var(--reddit-border-hover);
    background-color: var(--reddit-hover);
}

.forum-btn-primary {
    background-color: var(--reddit-button);
    border-color: var(--reddit-button);
    color: white;
    font-weight: 700;
}

.forum-btn-primary:hover {
    background-color: var(--reddit-button-hover);
    border-color: var(--reddit-button-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(255, 69, 0, 0.3);
}

.forum-btn:active {
    transform: scale(0.98);
}

.forum-btn-secondary {
    background-color: transparent;
    color: var(--reddit-text);
    border: 1px solid var(--reddit-border);
}

.forum-btn-secondary:hover {
    background-color: var(--reddit-hover);
    border-color: var(--reddit-text-muted);
}

/* Filter Selects */
.forum-filter-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--reddit-border);
    border-radius: 8px;
    background: var(--reddit-card);
    color: var(--reddit-text);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    outline: none;
}

.forum-filter-select:hover {
    border-color: var(--reddit-border-hover);
    background-color: var(--reddit-hover);
}

.forum-filter-select:focus {
    outline: none;
    border-color: var(--reddit-link);
    box-shadow: 0 0 0 3px rgba(79, 188, 255, 0.1);
}

.forum-filter-select option {
    background: var(--reddit-card);
    color: var(--reddit-text);
}

.forum-user-menu {
    position: relative;
}

.forum-user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    background: transparent;
    border: 1px solid transparent;
    color: var(--reddit-text);
    transition: all 0.15s ease;
    font-size: 14px;
    font-weight: 400;
}

.forum-user-btn:hover {
    background-color: var(--reddit-hover);
    border-color: var(--reddit-border);
}

.forum-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--reddit-button);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

/* Sidebar Collapse Button */
.forum-sidebar-collapse-btn {
    position: absolute;
    top: 8px;
    right: -16px; /* Center button on border line: -32px / 2 = -16px */
    width: 32px;
    height: 32px;
    border: 1px solid var(--reddit-border);
    border-radius: 50%;
    background-color: var(--reddit-bg-page);
    color: var(--reddit-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 102;
    transition: all 0.3s ease;
    padding: 0;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.forum-sidebar-left.collapsed .forum-sidebar-collapse-btn {
    right: auto;
    left: 50%;
    top: 8px;
    transform: translateX(-50%);
    background-color: var(--reddit-bg-page);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    border-color: var(--reddit-border);
    z-index: 104;
    position: absolute;
    margin: 0;
}

.forum-sidebar-collapse-btn:hover {
    background-color: var(--reddit-hover);
    border-color: var(--reddit-border-hover);
}

.forum-sidebar-collapse-btn:active {
    transform: scale(0.95);
}

/* Sidebar Navigation - Flat Design */
.forum-sidebar-nav {
    padding: 8px 0 0 0;
}

.forum-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    color: var(--reddit-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.15s ease;
    border-radius: 0;
    position: relative;
}

.forum-nav-link:hover {
    background-color: var(--reddit-hover);
}

.forum-nav-link.active {
    background-color: var(--reddit-hover);
    font-weight: 600;
}

.forum-nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: var(--reddit-text);
    stroke: currentColor;
}

.forum-nav-link.active .forum-nav-icon {
    color: var(--reddit-text);
}

/* BETA Badge */
.forum-beta-badge {
    margin-left: auto;
    font-size: 11px;
    font-weight: 700;
    color: #ff4500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Sidebar Separator */
.forum-sidebar-separator {
    height: 1px;
    background-color: var(--reddit-border);
    margin: 12px 16px;
}

/* Sidebar Section */
.forum-sidebar-section {
    padding: 0;
    margin-bottom: 0;
}

.forum-sidebar-section .forum-nav-link {
    padding: 8px 16px;
}

/* Profile Page Styles */
.forum-profile-header {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 24px;
    background-color: var(--reddit-card);
    border: 1px solid var(--reddit-border);
    border-radius: 8px;
    margin-bottom: 16px;
}

.forum-profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--reddit-button);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.forum-profile-info {
    flex: 1;
}

.forum-profile-name {
    font-size: 24px;
    font-weight: 700;
    color: var(--reddit-text);
    margin: 0 0 4px 0;
}

.forum-profile-username {
    font-size: 14px;
    color: var(--reddit-text-muted);
    margin: 0 0 4px 0;
}

.forum-profile-email {
    font-size: 14px;
    color: var(--reddit-text-muted);
    margin: 0 0 4px 0;
}

.forum-profile-joined {
    font-size: 12px;
    color: var(--reddit-text-muted);
    margin: 8px 0 0 0;
}

.forum-profile-actions {
    display: flex;
    gap: 8px;
}

.forum-profile-stats {
    display: flex;
    gap: 24px;
    padding: 16px 24px;
    background-color: var(--reddit-card);
    border: 1px solid var(--reddit-border);
    border-radius: 8px;
    margin-bottom: 16px;
}

.forum-profile-stat-link {
    text-decoration: none;
    color: inherit;
    transition: opacity 0.15s;
}

.forum-profile-stat-link:hover {
    opacity: 0.7;
}

.forum-profile-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.forum-profile-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--reddit-text);
}

.forum-profile-stat-label {
    font-size: 12px;
    color: var(--reddit-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.forum-profile-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--reddit-border);
}

.forum-profile-filter {
    padding: 8px 16px;
    border-radius: 20px;
    background-color: transparent;
    color: var(--reddit-text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
    border: 1px solid transparent;
}

.forum-profile-filter:hover {
    background-color: var(--reddit-hover);
    color: var(--reddit-text);
}

.forum-profile-filter.active {
    background-color: var(--reddit-hover);
    color: var(--reddit-text);
    border-color: var(--reddit-border);
}

.forum-profile-posts {
    margin-top: 16px;
}

.forum-profile-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 24px;
    padding: 16px;
}

.forum-profile-page-info {
    color: var(--reddit-text-muted);
    font-size: 14px;
}

.forum-sidebar-view-toggle {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 16px;
}

.forum-sidebar-view-toggle .forum-view-btn {
    width: 100%;
    justify-content: flex-start;
    padding: 8px 12px;
    margin: 0;
    border: 1px solid var(--reddit-border);
    background: transparent;
    color: var(--reddit-text-muted);
    font-size: 13px;
    transition: all 0.15s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.forum-sidebar-view-toggle .forum-view-btn:hover {
    background-color: var(--reddit-hover);
    border-color: var(--reddit-border-hover);
    color: var(--reddit-text);
}

.forum-sidebar-view-toggle .forum-view-btn.active {
    background-color: var(--reddit-hover);
    border-color: var(--reddit-link);
    color: var(--reddit-text);
    font-weight: 600;
}

.forum-sidebar-view-toggle .forum-view-btn i {
    width: 16px;
    margin-right: 8px;
    text-align: center;
    flex-shrink: 0;
}

.forum-sidebar-view-toggle .forum-view-btn span {
    flex: 1;
}

.forum-sidebar-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 16px;
    background: none;
    border: none;
    color: var(--reddit-text-muted);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: color 0.15s ease;
    text-align: left;
}

.forum-sidebar-section-header:hover {
    color: var(--reddit-text);
}

.forum-section-caret {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    color: var(--reddit-text-muted);
    transition: transform 0.2s ease, color 0.15s ease;
}

.forum-sidebar-section-header.collapsed .forum-section-caret {
    transform: rotate(-90deg);
}

.forum-sidebar-section-content {
    padding: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 1000px;
    opacity: 1;
}

.forum-sidebar-section-content.collapsed {
    max-height: 0;
    opacity: 0;
    padding: 0;
}

/* Post Card */
.forum-post {
    background-color: transparent;
    border: none;
    border-radius: 0;
    margin-bottom: 0;
    display: flex;
    overflow: visible;
    transition: background-color 0.15s;
    animation: fadeIn 0.3s ease-out;
    padding: 8px 0;
    cursor: pointer;
}

.forum-post:hover {
    background-color: var(--reddit-hover);
}

.forum-post-detail:hover {
    background-color: transparent;
}

.forum-post-vote {
    background-color: transparent;
    width: 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 0;
    flex-shrink: 0;
}

.forum-vote-btn {
    background: none;
    border: none;
    color: var(--reddit-text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 20px;
    transition: all 0.15s ease;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
}

.forum-vote-btn:hover {
    color: var(--reddit-upvote);
    background-color: rgba(255, 69, 0, 0.1);
}

.forum-vote-btn:active {
    transform: scale(0.95);
}

.forum-vote-btn.upvoted {
    color: var(--reddit-upvote);
}

.forum-vote-btn.downvoted {
    color: var(--reddit-downvote);
}

.forum-vote-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.forum-vote-count {
    font-size: 12px;
    font-weight: 700;
    color: var(--reddit-text);
    margin: 2px 0;
    min-height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}

.forum-post-content {
    flex: 1;
    padding: 0;
    padding-right: 10px;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
    word-wrap: break-word;
}

.forum-post-separator {
    height: 1px;
    background-color: var(--reddit-border);
    margin: 0;
    width: 100%;
}

.forum-post:first-child .forum-post-separator,
.forum-post-separator:first-child {
    display: none;
}

.forum-post-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 12px;
    color: var(--reddit-text-muted);
}

.forum-post-author-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    position: relative;
}

.forum-post-meta {
    flex: 1;
}

.forum-post-follow-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 50%;
    background: none;
    border: none;
    color: var(--reddit-text-muted);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s ease;
    margin-left: auto;
    flex-shrink: 0;
}

.forum-post-follow-btn:hover {
    background-color: var(--reddit-hover);
    color: var(--reddit-text);
}

.forum-post-follow-btn i {
    font-size: 12px;
}

.forum-post-follow-btn span {
    display: none;
}

.forum-post-meta {
    display: flex;
    align-items: center;
    gap: 4px;
}

.forum-role-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(79, 70, 229, 0.15);
    color: #4f46e5;
}

.forum-role-badge.small {
    font-size: 10px;
    padding: 2px 6px;
}

.forum-post-meta-separator {
    color: var(--reddit-text-muted);
    font-size: 10px;
    margin: 0 2px;
}

.forum-post-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--reddit-button);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: white;
    text-decoration: none;
    flex-shrink: 0;
    transition: transform 0.15s, box-shadow 0.15s;
}

.forum-post-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.forum-post-author {
    color: var(--reddit-text);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.15s;
}

.forum-post-author:hover {
    text-decoration: underline;
    color: var(--reddit-link);
}

.forum-post-time {
    color: var(--reddit-text-muted);
    font-size: 12px;
    font-weight: 400;
}

.forum-post-title {
    font-size: 18px;
    font-weight: 500;
    color: var(--reddit-text);
    margin-bottom: 8px;
    margin-left: 40px;
    line-height: 1.35;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.forum-post-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.15s;
}

/* Title hover effect removed */

/* Post Status Badge */
.forum-post-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 4px;
}

.forum-post-status-badge.status-pending {
    background-color: rgba(255, 193, 7, 0.2);
    color: #ffc107;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.forum-post-status-badge.status-rejected {
    background-color: rgba(220, 53, 69, 0.2);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.3);
}

.forum-post-header .forum-post-status-badge {
    font-size: 10px;
    margin-left: 8px;
}

.forum-post-tags {
    margin-bottom: 8px;
    margin-left: 40px;
    font-size: 12px;
    color: var(--reddit-text-muted);
}

.forum-tag-text {
    color: var(--reddit-text-muted);
    font-size: 12px;
    font-weight: 400;
}

.forum-tag-link {
    color: inherit;
    text-decoration: none;
    display: inline-block;
}

.forum-tag-link u {
    text-decoration: underline;
    text-decoration-color: var(--reddit-text-muted);
    text-underline-offset: 2px;
    color: var(--reddit-text);
    transition: color 0.15s, text-decoration-color 0.15s;
}

.forum-tag-link:hover u {
    color: var(--reddit-link);
    text-decoration-color: var(--reddit-link);
}

.forum-tag-text u:not(.forum-tag-link u) {
    text-decoration: underline;
    text-decoration-color: var(--reddit-text-muted);
    text-underline-offset: 2px;
    color: var(--reddit-text);
}

.forum-post-body {
    color: var(--reddit-text);
    margin-bottom: 12px;
    margin-left: 40px;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.5;
    font-weight: 400;
}

.forum-post-image-container {
    margin: 12px 0 3px 0;
    margin-left: 40px;
    border-radius: 8px;
    overflow: hidden;
    background-color: var(--reddit-hover);
    display: block;
    width: calc(100% - 40px);
    max-width: 100%;
}

.forum-post-image {
    max-width: 100%;
    width: auto;
    height: auto;
    border-radius: 8px;

    cursor: pointer;
    display: block;
    transition: opacity 0.2s, transform 0.2s;
    object-fit: contain;
}

/* Blurred side fill for tall/landscape images while keeping 100% width */
.forum-image-blur-wrap {
    position: relative;
    width: 100%;
    max-height: var(--forum-image-max-h, 70vh);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 8px;
    background: var(--reddit-hover);
}

.forum-image-blur-wrap::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: var(--forum-image-bg, none);
    background-size: cover;
    background-position: center;
    filter: blur(24px);
    transform: scale(1.1);
}

.forum-image-blur-wrap > img.forum-post-image,
.forum-image-blur-wrap > img.forum-reply-image {
    position: relative;
    z-index: 1;
    width: 100%;
    height: auto;
    max-height: inherit; /* cap height while allowing full width */
    object-fit: contain;
}


.forum-post-footer {
    display: flex;
    gap: 8px;
    padding-top: 8px;
    margin-top: 4px;
    border-top: 1px solid var(--reddit-border);
    align-items: center;
    justify-content: space-between;
}

.forum-post-footer-actions {
    display: flex;
    gap: 8px;
    flex: 1;
}

.forum-post-footer-more {
    position: relative;
}

.forum-post-footer-more-menu {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 8px;
    background-color: var(--reddit-card);
    border: 1px solid var(--reddit-border);
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 100;
    min-width: 150px;
}

.forum-post-footer-more-menu .forum-post-action {
    display: flex;
    width: 100%;
    padding: 8px 12px;
    border-radius: 4px;
    margin: 2px 0;
}

/* Hide footer vote button on desktop */
.forum-post-footer-vote {
    display: none;
}

.forum-post-action {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    background: none;
    border: none;
    color: var(--reddit-text-muted);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.15s ease;
    line-height: 1.5;
}

.forum-post-action:hover {
    background-color: var(--reddit-hover);
    color: var(--reddit-text);
}

.forum-post-action:active {
    transform: scale(0.98);
}

.forum-post-action i {
    font-size: 16px;
}

.forum-post-delete-btn {
    color: var(--reddit-text-muted);
}

.forum-post-delete-btn:hover {
    background-color: rgba(255, 69, 0, 0.1);
    color: #ff4500;
}

/* Reply */
.forum-reply-wrapper {
    position: relative;
}

.forum-reply-wrapper[data-depth="0"] {
    border-bottom: 1px solid var(--reddit-border);
}

.forum-reply-wrapper[data-depth="0"]:last-child {
    border-bottom: none;
}

.forum-reply {
    padding: 12px 16px;
    transition: background-color 0.15s;
    position: relative;
    display: flex;
    gap: 8px;
}

.forum-reply:hover {
    background-color: var(--reddit-hover);
}

.forum-reply-thread-line {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    margin-left: 16px;
    width: 1px;
    background-color: var(--reddit-border);
}

/* Horizontal curved line part at the bottom */
.forum-reply-thread-line::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: calc(50% + 0.5px);
    height: 16px;
    border-bottom: 1px solid var(--reddit-border);
    border-left: 1px solid var(--reddit-border);
    border-bottom-left-radius: 12px;
    box-sizing: border-box;
}

.forum-reply-content-wrapper {
    flex: 1;
    min-width: 0;
}

.forum-reply-children {
    margin-left: 40px;
    position: relative;
    padding-left: 0;
}

/* Show more replies button */
.forum-reply-show-more {
    margin-top: 8px;
    margin-bottom: 4px;
    margin-left: 40px;
    padding-left: 24px;
    position: relative;
}

.forum-reply-show-more::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 1px;
    background-color: var(--reddit-border);
}

.forum-reply-show-btn {
    background: none;
    border: none;
    color: var(--reddit-text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s;
    font-family: inherit;
    line-height: 1.4;
}

.forum-reply-show-btn:hover {
    color: var(--reddit-text);
}

.forum-reply-show-btn.expanded {
    color: var(--reddit-text);
}

.forum-reply-show-btn:active {
    opacity: 0.7;
}

.forum-reply-show-btn i {
    font-size: 9px;
    transition: transform 0.2s ease;
    margin-top: 1px;
}

.forum-reply-show-btn.expanded i {
    transform: rotate(180deg);
}

.forum-reply-children::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: var(--reddit-border);
}

.forum-reply-wrapper[data-depth="1"] .forum-reply-thread-line {
    left: 0;
}

.forum-reply-wrapper[data-depth="2"] .forum-reply-thread-line {
    left: -40px;
}

.forum-reply-wrapper[data-depth="3"] .forum-reply-thread-line {
    left: -80px;
}

.forum-reply-wrapper[data-depth="4"] .forum-reply-thread-line {
    left: -120px;
}

.forum-reply-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--reddit-text-muted);
    flex-wrap: wrap;
}

.forum-reply-author-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.forum-reply-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--reddit-button);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: white;
    text-decoration: none;
    flex-shrink: 0;
    transition: transform 0.15s, box-shadow 0.15s;
}

.forum-reply-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.forum-reply-author {
    color: var(--reddit-text);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.15s;
}

.forum-reply-author:hover {
    color: var(--reddit-link);
    text-decoration: underline;
}

.forum-reply-content {
    color: var(--reddit-text);
    white-space: pre-wrap;
    word-wrap: break-word;
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.5;
    font-weight: 400;
}

.forum-reply-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    margin: 8px 0;
    cursor: pointer;
    display: block;
    transition: opacity 0.2s;
    object-fit: contain;
}

.forum-reply-image:hover {
    opacity: 0.9;
}

.forum-reply-footer {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 8px;
}

.forum-reply-action-btn {
    background: none;
    border: none;
    color: var(--reddit-text-muted);
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: inherit;
}

.forum-reply-action-btn:hover {
    background-color: var(--reddit-hover);
    color: var(--reddit-text);
}

/* Reply Menu (3-dot menu) */
.forum-reply-menu-wrapper {
    position: relative;
    margin-left: auto;
}

.forum-reply-menu-btn {
    background: none;
    border: none;
    color: var(--reddit-text-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.forum-reply-menu-btn:hover {
    background-color: var(--reddit-hover);
    color: var(--reddit-text);
}

.forum-reply-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--reddit-bg-card);
    border: 1px solid var(--reddit-border);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    min-width: 160px;
    z-index: 100;
    margin-top: 4px;
    overflow: hidden;
}

.forum-reply-menu-item {
    width: 100%;
    background: none;
    border: none;
    color: var(--reddit-text);
    font-size: 13px;
    cursor: pointer;
    padding: 10px 16px;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background-color 0.15s;
    font-family: inherit;
}

.forum-reply-menu-item:hover {
    background-color: var(--reddit-hover);
}

.forum-reply-menu-item i {
    width: 16px;
    text-align: center;
    color: var(--reddit-text-muted);
}

.forum-reply-action-btn i {
    font-size: 12px;
}

.forum-reply-delete-btn {
    color: var(--reddit-text-muted);
}

.forum-reply-delete-btn:hover {
    background-color: rgba(255, 69, 0, 0.1);
    color: #ff4500;
    border-color: rgba(255, 69, 0, 0.3);
}

.forum-reply-depth-limit {
    color: var(--reddit-text-muted);
    font-size: 11px;
    padding: 4px 8px;
    opacity: 0.7;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: help;
}

.forum-reply-depth-limit i {
    font-size: 11px;
}

.forum-nested-reply-form {
    margin-top: 12px;
    padding: 12px;
    background-color: var(--reddit-input);
    border-radius: 4px;
    border: 1px solid var(--reddit-border);
}

.forum-reply-cancel-btn {
    padding: 6px 16px;
    background-color: transparent;
    color: var(--reddit-text-muted);
    border: 1px solid var(--reddit-border);
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.forum-reply-cancel-btn:hover {
    background-color: var(--reddit-hover);
    border-color: var(--reddit-border-hover);
    color: var(--reddit-text);
}

.forum-reply-vote {
    display: flex;
    align-items: center;
    gap: 4px;
}

.forum-reply-vote-btn {
    background: none;
    border: none;
    color: var(--reddit-text-muted);
    cursor: pointer;
    padding: 4px 6px;
    font-size: 16px;
    transition: all 0.15s ease;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.forum-reply-vote-btn:hover {
    color: var(--reddit-upvote);
    background-color: var(--reddit-hover);
}

.forum-reply-vote-btn.upvoted {
    color: var(--reddit-upvote);
}

.forum-reply-vote-count {
    font-size: 12px;
    font-weight: 700;
    color: var(--reddit-text);
    margin: 0 4px;
    min-width: 20px;
    text-align: center;
}

/* Reply Section */
.forum-reply-section {
    margin-top: 16px;
}

.forum-reply-form {
    display: flex;
    flex-direction: column;
}

.forum-reply-input-wrapper {
    position: relative;
    display: flex;
    align-items: flex-end;
}

.forum-reply-textarea {
    width: 100%;
    background-color: var(--reddit-input);
    border: 1px solid var(--reddit-border);
    border-radius: 4px;
    padding: 12px 40px 12px 12px;
    color: var(--reddit-text);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    max-height: 400px;
    transition: border-color 0.15s, background-color 0.15s;
    line-height: 1.5;
}

.forum-reply-image-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: none;
    border: none;
    color: var(--reddit-text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: color 0.15s, background-color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.forum-reply-image-btn:hover {
    color: var(--reddit-text);
    background-color: var(--reddit-hover);
}

.forum-reply-textarea::placeholder {
    color: var(--reddit-text-muted);
}

.forum-reply-textarea:focus {
    outline: none;
    border-color: var(--reddit-link);
    background-color: var(--reddit-card);
}

.forum-reply-submit-btn {
    margin-top: 8px;
    align-self: flex-end;
    padding: 6px 16px;
    background-color: var(--reddit-button);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s;
}

.forum-reply-submit-btn:hover {
    background-color: var(--reddit-button-hover);
}

.forum-reply-submit-btn:active {
    transform: scale(0.98);
}

/* Comment Controls */
.forum-comment-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.forum-comment-controls-left {
    display: flex;
    align-items: center;
}

.forum-sort-dropdown {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.forum-sort-label {
    color: var(--reddit-text-muted);
    font-size: 12px;
}

.forum-sort-wrapper {
    position: relative;
}

.forum-sort-btn {
    background-color: transparent;
    border: 1px solid var(--reddit-border);
    border-radius: 4px;
    color: var(--reddit-text);
    font-size: 12px;
    cursor: pointer;
    padding: 6px 12px;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    min-width: 100px;
}

.forum-sort-btn:hover {
    background-color: var(--reddit-hover);
    border-color: var(--reddit-border-hover);
}

.forum-sort-btn-content {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
}

.forum-sort-icon {
    font-size: 12px;
    width: 14px;
    text-align: center;
}

.forum-sort-btn-text {
    flex: 1;
    text-align: left;
}

.forum-sort-chevron {
    font-size: 10px;
    margin-left: auto;
    transition: transform 0.15s;
}

.forum-sort-wrapper.active .forum-sort-chevron {
    transform: rotate(180deg);
}

.forum-sort-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background-color: var(--reddit-card);
    border: 1px solid var(--reddit-border);
    border-radius: 4px;
    min-width: 160px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    overflow: hidden;
}

.forum-sort-option {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: none;
    border: none;
    color: var(--reddit-text);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.15s;
    font-family: inherit;
}

.forum-sort-option:hover {
    background-color: var(--reddit-hover);
}

.forum-sort-option.active {
    background-color: var(--reddit-hover);
    color: var(--reddit-text);
    font-weight: 500;
}

.forum-sort-option i {
    width: 16px;
    text-align: center;
    font-size: 14px;
}

.forum-sort-option span {
    flex: 1;
}

.forum-comment-search-container {
    margin-top: 12px;
    margin-bottom: 16px;
    width: 100%;
}

.forum-comment-search-input {
    width: 100%;
    padding: 8px 12px;
    padding-right: 36px;
    border: 1px solid var(--reddit-border);
    border-radius: 4px;
    background: var(--reddit-input);
    color: var(--reddit-text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s, background-color 0.15s;
}

.forum-comment-search-input:focus {
    outline: none;
    border-color: var(--reddit-link);
    background: var(--reddit-bg-card);
}

.forum-comment-search-input::placeholder {
    color: var(--reddit-text-muted);
}

.forum-comment-controls-right {
    display: flex;
    align-items: center;
}

.forum-search-comments-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background-color: var(--reddit-input);
    border: 1px solid var(--reddit-border);
    border-radius: 4px;
    color: var(--reddit-text-muted);
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.forum-search-comments-btn:hover {
    background-color: var(--reddit-hover);
    border-color: var(--reddit-border-hover);
    color: var(--reddit-text);
}

.forum-search-comments-btn i {
    font-size: 12px;
}

/* Form */
.forum-form {
    background-color: var(--reddit-card);
    border: 1px solid var(--reddit-border);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.forum-form-group {
    margin-bottom: 20px;
}

.forum-form-group:last-child {
    margin-bottom: 0;
}

.forum-form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--reddit-text-muted);
    letter-spacing: 0.5px;
}

.forum-form-input,
.forum-form-textarea,
.forum-form-select {
    width: 100%;
    background-color: var(--reddit-input);
    border: 1px solid var(--reddit-border);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--reddit-text);
    font-size: 14px;
    font-family: inherit;
    font-weight: 400;
    outline: none;
    transition: all 0.2s;
}

.forum-form-input::placeholder,
.forum-form-textarea::placeholder {
    color: var(--reddit-text-muted);
}

.forum-form-input:focus,
.forum-form-textarea:focus,
.forum-form-select:focus {
    border-color: var(--reddit-border-hover);
    background-color: var(--reddit-bg-page);
    box-shadow: 0 0 0 3px rgba(79, 188, 255, 0.1);
}

.forum-form-textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.5;
}

.forum-form-file {
    display: block;
    width: 100%;
    padding: 8px;
    background-color: var(--reddit-input);
    border: 1px solid var(--reddit-border);
    border-radius: 8px;
    color: var(--reddit-text);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.forum-form-file:hover {
    border-color: var(--reddit-border-hover);
    background-color: var(--reddit-hover);
}

.forum-form-file:focus {
    outline: none;
    border-color: var(--reddit-border-hover);
    box-shadow: 0 0 0 3px rgba(79, 188, 255, 0.1);
}

.forum-image-preview {
    margin-top: 12px;
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    border: 1px solid var(--reddit-border);
    display: block;
}

/* Footer */
.forum-footer {
    background-color: var(--reddit-bg-page);
    border-top: 1px solid var(--reddit-border);
    padding: 24px 20px;
    margin-top: 48px;
}

.forum-footer-content {
    max-width: 1248px;
    margin: 0 auto;
    text-align: center;
    color: var(--reddit-text-muted);
    font-size: 12px;
}

.forum-footer-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.forum-footer-link {
    text-decoration: none;
    font-size: 12px;
    transition: color 0.15s;
}

.forum-footer-link:hover {
    text-decoration: underline;
    color: rgb(231, 231, 231);
}

/* Footer in Sidebar */
.forum-footer-sidebar {
    padding: 16px;
}

.forum-footer-sidebar .forum-footer-links {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    justify-content: flex-start;
    align-items: flex-start;
}

.forum-footer-sidebar .forum-footer-link {
    font-size: 12px;
    padding: 4px 0;
    color: var(--reddit-text-muted);
}

.forum-footer-sidebar .forum-footer-copyright {
    font-size: 11px;
    color: var(--reddit-text-muted);
    margin: 0;
    padding-top: 12px;
    border-top: 1px solid var(--reddit-border);
    text-align: left;
}

.forum-footer-sidebar .forum-footer-copyright a {
    color: var(--reddit-link);
    text-decoration: none;
    transition: color 0.2s ease;
}

.forum-footer-sidebar .forum-footer-copyright a:hover {
    color: var(--reddit-text);
    text-decoration: underline;
}

/* Popular Posts */
.forum-popular-item {
    padding: 8px 12px;
    border-bottom: 1px solid var(--reddit-border);
    transition: background-color 0.15s;
}

.forum-popular-item:hover {
    background-color: var(--reddit-hover);
}

.forum-popular-item:last-child {
    border-bottom: none;
}

.forum-popular-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--reddit-text);
    text-decoration: none;
    margin-bottom: 4px;
    display: block;
    line-height: 1.4;
    transition: color 0.15s;
}

.forum-popular-title:hover {
    color: var(--reddit-link);
}

.forum-popular-meta {
    font-size: 12px;
    color: var(--reddit-text-muted);
    font-weight: 400;
}

.forum-popular-author {
    color: inherit;
    text-decoration: none;
    transition: color 0.15s;
}

.forum-popular-author:hover {
    color: var(--reddit-link);
    text-decoration: underline;
}

/* Following List */
.forum-following-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-bottom: 1px solid var(--reddit-border);
}

.forum-following-item:last-child {
    border-bottom: none;
}

.forum-following-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--reddit-button);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.forum-following-info {
    flex: 1;
    min-width: 0;
}

.forum-following-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--reddit-text);
    text-decoration: none;
    display: block;
}

.forum-following-name:hover {
    text-decoration: underline;
}

.forum-following-username {
    font-size: 12px;
    color: var(--reddit-text-muted);
}

/* Ads */
.forum-ads-card {
    padding: 0;
    overflow: hidden;
}

.forum-ads-rotator {
    position: relative;
    width: 100%;
    overflow: hidden;
    margin-bottom: 2px;
}

.forum-ads-slide {
    display: none;
    width: 100%;
}

.forum-ads-slide.active {
    display: block;
    animation: forum-ad-fade 0.6s ease-in-out;
}

.forum-ads-slide img {
    width: 100%;
    display: block;
    object-fit: cover;
}

@keyframes forum-ad-fade {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Empty State */
.forum-empty {
    text-align: center;
    padding: 64px 16px;
    color: var(--reddit-text-muted);
}

.forum-empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.4;
    color: var(--reddit-text-muted);
}

.forum-empty-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--reddit-text);
    line-height: 1.4;
}

/* Loading */
.forum-loading {
    text-align: center;
    padding: 32px;
    color: var(--reddit-text-muted);
}

/* Toggle Seen Posts */
.forum-toggle-seen {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    margin-bottom: 16px;
    background-color: var(--reddit-card);
    border: 1px solid var(--reddit-border);
    border-radius: 4px;
}

.forum-toggle-seen input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.forum-toggle-seen label {
    cursor: pointer;
    font-size: 14px;
    color: var(--reddit-text);
}

/* Lightbox */
.forum-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(3, 3, 3, 0.9);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.forum-lightbox.active {
    display: flex;
}

.forum-lightbox-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
    animation: fadeIn 0.3s ease-out;
}

.forum-lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.forum-lightbox-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.forum-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Modal Styles */
.forum-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.forum-modal[style*="display: flex"],
.forum-modal[style*="display:block"] {
    display: flex !important;
}

.forum-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(2px);
}

.forum-modal-content {
    position: relative;
    background: var(--reddit-card);
    border: 1px solid var(--reddit-border);
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    animation: fadeIn 0.3s ease-out;
    z-index: 2001;
}

.forum-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--reddit-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.forum-modal-close {
    background: transparent;
    border: none;
    color: var(--reddit-text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.forum-modal-close:hover {
    background: var(--reddit-hover);
    color: var(--reddit-text);
}

.forum-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.forum-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--reddit-border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
}

/* Responsive */
@media (max-width: 1200px) {
    .forum-sidebar-right {
        display: none;
    }
}

@media (max-width: 960px) {
    .forum-header {
        z-index: 1000 !important; /* Increased to ensure dropdowns appear above main content */
    }
    
    .forum-container {
        flex-direction: column;
        padding-left: 20px !important;
    }
    
    .forum-sidebar-left {
        position: fixed;
        left: 0;
        top: 56px;
        width: 280px;
        z-index: 200;
        transform: translateX(-100%);
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.3);
    }
    
    .forum-sidebar-left:not(.collapsed) {
        transform: translateX(0);
        width: 280px;
    }
    
    .forum-sidebar-left.collapsed {
        transform: translateX(-100%);
        width: 1px;
    }
    
    .forum-sidebar-left.collapsed::before {
        display: none; /* Hide vertical line on mobile when collapsed */
    }
    
    /* RTL Mobile Overrides */
    html[dir="rtl"] .forum-container {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    html[dir="rtl"] .forum-main {
        margin-right: 0;
    }
    
    html[dir="rtl"] .forum-sidebar-left {
        left: auto;
        right: 0;
        transform: translateX(100%);
        box-shadow: -2px 0 8px rgba(0, 0, 0, 0.3);
    }
    
    html[dir="rtl"] .forum-sidebar-left:not(.collapsed) {
        transform: translateX(0);
    }
    
    html[dir="rtl"] .forum-sidebar-left.collapsed {
        transform: translateX(100%);
    }
    
    html[dir="rtl"] .forum-post-image-container {
        margin-right: 0;
    }
    
    .forum-sidebar-left .forum-sidebar-collapse-btn {
        display: none; /* Hide sidebar button on mobile - use header button instead */
    }
    
    .forum-mobile-sidebar-toggle {
        display: flex; /* Show header button on mobile */
    }
    
    /* Ensure view toggle is visible and accessible on mobile */
    .forum-sidebar-view-toggle {
        display: flex !important;
    }
    
    .forum-sidebar-view-toggle .forum-view-btn {
        padding: 10px 12px;
        font-size: 14px;
        min-height: 44px; /* Touch-friendly size */
    }
    
    .forum-sidebar-view-toggle .forum-view-btn i {
        font-size: 16px;
    }
    
    .forum-main {
        order: 1;
        width: 100%;
    }
    
    .forum-search-desktop {
        display: none !important;
    }
    
    .forum-search-mobile {
        display: block !important;
        flex: 1;
        max-width: none;
        position: relative;
        z-index: 200;
    }
    
    /* Mobile search suggestions positioning */
    .forum-mobile-search-overlay .forum-search-suggestions {
        position: absolute;
        top: calc(100% + 8px);
        left: 0;
        right: 0;
        z-index: 300;
        max-height: 50vh;
    }
    
    /* Show mobile search toggle on mobile */
    .forum-search-mobile-toggle {
        display: flex !important;
    }
    
    .forum-header-right {
        gap: 4px;
    }
    
    .forum-header-icon-btn {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    
    /* Ensure dropdown parent doesn't clip on mobile */
    .forum-header-dropdown {
        overflow: visible !important;
    }
    
    .forum-header-right {
        overflow: visible !important;
    }
    
    .forum-header-content {
        overflow-x: hidden;
        overflow-y: visible; /* Allow dropdowns to be visible */
    }
    
    .forum-header-dropdown-menu {
        min-width: 160px;
        font-size: 13px;
        z-index: 10001 !important; /* Very high z-index to ensure it appears above everything */
    }
    
    /* Allow fixed positioning for dropdowns on mobile */
    .forum-header-dropdown-menu[style*="position: fixed"] {
        z-index: 10001 !important;
    }
    
    .forum-header-dropdown-menu .forum-dropdown-item {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .forum-user-avatar-small {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .forum-logo span {
        display: none;
    }
    
    /* Improved header responsiveness for tablet/mobile */
    .forum-header-content {
        padding: 0 8px;
        gap: 6px;
    }
    
    .forum-mobile-sidebar-toggle {
        width: 36px;
        height: 36px;
        padding: 6px;
    }
    
    .forum-logo img {
        height: 80%;
        width: auto;
    }
    
    .forum-notifications-btn {
        min-width: 36px;
        padding: 6px 8px;
    }
    
    /* Add overlay when sidebar is open on mobile */
    .forum-sidebar-overlay {
        display: none;
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 199;
    }
    
    .forum-sidebar-left:not(.collapsed) + .forum-sidebar-overlay,
    body.sidebar-open .forum-sidebar-overlay {
        display: block;
    }
    
    /* Post responsive styles */
    .forum-container {
        padding: 0 !important;
        margin: 0;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    .forum-main {
        padding: 12px 8px;
        width: 100%;
        max-width: 100%;
        margin: 0;
        overflow-x: hidden;
    }
    
    .forum-post {
        padding: 12px 8px;
        margin-bottom: 0;
        max-width: 100%;
        overflow-x: hidden;
        flex-direction: column;
    }
    
    .forum-post-vote {
        display: none; /* Hide vote button from left side on mobile */
    }
    
    .forum-post-content {
        padding-left: 0;
        flex: 1;
        width: 100%;
    }
    
    .forum-post-footer {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-top: 8px;
        margin-left: 0;
        border-top: 1px solid var(--reddit-border);
        padding-top: 8px;
        position: relative;
    }
    
    .forum-post-footer-actions {
        display: flex;
        gap: 4px;
        flex: 1;
        overflow: hidden;
    }
    
    .forum-post-footer-actions .forum-post-action {
        flex-shrink: 0;
    }
    
    /* Show more button when there are more than 3 buttons - JavaScript will handle visibility */
    .forum-post-footer-more {
        display: none; /* Will be shown by JavaScript if needed */
    }
    
    .forum-post-footer-more-menu {
        display: none;
    }
    
    .forum-post-footer-more-menu.active {
        display: block;
    }
    
    /* Show vote button in footer on mobile */
    .forum-post-footer-vote {
        display: flex !important;
        flex-direction: row;
        align-items: center;
        gap: 6px;
        margin-right: 4px;
    }
    
    .forum-post-footer-vote .forum-vote-btn {
        width: 28px;
        height: 28px;
        font-size: 14px;
        transform: none !important;
        padding: 0;
        background: none;
        border: none;
        color: var(--reddit-text-muted);
        cursor: pointer;
        transition: all 0.15s ease;
        border-radius: 2px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .forum-post-footer-vote .forum-vote-btn:hover {
        color: var(--reddit-upvote);
        background-color: rgba(255, 69, 0, 0.1);
    }
    
    .forum-post-footer-vote .forum-vote-btn.upvoted {
        color: var(--reddit-upvote);
    }
    
    .forum-post-footer-vote .forum-vote-btn i {
        transform: none !important;
    }
    
    .forum-post-footer-vote .forum-vote-count {
        font-size: 12px;
        font-weight: 700;
        color: var(--reddit-text);
        margin: 0;
        min-width: 20px;
        text-align: center;
        line-height: 1.2;
    }
    
    .forum-post-header {
        margin-bottom: 8px;
        display: flex;
        align-items: center;
    }
    
    .forum-post-author-wrapper {
        display: flex;
        align-items: center;
        flex: 1;
    }
    
    .forum-post-avatar {
        width: 24px;
        height: 24px;
        font-size: 11px;
        margin-right: 6px;
    }
    
    .forum-post-author {
        font-size: 12px;
    }
    
    .forum-post-time {
        font-size: 11px;
    }
    
    .forum-post-title {
        font-size: 16px;
        line-height: 1.4;
        margin-bottom: 8px;
        margin-left: 0;
    }
    
    .forum-post-tags {
        margin-bottom: 8px;
        margin-left: 0;
    }
    
    .forum-tag-text {
        font-size: 11px;
    }
    
    .forum-post-image-container {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
        margin-top: 8px;
        margin-bottom: 8px;
        overflow: hidden;
    }
    
    .forum-post-image {
        max-width: 100%;
        width: 100%;
        height: auto;
        display: block;
    }
    
    .forum-image-blur-wrap {
        max-width: 100%;
        width: 100%;
    }
    
    .forum-post-footer {
        margin-top: 8px;
        flex-wrap: wrap;
        gap: 8px;
        margin-left: 0;
    }
    
    .forum-post-action {
        font-size: 12px;
        padding: 4px 8px;
    }
    
    .forum-empty {
        padding: 24px 16px;
    }
    
    .forum-empty-title {
        font-size: 18px;
    }
    
    .forum-post-separator {
        margin: 0;
    }
}

@media (max-width: 640px) {
    /* Extra small mobile styles */
    .forum-main {
        padding: 8px 4px;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .forum-post {
        padding: 10px 6px;
        max-width: 100%;
        overflow-x: hidden;
        flex-direction: row;
    }
    
    .forum-post-content {
        max-width: 100%;
        overflow-x: hidden;
        word-wrap: break-word;
    }
    
    .forum-post-vote {
        width: 28px;
        min-width: 28px;
        padding-right: 6px;
        flex-direction: column;
        align-items: center;
    }
    
    /* RTL Mobile Vote Padding */
    html[dir="rtl"] .forum-post-vote {
        padding-right: 0;
        padding-left: 6px;
    }
    
    .forum-vote-btn {
        width: 24px;
        height: 24px;
        font-size: 12px;
        transform: none !important;
    }
    
    .forum-vote-btn i {
        transform: none !important;
    }
    
    .forum-vote-count {
        font-size: 10px;
    }
    
    .forum-post-title {
        font-size: 15px;
        margin-left: 0;
    }
    
    .forum-post-action {
        font-size: 11px;
        padding: 3px 6px;
    }
    
    .forum-post-tags {
        margin-left: 0;
    }
    
    .forum-post-body {
        margin-left: 0;
    }
    
    /* Extra small mobile (640px and below) - Improved header responsiveness */
    .forum-header {
        height: 56px;
        min-height: 56px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000; /* Increased to ensure dropdowns appear above main content */
    }
    
    .forum-header-content {
        flex-wrap: nowrap;
        height: 56px;
        min-height: 56px;
        padding: 6px 4px;
        max-width: 100vw;
        overflow-x: hidden;
        overflow-y: visible; /* Allow dropdowns to be visible */
        gap: 4px;
        align-items: center;
    }
    
    .forum-mobile-sidebar-toggle {
        width: 32px;
        height: 32px;
        padding: 6px;
        margin-right: 4px;
        flex-shrink: 0;
    }
    
    html[dir="rtl"] .forum-mobile-sidebar-toggle {
        margin-right: 0;
        margin-left: 4px;
    }
    
    .forum-logo {
        margin-right: 4px;
        flex-shrink: 0;
    }
    
    .forum-logo img {
        height: 80%;
        width: auto;
    }
    
    .forum-header-right {
        gap: 2px;
        flex-shrink: 0;
        margin-left: auto;
        align-items: center;
        overflow: visible !important;
    }
    
    /* Ensure dropdown parent doesn't clip on mobile */
    .forum-header-dropdown {
        overflow: visible !important;
    }
    
    .forum-header-icon-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
        min-width: 32px;
        padding: 4px;
        flex-shrink: 0;
    }
    
    .forum-user-avatar-small {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }
    
    /* Sign Up button responsive */
    .forum-signup-btn {
        padding: 6px 10px !important;
        min-width: 36px;
        white-space: nowrap;
        font-size: 13px;
    }
    
    .forum-signup-text {
        display: inline;
    }
    
    /* Make notifications more compact */
    .forum-notifications-btn {
        min-width: 32px;
        padding: 4px 6px;
        font-size: 14px;
        width: 32px;
        height: 32px;
    }
    
    .forum-notification-badge {
        top: -2px;
        right: -2px;
        font-size: 10px;
        padding: 1px 4px;
        min-width: 16px;
        height: 16px;
    }
    
    /* Very small screens (360px and below) */
    @media (max-width: 360px) {
        .forum-header-content {
            padding: 6px 2px;
            gap: 2px;
        }
        
        .forum-signup-text {
            display: none;
        }
        
        .forum-signup-btn {
            padding: 6px !important;
            min-width: 32px;
            width: 32px;
        }
        
        .forum-signup-btn::after {
            content: '+';
            font-size: 16px;
            font-weight: 700;
        }
        
        .forum-mobile-sidebar-toggle {
            width: 28px;
            height: 28px;
            padding: 4px;
        }
        
        .forum-header-icon-btn {
            width: 28px;
            height: 28px;
            min-width: 28px;
        }
    }
    
    /* Ensure header stays at top */
    body {
        padding-top: 56px;
    }
    
    .forum-post {
        flex-direction: column;
    }
    
    .forum-post-vote {
        width: 100%;
        flex-direction: row;
        justify-content: center;
        padding: 4px;
    }
    
    .forum-vote-btn {
        transform: rotate(-90deg);
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--reddit-bg-page);
}

::-webkit-scrollbar-thumb {
    background: var(--reddit-border);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--reddit-text-muted);
}

/* Animation keyframes */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.forum-post {
    animation: fadeIn 0.3s ease-out;
}

/* Better focus styles for accessibility */
*:focus-visible {
    outline: 2px solid var(--reddit-link);
    outline-offset: 2px;
    border-radius: 2px;
}

button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--reddit-link);
    outline-offset: 2px;
}

/* View Modes */
#postsContainer.forum-view-card .forum-post {
    border-radius: 8px;
    margin-bottom: 3px;
    background-color: transparent;
    border: none;
}

#postsContainer.forum-view-card .forum-post:hover {
    background-color: var(--reddit-hover);

}

#postsContainer.forum-view-card .forum-post-content {
    padding: 0;
    padding-right: 10px;
}

@media (max-width: 768px) {
    #postsContainer.forum-view-card .forum-post-content {
        padding-right: 0;
    }
}

#postsContainer.forum-view-classic .forum-post {
    border-radius: 4px;
    margin-bottom: 8px;
}

#postsContainer.forum-view-classic .forum-post-title {
    font-size: 16px;
}

#postsContainer.forum-view-classic .forum-post-content {
    padding: 8px;
}

#postsContainer.forum-view-compact .forum-post {
    border-radius: 4px;
    margin-bottom: 4px;
    border-left: 3px solid var(--reddit-border);
}

#postsContainer.forum-view-compact .forum-post-vote {
    width: 32px;
    padding: 2px 4px;
}

#postsContainer.forum-view-compact .forum-vote-btn {
    width: 20px;
    height: 20px;
    font-size: 16px;
}

/* Override compact view transform on mobile */
@media (max-width: 960px) {
    #postsContainer.forum-view-compact .forum-vote-btn {
        transform: none !important;
    }
    
    #postsContainer.forum-view-compact .forum-vote-btn i {
        transform: none !important;
    }
}

#postsContainer.forum-view-compact .forum-post-title {
    font-size: 14px;
    margin-bottom: 4px;
}

#postsContainer.forum-view-compact .forum-post-content {
    padding: 4px 8px;
}

#postsContainer.forum-view-compact .forum-post-header {
    margin-bottom: 4px;
    font-size: 11px;
}

#postsContainer.forum-view-compact .forum-post-avatar {
    width: 24px;
    height: 24px;
    font-size: 11px;
}

#postsContainer.forum-view-compact .forum-reply-avatar {
    width: 20px;
    height: 20px;
    font-size: 10px;
}

#postsContainer.forum-view-compact .forum-post-body {
    font-size: 13px;
    margin-bottom: 4px;
}

#postsContainer.forum-view-compact .forum-post-footer {
    padding-top: 4px;
    margin-top: 2px;
}

#postsContainer.forum-view-compact .forum-post-image {
    max-height: 200px;
}

#postsContainer.forum-view-compact .forum-image-blur-wrap {
    --forum-image-max-h: 200px;
}

/* Sponsored Posts (Ads) - Mobile Only */
@media (max-width: 960px) {
    .forum-post-sponsored {
        background-color: var(--reddit-card);
        border: 1px solid var(--reddit-border);
        border-radius: 4px;
        padding: 12px;
        margin-bottom: 8px;
    }
    
    .forum-post-sponsored-label {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 11px;
        font-weight: 600;
        color: var(--reddit-text-muted);
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-bottom: 8px;
        padding-bottom: 8px;
        border-bottom: 1px solid var(--reddit-border);
    }
    
    .forum-post-sponsored-label i {
        font-size: 10px;
        color: var(--reddit-text-muted);
    }
    
    .forum-post-sponsored-content {
        display: block;
        text-decoration: none;
        color: inherit;
    }
    
    .forum-post-sponsored-image {
        width: 100%;
        height: auto;
        max-height: 400px;
        object-fit: contain;
        border-radius: 4px;
        cursor: pointer;
    }
    
    .forum-post-sponsored-content:hover .forum-post-sponsored-image {
        opacity: 0.9;
    }
}

/* Hide sponsored posts on desktop */
@media (min-width: 961px) {
    .forum-post-sponsored {
        display: none !important;
    }
}

/* Image Preview Area (Create Post Form) */
.forum-images-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
}

.forum-image-preview-item {
    position: relative;
    width: 120px;
    height: 120px;
    border: 2px solid var(--reddit-border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--reddit-card);
}

.forum-image-preview-number {
    position: absolute;
    top: 4px;
    left: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    z-index: 2;
}

.forum-image-preview-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.forum-image-preview-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 4px;
    padding: 4px;
    background: rgba(0, 0, 0, 0.7);
    opacity: 0;
    transition: opacity 0.2s;
}

.forum-image-preview-item:hover .forum-image-preview-controls {
    opacity: 1;
}

.forum-image-preview-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 4px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.forum-image-preview-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.3);
}

.forum-image-preview-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.forum-image-preview-remove {
    background: rgba(220, 53, 69, 0.8) !important;
}

.forum-image-preview-remove:hover {
    background: rgba(220, 53, 69, 1) !important;
}

/* PDF Preview Area */
.forum-pdf-preview {
    margin-top: 12px;
}

.forum-pdf-preview-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: var(--reddit-card);
    border: 1px solid var(--reddit-border);
    border-radius: 8px;
    gap: 12px;
}

.forum-pdf-preview-name {
    flex: 1;
    color: var(--reddit-text);
    font-size: 14px;
}

.forum-pdf-preview-remove {
    background: transparent;
    border: none;
    color: var(--reddit-text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.forum-pdf-preview-remove:hover {
    background: var(--reddit-hover);
    color: var(--reddit-text);
}

/* Image Carousel */
.forum-post-media-container {
    margin: 12px 0;
    position: relative;
}

.forum-pdf-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    margin-bottom: 12px;
    transition: background 0.2s;
}

.forum-pdf-button:hover {
    background: #c82333;
    color: white;
}

.forum-pdf-button i {
    font-size: 16px;
}

.forum-image-carousel {
    position: relative;
    width: 100%;
    margin: 0 auto;
    background: var(--reddit-card);
    border: 1px solid var(--reddit-border);
    border-radius: 8px;
    overflow: hidden;
}

.forum-image-carousel-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.forum-image-carousel-track {
    display: flex;
    transition: transform 0.3s ease;
    will-change: transform;
}

.forum-image-carousel-slide {
    min-width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--reddit-card);
}

.forum-image-carousel-slide img {
    max-width: 100%;
    max-height: 600px;
    height: auto;
    object-fit: contain;
    display: block;
    cursor: pointer;
}

.forum-image-carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    z-index: 10;
    transition: background 0.2s;
}

.forum-image-carousel-nav:hover {
    background: rgba(0, 0, 0, 0.8);
}

.forum-image-carousel-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.forum-image-carousel-nav.prev {
    left: 12px;
}

.forum-image-carousel-nav.next {
    right: 12px;
}

.forum-image-carousel-counter {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    z-index: 10;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 20px;
    backdrop-filter: blur(4px);
}

.forum-image-carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.forum-image-carousel-dot:hover {
    background: rgba(255, 255, 255, 0.6);
    transform: scale(1.2);
}

.forum-image-carousel-dot.active {
    background: rgba(255, 255, 255, 1);
    width: 24px;
    border-radius: 4px;
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Mobile adjustments */
@media (max-width: 960px) {
    .forum-image-preview-item {
        width: 100px;
        height: 100px;
    }
    
    .forum-image-carousel-slide img {
        max-height: 400px;
    }
    
    .forum-image-carousel-nav {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .forum-image-carousel-nav.prev {
        left: 8px;
    }
    
    .forum-image-carousel-nav.next {
        right: 8px;
    }
}