/* ============================================
   FORUM BELAJARBRO - Premium Design System
   ============================================ */

/* === CSS Variables === */
:root {
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --primary-light: #60A5FA;
  --primary-bg: #EFF6FF;
  --secondary: #059669;
  --secondary-dark: #047857;
  --accent: #EF4444;
  --accent-warm: #D97706;

  --bg-body: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F8FAFC;
  --bg-sidebar: #F8FAFC;
  --bg-input: #F1F5F9;
  --bg-nav: rgba(255, 255, 255, 0.96);

  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #64748B;
  --text-inverse: #FFFFFF;

  --border: #E2E8F0;
  --border-light: #EEF2F6;
  --border-focus: var(--primary);

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 28px rgba(15, 23, 42, 0.08), 0 4px 8px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 20px 50px rgba(15, 23, 42, 0.12);
  --shadow-glow: 0 4px 12px rgba(37, 99, 235, 0.22);

  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 999px;

  --transition: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);

  --font: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --max-width: 1200px;
}

/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 15px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; height: auto; }

/* === Typography === */
h1, h2, h3, h4, h5 { font-weight: 700; line-height: 1.3; color: var(--text-primary); }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }

/* === Navbar === */
.forum-nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-nav);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border-light);
  height: 64px;
  transition: box-shadow var(--transition);
}
.forum-nav.scrolled { box-shadow: var(--shadow-md); }

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  color: var(--text-primary);
}
.nav-brand:hover { color: var(--primary); }

.nav-logo { height: 38px; width: auto; display: block; }

.nav-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
  flex-shrink: 0;
}

.nav-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

/* Search */
.nav-search {
  flex: 1;
  max-width: 440px;
  position: relative;
}

.nav-search input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--text-primary);
  transition: all var(--transition);
  outline: none;
}
.nav-search input:focus {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.nav-search input::placeholder { color: var(--text-muted); }

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
}

.search-results {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  max-height: 400px;
  overflow-y: auto;
  z-index: 100;
}
.search-results.active { display: block; }

.search-result-item {
  display: block;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  transition: background var(--transition);
}
.search-result-item:hover { background: var(--primary-bg); color: var(--text-primary); }
.search-result-item:last-child { border-bottom: none; }
.search-result-title { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.search-result-category { font-size: 12px; color: var(--text-muted); }

/* Nav Actions */
.nav-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn-ask {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 13.5px;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}
.btn-ask:hover {
  background: var(--primary-dark);
  color: white;
}

.btn-login, .btn-register {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 13.5px;
  transition: all var(--transition);
}
.btn-login {
  color: var(--text-primary);
  border: 1px solid var(--border);
  background: var(--bg-card);
}
.btn-login:hover { background: var(--bg-input); color: var(--text-primary); border-color: #CBD5E1; }
.btn-register {
  background: var(--primary);
  color: white;
  border: 1px solid transparent;
}
.btn-register:hover { background: var(--primary-dark); color: white; }

/* Notification */
.nav-notif { position: relative; }

.notif-btn {
  position: relative;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 17px;
  transition: all var(--transition);
}
.notif-btn:hover { color: var(--text-primary); background: var(--bg-input); border-color: var(--border); }

.notif-dropdown {
  min-width: 320px;
  max-width: 360px;
  padding: 0;
  overflow: hidden;
}
.notif-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-primary);
}
.notif-count-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-bg);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}
.notif-dropdown-list {
  max-height: 320px;
  overflow-y: auto;
}
.notif-empty {
  padding: 24px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}
.notif-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: 13px;
  transition: background var(--transition);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.notif-item.unread { background: #F8FAFF; }
.notif-item-text strong { color: var(--text-primary); }
.notif-item-title { display: block; color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.notif-item-time { font-size: 11px; color: var(--text-muted); }

.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--radius-full);
  min-width: 16px;
  text-align: center;
  line-height: 14px;
  animation: notifPulse 2s ease infinite;
}

@keyframes notifPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* User menu */
.user-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-full);
  transition: all var(--transition);
  color: var(--text-muted);
}
.user-btn:hover { background: var(--bg-input); }
.user-btn .fa-chevron-down { font-size: 10px; transition: transform var(--transition); }

.user-avatar-sm {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.nav-user { position: relative; }

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  min-width: 260px;
  z-index: 200;
  animation: dropIn 0.2s ease;
}
.dropdown-menu.active { display: block; }

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.dropdown-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
}
.dropdown-avatar { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--border); }
.dropdown-name { font-weight: 700; font-size: 14px; }
.dropdown-badge { font-size: 12px; color: var(--accent-warm); }
.dropdown-badge i { font-size: 11px; }

.dropdown-divider { height: 1px; background: var(--border-light); margin: 4px 0; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--text-secondary);
  font-size: 14px;
  transition: all var(--transition);
}
.dropdown-item:hover { background: var(--primary-bg); color: var(--primary); }
.dropdown-item.text-danger { color: var(--accent); }
.dropdown-item.text-danger:hover { background: rgba(255,107,107,0.08); color: var(--accent); }
.dropdown-item i { width: 18px; text-align: center; font-size: 14px; }

/* Mobile toggle */
.nav-toggle {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  font-size: 20px;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
}
.nav-toggle:hover { background: var(--bg-input); }

/* Mobile Menu */
.mobile-menu {
  display: none;
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
  backdrop-filter: blur(4px);
}
.mobile-menu.active { display: block; animation: fadeIn 0.2s ease; }

.mobile-menu-inner {
  background: var(--bg-card);
  padding: 20px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-height: 80vh;
  overflow-y: auto;
}

.mobile-user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--primary-bg);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}
.mobile-avatar { width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--primary-light); }
.mobile-name { font-weight: 700; font-size: 15px; }
.mobile-badge { font-size: 13px; color: var(--accent-warm); }

.mobile-search {
  position: relative;
  margin-bottom: 16px;
}
.mobile-search i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}
.mobile-search input {
  width: 100%;
  padding: 12px 16px 12px 40px;
  border: 2px solid var(--border);
  border-radius: var(--radius-full);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  background: var(--bg-input);
  color: var(--text-primary);
}
.mobile-search input:focus { border-color: var(--primary); }

.mobile-nav-links a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 15px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.mobile-nav-links a:hover { background: var(--primary-bg); color: var(--primary); }
.mobile-nav-links a i { width: 20px; text-align: center; color: var(--text-muted); }
.mobile-nav-links a.text-danger { color: var(--accent); }
.mobile-nav-links a.text-danger i { color: var(--accent); }

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

/* === Main Content === */
.forum-main {
  flex: 1;
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px;
}

/* === Layout Grid === */
.forum-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
  align-items: start;
}

.forum-content { min-width: 0; }

/* === Sidebar === */
.sidebar {
  position: sticky;
  top: 88px;
}

.sidebar-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.sidebar-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.sidebar-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.sidebar-card-head .sidebar-title { margin-bottom: 0; }
.sidebar-more {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary);
}
.sidebar-more:hover { text-decoration: underline; }

.sidebar-cat-list { list-style: none; }
.sidebar-cat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--transition);
}
.sidebar-cat-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-cat-item:hover { background: var(--bg-input); color: var(--text-primary); }
.sidebar-cat-item.active { background: var(--primary-bg); color: var(--primary); font-weight: 600; }
.sidebar-cat-count {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  background: var(--bg-input);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.sidebar-promo-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 12px;
}
.sidebar-quick-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sidebar-quick-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
}
.sidebar-quick-link i { font-size: 11px; color: var(--text-muted); }
.sidebar-quick-link:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-bg);
}

.sidebar-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.stat-box {
  text-align: center;
  padding: 14px;
  background: var(--bg-input);
  border-radius: var(--radius-md);
}
.stat-number { font-size: 1.4rem; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

/* === Forum Header === */
.hero-board {
  background: #F8FAFC;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px 28px;
  margin-bottom: 24px;
}

.hero-title {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.28;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.hero-subtitle {
  font-size: 14.5px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 18px;
  max-width: 640px;
}

.hero-ask-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 5px 5px 14px;
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 10px;
  max-width: 700px;
  transition: all var(--transition);
}
.hero-ask-bar:hover,
.hero-ask-bar:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}
.hero-ask-icon {
  color: var(--text-muted);
  font-size: 15px;
  flex-shrink: 0;
}
.hero-ask-bar input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
  padding: 8px 0;
}
.hero-ask-bar input::placeholder { color: var(--text-muted); }
.hero-ask-submit {
  padding: 9px 18px;
  border: none;
  border-radius: 7px;
  background: var(--text-primary);
  color: #FFFFFF;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition);
}
.hero-ask-submit:hover { background: var(--primary); }

/* === Category Pills === */
.category-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 20px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.category-pills::-webkit-scrollbar { display: none; }

.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: all var(--transition);
  cursor: pointer;
}
.cat-pill:hover { border-color: #CBD5E1; color: var(--text-primary); background: var(--bg-card-hover); }
.cat-pill.active {
  background: var(--text-primary);
  color: white;
  border-color: var(--text-primary);
}

/* === Sort Tabs === */
.sort-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--bg-card);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  width: fit-content;
}
.sort-tab {
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition);
  cursor: pointer;
  border: none;
  background: transparent;
  font-family: var(--font);
}
.sort-tab:hover { color: var(--text-primary); }
.sort-tab.active {
  background: var(--text-primary);
  color: white;
}

/* === Question Card === */
.question-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px 22px;
  margin-bottom: 12px;
  transition: border-color var(--transition), box-shadow var(--transition);
  position: relative;
}
.question-card:hover {
  border-color: #CBD5E1;
  box-shadow: var(--shadow-md);
}
.question-card.solved { border-left: 3px solid var(--secondary); }
.question-card.pinned { border-left: 3px solid var(--accent-warm); }

.qc-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.qc-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.qc-meta { flex: 1; min-width: 0; }
.qc-author {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}
.qc-author:hover { color: var(--primary); }
.qc-time { font-size: 12px; color: var(--text-muted); }

.qc-category {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: all var(--transition);
}
.qc-category:hover {
  border-color: #CBD5E1;
  color: var(--text-primary);
  background: var(--bg-input);
}

.qc-question {
  font-size: 15px;
  font-weight: 400;
  color: var(--text-primary);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 14px;
}
.qc-question a { color: inherit; }
.qc-question a:hover { color: var(--primary); }

.qc-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.qc-stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}
.qc-stat i { font-size: 14px; }
.qc-stat.has-best { color: var(--secondary); font-weight: 600; }
.qc-stat.has-best i { color: var(--secondary); }

.qc-solved-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: rgba(30,187,163,0.1);
  color: var(--secondary);
  font-size: 11px;
  font-weight: 700;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* === Question Detail Page === */
.question-detail {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  padding: 28px 30px;
  margin-bottom: 24px;
}

.qd-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.6;
  margin-bottom: 14px;
  color: var(--text-primary);
}
.qd-title-brainly {
  font-size: 15.5px;
  font-weight: 400;
  line-height: 1.75;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.tutor-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  margin-left: 6px;
  border-radius: var(--radius-full);
  background: var(--primary-bg);
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}

/* === Related Questions (Brainly-style internal linking) === */
.related-questions {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-top: 20px;
}
.related-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
}
.related-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.related-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-sidebar);
  color: var(--text-primary);
  transition: all var(--transition);
}
.related-item:hover {
  border-color: var(--primary);
  background: var(--primary-bg);
}
.related-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.related-item-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.related-solved {
  color: var(--secondary-dark);
  background: #ECFDF5;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 11px;
}

.qd-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
}
.qd-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--border);
  object-fit: cover;
}
.qd-author-name { font-weight: 700; font-size: 15px; }
.qd-author-name a { color: var(--text-primary); }
.qd-author-name a:hover { color: var(--primary); }
.qd-author-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--accent-warm);
}
.qd-time { font-size: 13px; color: var(--text-muted); }

.qd-content {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-primary);
  margin-bottom: 24px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.qd-content p { margin-bottom: 12px; }
.qd-content img { border-radius: var(--radius-sm); margin: 8px 0; }
.qd-content pre { background: var(--bg-input); padding: 16px; border-radius: var(--radius-sm); overflow-x: auto; }
.qd-content blockquote {
  border-left: 4px solid var(--primary);
  padding: 12px 20px;
  background: var(--primary-bg);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 12px 0;
}

.qd-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
  flex-wrap: wrap;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
}
.action-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }
.action-btn.active { background: var(--primary-bg); color: var(--primary); border-color: var(--primary); }
.action-btn.upvoted { background: rgba(108,99,255,0.12); color: var(--primary); border-color: var(--primary); }
.action-btn.downvoted { background: rgba(255,107,107,0.08); color: var(--accent); border-color: var(--accent); }

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

.action-btn-share { margin-left: auto; }

/* === Answers Section === */
.answers-section { margin-bottom: 24px; }

.answers-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.answers-count {
  font-size: 1.2rem;
  font-weight: 700;
}
.answers-count span { color: var(--primary); }

/* Answer Card */
.answer-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  padding: 24px;
  margin-bottom: 12px;
  transition: all var(--transition);
}
.answer-card:hover { box-shadow: var(--shadow-sm); }
.answer-card.best-answer {
  border: 2px solid var(--secondary);
  background: linear-gradient(to bottom right, rgba(30,187,163,0.03), var(--bg-card));
}

.best-answer-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: linear-gradient(135deg, var(--secondary), var(--secondary-dark));
  color: white;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 14px;
}

.answer-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.answer-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--border-light);
  object-fit: cover;
}
.answer-author { font-weight: 600; font-size: 14px; }
.answer-author a { color: var(--text-primary); }
.answer-author a:hover { color: var(--primary); }
.answer-time { font-size: 12px; color: var(--text-muted); }

.answer-content {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-primary);
  margin-bottom: 16px;
  word-wrap: break-word;
}
.answer-content p { margin-bottom: 10px; }

.answer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
}

.mark-best-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--secondary);
  border-radius: var(--radius-full);
  color: var(--secondary);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
}
.mark-best-btn:hover { background: var(--secondary); color: white; }

/* === Answer Form === */
.answer-form-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  padding: 24px;
  margin-bottom: 24px;
}
.answer-form-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.answer-form-title i { color: var(--primary); }

.submit-answer-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: linear-gradient(135deg, var(--secondary), var(--secondary-dark));
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 16px;
  box-shadow: 0 2px 8px rgba(30,187,163,0.3);
}
.submit-answer-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(30,187,163,0.4);
}
.submit-answer-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Login Prompt */
.login-prompt {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 2px dashed var(--border);
  padding: 32px;
  text-align: center;
  margin-bottom: 24px;
}
.login-prompt p {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.login-prompt .btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 15px;
  transition: all var(--transition);
}
.login-prompt .btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-glow); color: white; }

/* === Ask Question Page === */
.ask-page {
  max-width: 780px;
  margin: 0 auto;
}

.ask-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  padding: 32px;
}

.ask-card h1 {
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.ask-subtitle {
  color: var(--text-secondary);
  margin-bottom: 28px;
  font-size: 15px;
}

.form-group {
  margin-bottom: 20px;
}
.form-label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--text-primary);
}
.form-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%235A6178' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}
.form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(108,99,255,0.1); }

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition);
}
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(108,99,255,0.1); background: white; }

/* === Searchable Select Dropdown with Live Filter & Creation === */
.searchable-select {
  position: relative;
  width: 100%;
}

.searchable-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  transition: all var(--transition);
  min-height: 48px;
  outline: none;
}

.searchable-select-trigger:hover {
  border-color: var(--primary-light);
  background: white;
}

.searchable-select-trigger:focus,
.searchable-select.is-open .searchable-select-trigger {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 4px rgba(108,99,255,0.12);
}

.searchable-select.is-open .searchable-select-trigger {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.select-trigger-content {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  overflow: hidden;
}

.select-placeholder {
  color: var(--text-muted);
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 8px;
}

.selected-cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cat-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

.badge-new-cat {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
  font-weight: 600;
  margin-left: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.select-trigger-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-clear-selection {
  background: none;
  border: none;
  padding: 4px 6px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1;
  transition: all 0.15s;
}

.btn-clear-selection:hover {
  color: var(--accent);
  background: rgba(255, 107, 107, 0.1);
}

.trigger-chevron {
  font-size: 12px;
  color: var(--text-secondary);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.searchable-select.is-open .trigger-chevron {
  transform: rotate(180deg);
  color: var(--primary);
}

/* Dropdown Menu Panel */
.select-dropdown-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 2px solid var(--primary);
  border-top: none;
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
  z-index: 105;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: dropdownFadeDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.searchable-select.is-open .select-dropdown-panel {
  display: flex;
}

/* Search input header inside dropdown */
.select-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-light);
}

.select-search-box .search-icon {
  position: static;
  transform: none;
  left: auto;
  top: auto;
  color: var(--text-muted);
  font-size: 13px;
  flex-shrink: 0;
}

.select-search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--text-primary);
  outline: none;
}

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

.search-clear-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  padding: 2px;
}

.search-clear-btn:hover {
  color: var(--text-primary);
}

/* Options List */
.select-options-list {
  max-height: 220px;
  overflow-y: auto;
  padding: 6px 0;
  overscroll-behavior: contain;
}

.select-options-list::-webkit-scrollbar {
  width: 6px;
}
.select-options-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 6px;
}

.select-option-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
  font-size: 14px;
}

.select-option-item:hover,
.select-option-item.is-focused {
  background: var(--primary-bg);
  color: var(--primary);
}

.select-option-item.is-selected {
  background: rgba(108, 99, 255, 0.12);
  color: var(--primary);
  font-weight: 600;
}

.option-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.option-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.option-count {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-body);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

/* Create Category Option Item */
.create-category-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(108, 99, 255, 0.07), rgba(30, 187, 163, 0.08));
  border-top: 1px dashed var(--border);
  cursor: pointer;
  transition: background 0.15s ease;
}

.create-category-item:hover,
.create-category-item.is-focused {
  background: linear-gradient(135deg, rgba(108, 99, 255, 0.14), rgba(30, 187, 163, 0.16));
}

.create-cat-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(108,99,255,0.25);
}

.create-cat-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.create-cat-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.create-cat-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.create-cat-pill {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: rgba(30, 187, 163, 0.15);
  color: var(--secondary-dark);
  font-weight: 700;
  flex-shrink: 0;
}

/* Empty State */
.select-empty-state {
  padding: 20px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.select-empty-state i {
  font-size: 1.5rem;
  opacity: 0.5;
}

.btn-submit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 12px rgba(108,99,255,0.3);
  width: 100%;
  justify-content: center;
}
.btn-submit:hover { transform: translateY(-1px); box-shadow: var(--shadow-glow); }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* === Profile Page === */
.profile-header {
  background: #0F172A;
  border: 1px solid #1E293B;
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  color: white;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.profile-info {
  display: flex;
  align-items: center;
  gap: 24px;
  position: relative;
  z-index: 1;
}
.profile-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.3);
  object-fit: cover;
}
.profile-name { font-size: 1.6rem; font-weight: 800; color: white; }
.profile-username { font-size: 14px; color: rgba(255,255,255,0.7); margin-bottom: 8px; }

.profile-stats-row {
  display: flex;
  gap: 20px;
  margin-top: 8px;
}
.profile-stat { text-align: center; }
.profile-stat-val { font-size: 1.2rem; font-weight: 800; color: white; }
.profile-stat-label { font-size: 11px; color: rgba(255,255,255,0.6); text-transform: uppercase; letter-spacing: 0.5px; }

.profile-badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(245,158,11,0.2);
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: var(--radius-full);
  color: var(--accent-warm);
  font-size: 13px;
  font-weight: 700;
  margin-top: 10px;
}

.profile-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  padding: 4px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
  margin-bottom: 20px;
  width: fit-content;
}
.profile-tab {
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 14px;
  color: var(--text-muted);
  transition: all var(--transition);
}
.profile-tab:hover { color: var(--text-primary); }
.profile-tab.active { background: var(--primary); color: white; }

/* === Login / Register Page === */
.auth-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 200px);
  padding: 40px 20px;
}
.auth-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
}
.auth-title {
  font-size: 1.5rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 8px;
}
.auth-subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 28px;
  font-size: 14px;
}
.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-muted);
}
.auth-footer a { font-weight: 600; }

.auth-error {
  background: rgba(255,107,107,0.08);
  border: 1px solid rgba(255,107,107,0.2);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--accent);
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* === Category Page === */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.category-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  padding: 24px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.category-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
}
.category-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.category-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: white;
  margin-bottom: 14px;
}
.category-name {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 4px;
  color: var(--text-primary);
}
.category-count {
  font-size: 13px;
  color: var(--text-muted);
}

/* === Pagination === */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 32px;
  padding: 20px 0;
}
.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 14px;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }
.page-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.page-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* === Toast === */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 500;
  animation: toastIn 0.3s ease;
  min-width: 280px;
}
.toast.success { border-left: 4px solid var(--secondary); }
.toast.error { border-left: 4px solid var(--accent); }
.toast.info { border-left: 4px solid var(--primary); }

.toast-icon { font-size: 18px; }
.toast.success .toast-icon { color: var(--secondary); }
.toast.error .toast-icon { color: var(--accent); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* === Back to top === */
.back-to-top {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(108,99,255,0.3);
  transition: all var(--transition);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  z-index: 100;
}
.back-to-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { transform: translateY(-3px); box-shadow: var(--shadow-glow); }

/* === Share Modal === */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.active { display: flex; }

.modal-box {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 460px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.3s ease;
}
.modal-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 16px; }
.modal-close {
  float: right;
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
}

.share-url-box {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.share-url-box input {
  flex: 1;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-input);
  outline: none;
}
.share-url-box button {
  padding: 10px 18px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
}
.share-url-box button:hover { background: var(--primary-dark); }

/* === Empty State === */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}
.empty-state i { font-size: 64px; color: var(--border); margin-bottom: 16px; }
.empty-state h3 { font-weight: 700; margin-bottom: 8px; color: var(--text-secondary); }
.empty-state p { color: var(--text-muted); font-size: 14px; }

/* === TinyMCE overrides === */
.tox.tox-tinymce { border: 2px solid var(--border) !important; border-radius: var(--radius-md) !important; }
.tox.tox-tinymce:focus-within { border-color: var(--primary) !important; box-shadow: 0 0 0 4px rgba(108,99,255,0.1) !important; }
.tox .tox-statusbar__branding { display: none !important; }

/* === Loading Skeleton === */
.skeleton {
  background: linear-gradient(90deg, var(--bg-input) 25%, var(--border-light) 50%, var(--bg-input) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* === Responsive === */
@media (max-width: 1024px) {
  .forum-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; display: none; }
}

@media (max-width: 768px) {
  .nav-logo { height: 34px; }
  .nav-search { display: none; }
  .nav-toggle { display: block; }
  .btn-ask span { display: none; }
  .btn-login { display: none; }
  .nav-divider, .nav-title { display: none; }

  .hero-board { padding: 20px 18px; }
  .hero-title { font-size: 1.35rem; }
  .hero-ask-bar { flex-wrap: wrap; padding: 8px; }
  .hero-ask-submit { width: 100%; }

  .question-detail { padding: 20px; }
  .qd-title { font-size: 1.3rem; }
  .ask-card { padding: 24px; }

  .profile-info { flex-direction: column; text-align: center; }
  .profile-stats-row { justify-content: center; }

  .category-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .forum-main { padding: 16px 12px; }
  .question-card { padding: 16px; }
  .qc-header { gap: 8px; }
  .qc-avatar { width: 34px; height: 34px; }
  .category-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 28px 20px; }
}

/* === Scrollbar === */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================
   CATEGORY EXPAND TOGGLE
   ============================================ */
.category-pills-container {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 20px;
  position: relative;
}
.category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 40px;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  flex: 1;
}
.category-pills.expanded {
  max-height: 600px;
}
.cat-expand-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.cat-expand-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-bg);
}
.cat-expand-btn.active i {
  transform: rotate(180deg);
}
.cat-expand-btn i {
  transition: transform 0.3s ease;
  font-size: 13px;
}

/* ============================================
   2-LEVEL NESTED COMMENTS & REPLIES
   ============================================ */
.btn-scroll-answer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--primary-bg);
  color: var(--primary);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
}
.btn-scroll-answer:hover {
  background: var(--primary);
  color: white;
}
.btn-reply-toggle, .btn-reply-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-secondary);
  cursor: pointer;
}
.btn-reply-toggle:hover, .btn-reply-tag:hover {
  color: var(--primary);
  border-color: var(--primary);
}
.replies-container {
  margin-top: 14px;
  padding-left: 20px;
  border-left: 2px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.reply-card {
  background: var(--bg-card-hover);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  transition: all var(--transition);
}
.reply-card:hover {
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}
.reply-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.reply-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--border-light);
}
.reply-author {
  font-size: 13px;
  font-weight: 700;
}
.reply-author a { color: var(--text-primary); }
.reply-author a:hover { color: var(--primary); }
.reply-time {
  font-size: 11px;
  color: var(--text-muted);
}
.reply-content {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  margin-bottom: 8px;
  word-break: break-word;
}
.reply-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
}
.action-btn-sm {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.action-btn-sm:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.action-btn-sm.upvoted {
  background: rgba(108,99,255,0.12);
  color: var(--primary);
  border-color: var(--primary);
}
.action-btn-sm.downvoted {
  background: rgba(255,107,107,0.08);
  color: var(--accent);
  border-color: var(--accent);
}
.vote-count-sm {
  font-weight: 700;
  font-size: 12px;
  min-width: 18px;
  text-align: center;
  color: var(--text-primary);
}

/* Mention Tag */
.mention-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  background: rgba(108,99,255,0.1);
  color: var(--primary);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95em;
  transition: all var(--transition);
}
.mention-tag:hover {
  background: var(--primary);
  color: white;
}

/* Reply Form */
.reply-form-wrap {
  display: none;
  margin-top: 14px;
  padding: 14px 18px;
  background: var(--bg-sidebar);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  animation: fadeIn 0.25s ease;
}
.reply-form-wrap.active {
  display: block;
}
.reply-target-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-bg);
  color: var(--primary);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}
.btn-cancel-reply-target {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
}
.btn-cancel-reply-target:hover { color: var(--accent); }
.reply-input-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.reply-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--text-primary);
  outline: none;
  resize: vertical;
  transition: all var(--transition);
}
.reply-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108,99,255,0.1);
}
.reply-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.btn-cancel-reply {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-cancel-reply:hover {
  background: var(--bg-input);
  color: var(--text-primary);
}
.btn-submit-reply {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 18px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-submit-reply:hover {
  background: var(--primary-dark);
  box-shadow: 0 2px 8px rgba(108,99,255,0.3);
}
.reply-login-note {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  padding: 6px 0;
}
.reply-login-note a { font-weight: 600; }

/* ============================================
   RICH SHARE MODAL
   ============================================ */
.share-modal-box {
  max-width: 520px;
  padding: 32px 28px;
}
.share-modal-desc {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
}
.share-social-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.share-social-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 6px;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: all var(--transition-spring);
  border: 1px solid var(--border-light);
  background: var(--bg-card);
}
.share-social-btn:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}
.share-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: white;
  transition: all var(--transition);
}
.share-social-btn span {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
}
.share-wa .share-icon-wrap { background: linear-gradient(135deg, #25D366, #128C7E); }
.share-tg .share-icon-wrap { background: linear-gradient(135deg, #2AABEE, #229ED9); }
.share-tw .share-icon-wrap { background: linear-gradient(135deg, #1A1A1A, #000000); }
.share-fb .share-icon-wrap { background: linear-gradient(135deg, #1877F2, #0D65D9); }
.share-th .share-icon-wrap { background: linear-gradient(135deg, #2A2A2A, #0A0A0A); }

.share-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin-bottom: 16px;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.share-divider::before, .share-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-light);
}
.share-divider span {
  padding: 0 12px;
}

/* ============================================
   DARK MODE PREMIUM FOOTER
   ============================================ */
.forum-footer {
  background: #0F172A;
  color: #94A3B8;
  border-top: 1px solid #1E293B;
  margin-top: 48px;
  padding: 52px 0 24px;
  font-size: 14px;
}
.footer-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.8fr 1fr 1fr 1fr;
  gap: 36px;
  margin-bottom: 40px;
}
.footer-logo-link {
  display: inline-flex;
  align-items: center;
  background: #FFFFFF;
  padding: 7px 14px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  margin-bottom: 16px;
}
.footer-logo {
  height: 30px;
  width: auto;
  display: block;
}
.footer-tagline {
  line-height: 1.65;
  color: #94A3B8;
  margin-bottom: 20px;
  font-size: 13.5px;
  max-width: 340px;
}
.footer-social-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.footer-social-label {
  font-size: 12.5px;
  font-weight: 600;
  color: #CBD5E1;
}
.footer-social-icons {
  display: flex;
  gap: 8px;
}
.social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  color: #CBD5E1;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 15px;
  transition: all var(--transition);
}
.social-btn:hover {
  border-color: rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.12);
}

.footer-col-title {
  color: #F8FAFC;
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 14px;
  letter-spacing: 0.02em;
}
.footer-menu {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.footer-menu a {
  color: #94A3B8;
  display: inline-block;
  font-size: 13.5px;
  transition: color var(--transition);
}
.footer-menu a:hover {
  color: #FFFFFF;
}
.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: #64748B;
}
.footer-bottom strong { color: #E2E8F0; }

@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
}
@media (max-width: 600px) {
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .footer-bottom { flex-direction: column; text-align: center; }
  .share-social-grid { grid-template-columns: repeat(3, 1fr); }
  .replies-container { padding-left: 10px; margin-left: 8px; }
}


/* =====================================================================
   REFINED EDITORIAL LAYER
   Tenang, rapi, dan konsisten: kanvas putih, garis tipis, satu warna
   tinta untuk aksi utama, tanpa gradien, glow, atau animasi berlebihan.
   ===================================================================== */
:root {
  --ink: #0F172A;
  --ink-soft: #1E293B;
  --border: #E6E8EC;
  --border-light: #F0F2F5;
  --border-strong: #CBD5E1;
  --bg-sidebar: #FAFAFB;
  --bg-input: #F5F6F8;
  --ring: 0 0 0 3px rgba(15, 23, 42, 0.07);
  --shadow-pop: 0 16px 40px -12px rgba(15, 23, 42, 0.18), 0 2px 6px rgba(15, 23, 42, 0.04);
}

body { font-size: 15px; letter-spacing: -0.003em; }
::selection { background: #DBEAFE; color: var(--ink); }
a:focus-visible, button:focus-visible {
  outline: 2px solid #93C5FD;
  outline-offset: 2px;
}
.select-search-input:focus,
.select-search-input:focus-visible,
.hero-ask-bar input:focus-visible,
.nav-search input:focus-visible {
  outline: none !important;
}

/* --- Navbar --- */
.forum-nav {
  height: 64px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.forum-nav.scrolled { box-shadow: none; }
.nav-container { gap: 24px; padding: 0 24px; }
.nav-divider { height: 20px; background: var(--border); }
.nav-title { font-size: 14px; font-weight: 600; color: var(--text-secondary); }
.nav-brand:hover .nav-title { color: var(--ink); }

.nav-search input {
  height: 40px;
  padding: 0 14px 0 38px;
  background: var(--bg-input);
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 14px;
}
.nav-search input:focus { background: #FFFFFF; border-color: var(--border-strong); box-shadow: var(--ring); }
.search-results { border-radius: 10px; border-color: var(--border); box-shadow: var(--shadow-pop); top: calc(100% + 6px); }
.search-result-item { padding: 11px 14px; }
.search-result-item:hover { background: var(--bg-input); color: var(--ink); }

.btn-ask, .btn-register {
  height: 38px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--ink);
  color: #FFFFFF;
  border: 1px solid var(--ink);
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: none;
}
.btn-ask:hover, .btn-register:hover { background: var(--ink-soft); color: #FFFFFF; transform: none; box-shadow: none; }
.btn-ask i { font-size: 12px; }
.btn-login {
  height: 38px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--ink);
  background: #FFFFFF;
  font-size: 13.5px;
  font-weight: 600;
}
.btn-login:hover { border-color: var(--border-strong); background: #FFFFFF; color: var(--ink); }

.notif-btn { width: 38px; height: 38px; border-radius: 8px; font-size: 17px; color: var(--text-secondary); border: 1px solid transparent; }
.notif-btn:hover { background: var(--bg-input); border-color: transparent; color: var(--ink); }
.notif-badge {
  animation: none;
  top: 5px;
  right: 5px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  line-height: 13px;
  font-size: 10px;
  background: #DC2626;
  border: 2px solid #FFFFFF;
}
.user-btn { padding: 3px 6px 3px 3px; border: 1px solid transparent; border-radius: 999px; }
.user-btn:hover { background: #FFFFFF; border-color: var(--border); }
.user-avatar-sm { width: 32px; height: 32px; border: 1px solid var(--border); }

.dropdown-menu {
  top: calc(100% + 10px);
  min-width: 248px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-pop);
  animation: refinedDrop 0.14s ease-out;
}
@keyframes refinedDrop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.dropdown-header { padding: 10px 10px 12px; }
.dropdown-avatar { width: 40px; height: 40px; border: 1px solid var(--border); }
.dropdown-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.dropdown-badge { font-size: 12px; color: var(--text-muted); }
.dropdown-badge i { color: #D97706; }
.dropdown-divider { margin: 4px 2px; background: var(--border-light); }
.dropdown-item { padding: 8px 10px; border-radius: 7px; font-size: 13.5px; color: var(--text-secondary); }
.dropdown-item:hover { background: var(--bg-input); color: var(--ink); }
.dropdown-item i { color: var(--text-muted); font-size: 13px; }
.dropdown-item.text-danger, .dropdown-item.text-danger i { color: #B91C1C; }
.dropdown-item.text-danger:hover { background: #FEF2F2; color: #B91C1C; }
.notif-dropdown { padding: 0; width: min(360px, calc(100vw - 24px)); min-width: 0; }
.notif-dropdown-header { padding: 13px 16px; font-size: 13.5px; font-weight: 600; color: var(--ink); border-bottom: 1px solid var(--border-light); }
.notif-count-label { background: #EFF6FF; color: #1D4ED8; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.notif-dropdown-list { max-height: 360px; overflow-y: auto; }
.notif-empty { padding: 32px 20px; text-align: center; }
.notif-empty-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: var(--bg-input);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.notif-empty-title { font-size: 13.5px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.notif-empty-desc { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; max-width: 240px; margin: 0 auto; }

.notif-item {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 11px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--bg-sidebar); }
.notif-item.unread { background: #F8FAFF; }
.notif-item.unread:hover { background: #F1F5FF; }

.notif-avatar-wrap { position: relative; flex-shrink: 0; margin-top: 1px; }
.notif-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); display: block; }
.notif-type-icon {
  position: absolute;
  right: -3px;
  bottom: -2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  color: #FFFFFF;
}
.notif-type-icon.is-reply { background: var(--ink); }
.notif-type-icon.is-best { background: #059669; }
.notif-type-icon.is-vote { background: #2563EB; }

.notif-item-body { flex: 1; min-width: 0; }
.notif-item-text { font-size: 13px; line-height: 1.45; color: var(--text-secondary); }
.notif-item-text strong { color: var(--ink); font-weight: 600; }
.notif-item-title {
  font-size: 12.5px;
  color: var(--text-primary);
  margin-top: 3px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.notif-item-time { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
.notif-unread-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2563EB;
  flex-shrink: 0;
  margin-top: 6px;
}

/* --- Mobile menu --- */
.mobile-menu { background: rgba(15, 23, 42, 0.32); backdrop-filter: none; }
.mobile-menu-inner { border-radius: 0 0 14px 14px; box-shadow: var(--shadow-pop); padding: 16px; }
.mobile-user-card { background: var(--bg-sidebar); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.mobile-avatar { width: 42px; height: 42px; border: 1px solid var(--border); }
.mobile-badge { color: var(--text-muted); font-size: 12.5px; }
.mobile-search input { height: 42px; padding: 0 14px 0 38px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-input); }
.mobile-search input:focus { border-color: var(--border-strong); background: #FFFFFF; box-shadow: var(--ring); }
.mobile-nav-links a { padding: 11px 12px; border-radius: 8px; font-size: 14.5px; }
.mobile-nav-links a:hover { background: var(--bg-input); color: var(--ink); }

/* --- Layout --- */
.forum-main { padding: 36px 24px 64px; }
.forum-layout { grid-template-columns: minmax(0, 1fr) 288px; gap: 48px; }
.sidebar { top: 100px; }

/* --- Forum header (hero box) --- */
.hero-board {
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 32px;
  margin-bottom: 24px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.hero-title { font-size: 26px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.25; margin-bottom: 8px; }
.hero-subtitle { font-size: 15px; color: var(--text-secondary); max-width: 620px; margin-bottom: 20px; }
.hero-ask-bar {
  max-width: 680px;
  height: 54px;
  padding: 6px 6px 6px 16px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.hero-ask-bar:hover { border-color: var(--border-strong); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04); }
.hero-ask-bar:focus-within { border-color: var(--border-strong); box-shadow: var(--ring); }
.hero-ask-bar input {
  font-size: 14.5px;
  font-weight: 400;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.hero-ask-bar input::placeholder {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.hero-ask-bar input::placeholder,
.nav-search input::placeholder,
.reply-textarea::placeholder,
.select-search-input::placeholder {
  font-weight: 400;
  color: var(--text-muted);
}
.hero-ask-submit { height: 40px; padding: 0 18px; border-radius: 8px; background: var(--ink); font-size: 13.5px; }
.hero-ask-submit:hover { background: var(--ink-soft); }

/* --- Category chips --- */
.category-pills-container { margin-bottom: 0; gap: 8px; }
.category-pills { gap: 6px; max-height: 34px; padding-bottom: 0; margin-bottom: 0; }
.category-pills.expanded { max-height: 600px; }
.cat-pill {
  height: 34px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #FFFFFF;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}
.cat-pill:hover { border-color: var(--border-strong); background: #FFFFFF; color: var(--ink); }
.cat-pill.active { background: var(--ink); border-color: var(--ink); color: #FFFFFF; box-shadow: none; }
.cat-expand-btn { width: 34px; height: 34px; min-width: 34px; border-color: var(--border); }
.cat-expand-btn:hover { border-color: var(--border-strong); background: #FFFFFF; color: var(--ink); }

/* --- Sort tabs (underline) --- */
.sort-tabs {
  width: 100%;
  gap: 26px;
  margin: 22px 0 16px;
  padding: 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}
.sort-tab {
  padding: 12px 0;
  margin-bottom: -1px;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
}
.sort-tab:hover { color: var(--ink); }
.sort-tab.active { background: transparent; color: var(--ink); border-bottom-color: var(--ink); box-shadow: none; font-weight: 600; }

/* --- Question feed (cards) --- */
.question-card,
.question-card.solved,
.question-card.pinned {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
  margin: 0 0 12px 0;
  box-shadow: none;
  transition: border-color var(--transition);
}
.question-card:hover { background: #FFFFFF; border-color: var(--border-strong); box-shadow: none; transform: none; }
.qc-header { gap: 10px; margin-bottom: 10px; }
.qc-avatar { width: 32px; height: 32px; border: 1px solid var(--border); }
.qc-author { font-size: 13.5px; font-weight: 600; }
.qc-time { font-size: 12.5px; }
.qc-category {
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #FFFFFF;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
}
.qc-category:hover { border-color: var(--border-strong); background: #FFFFFF; color: var(--ink); }
.qc-question { font-size: 15.5px; line-height: 1.65; color: var(--ink); margin-bottom: 12px; }
.qc-question a:hover { color: var(--primary-dark); }
.qc-footer { gap: 18px; }
.qc-stat { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.qc-stat i { font-size: 12px; opacity: 0.85; }
.qc-stat.has-best, .qc-stat.has-best i { color: var(--text-muted); font-weight: 500; }
.qc-solved-badge {
  padding: 2px 9px;
  background: #ECFDF5;
  border: 1px solid #D1FAE5;
  color: #047857;
  font-size: 12px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

/* --- Pagination --- */
.pagination { margin-top: 28px; padding: 0; gap: 6px; }
.page-btn { min-width: 36px; height: 36px; padding: 0 10px; border-radius: 8px; border-color: var(--border); font-size: 13.5px; font-weight: 500; }
.page-btn:hover { border-color: var(--border-strong); background: #FFFFFF; color: var(--ink); }
.page-btn.active { background: var(--ink); border-color: var(--ink); color: #FFFFFF; }

/* --- Empty state --- */
.empty-state { padding: 56px 20px; }
.empty-state i { font-size: 36px; color: var(--border-strong); margin-bottom: 14px; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--ink); }
.empty-state p { font-size: 14px; }

/* --- Sidebar --- */
.sidebar-card { background: #FFFFFF; border: 1px solid var(--border); border-radius: 12px; padding: 18px; box-shadow: none; }
.sidebar-card-head { margin-bottom: 10px; }
.sidebar-title { font-size: 11.5px; font-weight: 600; letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 10px; }
.sidebar-more { font-size: 12.5px; font-weight: 500; color: var(--text-secondary); }
.sidebar-more:hover { color: var(--ink); text-decoration: none; }
.sidebar-cat-item { padding: 7px 8px; border-radius: 7px; font-size: 13.5px; color: var(--text-secondary); }
.sidebar-cat-item:hover { background: var(--bg-input); color: var(--ink); }
.sidebar-cat-item.active { background: var(--bg-input); color: var(--ink); font-weight: 600; }
.sidebar-cat-count { background: transparent; padding: 0; font-size: 12.5px; font-weight: 500; color: var(--text-muted); }
.sidebar-promo { background: var(--bg-sidebar); }
.sidebar-promo-text { font-size: 13px; line-height: 1.6; }
.sidebar-quick-link { background: #FFFFFF; border-color: var(--border); border-radius: 8px; font-weight: 500; }
.sidebar-quick-link:hover { border-color: var(--border-strong); background: #FFFFFF; color: var(--ink); }

/* --- Question detail --- */
.question-detail { border: 1px solid var(--border); border-radius: 14px; padding: 28px 30px; margin-bottom: 8px; box-shadow: none; }
.qd-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding-bottom: 0; border-bottom: 0; }
.qd-avatar-link,
.answer-meta > a:first-child,
.reply-meta > a:first-child,
.qc-header > a:first-child { display: inline-flex; align-items: center; flex-shrink: 0; line-height: 0; }
.qd-avatar { display: block; width: 40px; height: 40px; border: 1px solid var(--border); }
.qd-author-info { display: flex; flex-direction: column; justify-content: center; gap: 3px; min-width: 0; }
.qd-author-name { font-size: 14px; font-weight: 600; line-height: 1.25; }
.qd-author-badge { font-size: 12px; color: var(--text-muted); }
.qd-author-badge i { color: #D97706; font-size: 10px; }
.qd-time { font-size: 12.5px; line-height: 1.25; }
.qd-title-brainly { font-size: 16px; font-weight: 400; line-height: 1.75; letter-spacing: 0; margin-bottom: 22px; }
.qd-title { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.qd-content { font-size: 15.5px; line-height: 1.75; }
.qd-content blockquote { border-left: 3px solid var(--border-strong); background: var(--bg-sidebar); }
.qd-actions { gap: 6px; padding-top: 16px; border-top: 1px solid var(--border-light); }
.qd-actions-right { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.qd-actions .action-btn-save,
.qd-actions .action-btn-share { margin-left: 0; width: 34px; padding: 0; justify-content: center; }

.action-btn {
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #FFFFFF;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}
.action-btn:hover { border-color: var(--border-strong); background: #FFFFFF; color: var(--ink); }
.action-btn.active { background: var(--bg-input); border-color: var(--border-strong); color: var(--ink); }
.action-btn.upvoted { background: #EFF6FF; border-color: #BFDBFE; color: var(--primary-dark); }
.action-btn.downvoted { background: #FEF2F2; border-color: #FECACA; color: #B91C1C; }
.vote-count { font-size: 14px; font-weight: 600; min-width: 22px; }
.vote-btn-count { font-weight: 600; font-variant-numeric: tabular-nums; }

/* --- Answers --- */
.qd-submeta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12.5px;
  line-height: 1.25;
  color: var(--text-muted);
  margin-top: 0;
}
.qd-cat-link {
  color: var(--text-secondary);
  font-weight: 500;
}
.qd-cat-link:hover { color: var(--ink); text-decoration: underline; }
.qd-dot { color: var(--text-muted); }

.answers-section { margin-top: 28px; }
.answers-header { margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.answers-count { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.answers-count span { color: var(--ink); }
.btn-scroll-answer { height: 34px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; background: #FFFFFF; color: var(--ink); font-weight: 500; }
.btn-scroll-answer:hover { border-color: var(--border-strong); background: #FFFFFF; color: var(--ink); }

.answer-card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 24px;
  margin-bottom: 14px;
  box-shadow: none;
}
.answer-card:hover { border-color: var(--border-strong); box-shadow: none; }
.answer-card.best-answer {
  background: #F7FDF9;
  border: 1px solid #CDEFD9;
  border-radius: 14px;
  padding: 22px 24px;
  margin: 0 0 14px 0;
}
.best-answer-badge { padding: 0; margin-bottom: 12px; background: transparent; color: #047857; font-size: 12.5px; font-weight: 600; border-radius: 0; }
.answer-meta { gap: 10px; margin-bottom: 12px; }
.answer-avatar { display: block; width: 34px; height: 34px; border: 1px solid var(--border); }
.answer-author { font-size: 14px; font-weight: 600; line-height: 1.25; }
.answer-time { font-size: 12.5px; line-height: 1.25; margin-top: 2px; }
.answer-content { font-size: 15.5px; line-height: 1.75; margin-bottom: 14px; }
.qd-content ul, .qd-content ol,
.answer-content ul, .answer-content ol,
.reply-content ul, .reply-content ol,
.live-math-preview-body ul, .live-math-preview-body ol {
  margin: 8px 0 12px 0;
  padding-left: 22px;
}
.qd-content ul, .answer-content ul, .reply-content ul, .live-math-preview-body ul { list-style-type: disc; }
.qd-content ol, .answer-content ol, .reply-content ol, .live-math-preview-body ol { list-style-type: decimal; }
.qd-content li, .answer-content li, .reply-content li, .live-math-preview-body li { margin-bottom: 4px; }
.qd-content li > ul, .qd-content li > ol,
.answer-content li > ul, .answer-content li > ol { margin: 4px 0; }
.qd-content li:last-child, .answer-content li:last-child, .reply-content li:last-child, .live-math-preview-body li:last-child { margin-bottom: 0; }
.answer-actions { gap: 6px; padding-top: 0; border-top: 0; flex-wrap: wrap; }
.mark-best-btn { height: 34px; padding: 0 12px; border: 1px solid #A7F3D0; border-radius: 8px; background: #FFFFFF; color: #047857; font-size: 13px; font-weight: 500; }
.mark-best-btn:hover { background: #ECFDF5; color: #065F46; }
.tutor-badge { background: var(--bg-input); border: 1px solid var(--border); color: var(--text-secondary); font-size: 11px; font-weight: 600; }

.replies-container { margin-top: 16px; padding-left: 14px; border-left: 2px solid var(--border); gap: 10px; }
.reply-card { background: var(--bg-sidebar); border: 1px solid var(--border-light); border-radius: 10px; padding: 14px 16px; box-shadow: none; }
.reply-card:hover { background: var(--bg-sidebar); border-color: var(--border); box-shadow: none; }
.reply-avatar { width: 26px; height: 26px; border: 1px solid var(--border); }
.reply-author { font-size: 13px; font-weight: 600; }
.reply-time { font-size: 12px; }
.reply-content { font-size: 14.5px; line-height: 1.65; }
.reply-actions { padding-top: 0; border-top: 0; gap: 2px; }
.action-btn-sm { height: 28px; padding: 0 9px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--text-muted); font-size: 12px; font-weight: 500; }
.action-btn-sm:hover { background: var(--bg-input); color: var(--ink); border-color: transparent; }
.action-btn-sm.upvoted { background: #EFF6FF; color: var(--primary-dark); border-color: transparent; }
.action-btn-sm.downvoted { background: #FEF2F2; color: #B91C1C; border-color: transparent; }
.vote-count-sm { font-size: 12px; font-weight: 600; }
.mention-tag { padding: 0 4px; border-radius: 4px; background: #EFF6FF; color: var(--primary-dark); font-weight: 600; }
.mention-tag:hover { background: #DBEAFE; color: #1E40AF; }

.reply-form-wrap { background: var(--bg-sidebar); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.reply-target-badge { background: #FFFFFF; border: 1px solid var(--border); color: var(--text-secondary); }
.reply-textarea { border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
.reply-textarea:focus { border-color: var(--border-strong); box-shadow: var(--ring); }
.btn-cancel-reply { height: 32px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; background: #FFFFFF; font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.btn-submit-reply { height: 32px; padding: 0 14px; border-radius: 8px; background: var(--ink); font-size: 13px; font-weight: 600; }
.btn-submit-reply:hover { background: var(--ink-soft); box-shadow: none; }

/* --- Answer form & login prompt --- */
#mainAnswerForm { margin-top: 32px; }
.answer-form-card { border: 1px solid var(--border); border-radius: 14px; padding: 24px; box-shadow: none; }
.answer-form-title { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.answer-form-title i { color: var(--text-muted); font-size: 13px; }
.answer-form-subtitle { font-size: 13.5px; color: var(--text-muted); margin-bottom: 16px; }
.submit-answer-btn { height: 42px; padding: 0 20px; border-radius: 8px; background: var(--ink); font-size: 14px; font-weight: 600; box-shadow: none; }
.submit-answer-btn:hover { background: var(--ink-soft); transform: none; box-shadow: none; }
.login-prompt { background: var(--bg-sidebar); border: 1px solid var(--border); border-radius: 14px; padding: 28px; }
.login-prompt p { font-size: 14.5px; }
.login-prompt .btn-primary { height: 40px; padding: 0 18px; border-radius: 8px; background: var(--ink); font-size: 14px; font-weight: 600; }
.login-prompt .btn-primary:hover { background: var(--ink-soft); transform: none; box-shadow: none; color: #FFFFFF; }

.tox.tox-tinymce {
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
  transition: border-color var(--transition), box-shadow var(--transition) !important;
}
.tox.tox-tinymce:focus-within,
.tox.tox-tinymce.is-focused {
  border-color: #94A3B8 !important;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08) !important;
}
.tox .tox-editor-header { box-shadow: none !important; border-bottom: 1px solid var(--border-light) !important; }

/* --- Related questions --- */
.related-questions { background: transparent; border: 0; border-radius: 0; padding: 0; margin-top: 44px; }
.related-title { font-size: 19px; font-weight: 700; letter-spacing: -0.015em; color: var(--ink); margin-bottom: 12px; }
.related-list { gap: 0; border-top: 1px solid var(--border); }
.related-item { padding: 13px 0; border: 0; border-bottom: 1px solid var(--border-light); border-radius: 0; background: transparent; }
.related-item:hover { background: transparent; border-color: var(--border-light); }
.related-item:hover .related-item-title { color: var(--primary-dark); }
.related-item-title { font-size: 14.5px; font-weight: 400; color: var(--text-primary); }
.related-solved { background: #ECFDF5; color: #047857; }

/* --- Ask page --- */
.ask-page { max-width: 720px; }
.ask-card { border: 1px solid var(--border); border-radius: 16px; padding: 36px 40px; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03); }
.ask-card h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 6px; }
.ask-subtitle { font-size: 14.5px; color: var(--text-muted); margin-bottom: 28px; }
.form-group { margin-bottom: 22px; }
.form-label { font-size: 13.5px; font-weight: 600; margin-bottom: 8px; }
.form-hint { font-size: 12.5px; margin-top: 7px; }
.form-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
  padding: 12px 14px;
  border: 1px solid #FECACA;
  border-radius: 10px;
  background: #FEF2F2;
  color: #B91C1C;
  font-size: 13.5px;
}
.form-alert i { margin-top: 2px; }

.searchable-select-trigger { min-height: 44px; padding: 0 14px; border: 1px solid var(--border); border-radius: 8px; background: #FFFFFF; }
.searchable-select-trigger:hover { border-color: var(--border-strong); background: #FFFFFF; }
.searchable-select-trigger:focus,
.searchable-select.is-open .searchable-select-trigger { border-color: var(--border-strong); background: #FFFFFF; box-shadow: var(--ring); }
.searchable-select.is-open .searchable-select-trigger { border-radius: 8px; }
.select-placeholder { color: var(--text-muted); }
.trigger-chevron { color: var(--text-muted); }
.searchable-select.is-open .trigger-chevron { color: var(--ink); }
.select-dropdown-panel {
  top: calc(100% + 6px);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-pop);
  animation: refinedDrop 0.14s ease-out;
}
.select-search-box { background: #FFFFFF; padding: 10px 14px; transition: background var(--transition), border-color var(--transition); }
.select-search-box:focus-within { background: #FAFAFB; border-bottom-color: var(--border-strong); }
.select-option-item { padding: 9px 14px; }
.select-option-item:hover, .select-option-item.is-focused { background: var(--bg-input); color: var(--ink); }
.select-option-item.is-selected { background: var(--bg-input); color: var(--ink); }
.option-count { background: transparent; padding: 0; }
.selected-cat-badge { color: var(--ink); }

.btn-submit { height: 46px; padding: 0 22px; border-radius: 10px; background: var(--ink); font-size: 14.5px; font-weight: 600; box-shadow: none; }
.btn-submit:hover { background: var(--ink-soft); transform: none; box-shadow: none; }

/* --- Profile --- */
.profile-header { background: #FFFFFF; color: var(--ink); border: 1px solid var(--border); border-radius: 16px; padding: 28px 32px; }
.profile-header::before { display: none; }
.profile-info { gap: 22px; }
.profile-avatar { width: 80px; height: 80px; border: 1px solid var(--border); }
.profile-name { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }
.profile-username { font-size: 14px; color: var(--text-muted); margin-bottom: 0; }
.profile-stats-row { gap: 28px; margin-top: 14px; }
.profile-stat { text-align: left; }
.profile-stat-val { font-size: 18px; font-weight: 700; color: var(--ink); }
.profile-stat-label { font-size: 12px; color: var(--text-muted); text-transform: none; letter-spacing: 0; }
.profile-badge-tag { margin-top: 14px; padding: 4px 11px; background: var(--bg-sidebar); border: 1px solid var(--border); color: var(--text-secondary); font-size: 12.5px; font-weight: 600; }
.profile-badge-tag i { color: #D97706; }
.profile-tabs { width: 100%; gap: 26px; padding: 0; margin: 24px 0 16px; background: transparent; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; }
.profile-tab { padding: 12px 0; margin-bottom: -1px; border-radius: 0; border-bottom: 2px solid transparent; font-size: 14px; font-weight: 500; }
.profile-tab:hover { color: var(--ink); }
.profile-tab.active { background: transparent; color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }

/* --- Category page --- */
.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.025em; margin-bottom: 6px; }
.page-head p { font-size: 15px; color: var(--text-secondary); }
.category-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.category-card { padding: 20px; border: 1px solid var(--border); border-radius: 12px; display: block; }
.category-card::before { display: none; }
.category-card:hover { transform: none; border-color: var(--border-strong); box-shadow: 0 6px 18px -10px rgba(15, 23, 42, 0.14); }
.category-icon { width: 38px; height: 38px; border-radius: 9px; background: var(--bg-input); border: 1px solid var(--border); color: var(--ink); font-size: 15px; margin-bottom: 14px; }
.category-name { font-size: 15px; font-weight: 600; margin-bottom: 3px; color: var(--ink); }
.category-count { font-size: 13px; color: var(--text-muted); }

/* --- Toast, modal, back to top --- */
.toast { background: var(--ink); color: #F8FAFC; border: 0; border-radius: 10px; box-shadow: 0 14px 36px -10px rgba(15, 23, 42, 0.4); font-size: 13.5px; }
.toast.success, .toast.error, .toast.info { border-left: 0; }
.toast-icon { font-size: 15px; }
.toast.success .toast-icon { color: #34D399; }
.toast.error .toast-icon { color: #F87171; }
.toast.info .toast-icon { color: #93C5FD; }
.modal-overlay { background: rgba(15, 23, 42, 0.4); backdrop-filter: none; }
.modal-box { border-radius: 16px; border: 1px solid var(--border); box-shadow: var(--shadow-pop); }
.share-social-btn { border-color: var(--border); border-radius: 10px; }
.share-social-btn:hover { transform: none; box-shadow: none; border-color: var(--border-strong); }
.share-icon-wrap { width: 40px; height: 40px; font-size: 18px; }
.share-wa .share-icon-wrap { background: #25D366; }
.share-tg .share-icon-wrap { background: #229ED9; }
.share-tw .share-icon-wrap, .share-th .share-icon-wrap { background: #111111; }
.share-fb .share-icon-wrap { background: #1877F2; }
.share-url-box input { border: 1px solid var(--border); border-radius: 8px; }
.share-url-box button { border-radius: 8px; background: var(--ink); }
.share-url-box button:hover { background: var(--ink-soft); }
.back-to-top { width: 40px; height: 40px; background: #FFFFFF; color: var(--ink); border: 1px solid var(--border); box-shadow: 0 6px 18px -8px rgba(15, 23, 42, 0.2); font-size: 14px; }
.back-to-top:hover { transform: none; border-color: var(--border-strong); box-shadow: 0 6px 18px -8px rgba(15, 23, 42, 0.2); }

/* --- Footer (CPNS style + running marquee) --- */
.forum-footer {
  background-color: #1D2230;
  color: #9EA7B0;
  border-top: 0;
  margin-top: 72px;
  padding: 0;
  font-size: 14px;
}
.marquee-container {
  overflow: hidden;
  white-space: nowrap;
  box-sizing: border-box;
  background-color: #ff7675;
  color: #ffffff;
  padding: 8px 16px;
}
.marquee-text {
  display: inline-block;
  padding-left: 100%;
  animation: forumMarquee 50s linear infinite;
}
.marquee-text:hover {
  animation-play-state: paused;
}
@keyframes forumMarquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}
#bromax-ads {
  font-weight: 600;
  text-decoration: none;
  background: linear-gradient(90deg, #fbe482 0%, #fff5c2 25%, #fbe482 50%, #fff5c2 75%, #fbe482 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: bromaxShimmer 3.5s linear infinite;
}
@keyframes bromaxShimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.footer-cpns-body {
  padding: 48px 24px;
}
.footer-cpns-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 32px;
}
.footer-logo-link { background: transparent; padding: 0; border-radius: 0; box-shadow: none; margin-bottom: 14px; display: inline-block; }
.footer-logo { height: 36px; width: auto; filter: brightness(0) invert(1); opacity: 0.95; }
.footer-tagline { color: #9EA7B0; font-size: 14px; line-height: 1.65; margin-bottom: 0; }
.footer-col-title { color: #FFFFFF; font-size: 14px; font-weight: 700; letter-spacing: 0.01em; margin-bottom: 14px; }
.footer-cpns-col .footer-menu { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0; }
.footer-cpns-col .footer-menu li:not(:last-child) { margin-bottom: 8px; }
.footer-cpns-col .footer-menu a { color: #9EA7B0; font-size: 14px; text-decoration: none; }
.footer-cpns-col .footer-menu a:hover { color: #FFFFFF; text-decoration: underline; }

.footer-cpns-socials {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.footer-cpns-socials a { display: inline-flex; }

.store {
  background-color: #06070A;
  color: #FFFFFF;
  padding: 6px 15px;
  border: 1px solid #FFFFFF;
  border-radius: 5px;
  width: 170px;
  display: flex;
  align-items: center;
  text-align: left;
  margin-top: 14px;
}
.store-logo {
  width: 28px;
  height: 28px;
  margin-right: 10px;
  flex-shrink: 0;
}
.store-logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  line-height: 1;
}
.store-text span {
  font-size: 12.5px;
  display: block;
  line-height: 1.25;
}
.store-text span:nth-of-type(2) {
  font-size: 16px;
  font-weight: 600;
  margin-top: -2px;
}

.footer-cpns-bottom {
  background-color: #1A1E2B;
  border-top: 1px solid #2d3436;
  color: #F8FAFC;
  text-align: center;
  padding: 16px 20px;
  font-size: 14px;
}
.footer-cpns-bottom a {
  color: #FFFFFF;
  font-weight: 700;
  text-decoration: none;
}
.footer-cpns-bottom a:hover { text-decoration: underline; }

@media (max-width: 960px) {
  .footer-cpns-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .footer-cpns-grid { grid-template-columns: 1fr; text-align: center; }
  .footer-cpns-socials { justify-content: center; }
  .store { margin-left: auto; margin-right: auto; }
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .forum-layout { grid-template-columns: 1fr; gap: 0; }
  .sidebar { display: none; }
}
@media (max-width: 768px) {
  .nav-container { padding: 0 16px; gap: 12px; }
  .nav-logo { height: 32px; }
  .forum-main { padding: 22px 16px 48px; }
  .hero-board { padding: 20px 18px; border-radius: 14px; margin-bottom: 18px; }
  .hero-title { font-size: 22px; }
  .hero-subtitle { font-size: 14px; margin-bottom: 16px; }
  .hero-ask-bar { flex-wrap: nowrap; height: 50px; padding: 5px 5px 5px 12px; }
  .hero-ask-submit { width: auto; height: 38px; padding: 0 14px; }
  .sort-tabs, .profile-tabs { gap: 20px; overflow-x: auto; scrollbar-width: none; }
  .sort-tab, .profile-tab { white-space: nowrap; }
  .question-detail { padding: 20px 18px; }
  .answer-card, .answer-card.best-answer { padding: 18px 16px; }
  .qd-actions .action-btn-save span,
  .qd-actions .action-btn-share span { display: none; }
  .qd-actions .action-btn-save,
  .qd-actions .action-btn-share { width: 34px; padding: 0; justify-content: center; }
  .ask-card { padding: 26px 20px; }
  .profile-header { padding: 22px 20px; }
  .profile-stat { text-align: center; }
  .forum-footer { margin-top: 48px; }
}
@media (max-width: 480px) {
  .hero-ask-icon { display: none; }
  .question-card,
  .question-card.solved,
  .question-card.pinned { padding: 16px; }
  .qc-question { font-size: 15px; }
}

/* =====================================================================
   EDIT/DELETE MODALS, LEADERBOARD, & MATHJAX FORMULA BUILDER
   ===================================================================== */
.action-btn-danger:hover,
.action-btn-sm.action-btn-danger:hover {
  color: #B91C1C;
  border-color: #FECACA;
  background: #FEF2F2;
}
.modal-box-wide { max-width: 660px; }
.modal-desc { font-size: 13.5px; color: var(--text-muted); margin-bottom: 16px; }
.modal-footer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}
.btn-danger-solid {
  height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: #DC2626;
  color: #FFFFFF;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.btn-danger-solid:hover { background: #B91C1C; }

/* --- Leaderboard --- */
.leaderboard-wrap { max-width: 820px; margin: 0 auto; }
.my-rank-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-sidebar);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.my-rank-left { display: flex; align-items: center; gap: 14px; }
.my-rank-name { font-size: 15px; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.my-rank-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.my-rank-right { display: flex; align-items: center; gap: 24px; }
.my-rank-stat { text-align: right; }
.my-rank-val { display: block; font-size: 18px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.my-rank-label { display: block; font-size: 12px; color: var(--text-muted); }

.lb-points-guide {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding: 10px 14px;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: #FFFFFF;
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}
.lb-points-guide strong { color: var(--ink); }

.lb-card { border: 1px solid var(--border); border-radius: 14px; background: #FFFFFF; overflow: hidden; }
.lb-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  transition: background var(--transition);
}
.lb-row:last-child { border-bottom: 0; }
.lb-row:hover { background: var(--bg-sidebar); color: var(--ink); }
.lb-row.is-me { background: #F8FAFF; }
.lb-rank {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-input);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.lb-rank.top-1 { background: #FEF3C7; color: #92400E; }
.lb-rank.top-2 { background: #E2E8F0; color: #334155; }
.lb-rank.top-3 { background: #FFEDD5; color: #9A3412; }
.lb-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); flex-shrink: 0; }
.lb-user { flex: 1; min-width: 0; }
.lb-name { font-size: 14.5px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 6px; }
.lb-meta { font-size: 12.5px; color: var(--text-muted); margin-top: 1px; }
.lb-badge, .lb-me-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.lb-me-tag { background: #EFF6FF; border-color: #BFDBFE; color: #1D4ED8; }
.lb-points { text-align: right; flex-shrink: 0; }
.lb-poin-val { display: block; font-size: 15px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.lb-poin-label { display: block; font-size: 11px; color: var(--text-muted); }

/* Sidebar Leaderboard Widget */
.sidebar-lb-list { display: flex; flex-direction: column; gap: 4px; }
.sidebar-lb-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 7px;
  color: var(--text-secondary);
  font-size: 13px;
  transition: background var(--transition);
}
.sidebar-lb-item:hover { background: var(--bg-input); color: var(--ink); }
.sidebar-lb-rank { width: 16px; font-size: 12px; font-weight: 700; color: var(--text-muted); text-align: center; }
.sidebar-lb-avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); flex-shrink: 0; }
.sidebar-lb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; color: var(--ink); }
.sidebar-lb-poin { font-size: 12px; font-weight: 600; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* --- MathJax & Visual Formula Builder --- */
mjx-container { max-width: 100%; overflow-x: auto; overflow-y: hidden; }
mjx-container[jax="CHTML"][display="true"] { margin: 12px 0 !important; padding: 6px 0; }

.btn-math-inline {
  margin-right: auto;
  height: 32px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #FFFFFF;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.tox .tox-tbtn--bespoke,
.tox .tox-tbtn {
  align-items: center !important;
}
.tox .tox-tbtn__icon-wrap + .tox-tbtn__select-label {
  margin-left: 4px;
  line-height: 1;
}
.btn-math-inline:hover { border-color: var(--border-strong); color: var(--ink); background: var(--bg-input); }

.math-modal-box { max-width: 720px; padding: 26px 28px; }
.math-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}
.math-tab {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #FFFFFF;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}
.math-tab:hover { border-color: var(--border-strong); color: var(--ink); }
.math-tab.active { background: var(--ink); border-color: var(--ink); color: #FFFFFF; font-weight: 600; }

.math-templates {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.math-tpl-btn {
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg-sidebar);
  color: var(--ink);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.math-tpl-btn:hover { border-color: var(--border-strong); background: var(--bg-input); }

.math-editor-row { margin-bottom: 14px; }
.math-field-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.math-field-label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.math-mode-toggle { display: flex; align-items: center; gap: 14px; font-size: 12.5px; color: var(--text-secondary); }
.math-mode-opt { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.math-mode-opt code { background: var(--bg-input); padding: 1px 5px; border-radius: 4px; font-size: 11.5px; color: var(--ink); }

.math-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #FFFFFF;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13.5px;
  color: var(--ink);
  resize: vertical;
  outline: none;
}
.math-input:focus { border-color: var(--border-strong); box-shadow: var(--ring); }

.math-preview-wrap { margin-bottom: 6px; }
.math-preview-box {
  margin-top: 6px;
  min-height: 58px;
  padding: 12px 16px;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: var(--bg-sidebar);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--ink);
  overflow-x: auto;
}
.math-preview-empty { font-size: 13px; color: var(--text-muted); }

/* --- Live combined text + MathJax preview --- */
.live-math-preview {
  margin-top: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-sidebar);
}
.live-math-preview-head {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.live-math-preview-body {
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink);
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.live-math-preview-body p { margin-bottom: 8px; }
.live-math-preview-body p:last-child { margin-bottom: 0; }

@media (max-width: 600px) {
  .lb-row { padding: 12px 14px; gap: 10px; }
  .math-modal-box { padding: 20px 18px; }
}
