/* Modern Responsive Layout Implementation */

/* CSS Variables for consistent theming */
:root {
  --layout-sidebar-width: 260px;
  --layout-main-width: 1fr; /* Use flexible width instead of fixed */
  --layout-discovery-width: 300px;
  --layout-gap: 20px;
  --layout-header-height: 60px;
  
  /* Breakpoints */
  --breakpoint-mobile: 768px;
  --breakpoint-tablet: 1199px;
  --breakpoint-desktop: 1200px;
}

/* ===== DESKTOP LAYOUT (1200px+) ===== */
@media (min-width: 1200px) {
  .modern-layout-container {
    display: grid;
    grid-template-columns: var(--layout-sidebar-width) var(--layout-main-width) var(--layout-discovery-width);
    grid-template-areas: "sidebar main discovery";
    gap: var(--layout-gap);
    max-width: 1400px; /* Increased max width */
    margin: 0 auto;
    padding: var(--layout-gap);
    min-height: calc(100vh - var(--layout-header-height));
  }

  .layout-sidebar {
    grid-area: sidebar;
    position: sticky;
    top: calc(var(--layout-header-height) + var(--layout-gap));
    height: fit-content;
    max-height: calc(100vh - var(--layout-header-height) - var(--layout-gap) * 2);
    overflow-y: auto;
  }

  .layout-main {
    grid-area: main;
    min-height: 100vh;
    max-width: 800px; /* Set a reasonable max width for readability */
  }

  .layout-discovery {
    grid-area: discovery;
    position: sticky;
    top: calc(var(--layout-header-height) + var(--layout-gap));
    height: fit-content;
    max-height: calc(100vh - var(--layout-header-height) - var(--layout-gap) * 2);
    overflow-y: auto;
  }

  /* Hide mobile-specific elements on desktop */
  .mobile-only {
    display: none !important;
  }

  .desktop-only {
    display: block;
  }
}

/* ===== TABLET LAYOUT (768px - 1199px) ===== */
@media (min-width: 768px) and (max-width: 1199px) {
  .modern-layout-container {
    display: grid;
    grid-template-columns: 1fr 280px; /* Give more space to main content */
    grid-template-areas: "main discovery";
    gap: var(--layout-gap);
    padding: var(--layout-gap);
    min-height: calc(100vh - var(--layout-header-height));
  }

  .layout-sidebar {
    position: fixed;
    top: var(--layout-header-height);
    left: -260px; /* Adjusted for smaller sidebar */
    width: 260px;
    height: calc(100vh - var(--layout-header-height));
    background: #1a1a1a;
    border-right: 1px solid #333;
    z-index: 1000;
    transition: left 0.3s ease;
    overflow-y: auto;
    padding: var(--layout-gap);
  }

  .layout-sidebar.open {
    left: 0;
  }

  .layout-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }

  .layout-sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
  }

  .layout-main {
    grid-area: main;
    max-width: none; /* Allow full width on tablet */
  }

  .layout-discovery {
    grid-area: discovery;
    position: sticky;
    top: calc(var(--layout-header-height) + var(--layout-gap));
    height: fit-content;
    max-height: calc(100vh - var(--layout-header-height) - var(--layout-gap) * 2);
    overflow-y: auto;
  }

  /* Hamburger menu button for tablet */
  .hamburger-menu {
    display: block;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: var(--CS-blue);
    border: none;
    border-radius: 4px;
    padding: 8px;
    color: white;
    cursor: pointer;
  }

  .mobile-only {
    display: none !important;
  }

  .tablet-only {
    display: block;
  }
}

/* ===== MOBILE LAYOUT (< 768px) ===== */
@media (max-width: 767px) {
  .modern-layout-container {
    display: block;
    padding: 0;
    min-height: calc(100vh - var(--layout-header-height));
  }

  .layout-sidebar {
    position: fixed;
    top: var(--layout-header-height);
    left: -100%;
    width: 280px;
    height: calc(100vh - var(--layout-header-height));
    background: #1a1a1a;
    border-right: 1px solid #333;
    z-index: 1000;
    transition: left 0.3s ease;
    overflow-y: auto;
    padding: var(--layout-gap);
  }

  .layout-sidebar.open {
    left: 0;
  }

  .layout-main {
    padding: 10px var(--layout-gap) 16px;
    width: 100%;
  }

  .layout-discovery {
    display: none; /* Hidden on mobile, content integrated into main feed */
  }

  /* Touch feedback */
  .mobile-touch-target {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
  }

  .mobile-touch-target:active {
    transform: scale(0.95);
  }

  /* Floating Action Button */
  .floating-action-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    padding: 0;
    background: var(--CS-blue);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 999;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .floating-action-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  }

  .floating-action-btn:active {
    transform: scale(0.9);
  }

  /* Hamburger menu button for mobile */
  .hamburger-menu {
    display: block;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: var(--CS-blue);
    border: none;
    border-radius: 4px;
    padding: 8px;
    color: white;
    cursor: pointer;
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s ease;
  }

  .hamburger-menu:active {
    transform: scale(0.95);
  }

  .mobile-only {
    display: block;
  }

  .desktop-only,
  .tablet-only {
    display: none !important;
  }
}

/* ===== SIDEBAR COMPONENTS ===== */
.sidebar-section {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  margin-bottom: var(--layout-gap);
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid #333;
  background: #222;
}

.sidebar-header h3 {
  margin: 0;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
}

.sidebar-content {
  padding: 16px;
}

/* Profile Quick View */
.profile-quick-view {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.profile-avatar-link {
  text-decoration: none;
  display: block;
}

.profile-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  border: 2px solid var(--CS-blue);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.profile-avatar-link:hover .profile-avatar {
  border-color: var(--CS-aqua);
  transform: scale(1.05);
}

.profile-info {
  flex: 1;
  min-width: 0; /* Allow text truncation */
}

.profile-info h4 {
  margin: 0;
  font-size: 14px;
}

.profile-info h4 a {
  color: #fff;
  text-decoration: none;
  transition: color 0.2s ease;
}

.profile-info h4 a:hover {
  color: var(--CS-aqua);
}

.profile-stats {
  display: flex;
  gap: 8px;
  margin: 4px 0 0 0;
  font-size: 12px;
  color: #888;
  flex-wrap: wrap;
}

.profile-stats span {
  white-space: nowrap;
}

.profile-stats .stat-link {
  color: #888;
  text-decoration: none;
  transition: color 0.2s ease;
  cursor: pointer;
}

.profile-stats .stat-link:hover {
  color: var(--CS-aqua, #00d4ff);
  text-decoration: underline;
}

.profile-stats .stat-link span {
  font-weight: 600;
  color: #fff;
}

/* Navigation Menu */
.nav-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-menu-item {
  margin-bottom: 2px;
}

.nav-menu-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: #ccc;
  text-decoration: none;
  border-radius: 6px;
  border-left: 3px solid transparent;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.nav-menu-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-menu-link.active {
  background: rgba(0, 163, 255, 0.12);
  color: var(--CS-aqua);
  border-left-color: var(--CS-aqua);
}

.nav-menu-link i {
  width: 16px;
  text-align: center;
}

/* Following List */
.following-list {
  max-height: 300px;
  overflow-y: auto;
}

.following-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #333;
}

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

.following-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
}

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

.following-name {
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.following-status {
  color: #888;
  font-size: 11px;
  margin: 0;
}

.unread-indicator {
  width: 8px;
  height: 8px;
  background: var(--CS-blue);
  border-radius: 50%;
  flex-shrink: 0;
}

/* Channel List */
.channel-list {
  max-height: 300px;
  overflow-y: auto;
}

.channel-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #333;
}

.channel-item.clickable {
  cursor: pointer;
  border-radius: 6px;
  padding: 8px;
  transition: background 0.15s;
}

.channel-item.clickable:hover {
  background: rgba(255, 255, 255, 0.08);
}

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

.channel-icon {
  width: 24px;
  height: 24px;
  background: var(--CS-blue);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
  font-weight: bold;
}

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

.channel-name {
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-members {
  color: #888;
  font-size: 11px;
  margin: 0;
}

/* Quick Actions */
.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #333;
  border: 1px solid #444;
  border-radius: 6px;
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
}

.quick-action-btn:hover {
  background: #444;
  border-color: var(--CS-blue);
  color: #fff;
}

.quick-action-btn i {
  width: 16px;
  text-align: center;
}

/* ===== DISCOVERY PANEL COMPONENTS ===== */
.discovery-section {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  margin-bottom: var(--layout-gap);
  overflow: hidden;
}

.discovery-header {
  padding: 16px;
  border-bottom: 1px solid #333;
  background: #222;
}

.discovery-header h3 {
  margin: 0;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
}

.discovery-content {
  padding: 16px;
}

/* Trending Topics */
.trending-topics {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trending-topic {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #333;
  transition: all 0.2s ease;
}

.trending-topic.clickable {
  cursor: pointer;
  padding: 10px 12px;
  margin: 0 -12px;
  border-radius: 6px;
  border-bottom: none;
}

.trending-topic.clickable:hover {
  background-color: rgba(0, 174, 239, 0.1);
}

.trending-topic.clickable:hover .topic-tag {
  color: #fff;
}

.trending-topic:last-child {
  border-bottom: none;
}

.topic-tag {
  color: var(--CS-aqua);
  font-weight: 500;
  font-size: 14px;
}

.topic-count {
  color: #888;
  font-size: 12px;
}

/* Empty state for trending topics */
.trending-topics .empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  text-align: center;
}

/* Suggested Users */
.suggested-users {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.suggested-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.suggested-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
}

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

.suggested-name {
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.suggested-reason {
  color: #888;
  font-size: 12px;
  margin: 0;
}

.follow-btn {
  background: var(--CS-blue);
  border: none;
  border-radius: 4px;
  color: white;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.follow-btn:hover {
  background: var(--CS-aqua);
}

/* Popular Channels */
.popular-channels {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.popular-channel {
  display: flex;
  align-items: center;
  gap: 14px;
}

.popular-channel.clickable {
  cursor: pointer;
  border-radius: 6px;
  padding: 10px 8px;
  transition: background 0.15s;
}

.popular-channel .join-btn {
  flex-shrink: 0;
  margin-left: 4px;
}

.popular-channel.clickable:hover {
  background: rgba(255, 255, 255, 0.08);
}

.popular-channel-icon {
  width: 40px;
  height: 40px;
  background: var(--CS-blue);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
  font-weight: bold;
}

.popular-channel-info {
  flex: 1;
  min-width: 0;
}

.popular-channel-name {
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s ease;
}

.popular-channel-name:hover {
  color: var(--CS-blue);
  text-decoration: underline;
}

.popular-channel-members {
  color: #888;
  font-size: 12px;
  margin: 0;
}

.join-btn {
  background: #333;
  border: 1px solid #444;
  border-radius: 4px;
  color: white;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.join-btn:hover {
  background: #444;
  border-color: var(--CS-blue);
}

.join-btn.joined {
  background: var(--CS-blue, #0c6af5);
  color: #fff;
  border: 1px solid var(--CS-blue, #0c6af5);
}

.join-btn.joined:hover {
  background: var(--CS-aqua, #00a3ff);
  color: #fff;
  border-color: var(--CS-aqua, #00a3ff);
}

/* ===== INTERLEAVED CONTENT STYLES ===== */
.interleaved-content {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 16px;
  margin: 20px 0;
  text-align: center;
}

.suggested-user-card {
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: left;
}

.suggested-user-card .suggested-avatar {
  width: 60px;
  height: 60px;
}

.suggested-user-card .suggested-info h4 {
  margin: 0 0 4px 0;
  color: #fff;
  font-size: 16px;
}

.suggested-user-card .suggested-reason {
  font-size: 14px;
  margin-bottom: 8px;
}

.channel-spotlight {
  text-align: center;
}

.channel-spotlight h4 {
  margin: 0 0 8px 0;
  color: var(--CS-aqua);
  font-size: 18px;
}

.channel-spotlight .member-count {
  color: #888;
  font-size: 14px;
  margin-bottom: 12px;
}

.channel-spotlight p {
  color: #ccc;
  margin-bottom: 16px;
}

.trending-highlight {
  text-align: center;
}

.trending-highlight h4 {
  margin: 0 0 8px 0;
  color: #fff;
  font-size: 18px;
}

.trending-highlight p {
  color: #ccc;
  margin-bottom: 12px;
}

.trending-posts {
  color: var(--CS-blue);
  font-size: 14px;
}

/* ===== RESPONSIVE UTILITIES ===== */
.show-on-mobile {
  display: none;
}

.show-on-tablet {
  display: none;
}

.show-on-desktop {
  display: block;
}

@media (max-width: 767px) {
  .show-on-mobile {
    display: block;
  }
  .hide-on-mobile {
    display: none;
  }
}

@media (min-width: 768px) and (max-width: 1199px) {
  .show-on-tablet {
    display: block;
  }
  .hide-on-tablet {
    display: none;
  }
}

@media (min-width: 1200px) {
  .show-on-desktop {
    display: block;
  }
  .hide-on-desktop {
    display: none;
  }
}

/* ===== SWIPE GESTURES (Mobile) ===== */
@media (max-width: 767px) {
  .swipeable-tabs {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .swipeable-tabs::-webkit-scrollbar {
    display: none;
  }

  .swipeable-tab {
    flex: 0 0 100%;
    scroll-snap-align: start;
  }

  .tab-indicators {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 16px;
  }

  .tab-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #333;
    transition: background-color 0.2s ease;
  }

  .tab-indicator.active {
    background: var(--CS-blue);
  }
}

/* ===== PULL TO REFRESH ===== */
@media (max-width: 767px) {
  .pull-to-refresh {
    position: relative;
    overflow: hidden;
  }

  .pull-refresh-indicator {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--CS-blue);
    border-radius: 50%;
    color: white;
    transition: top 0.3s ease;
  }

  .pull-refresh-indicator.visible {
    top: 20px;
  }

  .pull-refresh-indicator i {
    font-size: 18px;
    animation: spin 1s linear infinite;
  }

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

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .sidebar-section,
  .discovery-section,
  .interleaved-content {
    border-width: 2px;
  }
  
  .nav-menu-link:hover,
  .nav-menu-link.active {
    outline: 2px solid var(--CS-aqua);
  }
}

/* Focus indicators for keyboard navigation */
.nav-menu-link:focus,
.quick-action-btn:focus,
.follow-btn:focus,
.join-btn:focus,
.floating-action-btn:focus {
  outline: 2px solid var(--CS-aqua);
  outline-offset: 2px;
}

/* Ensure minimum touch target size on mobile */
@media (max-width: 767px) {
  .nav-menu-link,
  .quick-action-btn,
  .follow-btn,
  .join-btn {
    min-height: 44px;
    min-width: 44px;
  }
}

/* ===== SOCIAL FEED SPECIFIC STYLES ===== */
.social-feed-content {
  width: 100%;
  max-width: 100%;
}

.social-feed-content .post-composer {
  margin-bottom: 20px;
}

.social-feed-content #message-col {
  width: 100%;
}

/* Ensure posts take full width of main content area */
.social-feed-content .post-card {
  width: 100%;
  margin-bottom: 16px;
}

/* Loading state styling */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: #888;
  gap: 12px;
}

.loading-state wa-spinner {
  --size: 32px;
}

/* Guest callout styling */
.guest-callout {
  margin-bottom: 20px;
}

/* Responsive adjustments for social feed */
@media (max-width: 767px) {
  .social-feed-content {
    padding: 0;
  }
  
  .social-feed-content .post-composer {
    margin: 0 0 16px 0;
    border-radius: 0;
  }
  
  .social-feed-content .guest-callout {
    margin: 0 0 16px 0;
    border-radius: 0;
  }
}

@media (min-width: 768px) and (max-width: 1199px) {
  .social-feed-content {
    padding-right: 20px; /* Add some spacing from discovery panel */
  }
}


/* Filter Active Banner */
.filter-active-banner {
  background: linear-gradient(135deg, rgba(0, 174, 239, 0.2), rgba(0, 255, 246, 0.2));
  border: 1px solid var(--CS-aqua);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.filter-active-banner span {
  color: #fff;
  font-size: 14px;
}

.filter-active-banner strong {
  color: var(--CS-aqua);
  font-weight: 600;
}

.btn-clear-filter {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 8px 16px;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn-clear-filter:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-clear-filter i {
  font-size: 12px;
}

/* Mobile responsive for filter banner */
@media (max-width: 768px) {
  .filter-active-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .btn-clear-filter {
    width: 100%;
    justify-content: center;
  }
}

/* ==========================================================================
   Custom Scrollbar Styles - Facebook-inspired
   ========================================================================== */

/* Global scrollbar styling - always visible but subtle */
html::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track {
  background: transparent;
}

html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
  transition: background 0.2s ease;
}

html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover,
html.is-scrolling::-webkit-scrollbar-thumb,
body.is-scrolling::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border: 2px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-corner {
  background: transparent;
}

/* Firefox scrollbar - global */
html, body {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

/* Auto-hiding scrollbar for columns/panels */
.scroll-container,
.link-sidebar,
.right-sidebar,
.feed-panel,
.profile-panel,
.channels-panel,
.layout-sidebar,
.discovery-panel,
.followers-dialog .dialog-content,
#suggestionsList,
#followList,
#channelsContent {
  /* Enable scrollbar but hide by default */
  overflow-y: auto;
  overflow-x: hidden;
}

/* Scrollbar auto-hide styling for sidebar columns */
.scroll-container::-webkit-scrollbar,
.link-sidebar::-webkit-scrollbar,
.right-sidebar::-webkit-scrollbar,
.feed-panel::-webkit-scrollbar,
.profile-panel::-webkit-scrollbar,
.channels-panel::-webkit-scrollbar,
.layout-sidebar::-webkit-scrollbar,
.discovery-panel::-webkit-scrollbar {
  width: 8px;
  background: transparent;
}

.scroll-container::-webkit-scrollbar-track,
.link-sidebar::-webkit-scrollbar-track,
.right-sidebar::-webkit-scrollbar-track,
.feed-panel::-webkit-scrollbar-track,
.profile-panel::-webkit-scrollbar-track,
.channels-panel::-webkit-scrollbar-track,
.layout-sidebar::-webkit-scrollbar-track,
.discovery-panel::-webkit-scrollbar-track {
  background: transparent;
}

.scroll-container::-webkit-scrollbar-thumb,
.link-sidebar::-webkit-scrollbar-thumb,
.right-sidebar::-webkit-scrollbar-thumb,
.feed-panel::-webkit-scrollbar-thumb,
.profile-panel::-webkit-scrollbar-thumb,
.channels-panel::-webkit-scrollbar-thumb,
.layout-sidebar::-webkit-scrollbar-thumb,
.discovery-panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
  /* Note: transition doesn't work on scrollbar pseudo-elements in all browsers */
}

/* Show scrollbar on hover */
.scroll-container:hover::-webkit-scrollbar-thumb,
.link-sidebar:hover::-webkit-scrollbar-thumb,
.right-sidebar:hover::-webkit-scrollbar-thumb,
.feed-panel:hover::-webkit-scrollbar-thumb,
.profile-panel:hover::-webkit-scrollbar-thumb,
.channels-panel:hover::-webkit-scrollbar-thumb,
.layout-sidebar:hover::-webkit-scrollbar-thumb,
.discovery-panel:hover::-webkit-scrollbar-thumb,
.scroll-container.is-hovering::-webkit-scrollbar-thumb,
.link-sidebar.is-hovering::-webkit-scrollbar-thumb,
.right-sidebar.is-hovering::-webkit-scrollbar-thumb,
.feed-panel.is-hovering::-webkit-scrollbar-thumb,
.profile-panel.is-hovering::-webkit-scrollbar-thumb,
.channels-panel.is-hovering::-webkit-scrollbar-thumb,
.layout-sidebar.is-hovering::-webkit-scrollbar-thumb,
.discovery-panel.is-hovering::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* Show scrollbar when actively scrolling */
.scroll-container.is-scrolling::-webkit-scrollbar-thumb,
.link-sidebar.is-scrolling::-webkit-scrollbar-thumb,
.right-sidebar.is-scrolling::-webkit-scrollbar-thumb,
.feed-panel.is-scrolling::-webkit-scrollbar-thumb,
.profile-panel.is-scrolling::-webkit-scrollbar-thumb,
.channels-panel.is-scrolling::-webkit-scrollbar-thumb,
.layout-sidebar.is-scrolling::-webkit-scrollbar-thumb,
.discovery-panel.is-scrolling::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* Hover on scrollbar thumb when visible */
.scroll-container:hover::-webkit-scrollbar-thumb:hover,
.link-sidebar:hover::-webkit-scrollbar-thumb:hover,
.right-sidebar:hover::-webkit-scrollbar-thumb:hover,
.feed-panel:hover::-webkit-scrollbar-thumb:hover,
.profile-panel:hover::-webkit-scrollbar-thumb:hover,
.channels-panel:hover::-webkit-scrollbar-thumb:hover,
.layout-sidebar:hover::-webkit-scrollbar-thumb:hover,
.discovery-panel:hover::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* Firefox auto-hide scrollbar simulation (limited support) */
.link-sidebar,
.right-sidebar,
.feed-panel,
.profile-panel,
.channels-panel,
.layout-sidebar,
.discovery-panel {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.link-sidebar:hover,
.right-sidebar:hover,
.feed-panel:hover,
.profile-panel:hover,
.channels-panel:hover,
.layout-sidebar:hover,
.discovery-panel:hover,
.link-sidebar.is-scrolling,
.right-sidebar.is-scrolling,
.feed-panel.is-scrolling,
.profile-panel.is-scrolling,
.channels-panel.is-scrolling,
.layout-sidebar.is-scrolling,
.discovery-panel.is-scrolling {
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}
