/* BBclubs Group Styling - Extracted from inline styles */

/* Prevent body scrolling when using fixed layout */
body {
  overflow-x: hidden;
}

.member-avatar {
  text-align: center;
}
.member-avatar img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #ddd;
}

/* Creator avatar styling */
.creator-avatar img {
  width: 35px !important;
  height: 35px !important;
  border-radius: 50px !important;
  object-fit: cover;
}

/* Hide create post form by default */
#create_post_form {
  display: none;
}

/* Show only when explicitly enabled */
#create_post_form.show {
  display: block !important;
}

/* Ensure form elements are visible when form is shown */
/* #create_post_form.show * {
  display: block !important;
} */

#create_post_form.show input,
#create_post_form.show textarea,
#create_post_form.show select,
#create_post_form.show button {
  display: inline-block !important;
}

#create_post_form.show fieldset,
#create_post_form.show dl,
#create_post_form.show dd {
  display: block !important;
}

/* Override fieldset dd margin for post form to use full width */
#create_post_form fieldset dd {
  margin-left: 0 !important;
  width: 100% !important;
}

#create_post_form fieldset dl {
  width: 100% !important;
}

/* Post Title Field Styling for Emoji Support */
#post_title {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol' !important;
  font-size: 16px !important;
  line-height: 1.4 !important;
}

/* Deleted Post Styling */
.username.deleted {
  color: #999 !important;
  font-style: italic !important;
  text-decoration: line-through !important;
}

/* Simple Textarea Editor Styling */

/* Textarea styling */
textarea {
  border: 1px solid #ccc !important;
  border-radius: 4px !important;
  font-family: inherit !important;
  font-size: 14px !important;
  line-height: 1.4 !important;
  min-height: 200px !important;
  padding: 12px !important;
  width: 100% !important;
  resize: vertical !important;
}

/* Image Uploader Loading State */
.uploading-image {
  opacity: 0.6;
  position: relative;
}

.uploading-image::after {
  content: "Uploading...";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  z-index: 1000;
}

/* Editor CSS */

/* Toolbar styling removed - toolbar disabled */

/* Simple editor styling */
#editor {
  position: relative !important;
  z-index: 10 !important;
}

#editor * {
  box-sizing: border-box !important;
}

/* Code styling for textarea content */
code {
  background-color: #f6f8fa !important;
  border: 1px solid #e1e4e8 !important;
  border-radius: 3px !important;
  padding: 2px 4px !important;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace !important;
  font-size: 13px !important;
}

pre {
  background-color: #f6f8fa !important;
  border: 1px solid #e1e4e8 !important;
  border-radius: 6px !important;
  padding: 16px !important;
  margin: 8px 0 !important;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace !important;
  font-size: 13px !important;
  line-height: 1.45 !important;
  overflow-x: auto !important;
  white-space: pre !important;
}

/* Toolbar styling completely removed - toolbar disabled */

/* Group profile photo overlay styling */
.group-info-section.with-profile-photo {
  margin-top: 0px;
}

.group-info-section.with-cover-photo {
  border-radius: 0 0 8px 8px;
}

.group-info-section:not(.with-cover-photo) {
  border-radius: 8px;
}

.group-cover-photo {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  background-size: cover;
  background-position: center;
  border-radius: 8px;
  margin-bottom: 20px;
  overflow: hidden;
}

.group-cover-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Reddit-style Threaded Comment System */
.comment-item {
  position: relative;
  margin-bottom: 4px;
  min-height: 20px;
}

/* Threaded indentation system */
.comment-item[data-depth="0"] { 
  margin-left: 0px; 
  padding-left: 0px;
  border-left: none;
}

.comment-item[data-depth="1"] { 
  margin-left: 0px; 
  padding-left: 24px;
  border-left: 2px solid #e1e5e9;
}

.comment-item[data-depth="2"] { 
  margin-left: 0px; 
  padding-left: 48px;
  border-left: 2px solid #d1d5db;
}

.comment-item[data-depth="3"] { 
  margin-left: 0px; 
  padding-left: 72px;
  border-left: 2px solid #9ca3af;
}

.comment-item[data-depth="4"] { 
  margin-left: 0px; 
  padding-left: 20px;
  border-left: 2px solid #6b7280;
}

.comment-item[data-depth="5"] { 
  margin-left: 0px; 
  padding-left: 120px;
  border-left: 2px solid #4b5563;
}

.comment-item[data-depth="6"] { 
  margin-left: 0px; 
  padding-left: 144px;
  border-left: 2px solid #374151;
}

.comment-item[data-depth="7"] { 
  margin-left: 0px; 
  padding-left: 168px;
  border-left: 2px solid #1f2937;
}

.comment-item[data-depth="8"] { 
  margin-left: 0px; 
  padding-left: 192px;
  border-left: 2px solid #111827;
}

/* Reddit-style Threaded Comment System */


/* Thread branch separation - add margin between different branches at all levels */
/* Compact spacing for replies */
.comment-item[data-depth="1"]:not(:first-child) {
  margin-top: 8px;
  padding-top: 6px;
}

.comment-item[data-depth="2"]:not(:first-child) {
  margin-top: 6px;
  padding-top: 4px;
}

.comment-item[data-depth="3"]:not(:first-child) {
  margin-top: 4px;
  padding-top: 3px;
}

.comment-item[data-depth="4"]:not(:first-child) {
  margin-top: 3px;
  padding-top: 2px;
}

.comment-item[data-depth="5"]:not(:first-child),
.comment-item[data-depth="6"]:not(:first-child),
.comment-item[data-depth="7"]:not(:first-child),
.comment-item[data-depth="8"]:not(:first-child) {
  margin-top: 2px;
  padding-top: 2px;
}

/* Visual thread branch indicators - subtle dots for all levels */
.thread-branch {
  position: relative;
}



/* Enhanced thread branch separation - more subtle */
.comment-item[data-is-new-branch="1"] {
  margin-top: 16px;
  padding-top: 12px;
  position: relative;
}

/* Only show thread branch label for first level branches with multiple replies */
.comment-item[data-depth="1"][data-is-new-branch="1"]::before {
  content: 'Thread ' attr(data-thread-branch);
  position: absolute;
  top: -8px;
  left: 5px;
  background: transparent;
  color: #6c757d;
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 2px;
  z-index: 5;
  font-weight: 500;
  white-space: nowrap;
  display: inline-block;
  line-height: 1;
  writing-mode: horizontal-tb;
}


/* Thread branch background colors - removed gradients, keeping white background */
.comment-item[data-thread-branch="0"] .comment-post {
  background: #fff;
}

.comment-item[data-thread-branch="1"] .comment-post {
  background: #fff;
}

.comment-item[data-thread-branch="2"] .comment-post {
  background: #fff;
}

.comment-item[data-thread-branch="3"] .comment-post {
  background: #fff;
}

.comment-item[data-thread-branch="4"] .comment-post {
  background: #fff;
}


.comment-collapse {
  margin-top: 13px;
  position: absolute;
  left: -11px;
  top: -5px;
  width: 16px;
  height: 16px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 50px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #6b7280;
  z-index: 4;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.comment-collapse:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
  color: #374151;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.comment-collapse.collapsed::after {
  content: '-';
  font-size: 10px;
  color: #6b7280;
  font-weight: bold;
}

.comment-collapse.expanded::after {
  content: '+';
  font-size: 10px;
  color: #374151;
  font-weight: bold;
}

/* Hide collapse button for root posts */
.comment-item[data-depth="0"] .comment-collapse {
  display: none;
}

/* Child count indicator */
.comment-child-count {
  position: absolute;
  left: -40px;
  top: 6px;
  font-size: 10px;
  color: #9ca3af;
  background: #f9fafb;
  padding: 2px 4px;
  border-radius: 2px;
  border: 1px solid #e5e7eb;
  z-index: 3;
  min-width: 16px;
  text-align: center;
}

.comment-item[data-depth="0"] .comment-child-count {
  display: none;
}

.comment-post {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 6px;
  position: relative;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.comment-item[data-depth]:not([data-depth="0"]) .comment-post::before {
  content: '';
  position: absolute;
  top: 14px;
  left: 0;
  width: 22px;
  height: 2px;
  background: #e1e1e1;
  left: -21px;
}

.comment-item[data-depth]:not([data-depth="0"]) .comment-post::after {
    content: '';
    position: absolute;
    top: 11px;
    left: -12px;
    width: 8px;
    height: 8px;
    background: #e1e1e1;
    border-radius: 50%;
}



/* Enhanced styling for different depths - main posts vs replies */
.comment-item[data-depth="0"] {
  margin-top: 40px;
}

.comment-item[data-depth="0"] .comment-post {
  background: #eeeeee91;
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.1);
  padding: 16px 20px;
  border: 0px;
  border-radius: 3px;
}

/* Post stats for main posts */
.post-stats {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
  font-size: 12px;
  color: #6b7280;
}

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

.post-stat-icon {
  width: 14px;
  height: 14px;
  opacity: 0.7;
}

.post-stat-value {
  font-weight: 600;
  color: #374151;
}

/* Compact styling for replies with right indent */
.comment-item[data-depth="1"],
.comment-item[data-depth="2"],
.comment-item[data-depth="3"],
.comment-item[data-depth="4"],
.comment-item[data-depth="5"],
.comment-item[data-depth="6"],
.comment-item[data-depth="7"],
.comment-item[data-depth="8"] {
  position: relative;
}

.comment-item[data-depth="1"]::before,
.comment-item[data-depth="2"]::before,
.comment-item[data-depth="3"]::before,
.comment-item[data-depth="4"]::before,
.comment-item[data-depth="5"]::before,
.comment-item[data-depth="6"]::before,
.comment-item[data-depth="7"]::before,
.comment-item[data-depth="8"]::before {
  content: '';
  position: absolute;
  top: -5px;
  left: -5px;
  width: 8px;
  height: 8px;
  background: #e1e5e9;
  border-radius: 50%;
}

.comment-item[data-depth="1"]::after,
.comment-item[data-depth="2"]::after,
.comment-item[data-depth="3"]::after,
.comment-item[data-depth="4"]::after,
.comment-item[data-depth="5"]::after,
.comment-item[data-depth="6"]::after,
.comment-item[data-depth="7"]::after,
.comment-item[data-depth="8"]::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: -5px;
  width: 8px;
  height: 8px;
  background: #e1e5e9;
  border-radius: 50%;
}

.comment-item[data-depth="2"] {
  margin-left: 70px;
  padding-left: 20px;
  border-left: 2px solid #d1d5db;
}

.comment-item[data-depth="3"] {
  margin-left: 90px;
  padding-left: 20px;
  border-left: 2px solid #9ca3af;
}

.comment-item[data-depth="4"] {
  margin-left: 110px;
}

.comment-item[data-depth="5"] {
  margin-left: 130px;
  padding-left: 20px;
  border-left: 2px solid #9ca3af;
}

.comment-item[data-depth="6"] {
  margin-left: 150px;
  padding-left: 20px;
  border-left: 2px solid #9ca3af;
}

.comment-item[data-depth="7"] {
  margin-left: 170px;
  padding-left: 20px;
  border-left: 2px solid #9ca3af;
}

.comment-item[data-depth="8"] {
  margin-left: 190px;
  padding-left: 20px;
  border-left: 2px solid #9ca3af;
}

/* Maximum depth styling - visual indicator that no further replies are allowed */
.comment-item[data-depth="8"] .comment-post {
  border-left: 3px solid #ff6b6b;
  background: #fff5f5;
  position: relative;
}

.comment-item[data-depth="8"] .comment-post::after {
  content: 'Maximum depth reached';
  position: absolute;
  top: -8px;
  right: 8px;
  background: #ff6b6b;
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: bold;
}

.comment-item[data-depth="1"] .comment-post,
.comment-item[data-depth="2"] .comment-post,
.comment-item[data-depth="3"] .comment-post,
.comment-item[data-depth="4"] .comment-post,
.comment-item[data-depth="5"] .comment-post,
.comment-item[data-depth="6"] .comment-post,
.comment-item[data-depth="7"] .comment-post,
.comment-item[data-depth="8"] .comment-post {
  background: #fafafa;
  padding: 3px 7px;
  border: 1px solid #e5e7eb;
  box-shadow: none;
  margin-bottom: 4px;
}

.comment-post:hover {
  border-color: #007bff;
  box-shadow: 0 2px 6px rgba(0,123,255,0.15);
}

.comment-post .post-header {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
  color: #666;
}

.comment-post .poster-info {
  display: flex;
  align-items: center;
  margin-right: 8px;
}

.comment-post .poster-avatar {
  margin-right: 6px;
}

/* Adjust avatar margin for main posts */
.comment-item[data-depth="0"] .comment-post .poster-avatar {
  margin-right: 10px;
}

/* Avatar sizing - bigger for main posts, smaller for replies */
.comment-item[data-depth="0"] .comment-post .poster-avatar img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #e1e5e9;
}

.comment-item[data-depth]:not([data-depth="0"]) .comment-post .poster-avatar img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid #e1e5e9;
}

.comment-post .poster-name {
  font-weight: 600;
  color: #007bff;
  text-decoration: none;
}

/* Compact poster info for replies */
.comment-item[data-depth]:not([data-depth="0"]) .comment-post .poster-name {
  font-size: 12px;
  font-weight: 500;
}

.comment-post .poster-name:hover {
  text-decoration: underline;
}

.comment-post .post-time {
  color: #666;
  margin-left: 8px;
}

.comment-post .post-separator {
  color: #999;
  margin: 0px;
  font-weight: bold;
}

/* Compact post time for replies */
.comment-item[data-depth]:not([data-depth="0"]) .comment-post .post-time {
  font-size: 10px;
  margin-left: 4px;
}

/* Compact post separator for replies */
.comment-item[data-depth]:not([data-depth="0"]) .comment-post .post-separator {
  margin: 0 4px;
  font-size: 10px;
}

.comment-post .post-content {
  font-size: 14px;
  line-height: 1.4;
  color: #333;
  margin-bottom: 8px;
}

.comment-content {
  background-color: #fff;
  padding: 10px;
  border-radius: 4px;
}

/* Compact text for replies */
.comment-item[data-depth]:not([data-depth="0"]) .comment-post .post-content {
  font-size: 12px;
  line-height: 1.2;
  margin-bottom: 4px;
}

.comment-post .post-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  float: left;
}

/* Parent post actions at bottom right */
.comment-item[data-depth="0"] .comment-post .post-actions {
  justify-content: flex-end;
  margin-top: 12px;
  text-align: right;
}

/* Compact post actions for replies */
.comment-item[data-depth]:not([data-depth="0"]) .comment-post .post-actions {
  gap: 4px;
  font-size: 9px;
  margin-top: 2px;
}

.comment-post .post-actions .button2 {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 2px;
  font-size: 11px;
  transition: all 0.2s ease;
}

.comment-post .post-actions .button2:hover {
  background: #e5e5e5f5;
  color: #666b6f;
  border-radius: 50px;
}


/* Enhanced typography for comments */
.comment-content {
  line-height: 1.5;
  font-size: 14px;
  color: #1f2937;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.comment-content p {
  margin: 0 0 8px 0;
}

.comment-content p:last-child {
  margin-bottom: 0;
}

/* Comment main content area */
.comment-main {
  flex: 1;
  min-width: 0;
}

.comment-post {
  display: flex;
  align-items: flex-start;
}

/* Threading indicators */
.thread-line {
  position: absolute;
  left: -2px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #e5e7eb;
  z-index: 1;
}

.thread-connector {
  position: absolute;
  left: -2px;
  top: 20px;
  width: 16px;
  height: 2px;
  background: #e5e7eb;
  z-index: 2;
}

/* Enhanced collapsed comment styling with smooth transitions */
.comment-item.collapsed .comment-post {
  display: none;
}

.comment-item.collapsed .comment-child-count {
  display: none;
}

.comment-item.collapsed .comment-collapse {
  background: #f8f9fa;
  border-color: #007bff;
  color: #007bff;
  display: block !important;
  visibility: visible !important;
  transform: rotate(0deg);
  transition: all 0.2s ease;
}

.comment-item.collapsed .comment-collapse::after {
  content: '-';
  font-size: 10px;
  color: #6b7280;
  font-weight: bold;
  padding-left: 6px;
}

.comment-item .comment-collapse {
  transition: all 0.2s ease;
}

.comment-item .comment-collapse.collapsed {
  transform: rotate(0deg);
}



/* All replies are visible by default */

/* Responsive design - limit indentation on mobile */
@media (max-width: 768px) {
  .comment-item[data-depth="1"] { margin-left: 15px; }
  .comment-item[data-depth="2"] { margin-left: 30px; }
  .comment-item[data-depth="3"] { margin-left: 45px; }
  .comment-item[data-depth="4"] { margin-left: 60px; }
  .comment-item[data-depth="5"] { margin-left: 60px; }
  .comment-item[data-depth="6"] { margin-left: 60px; }
  .comment-item[data-depth="7"] { margin-left: 60px; }
  .comment-item[data-depth="8"] { margin-left: 60px; }
  
  /* Adjust maximum depth indicator for mobile */
  .comment-item[data-depth="8"] .comment-post::after {
    font-size: 9px;
    padding: 1px 4px;
    top: -6px;
    right: 4px;
  }
}

/* Two-column layout */
.page-layout {
  display: flex;
  gap: 20px;
  margin-top: 20px;
  transition: all 0.3s ease;
  min-height: calc(100vh - 120px); /* Minimum height minus header */
  position: relative;
}

.sidebar {
  width: 18%;
  background: #f8f9fa;
  border-radius: 8px;
  padding: 20px;
  border: 1px solid #e9ecef;
  height: fit-content;
  transition: all 0.3s ease;
  overflow-y: auto;
  overflow-x: hidden;
  position: sticky;
  top: 20px;
  align-self: flex-start;
  max-height: calc(100vh - 40px);
}

/* Panel styling */
.panel {
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  margin-bottom: 15px;
  overflow: hidden;
}

.panel .inner {
  padding: 15px;
}

.panel h3 {
  margin: 0 0 10px 0;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  border-bottom: 1px solid #e9ecef;
  padding-bottom: 8px;
}

/* Button styling */
.button1, .button2 {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid #ddd;
  border-radius: 4px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
}

.button1 {
  background: #007cba;
  color: white;
  border-color: #007cba;
}

.button1:hover {
  background: #005a87;
  border-color: #005a87;
}

.button2 {
  background: #f8f9fa;
  color: #333;
  border-color: #ddd;
}

.button2:hover {
  background: #e9ecef;
  border-color: #adb5bd;
}

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

.sidebar::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

.sidebar.hidden {
  width: 0;
  padding: 0;
  margin: 0;
  border: none;
  opacity: 0;
}

.main-content {
  width: 82%;
  flex: 1;
  transition: all 0.3s ease;
  overflow: visible;
  position: relative;
}

.main-content.expanded {
  width: 100%;
}

/* Ensure the main content container doesn't cause page overflow */
.main-content > * {
  max-width: 100%;
  box-sizing: border-box;
}

.sidebar-toggle {
  position: absolute;
  top: 190px;
  left: 140px;
  z-index: 1000;
  background: #dddddd;
  color: #3b3b3b;
  border: none;
  border-radius: 5%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.sidebar-toggle:hover {
  background: #cccccc;
  transform: scale(1.1);
}

.sidebar-toggle.hidden {
  display: none;
}

.sidebar-show-toggle {
  position: absolute;
  top: 190px;
  left: 140px;
  z-index: 1000;
  background: #dddddd;
  color: #3b3b3b;
  border: none;
  border-radius: 5%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  display: none;
}

.sidebar-show-toggle:hover {
  background: #cccccc;
  transform: scale(1.1);
}

.sidebar-show-toggle.visible {
  display: block;
}

@media (max-width: 768px) {
  .page-layout {
    flex-direction: column;
    min-height: auto; /* Allow natural height on mobile */
    gap: 15px; /* Reduce gap on mobile */
  }
  .sidebar {
    width: 100%;
    max-width: 100%; /* Ensure sidebar doesn't exceed container width */
    height: auto; /* Allow natural height on mobile */
    position: static; /* Remove sticky positioning on mobile */
    max-height: none; /* Remove height restrictions on mobile */
    top: auto;
    align-self: auto;
    padding: 15px; /* Reduce padding on mobile */
    margin: 0; /* Remove any margins */
    box-sizing: border-box; /* Include padding in width calculation */
  }
  .main-content {
    width: 100%;
    max-width: 100%; /* Ensure main content doesn't exceed container width */
    overflow: visible;
    padding: 0; /* Remove any padding that might cause overflow */
    margin: 0; /* Remove any margins */
    box-sizing: border-box; /* Include padding in width calculation */
  }
  .sidebar.hidden {
    display: none;
  }
  .sidebar-toggle,
  .sidebar-show-toggle {
    display: none;
  }
  body {
    overflow-x: hidden; /* Prevent horizontal scrolling on mobile */
  }
  
  /* Ensure all child elements respect container width */
  .sidebar *,
  .main-content * {
    max-width: 100%;
    box-sizing: border-box;
  }
  
  /* Fix any potential width issues with panels in sidebar */
  .sidebar .panel {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  /* Ensure form elements don't overflow */
  .sidebar input,
  .sidebar button,
  .sidebar select,
  .sidebar textarea {
    max-width: 100%;
    box-sizing: border-box;
  }
  
  /* Fix social share buttons on mobile */
  .sidebar .panel div[style*="display: flex"] {
    flex-wrap: wrap !important;
    gap: 5px !important;
  }
  
  /* Ensure social share links don't overflow */
  .sidebar .panel a[href*="facebook"],
  .sidebar .panel a[href*="twitter"] {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 11px !important;
    padding: 4px 8px !important;
    text-align: center;
  }
  
  /* Fix navigation buttons on mobile */
  .sidebar .panel .button1,
  .sidebar .panel .button2 {
    width: 100% !important;
    box-sizing: border-box;
    margin-bottom: 5px;
    text-align: center !important;
  }
  
  /* Ensure member list doesn't overflow */
  .sidebar .member-avatar,
  .sidebar .creator-avatar {
    flex-shrink: 0;
  }
  
  /* Fix any long usernames or text that might overflow */
  .sidebar * {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
  }
}

/* BBCode Toolbar and Reply Styles */
.bbcode-toolbar {
    margin-bottom: 5px;
    padding: 5px;
    background: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 3px;
}

.bbcode-toolbar .button2 {
    margin: 2px;
    padding: 3px 6px;
    font-size: 11px;
}

.replies {
    margin-left: 20px;
    margin-top: 10px;
}

.replies h4 {
    color: #666;
    font-size: 13px;
    margin: 10px 0 5px 0;
    font-weight: bold;
}

.replies .post {
    margin-bottom: 10px;
    border-left: 3px solid #ddd;
    padding-left: 10px;
}

.reply-toggle {
    margin: 10px 0;
    text-align: right;
}

.reply-toggle .button2 {
    font-size: 11px;
    padding: 4px 8px;
}

/* Align SVG icons with text in buttons */
.button2 .icon-reply {
  vertical-align: sub;
  margin-right: 1px;
}

.poster-avatar {
    float: left;
    margin-right: 8px;
    margin-bottom: 5px;
}

.poster-avatar img {
    width: 32px;
    height: 32px;
    border-radius: 3px;
    border: 1px solid #ccc;
}

.postprofile-details dd {
    overflow: hidden;
}

.post-actions {
    margin-top: 5px;
    text-align: right;
}

.post-actions form {
    display: inline;
}

/* Masonry Layout for Multiple Images */
.masonry-layout {
  column-count: 2;
  column-gap: 10px;
  break-inside: avoid;
}

.masonry-item {
  break-inside: avoid;
  margin-bottom: 10px;
  display: inline-block;
  width: 100%;
}

.masonry-item img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid #ddd;
  display: block;
  transition: transform 0.2s ease;
}

/* Responsive Masonry */
@media (max-width: 768px) {
  .masonry-layout {
    column-count: 1;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .masonry-layout {
    column-count: 2;
  }
}

@media (min-width: 1025px) {
  .masonry-layout {
    column-count: 3;
  }
}

/* Single image styling */
.single-image img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid #ddd;
  cursor: pointer;
}

/* Lightbox Gallery Styles */
.lightbox {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(5px);
  animation: fadeIn 0.3s ease;
}

.lightbox.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  animation: zoomIn 0.3s ease;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: white;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  z-index: 10000;
  transition: opacity 0.3s ease;
}

.lightbox-close:hover {
  opacity: 0.7;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: white;
  font-size: 30px;
  font-weight: bold;
  cursor: pointer;
  padding: 10px 15px;
  background-color: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  transition: all 0.3s ease;
  user-select: none;
}

.lightbox-nav:hover {
  background-color: rgba(0, 0, 0, 0.8);
  transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
  left: 30px;
}

.lightbox-next {
  right: 30px;
}

.lightbox-counter {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  background-color: rgba(0, 0, 0, 0.7);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
}

.lightbox-loading {
  color: white;
  font-size: 18px;
  text-align: center;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes zoomIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Make images clickable */
.post-image img,
.masonry-item img {
  cursor: pointer;
  transition: transform 0.2s ease;
}

/* Anonymous username styling */
.username.anonymous {
    font-size: 12px;
    color: #666666;
    font-weight: bold;
}

/* Mobile responsive adjustments for lightbox */
@media (max-width: 768px) {
  .lightbox-close {
    top: 10px;
    right: 15px;
    font-size: 30px;
  }
  
  .lightbox-nav {
    font-size: 24px;
    padding: 8px 12px;
  }
  
  .lightbox-prev {
    left: 15px;
  }
  
  .lightbox-next {
    right: 15px;
  }
  
  .lightbox-counter {
    bottom: 20px;
    font-size: 12px;
    padding: 6px 12px;
  }
}
