@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* --- DESIGN SYSTEM & THEMES --- */
:root {
  /* Font Family */
  --font-primary: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Theme: Dark (Default) */
  --bg-gradient: radial-gradient(circle at 0% 0%, rgba(124, 58, 237, 0.08) 0%, transparent 40%),
                 radial-gradient(circle at 100% 100%, rgba(0, 229, 255, 0.06) 0%, transparent 40%),
                 #050814;
  --bg-color: #050814;
  --panel-bg: rgba(13, 20, 38, 0.45);
  --panel-bg-hover: rgba(20, 29, 54, 0.55);
  --panel-border: rgba(255, 255, 255, 0.06);
  --panel-border-hover: rgba(255, 255, 255, 0.12);
  
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  
  --accent-primary: #7C3AED;
  --accent-primary-glow: rgba(124, 58, 237, 0.35);
  --accent-secondary: #00E5FF;
  --accent-secondary-glow: rgba(0, 229, 255, 0.35);
  --accent-success: #10B981;
  --accent-success-glow: rgba(16, 185, 129, 0.25);
  
  --input-bg: rgba(7, 10, 22, 0.6);
  --input-border: rgba(255, 255, 255, 0.08);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5), 0 0 40px rgba(124, 58, 237, 0.05);
  --shadow-neon: 0 0 20px rgba(0, 229, 255, 0.15);
  
  --glass-blur: blur(16px);
  --transition-fast: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  
  --badge-admin: linear-gradient(135deg, #FF4E50, #F9D423);
  --badge-moderator: linear-gradient(135deg, #00E5FF, #7C3AED);
  --badge-pro: linear-gradient(135deg, #10B981, #059669);
  --badge-user: linear-gradient(135deg, #64748B, #475569);
}

[data-theme="light"] {
  /* Theme: Light */
  --bg-gradient: radial-gradient(circle at 0% 0%, rgba(124, 58, 237, 0.04) 0%, transparent 40%),
                 radial-gradient(circle at 100% 100%, rgba(0, 229, 255, 0.03) 0%, transparent 40%),
                 #F8FAFC;
  --bg-color: #F8FAFC;
  --panel-bg: rgba(255, 255, 255, 0.75);
  --panel-bg-hover: rgba(255, 255, 255, 0.9);
  --panel-border: rgba(0, 0, 0, 0.06);
  --panel-border-hover: rgba(0, 0, 0, 0.12);
  
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  
  --accent-primary: #6D28D9;
  --accent-primary-glow: rgba(109, 40, 217, 0.15);
  --accent-secondary: #0891B2;
  --accent-secondary-glow: rgba(8, 145, 178, 0.15);
  --accent-success: #059669;
  --accent-success-glow: rgba(5, 150, 105, 0.15);
  
  --input-bg: rgba(255, 255, 255, 0.8);
  --input-border: rgba(0, 0, 0, 0.08);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 24px rgba(148, 163, 184, 0.15);
  --shadow-lg: 0 16px 40px rgba(148, 163, 184, 0.25);
  --shadow-neon: 0 0 15px rgba(8, 145, 178, 0.1);
  
  --badge-user: linear-gradient(135deg, #94A3B8, #64748B);
}

/* --- RESET & GLOBAL STYLES --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-primary);
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  background: var(--bg-gradient);
  background-color: var(--bg-color);
  color: var(--text-primary);
  overflow-x: hidden;
  scroll-behavior: smooth;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

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

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

::-webkit-scrollbar-thumb {
  background: var(--panel-border);
  border-radius: 99px;
  border: 2px solid var(--bg-color);
}

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

a {
  color: inherit;
  text-decoration: none;
  transition: all var(--transition-fast);
}

li {
  list-style: none;
}

/* --- LAYOUT GRID --- */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
  position: relative;
  z-index: 1;
}

/* Grid layout for main content area */
.main-layout {
  display: grid;
  grid-template-columns: 240px 1fr 320px;
  gap: 24px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 24px 80px 24px;
  align-items: start;
}

/* --- DECORATIVE BLUR SPHERES (DEPTH EFFECT) --- */
.blur-sphere {
  position: fixed;
  width: 40vw;
  height: 40vw;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(140px);
  opacity: 0.35;
  transition: opacity var(--transition-slow);
}

[data-theme="light"] .blur-sphere {
  opacity: 0.15;
  filter: blur(100px);
}

.sphere-1 {
  background: radial-gradient(circle, var(--accent-primary) 0%, transparent 70%);
  top: -10%;
  left: -10%;
  animation: floatSphere1 25s infinite alternate ease-in-out;
}

.sphere-2 {
  background: radial-gradient(circle, var(--accent-secondary) 0%, transparent 70%);
  bottom: -10%;
  right: -10%;
  animation: floatSphere2 30s infinite alternate ease-in-out;
}

@keyframes floatSphere1 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(10%, 15%) scale(1.1); }
}

@keyframes floatSphere2 {
  0% { transform: translate(0, 0) scale(1.1); }
  100% { transform: translate(-15%, -10%) scale(0.9); }
}

/* --- GLASSMORPHISM COMPONENT BASE --- */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  transition: border-color var(--transition-normal), 
              background-color var(--transition-normal), 
              box-shadow var(--transition-normal), 
              transform var(--transition-normal);
}

.glass-panel-hover:hover {
  background: var(--panel-bg-hover);
  border-color: var(--panel-border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* --- NAVIGATION BAR --- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  height: 72px;
  background: rgba(13, 20, 38, 0.4);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  transition: all var(--transition-normal);
}

[data-theme="light"] .navbar {
  background: rgba(255, 255, 255, 0.6);
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  cursor: pointer;
}

.brand-logo-img {
  height: 38px;
  width: auto;
  object-fit: contain;
  transition: filter var(--transition-normal);
}

[data-theme="dark"] .brand-logo-img {
  filter: invert(1) brightness(1.2);
  mix-blend-mode: screen;
}

[data-theme="light"] .brand-logo-img {
  mix-blend-mode: multiply;
}

.search-bar-container {
  position: relative;
  width: 280px;
}

.search-bar {
  width: 100%;
  height: 40px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 20px;
  padding: 0 16px 0 42px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.search-bar:focus {
  border-color: var(--accent-secondary);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.15);
  width: 320px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.search-icon svg {
  width: 16px;
  height: 16px;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.theme-toggle-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.theme-toggle-btn:hover {
  border-color: var(--text-secondary);
  transform: scale(1.05);
}

.theme-toggle-btn svg {
  width: 18px;
  height: 18px;
}

[data-theme="light"] .theme-sun {
  display: none;
}
[data-theme="dark"] .theme-moon {
  display: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary) 0%, #6366F1 100%);
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-primary-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.45);
}

.btn-secondary {
  background: var(--input-bg);
  color: var(--text-primary);
  border: 1px solid var(--input-border);
}

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

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 4px;
  border-radius: 12px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  position: relative;
  background-size: cover;
  background-position: center;
  border: 2px solid var(--panel-border);
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIiBmaWxsPSJub25lIj48cmVjdCB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEwMCIgcng9IjMwIiBmaWxsPSIjMUUyOTNCIi8+PGNpcmNsZSBjeD0iNTAiIGN5PSI0MCIgcj0iMTgiIGZpbGw9IiM2NDc0OEIiLz48cGF0aCBkPSJNMjAgODBjMC0xNSAxNS0yMCAzMC0yMHMzMCA1IDMwIDIwdjVIMjB2LTV6IiBmaWxsPSIjNjQ3NDhCIi8+PC9zdmc+");
}

.member-avatar, .comment-avatar, .member-card-avatar, #profile-avatar-preview {
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIiBmaWxsPSJub25lIj48cmVjdCB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEwMCIgcng9IjMwIiBmaWxsPSIjMUUyOTNCIi8+PGNpcmNsZSBjeD0iNTAiIGN5PSI0MCIgcj0iMTgiIGZpbGw9IiM2NDc0OEIiLz48cGF0aCBkPSJNMjAgODBjMC0xNSAxNS0yMCAzMC0yMHMzMCA1IDMwIDIwdjVIMjB2LTV6IiBmaWxsPSIjNjQ3NDhCIi8+PC9zdmc+");
}

.avatar.online::after {
  content: '';
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-success);
  border: 2px solid var(--bg-color);
  box-shadow: 0 0 8px var(--accent-success-glow);
}

/* --- LEFT SIDEBAR (NAVIGATION) --- */
.sidebar-left {
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 96px;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
}

.sidebar-link svg {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.sidebar-link:hover, .sidebar-link.active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

[data-theme="light"] .sidebar-link:hover, [data-theme="light"] .sidebar-link.active {
  background: rgba(0, 0, 0, 0.03);
}

.sidebar-link.active svg {
  color: var(--accent-primary);
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1px;
  padding: 16px 14px 4px 14px;
}

.sidebar-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 14px;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

[data-theme="light"] .tag {
  background: rgba(0, 0, 0, 0.03);
}

.tag:hover {
  color: var(--text-primary);
  border-color: var(--accent-secondary);
  background: rgba(0, 229, 255, 0.05);
  cursor: pointer;
}

/* --- HERO BANNER --- */
.hero-block {
  grid-column: 1 / -1;
  padding: 40px;
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 32px;
}

.hero-logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 200px;
  height: 200px;
  position: relative;
  z-index: 1;
  margin-right: 20px;
}

.hero-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation: floatLogo 6s infinite ease-in-out;
  transition: filter var(--transition-normal);
}

[data-theme="dark"] .hero-logo-img {
  filter: invert(1) brightness(1.2);
  mix-blend-mode: screen;
}

[data-theme="light"] .hero-logo-img {
  mix-blend-mode: multiply;
}

@keyframes floatLogo {
  0% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(2deg); }
  100% { transform: translateY(0px) rotate(0deg); }
}

.hero-glow {
  position: absolute;
  top: -50%;
  right: -10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(0, 229, 255, 0.12) 0%, transparent 60%);
  pointer-events: none;
}

.hero-content {
  max-width: 680px;
  position: relative;
  z-index: 1;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 30px;
  background: rgba(124, 58, 237, 0.1);
  border: 1px solid rgba(124, 58, 237, 0.25);
  color: var(--accent-primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 20px;
}

[data-theme="light"] .hero-badge {
  background: rgba(109, 40, 217, 0.06);
}

.hero-badge svg {
  width: 14px;
  height: 14px;
}

.hero-title {
  font-size: 42px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-title span {
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

.hero-actions {
  display: flex;
  gap: 16px;
}

.hero-actions .btn {
  height: 46px;
  padding: 0 24px;
  font-size: 15px;
}

/* --- CENTER CONTENT (MAIN FORUM FEED) --- */
.center-content {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title svg {
  width: 20px;
  height: 20px;
  color: var(--accent-primary);
}

/* Categories Section */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.category-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.category-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--card-accent, var(--accent-primary));
  opacity: 0.7;
}

.category-icon-wrapper {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--card-accent, var(--accent-primary));
  margin-bottom: 4px;
}

[data-theme="light"] .category-icon-wrapper {
  background: rgba(0, 0, 0, 0.02);
}

.category-icon-wrapper svg {
  width: 20px;
  height: 20px;
}

.category-info h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.category-info p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.category-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: auto;
  border-top: 1px solid var(--panel-border);
  padding-top: 10px;
}

/* Discussion Feed Controls */
.feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 12px;
}

.feed-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.feed-tabs::-webkit-scrollbar {
  display: none;
}

.feed-tab {
  height: 36px;
  padding: 0 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.feed-tab svg {
  width: 15px;
  height: 15px;
}

.feed-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

[data-theme="light"] .feed-tab:hover {
  background: rgba(0, 0, 0, 0.03);
}

.feed-tab.active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--panel-border);
}

[data-theme="light"] .feed-tab.active {
  background: #fff;
  border-color: rgba(0,0,0,0.08);
}

/* Forum Threads (Popular / List) */
.threads-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.thread-card {
  display: grid;
  grid-template-columns: 48px 1fr 140px;
  gap: 16px;
  padding: 18px 20px;
  align-items: center;
}

.thread-votes {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.vote-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 4px;
  border-radius: 4px;
}

.vote-btn:hover {
  color: var(--accent-primary);
  background: rgba(124, 58, 237, 0.08);
}

.vote-btn.downvote:hover {
  color: var(--accent-secondary);
  background: rgba(0, 229, 255, 0.08);
}

.vote-btn svg {
  width: 18px;
  height: 18px;
}

.vote-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 24px;
  text-align: center;
}

.thread-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.thread-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.4;
}

.thread-title:hover {
  color: var(--accent-primary);
}

.thread-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

.user-badge {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  color: #fff;
  letter-spacing: 0.5px;
}

.badge-admin { background: var(--badge-admin); }
.badge-mod { background: var(--badge-moderator); }
.badge-pro { background: var(--badge-pro); }
.badge-user { background: var(--badge-user); }

.user-badge-age {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--text-secondary);
  background: var(--surface-bg-hover);
  border: 1px solid var(--panel-border);
  letter-spacing: 0.2px;
  display: inline-flex;
  align-items: center;
}

.thread-category-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--tag-color, var(--accent-primary));
  background: var(--tag-bg, rgba(124, 58, 237, 0.08));
  padding: 2px 8px;
  border-radius: 6px;
}

.thread-stats {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  color: var(--text-muted);
}

.thread-stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}

.thread-stat-item svg {
  width: 16px;
  height: 16px;
}

.bookmark-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all var(--transition-fast);
}

.bookmark-btn:hover, .bookmark-btn.active {
  color: #EAB308;
  background: rgba(234, 179, 8, 0.08);
}

.bookmark-btn svg {
  width: 16px;
  height: 16px;
}

/* --- RIGHT SIDEBAR (STATS & LATEST UPDATES) --- */
.sidebar-right {
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 96px;
}

.sidebar-widget {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.widget-title {
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.widget-title svg {
  width: 16px;
  height: 16px;
  color: var(--accent-secondary);
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
}

.stat-label {
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-value {
  font-weight: 700;
  color: var(--text-primary);
}

.stat-value.glow-cyan {
  color: var(--accent-secondary);
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
}

/* Members List Styling */
.member-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.member-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.member-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.member-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
}

.member-details {
  display: flex;
  flex-direction: column;
}

.member-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.member-role {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Latest replies widget */
.reply-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.reply-item {
  display: flex;
  gap: 10px;
  font-size: 13px;
}

.reply-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.reply-header {
  font-weight: 700;
  color: var(--text-primary);
}

.reply-text {
  color: var(--text-secondary);
  line-height: 1.3;
}

.reply-meta {
  font-size: 11px;
  color: var(--text-muted);
}

/* --- MODAL DIALOG (CREATE TOPIC) --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 8, 20, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-container {
  width: 580px;
  max-width: 90%;
  padding: 32px;
  transform: scale(0.9) translateY(20px);
  transition: transform var(--transition-normal);
  border-radius: 20px;
}

.modal-overlay.active .modal-container {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.modal-title {
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.modal-close-btn:hover {
  background: var(--panel-border);
  color: var(--text-primary);
}

.modal-close-btn svg {
  width: 18px;
  height: 18px;
}

.form-group {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 10px;
  color: var(--text-primary);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 10px var(--accent-primary-glow);
}

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

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 28px;
}

/* --- TOAST NOTIFICATIONS --- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 150;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-radius: 12px;
  min-width: 280px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--panel-border);
  animation: slideInToast 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideInToast {
  0% { transform: translateY(20px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.toast-success {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.25);
  color: var(--accent-success);
}

.toast-info {
  background: rgba(0, 229, 255, 0.1);
  border-color: rgba(0, 229, 255, 0.25);
  color: var(--accent-secondary);
}

.toast-message {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.toast-close {
  cursor: pointer;
  color: var(--text-muted);
}

.toast-close svg {
  width: 14px;
  height: 14px;
}

/* --- SKELETON LOADING EFFECTS --- */
.skeleton {
  background: linear-gradient(90deg, 
    var(--panel-border) 25%, 
    rgba(255, 255, 255, 0.08) 37%, 
    var(--panel-border) 63%);
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
}

[data-theme="light"] .skeleton {
  background: linear-gradient(90deg, 
    #E2E8F0 25%, 
    #F1F5F9 37%, 
    #E2E8F0 63%);
  background-size: 400% 100%;
}

@keyframes skeleton-loading {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

.skeleton-text {
  height: 14px;
  border-radius: 4px;
  width: 100%;
}

.skeleton-title {
  height: 18px;
  border-radius: 4px;
  width: 60%;
  margin-bottom: 8px;
}

.skeleton-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.skeleton-card {
  padding: 20px;
  border-radius: 16px;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
}

/* Helper hidden styles */
.hidden {
  display: none !important;
}

.fade-in {
  animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- RESPONSIVE MEDIA QUERIES --- */
@media (max-width: 1200px) {
  .main-layout {
    grid-template-columns: 200px 1fr;
  }
  .sidebar-right {
    display: none;
  }
}

@media (max-width: 900px) {
  .main-layout {
    grid-template-columns: 1fr;
    padding: 16px;
    padding-bottom: 80px; /* Space for bottom nav */
  }
  .sidebar-left, .sidebar-right {
    display: none;
  }
  
  .navbar-left {
    gap: 16px;
  }
  
  .brand-text {
    display: none;
  }
  
  .user-profile-name {
    display: none;
  }
  
  /* Make search bar responsive */
  .search-bar-container {
    width: 200px;
  }
  
  .search-bar:focus {
    width: 100%;
  }
  
  /* Show bottom navigation */
  .mobile-bottom-nav {
    display: flex;
  }

  /* Modals take up full screen */
  .modal-container {
    width: 95%;
    max-width: none;
    max-height: 90vh;
    overflow-y: auto;
  }
}

@media (max-width: 600px) {
  .navbar {
    padding: 0 8px;
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
  .navbar::-webkit-scrollbar {
    display: none;
  }
  .navbar-left {
    gap: 6px;
    flex-shrink: 0;
  }
  .navbar-right {
    gap: 6px;
    flex-shrink: 0;
  }
  .brand-logo-img {
    height: 32px;
  }
  .search-bar-container {
    width: 110px;
  }
  .search-bar {
    font-size: 12px;
    padding-left: 32px;
    padding-right: 8px;
    height: 36px;
  }
  .search-icon {
    left: 10px;
  }
  .theme-toggle-btn {
    width: 36px;
    height: 36px;
  }
  .btn {
    padding: 0 10px;
    font-size: 12px;
    height: 36px;
  }
  .hero-block {
    padding: 24px;
    margin-bottom: 16px;
    flex-direction: column-reverse;
    align-items: center;
    text-align: center;
  }
  .hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .hero-badge {
    margin-left: auto;
    margin-right: auto;
  }
  .hero-logo-container {
    width: 120px;
    height: 120px;
    margin-right: 0;
    margin-bottom: 16px;
  }
  .hero-title {
    font-size: 24px;
  }
  .hero-desc {
    font-size: 14px;
  }
  .hero-actions {
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }
  .hero-actions .btn {
    width: 100%;
    justify-content: center;
  }
  
  /* Thread Cards */
  .thread-card {
    display: grid;
    grid-template-columns: 48px 1fr;
    grid-template-areas: 
      "votes main"
      "stats stats";
    gap: 12px;
    padding: 16px;
  }
  .thread-votes {
    grid-area: votes;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
  }
  .thread-main {
    grid-area: main;
  }
  .thread-stats {
    grid-area: stats;
    justify-content: flex-start;
    border-top: 1px solid var(--panel-border);
    padding-top: 10px;
  }
  
  /* Grids */
  .categories-grid {
    grid-template-columns: 1fr;
  }
  .members-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
  }
  
  /* Details view */
  .thread-detail-card {
    padding: 16px;
  }
  .thread-detail-header {
    margin-bottom: 12px;
  }
  .thread-detail-title {
    font-size: 20px;
  }
}

/* --- MOBILE BOTTOM NAVIGATION --- */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 64px;
  background: rgba(13, 20, 38, 0.85);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--panel-border);
  z-index: 100;
  justify-content: space-around;
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom);
}

[data-theme="light"] .mobile-bottom-nav {
  background: rgba(255, 255, 255, 0.85);
}

.mobile-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-muted);
  text-decoration: none;
  flex: 1;
  height: 100%;
  transition: color var(--transition-normal);
}

.mobile-nav-link svg {
  width: 20px;
  height: 20px;
}

.mobile-nav-link span {
  font-size: 10px;
  font-weight: 600;
}

.mobile-nav-link.active {
  color: var(--accent-primary);
}

/* --- SPA VIEW TRANSITIONS --- */
.thread-details-section, .members-section {
  animation: fadeIn 0.4s ease forwards;
}

/* --- BRAND LOGO/USER PROFILE DROPDOWN --- */
.user-profile {
  position: relative;
}

.user-profile-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.user-profile-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 140px;
  padding: 6px;
  display: none;
  flex-direction: column;
  z-index: 110;
  border-radius: 10px;
  box-shadow: var(--shadow-md);
}

.user-dropdown::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 0;
  right: 0;
  height: 12px;
  background: transparent;
}

.user-profile:hover .user-dropdown,
.user-dropdown:hover {
  display: flex;
}

.dropdown-item {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  text-align: left;
  width: 100%;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 8px;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

[data-theme="light"] .dropdown-item:hover {
  background: rgba(0, 0, 0, 0.03);
}

/* --- THREAD DETAILS VIEW --- */
.thread-detail-card {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.thread-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.thread-detail-title {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.35;
  color: var(--text-primary);
}

.thread-detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 14px;
  width: 100%;
}

.thread-detail-body {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-secondary);
  white-space: pre-wrap;
  padding: 10px 0;
}

.thread-detail-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--panel-border);
  padding-top: 14px;
  margin-top: 8px;
}

/* --- COMMENTS LIST --- */
.comment-card {
  display: flex;
  gap: 16px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  margin-bottom: 12px;
  transition: all var(--transition-fast);
}

[data-theme="light"] .comment-card {
  background: rgba(0, 0, 0, 0.01);
}

.comment-card:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--panel-border-hover);
}

.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  border: 1px solid var(--panel-border);
}

.comment-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.comment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.comment-author-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.comment-author-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.comment-time {
  font-size: 11px;
  color: var(--text-muted);
}

.comment-text {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-secondary);
  white-space: pre-wrap;
}

/* --- MEMBERS SECTION --- */
.members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.member-card {
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

.member-card-avatar {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background-size: cover;
  background-position: center;
  border: 2px solid var(--panel-border);
  margin-bottom: 2px;
}

.member-card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.member-card-stats {
  display: flex;
  gap: 16px;
  font-size: 10px;
  color: var(--text-secondary);
  border-top: 1px solid var(--panel-border);
  padding-top: 8px;
  width: 100%;
  justify-content: center;
  margin-top: 4px;
}

.member-card-stat-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.member-card-stat-val {
  font-weight: 800;
  color: var(--text-primary);
  font-size: 12px;
}
