/* ===================================================
   StudyConnect Premium Design System
   Glassmorphism / Linear / Discord / Vercel
   =================================================== */

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

:root {
  --bg: #111110;
  --amber: #EA8528;
  --amber-glow: rgba(234, 133, 40, 0.20);
  --amber-glow-soft: rgba(234, 133, 40, 0.08);

  --glass: rgba(255, 255, 255, 0.03);
  --glass-hover: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-hover: rgba(255, 255, 255, 0.15);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);

  --text-1: rgba(255, 255, 255, 0.95);
  --text-2: rgba(255, 255, 255, 0.68);
  --text-3: rgba(255, 255, 255, 0.50);

  --success: #4ade80;
  --points-gold: #F5C518;
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.2);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Base & Reset --- */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg);
  color: var(--text-1);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* Typography Scale Override */
h1, .h1 {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  color: var(--text-1);
}

h2, .h2 {
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--text-1);
}

h3, .h3 {
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-1);
}

p {
  line-height: 1.65;
  color: var(--text-2);
}


/* =================================================
   GLOBAL LAYOUT & CONTAINMENT
   ================================================= */
.app-layout-container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding-left: 32px;
  padding-right: 32px;
  position: relative;
}

@media (min-width: 1600px) {
  .app-layout-container {
    max-width: 100%;
  }
}

@media (max-width: 992px) {
  .app-layout-container {
    padding-left: 24px;
    padding-right: 24px;
  }
}

@media (max-width: 576px) {
  .app-layout-container {
    padding-left: 16px;
    padding-right: 16px;
  }
}


/* Adjust page content top padding to account for sticky navbar */
.main-content {
  padding-top: 24px;
  min-height: calc(100vh - 160px);
}


/* Ambient glow orbs in background */
body::before {
  content: '';
  position: fixed;
  top: -15%;
  left: 20%;
  width: 45vw;
  height: 45vw;
  background: radial-gradient(circle, var(--amber-glow-soft) 0%, transparent 70%);
  z-index: -1;
  pointer-events: none;
  filter: blur(80px);
}

body::after {
  content: '';
  position: fixed;
  bottom: -15%;
  right: 15%;
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, rgba(234, 133, 40, 0.04) 0%, rgba(74, 222, 128, 0.015) 50%, transparent 70%);
  z-index: -1;
  pointer-events: none;
  filter: blur(80px);
}


/* Links */
a {
  color: var(--amber);
  text-decoration: none;
  transition: color var(--transition-normal);
}
a:hover {
  color: #f19d4b;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* =================================================
   GLASSMORPHISM CARDS
   ================================================= */
.glass-card {
  background: rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 2rem !important;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  transition: all var(--transition-bounce);
  position: relative;
  overflow: hidden;
}

.glass-card:hover {
  border-color: rgba(234, 133, 40, 0.25) !important;
  box-shadow: 0 12px 40px rgba(234, 133, 40, 0.12) !important;
  transform: translateY(-4px) scale(1.01) !important;
}


/* Remove hover effects for static boxes */
.glass-card.no-hover:hover,
.profile-header:hover,
.filter-bar:hover,
.how-it-works:hover,
.leaderboard-widget:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--glass-border);
}

/* =================================================
   NAVIGATION BAR
   ================================================= */
.glass-nav {
  position: sticky !important;
  top: 24px !important;
  margin-top: 24px;
  margin-bottom: 40px; /* spacing after navbar */
  background: rgba(17, 17, 16, 0.75) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border) !important;
  border-radius: var(--radius-lg) !important;
  padding: 0.65rem 1.5rem !important;
  z-index: 1050;
  max-width: 1360px !important;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  transition: all var(--transition-normal);
  box-sizing: border-box !important;
}

.glass-nav .container-fluid {
  padding-left: 0 !important;
  padding-right: 0 !important;
  max-width: 100% !important;
}

/* Official StudyConnect Wordmark & Navbar Branding */
.navbar-brand {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.navbar-brand img {
  display: block;
}

.brand-text {
  display: flex;
  align-items: center;
  margin-left: 10px;
  font-family: Inter, Manrope, Satoshi, sans-serif;
  font-weight: 800;
  font-size: 1.7rem;
  letter-spacing: -0.02em;
  line-height: 1;
}

.brand-study {
  color: #FFFFFF;
}

.brand-connect {
  color: #EA8528;
}

@media (max-width: 768px) {
  .brand-text {
    font-size: 1.35rem;
    margin-left: 8px;
  }
}

@media (max-width: 576px) {
  .brand-text {
    font-size: 1.15rem;
    margin-left: 6px;
  }
}

/* Three Section Navbar Layout - Strictly Single Row */
.glass-nav .container-fluid,
.glass-nav .navbar-collapse,
.navbar-center,
.glass-nav .navbar-nav {
  flex-wrap: nowrap !important;
}

.navbar-center {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}

.navbar-right {
  flex-shrink: 0 !important;
}

@media (max-width: 1399px) {
  .navbar-center {
    gap: 0.75rem;
  }
  .glass-nav .navbar-nav {
    gap: 2px !important;
  }
  .glass-nav .nav-link {
    padding: 0.4rem 0.45rem !important;
    font-size: 0.85rem !important;
  }
  .nav-search-wrapper {
    width: 200px !important;
    min-width: 140px !important;
  }
}

@media (max-width: 1199px) {
  .navbar-center {
    gap: 0.5rem;
  }
  .nav-search-wrapper {
    width: 160px !important;
    min-width: 120px !important;
  }
  .glass-nav .nav-link {
    padding: 0.35rem 0.35rem !important;
    font-size: 0.8rem !important;
  }
}

@media (max-width: 768px) {
  .glass-nav {
    top: 16px !important;
    margin-top: 16px;
  }
}

@media (max-width: 576px) {
  .glass-nav {
    top: 12px !important;
    margin-top: 12px;
    padding: 0.5rem 1.0rem !important;
  }
}


/* =================================================
   MOBILE FULLSCREEN OVERLAY MENU
   ================================================= */

/* Scroll lock when menu open */
body.mobile-menu-open {
  overflow: hidden !important;
  position: fixed !important;
  width: 100% !important;
}

/* Full-viewport overlay — sits above everything */
.mobile-menu-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100dvh !important;         /* dynamic viewport height for mobile */
  z-index: 9999 !important;
  /* Frosted glass — overlay is outside nav so backdrop-filter works correctly */
  background: rgba(14, 12, 10, 0.72) !important;
  backdrop-filter: blur(80px) saturate(160%) !important;
  -webkit-backdrop-filter: blur(80px) saturate(160%) !important;
  display: flex !important;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  /* Hidden state */
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-100%);
  transition:
    opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0s linear 0.35s;
}

/* Open state */
.mobile-menu-overlay.is-open {
  visibility: visible;
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
  transition:
    opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0s linear 0s;
}

/* Subtle amber radial glow accent in background */
.mobile-menu-overlay::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 90vw;
  height: 50vh;
  background: radial-gradient(ellipse at 50% 0%, rgba(234, 133, 40, 0.08) 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
}

/* ---- Header Row: Logo + Close ---- */
.mobile-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

.mobile-menu-brand {
  display: flex;
  align-items: center;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
}

/* Close button — amber pill like reference image */
.mobile-close-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--amber) !important;
  color: #111110 !important;
  border: none;
  border-radius: var(--radius-full);
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-bounce);
  flex-shrink: 0;
}

.mobile-close-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(234, 133, 40, 0.4);
}

.mobile-close-btn i {
  font-size: 0.85rem;
}

/* ---- Nav Links: divider style like reference image ---- */
.mobile-nav-links {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 0.5rem 0;
  position: relative;
  z-index: 1;
  /* Ensure dividers are inset from both edges equally */
  margin: 0;
}

.mobile-link {
  display: block;
  padding: 1.15rem 1.5rem;
  font-size: 1.25rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.80);
  text-decoration: none !important;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  transition: color 0.18s ease, background 0.18s ease;
  letter-spacing: -0.01em;
  box-sizing: border-box;
  width: 100%;
}

.mobile-link:first-child {
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.mobile-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}

.mobile-link.active {
  color: var(--amber) !important;
  font-weight: 600;
  background: rgba(234, 133, 40, 0.06);
}

.mobile-link.active:hover {
  background: rgba(234, 133, 40, 0.1);
}

/* ---- CTA Footer ---- */
.mobile-menu-footer {
  padding: 1.75rem 1.5rem 2.5rem;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

.mobile-cta-btn {
  background: var(--amber) !important;
  color: #111110 !important;
  border: none !important;
  border-radius: var(--radius-full) !important;
  padding: 0.9rem 1.5rem !important;
  font-size: 1rem !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 20px rgba(234, 133, 40, 0.3);
  transition: all var(--transition-bounce) !important;
}

.mobile-cta-btn:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 28px rgba(234, 133, 40, 0.45) !important;
  color: #111110 !important;
}

.mobile-footer-link {
  font-size: 0.9rem;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.mobile-footer-link:hover {
  opacity: 1;
}


.brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--amber);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  color: #111110;
  box-shadow: 0 0 15px var(--amber-glow);
}

.brand-text {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-1);
  letter-spacing: -0.5px;
}

.brand-accent {
  color: var(--amber);
}

/* Navigation Links */
.glass-nav .navbar-nav {
  gap: 6px;
}

@media (min-width: 1400px) {
  .glass-nav .navbar-nav {
    gap: 10px;
  }
}

.glass-nav .nav-link {
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.4rem 0.65rem !important;
  transition: all var(--transition-normal);
  position: relative;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

@media (min-width: 1400px) {
  .glass-nav .nav-link {
    padding: 0.4rem 0.8rem !important;
  }
}

.glass-nav .nav-link i {
  color: var(--text-2);
  transition: color var(--transition-normal);
}

.glass-nav .nav-link:hover {
  color: var(--text-1);
  text-shadow: 0 0 8px var(--amber-glow);
}

.glass-nav .nav-link:hover i {
  color: var(--text-1);
}

.glass-nav .nav-item.active .nav-link,
.glass-nav .nav-link.active {
  color: var(--amber) !important;
}

.glass-nav .nav-item.active .nav-link i,
.glass-nav .nav-link.active i {
  color: var(--amber) !important;
}

.glass-nav .nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 2px;
  background-color: var(--amber);
  transition: all var(--transition-normal);
  transform: translateX(-50%);
}

.glass-nav .nav-link:hover::after,
.glass-nav .nav-link.active::after {
  width: 80%;
}

/* User dropdown */
.glass-dropdown {
  background: rgba(17, 17, 16, 0.95) !important;
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--glass-shadow) !important;
  padding: 0.5rem !important;
  margin-top: 0.5rem !important;
}

.glass-dropdown .dropdown-item {
  color: var(--text-2);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.8rem;
  transition: all var(--transition-normal);
}

.glass-dropdown .dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-1);
}

.glass-dropdown .dropdown-item.active,
.glass-dropdown .dropdown-item:active {
  background: rgba(234, 133, 40, 0.15) !important;
  color: var(--amber) !important;
  font-weight: 600;
}

.glass-dropdown .dropdown-item.active i,
.glass-dropdown .dropdown-item:hover i {
  color: var(--amber) !important;
}

.glass-dropdown .dropdown-item.text-danger:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger) !important;
}

/* Hide Bootstrap default caret */
.community-dropdown .dropdown-toggle::after {
  display: none !important;
}

/* Chevron animation & color */
.community-chevron {
  font-size: 0.8rem;
  color: var(--text-3);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s ease;
}

.community-dropdown:hover .community-chevron,
.community-dropdown .dropdown-toggle[aria-expanded="true"] .community-chevron,
.community-dropdown .nav-link.active .community-chevron {
  transform: rotate(180deg);
  color: var(--amber);
}

.community-dropdown:hover .nav-link,
.community-dropdown .dropdown-toggle[aria-expanded="true"] {
  color: var(--text-1) !important;
}

/* Indicator dot */
.community-indicator-dot {
  width: 6px;
  height: 6px;
  background-color: var(--amber);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--amber);
  position: absolute;
  top: -2px;
  right: -8px;
}

/* Larger Dropdown Panel */
.community-dropdown-menu {
  width: 340px !important;
  min-width: 340px !important;
  max-width: 90vw !important;
  padding: 0.75rem !important;
  border-radius: var(--radius-lg) !important;
  background: rgba(15, 15, 20, 0.94) !important;
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.1), 0 0 24px rgba(234, 133, 40, 0.12) !important;
}

/* Dropdown Animation */
.glass-dropdown.show {
  animation: dropdownFadeSlideIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes dropdownFadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Modern Navigation Rows & Spacing */
.community-dropdown-menu li:not(:last-child) {
  margin-bottom: 16px !important;
}

.community-menu-item {
  color: var(--text-2);
  border: 1px solid transparent;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  text-decoration: none !important;
  overflow: hidden;
  max-width: 100%;
}

.community-item-icon {
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.2s ease;
}

.community-item-content {
  overflow: hidden;
  max-width: calc(100% - 58px);
}

.community-item-desc {
  white-space: normal !important;
  overflow-wrap: break-word !important;
  word-break: normal !important;
  line-height: 1.45 !important;
  color: var(--text-3);
  transition: color 0.2s ease;
}

.community-menu-item:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  transform: translateX(3px);
  color: var(--text-1) !important;
}

.community-menu-item:hover .community-item-icon {
  background: rgba(234, 133, 40, 0.15);
  color: var(--amber);
  border-color: rgba(234, 133, 40, 0.3);
}

.community-menu-item:hover .community-item-title {
  color: var(--amber) !important;
}

.community-menu-item:hover .community-item-desc {
  color: rgba(255, 255, 255, 0.75);
}

.community-menu-item.active {
  background: rgba(234, 133, 40, 0.12) !important;
  border-color: rgba(234, 133, 40, 0.28) !important;
  color: var(--text-1) !important;
}

.community-menu-item.active .community-item-icon {
  background: rgba(234, 133, 40, 0.2);
  color: var(--amber);
  border-color: rgba(234, 133, 40, 0.4);
}

.community-menu-item.active .community-item-title {
  color: var(--amber) !important;
}

.nav-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  transition: all var(--transition-normal);
}

.nav-avatar:hover {
  border-color: var(--amber);
}

/* Search input bar integration */
.nav-search-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 260px;
  min-width: 140px;
  max-width: 320px;
  flex: 1 1 260px;
}

.nav-search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.nav-search-box .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  font-size: 0.85rem;
  pointer-events: none;
  transition: color var(--transition-normal);
  z-index: 2;
}

.nav-search-input {
  width: 100%;
  height: 36px;
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid var(--glass-border) !important;
  border-radius: 20px !important;
  padding: 0 1rem 0 2.5rem !important;
  color: var(--text-1) !important;
  font-size: 0.85rem !important;
  transition: all var(--transition-bounce) !important;
  outline: none !important;
}

.nav-search-input:focus {
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: var(--amber) !important;
  box-shadow: 0 0 15px var(--amber-glow) !important;
  color: #fff !important;
}

.nav-search-input:focus + .search-icon {
  color: var(--amber) !important;
}

.nav-search-input::placeholder {
  color: var(--text-3) !important;
}

/* Floating Autocomplete Overlay */
.search-results-dropdown {
  position: absolute !important;
  top: calc(100% + 8px) !important;
  left: 0 !important;
  width: 100% !important;
  max-height: 350px;
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(17, 17, 16, 0.96) !important;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--amber) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(234, 133, 40, 0.15) !important;
  z-index: 9999 !important;
  padding: 0.4rem !important;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scroll-behavior: smooth;
  animation: searchDropdownFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Custom sleek scrollbar for results */
.search-results-dropdown::-webkit-scrollbar {
  width: 5px;
}
.search-results-dropdown::-webkit-scrollbar-track {
  background: transparent;
}
.search-results-dropdown::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
.search-results-dropdown::-webkit-scrollbar-thumb:hover {
  background: var(--amber);
}

/* Compact Premium Result Cards */
.search-result-item {
  display: flex;
  flex-direction: column;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  text-decoration: none !important;
  transition: all var(--transition-normal);
  cursor: pointer;
}

.search-result-item:hover, .search-result-item.focused {
  background: rgba(234, 133, 40, 0.1) !important;
  border-color: rgba(234, 133, 40, 0.3) !important;
  transform: translateX(2px);
}

.search-result-title {
  color: var(--text-1);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.3rem;
  line-height: 1.3;
}

.search-result-item:hover .search-result-title, .search-result-item.focused .search-result-title {
  color: var(--amber);
}

.search-result-meta {
  display: flex;
  align-items: center;
  font-size: 0.72rem;
  color: var(--text-2);
}

.search-result-meta .tag {
  font-size: 0.65rem !important;
  padding: 0.1rem 0.45rem !important;
}

/* Empty state styling */
.search-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--text-2);
  font-size: 0.85rem;
}

.search-empty-state i {
  font-size: 1.5rem;
  color: var(--text-3);
  margin-bottom: 0.5rem;
}


/* =================================================
   FLASH ALERTS — CAPSULE STYLE
   ================================================= */
.flash-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  z-index: 10000;
  position: fixed;
  top: 104px;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  max-width: 90vw;
  pointer-events: none;
}

@media (max-width: 768px) {
  .flash-container {
    top: 85px;
  }
}

/* Base capsule pill */
.glass-alert,
.glass-alert.alert {
  pointer-events: auto;
  display: inline-flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 0.55rem 1rem 0.55rem 1.1rem !important;
  border-radius: 9999px !important;   /* Strict capsule pill */
  font-size: 0.875rem !important;
  font-weight: 500 !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  animation: flashSlideDown 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  width: fit-content !important;
  max-width: calc(100vw - 32px) !important;
  margin: 0 auto !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45) !important;
}

@keyframes flashSlideDown {
  from { opacity: 0; transform: translateY(-12px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Icon */
.flash-icon {
  display: inline-flex !important;
  align-items: center !important;
  flex-shrink: 0 !important;
  font-size: 1rem !important;
}

/* Text */
.flash-text {
  flex: 1 !important;
  line-height: 1.4 !important;
  white-space: normal !important;
}

/* X close button — ONLY the X mark, NO square box, NO background, NO border */
.flash-close,
.glass-alert .btn-close,
.glass-alert button {
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  color: inherit !important;
  font-size: 0.9rem !important;
  cursor: pointer !important;
  padding: 0 0 0 6px !important;
  margin: 0 !important;
  opacity: 0.75 !important;
  line-height: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  width: auto !important;
  height: auto !important;
  filter: none !important;
  border-radius: 0 !important;
}

.flash-close:hover,
.glass-alert .btn-close:hover {
  opacity: 1 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  transform: scale(1.15);
}

/* ---- Per-category colours ---- */
.glass-alert-success {
  background: rgba(20, 35, 25, 0.85) !important;
  border-color: rgba(74, 222, 128, 0.4) !important;
  color: #4ade80 !important;
  box-shadow: 0 8px 25px rgba(74, 222, 128, 0.15) !important;
}

.glass-alert-danger {
  background: rgba(35, 20, 20, 0.85) !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
  color: #f87171 !important;
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.15) !important;
}

.glass-alert-warning {
  background: rgba(35, 25, 15, 0.85) !important;
  border-color: rgba(234, 133, 40, 0.4) !important;
  color: #EA8528 !important;
  box-shadow: 0 8px 25px rgba(234, 133, 40, 0.15) !important;
}

.glass-alert-info {
  background: rgba(18, 28, 42, 0.85) !important;
  border-color: rgba(96, 165, 250, 0.4) !important;
  color: #60a5fa !important;
  box-shadow: 0 8px 25px rgba(96, 165, 250, 0.15) !important;
}


/* =================================================
   BUTTONS
   ================================================= */
.btn {
  border-radius: var(--radius-sm);
  padding: 0.5rem 1.25rem;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all var(--transition-bounce);
}

/* Premium CTA Hero Buttons */
.hero-actions .btn {
  height: 50px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: var(--radius-md) !important; /* 12px */
  padding: 0 1.85rem !important;
  font-size: 0.95rem !important;
  transition: all var(--transition-bounce) !important;
}

.hero-actions .btn-glow:hover,
.hero-actions .btn-primary:hover {
  transform: translateY(-3px) scale(1.02) !important;
  box-shadow: 0 8px 24px rgba(234, 133, 40, 0.4) !important;
}

.hero-actions .btn-glass:hover,
.hero-actions .btn-secondary:hover {
  transform: translateY(-3px) scale(1.02) !important;
  box-shadow: 0 8px 24px rgba(255, 255, 255, 0.1) !important;
}


/* Primary Amber Button */
.btn-glow, .btn-primary {
  background: var(--amber) !important;
  color: #111110 !important;
  border: none !important;
  box-shadow: 0 4px 14px rgba(234, 133, 40, 0.15);
}

.btn-glow:hover, .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(234, 133, 40, 0.35);
  color: #111110 !important;
}

.btn-glow:active, .btn-primary:active {
  transform: translateY(0);
}

/* Secondary Glass Button */
.btn-glass, .btn-outline-light, .btn-secondary {
  background: var(--glass) !important;
  border: 1px solid var(--glass-border) !important;
  color: var(--text-1) !important;
}

.btn-glass:hover, .btn-outline-light:hover, .btn-secondary:hover {
  background: var(--glass-hover) !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
  color: #fff !important;
  transform: translateY(-1px);
}

/* Success Button */
.btn-success {
  background: rgba(74, 222, 128, 0.15) !important;
  border: 1px solid rgba(74, 222, 128, 0.3) !important;
  color: var(--success) !important;
}

.btn-success:hover {
  background: rgba(74, 222, 128, 0.25) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(74, 222, 128, 0.15);
}

/* Danger Button */
.btn-danger {
  background: rgba(239, 68, 68, 0.15) !important;
  border: 1px solid rgba(239, 68, 68, 0.3) !important;
  color: var(--danger) !important;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--danger-glow);
}

/* =================================================
   FORMS & INPUTS
   ================================================= */
.glass-input, .form-control, .form-select {
  background: rgba(255, 255, 255, 0.02) !important;
  border: 1px solid var(--glass-border) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--text-1) !important;
  transition: all var(--transition-normal) !important;
  padding: 0.65rem 0.9rem !important;
  font-size: 0.9rem !important;
}

.glass-input:focus, .form-control:focus, .form-select:focus {
  background: rgba(255, 255, 255, 0.04) !important;
  border-color: var(--amber) !important;
  box-shadow: 0 0 0 3px rgba(234, 133, 40, 0.15) !important;
  outline: none !important;
}

.glass-input::placeholder, .form-control::placeholder {
  color: var(--text-3) !important;
}

/* WTForms Form checks */
.form-check-input {
  background-color: var(--glass) !important;
  border: 1px solid var(--glass-border) !important;
  cursor: pointer;
}
.form-check-input:checked {
  background-color: var(--amber) !important;
  border-color: var(--amber) !important;
}

/* =================================================
   BADGES
   ================================================= */
.tag, .badge {
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  font-size: 0.725rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  border: 1px solid transparent;
}

/* Profile Stat Streak fallback */
.profile-stat.streak-active {
  background: rgba(234, 133, 40, 0.1) !important;
  border: 1px solid rgba(234, 133, 40, 0.25) !important;
  color: var(--amber) !important;
}

/* Navbar Premium Status Pills (Streak 🔥 & Points ⭐) */
.nav-streak-badge, .nav-points-badge {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 36px !important;
  padding: 0 0.85rem !important;
  border-radius: var(--radius-full) !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.3px !important;
  transition: all var(--transition-bounce) !important;
  cursor: default;
  user-select: none;
  background: rgba(234, 133, 40, 0.1) !important;
  border: 1px solid rgba(234, 133, 40, 0.25) !important;
  color: var(--amber) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  gap: 6px !important;
}

.nav-streak-badge i, .nav-points-badge i {
  color: var(--amber) !important;
  margin: 0 !important;
  font-size: 0.95rem;
}

.nav-streak-badge:hover, .nav-points-badge:hover {
  background: rgba(234, 133, 40, 0.18) !important;
  border-color: rgba(234, 133, 40, 0.45) !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(234, 133, 40, 0.25);
  color: #fff !important;
}

.nav-streak-badge:hover i, .nav-points-badge:hover i {
  color: var(--amber) !important;
}

/* Navbar Ask Button height alignment */
.glass-nav .btn-sm {
  height: 36px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 1.1rem !important;
}

/* Subject Badges */
.tag-subject {
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid var(--glass-border) !important;
  color: var(--text-2) !important;
}

/* Exam Badges */
.tag-exam {
  background: rgba(234, 133, 40, 0.06) !important;
  border: 1px solid rgba(234, 133, 40, 0.15) !important;
  color: var(--amber) !important;
}

/* Accepted Badges */
.badge-resolved {
  background: rgba(74, 222, 128, 0.1) !important;
  border: 1px solid rgba(74, 222, 128, 0.25) !important;
  color: var(--success) !important;
}

/* =================================================
   HOMEPAGE & HERO
   ================================================= */
.hero-section {
  background: transparent;
  padding: 1.5rem 0 3rem;
  position: relative;
}

@media (min-width: 992px) {
  .hero-section {
    padding: 6rem 0 3rem;
  }
}

.hero-title {
  font-size: 3.75rem;
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1.1;
  color: var(--text-1);
}

.gradient-text {
  background: linear-gradient(135deg, var(--amber) 0%, #ffae58 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  color: var(--text-2);
  font-size: 1.15rem;
  line-height: 1.6;
  max-width: 520px;
}

.hero-actions .btn {
  padding: 0.75rem 1.75rem;
  font-size: 0.95rem;
}

.hero-stats {
  margin-top: 3.5rem;
  display: flex;
  gap: 2.5rem;
  align-items: center;
}

.hero-stat-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-1);
}

.hero-stat-label {
  font-size: 0.75rem;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.hero-stat-divider {
  width: 1px;
  height: 35px;
  background-color: var(--glass-border);
}

/* Hero card illustrations */
.hero-mock-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--glass-shadow);
}
.hero-mock-card-2 {
  border-color: rgba(74, 222, 128, 0.25);
  box-shadow: 0 4px 20px rgba(74, 222, 128, 0.05);
}

/* =================================================
   QUESTION & ANSWER SYSTEM
   ================================================= */
.questions-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.question-card-title {
  color: var(--text-1);
  font-weight: 700;
  transition: color var(--transition-normal);
}

.question-card:hover .question-card-title {
  color: var(--amber);
}

.question-card-preview {
  color: var(--text-2);
}

/* Answer Card Styling */
.answer-card {
  border: 1px solid var(--glass-border);
  background: var(--glass);
}

.answer-card.answer-accepted {
  border-color: rgba(74, 222, 128, 0.3) !important;
  background: rgba(74, 222, 128, 0.02) !important;
  box-shadow: 0 0 20px rgba(74, 222, 128, 0.05);
}

.accepted-label {
  color: var(--success);
  font-size: 0.85rem;
  font-weight: 600;
}

.markdown-body {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.95rem;
  line-height: 1.7;
}

.markdown-body code {
  background: rgba(255, 255, 255, 0.06);
  color: var(--amber);
  border-radius: 4px;
  padding: 0.15rem 0.35rem;
}

/* ===================================================
   REDESIGNED VOTE BUTTONS — Modern Circular Style
   =================================================== */
.vote-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-right: 1.25rem;
  min-width: 44px;
}

.vote-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: var(--text-3) !important;
  font-size: 0.9rem !important;
  cursor: pointer;
  transition: all var(--transition-bounce) !important;
  line-height: 1 !important;
  padding: 0 !important;
}

.vote-btn:hover {
  background: rgba(234, 133, 40, 0.12) !important;
  border-color: rgba(234, 133, 40, 0.4) !important;
  color: var(--amber) !important;
  transform: scale(1.08) !important;
  box-shadow: 0 0 12px rgba(234, 133, 40, 0.2) !important;
}

.vote-btn.vote-up:hover {
  background: rgba(234, 133, 40, 0.12) !important;
  border-color: rgba(234, 133, 40, 0.5) !important;
  color: var(--amber) !important;
}

.vote-btn.vote-down:hover {
  background: rgba(239, 68, 68, 0.1) !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
  color: var(--danger) !important;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.15) !important;
}

.vote-btn.voted.vote-up {
  background: rgba(234, 133, 40, 0.18) !important;
  border-color: var(--amber) !important;
  color: var(--amber) !important;
  box-shadow: 0 0 14px rgba(234, 133, 40, 0.3) !important;
}

.vote-btn.voted.vote-down {
  background: rgba(239, 68, 68, 0.14) !important;
  border-color: var(--danger) !important;
  color: var(--danger) !important;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.25) !important;
}

.vote-btn:disabled {
  opacity: 0.4 !important;
  cursor: not-allowed !important;
  transform: none !important;
}

.vote-score {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1;
  min-width: 20px;
  text-align: center;
}

/* Accept button - check circle style */
.accept-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 36px !important;
  height: 36px !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: var(--text-3) !important;
  font-size: 1rem !important;
  cursor: pointer;
  transition: all var(--transition-bounce) !important;
  padding: 0 !important;
  margin-top: 4px !important;
}

.accept-btn:hover {
  background: rgba(74, 222, 128, 0.1) !important;
  border-color: rgba(74, 222, 128, 0.4) !important;
  color: var(--success) !important;
  transform: scale(1.08) !important;
}

.accept-btn.accepted {
  background: rgba(74, 222, 128, 0.15) !important;
  border-color: var(--success) !important;
  color: var(--success) !important;
  box-shadow: 0 0 14px rgba(74, 222, 128, 0.2) !important;
}

.accepted-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--success);
  margin-top: 4px;
}

/* =================================================
   LEADERBOARD & PODIUM
   ================================================= */
.podium-section {
  padding: 3rem 1.5rem 2rem;
  border-bottom: 1px solid var(--glass-border);
}

.podium-item a {
  display: block;
}

.podium-avatar {
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: var(--glass-shadow);
  transition: all var(--transition-normal);
}

.podium-avatar-lg {
  border: 3.5px solid var(--amber) !important;
  box-shadow: 0 0 30px var(--amber-glow) !important;
}

.podium-silver .podium-avatar {
  border-color: #A0A0A0;
}

.podium-bronze .podium-avatar {
  border-color: #CD7F32;
}

.podium-crown {
  color: var(--amber);
}

.podium-points {
  color: var(--amber);
}

/* Leaderboard Rows */
.leaderboard-row {
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.leaderboard-row:hover {
  background: rgba(255, 255, 255, 0.02);
}

.leaderboard-row-points {
  color: var(--amber);
}

/* =================================================
   TOASTS & ALERTS
   ================================================= */
.toast-notification {
  background: rgba(17, 17, 16, 0.95);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--glass-shadow);
}

.toast-icon.toast-points {
  color: var(--points-gold);
}

.toast-icon.toast-success {
  color: var(--success);
}

.toast-icon.toast-error {
  color: var(--danger);
}

/* =================================================
   PROFILE & HISTORY
   ================================================= */
.profile-stats-grid .profile-stat-box {
  background: rgba(255, 255, 255, 0.01);
}

.profile-stat-number {
  color: var(--amber);
}

.glass-tabs {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
}

.glass-tabs .nav-link.active {
  background: var(--amber) !important;
  color: #111110 !important;
}

/* Points history sidebar rows */
.points-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

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

/* =================================================
   RESPONSIVE LAYOUT adjustments
   ================================================= */
@media (max-width: 991.98px) {
  .hero-title {
    font-size: 2.75rem;
  }
  .nav-search-wrapper, .nav-search-box {
    margin: 0.75rem 0;
    width: 100%;
    max-width: 100%;
  }
}

/* =================================================
   AMBENT HERO ORBS & ILLUSTATIONS
   ================================================= */
.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.25;
  pointer-events: none;
}

.hero-orb-1 {
  width: 300px;
  height: 300px;
  background: var(--amber);
  top: 10%;
  left: -5%;
  animation: float-orb 12s ease-in-out infinite;
}

.hero-orb-2 {
  width: 250px;
  height: 250px;
  background: #ffae58;
  bottom: 10%;
  right: -5%;
  animation: float-orb 15s ease-in-out infinite reverse;
}

.hero-orb-3 {
  width: 180px;
  height: 180px;
  background: var(--success);
  top: 50%;
  left: 50%;
  animation: float-orb 8s ease-in-out infinite;
}

@keyframes float-orb {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, -40px) scale(1.1); }
}

/* Hero Illustration Stack */
.hero-illustration {
  animation: float-stack 5s ease-in-out infinite;
}

@keyframes float-stack {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

.hero-card-stack {
  position: relative;
}

.hero-mock-card {
  padding: 1.5rem !important;
  width: 360px !important;
}

.hero-mock-card-1 {
  transform: rotate(-3deg) translateX(-10px) !important;
  margin-bottom: -1.5rem;
  position: relative;
  z-index: 1;
}

.hero-mock-card-2 {
  transform: rotate(3deg) translateX(-35px) !important;
  position: relative;
  z-index: 2;
  border-color: rgba(74, 222, 128, 0.25) !important;
  box-shadow: 0 0 40px rgba(74, 222, 128, 0.08) !important;
}


/* =================================================
   ANIMATIONS & SCROLL TRIGGERS
   ================================================= */
.animate-fade-in-up {
  animation: fade-in-up 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.delay-1 { animation-delay: 0.1s; opacity: 0; }
.delay-2 { animation-delay: 0.2s; opacity: 0; }
.delay-3 { animation-delay: 0.3s; opacity: 0; }
.delay-4 { animation-delay: 0.4s; opacity: 0; }

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes fade-in-down {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scroll Trigger class */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.animate-on-scroll.animate-visible {
  opacity: 1;
  transform: translateY(0);
}

/* =================================================
   AVATARS
   ================================================= */
.avatar-xs, .avatar-sm, .avatar-md, .avatar-lg, .profile-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.avatar-xs { width: 28px; height: 28px; font-size: 0.65rem; }
.avatar-sm { width: 36px; height: 36px; font-size: 0.8rem; }
.avatar-md { width: 48px; height: 48px; font-size: 1.05rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.3rem; }
.profile-avatar { width: 80px; height: 80px; font-size: 1.6rem; border: 3px solid rgba(255,255,255,0.1); }

/* =================================================
   TOASTS & ALERTS CONTAINER
   ================================================= */
/* =================================================
   CENTERED ROUNDED CAPSULE TOAST SYSTEM
   ================================================= */
#toast-container,
.toast-container {
  position: fixed !important;
  top: 85px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  z-index: 999999 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 10px !important;
  pointer-events: none !important;
  /* Width is controlled per-toast; container just stacks them */
  width: max-content !important;
  max-width: calc(100vw - 32px) !important;
  padding: 0 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}

.toast-notification {
  pointer-events: auto !important;
  background: rgba(18, 18, 22, 0.95) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(255, 153, 0, 0.15) !important;
  border-radius: 50px !important;
  padding: 8px 24px 8px 18px !important;
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 10px !important;
  /* Clamp width so it never overflows on narrow phones */
  width: auto !important;
  min-width: 240px !important;
  max-width: min(480px, calc(100vw - 32px)) !important;
  box-sizing: border-box !important;
  color: #ffffff !important;
  animation: toastCapsuleIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
  transition: all 0.3s ease !important;
}

.toast-notification.toast-success {
  border-color: rgba(40, 167, 69, 0.5) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(40, 167, 69, 0.25) !important;
}
.toast-notification.toast-error,
.toast-notification.toast-warning {
  border-color: rgba(255, 71, 87, 0.5) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(255, 71, 87, 0.25) !important;
}

.toast-notification .toast-icon {
  font-size: 1.15rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  padding-top: 2px !important;
}

.toast-notification .toast-body {
  display: flex !important;
  flex-direction: column !important;
  gap: 2px !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;        /* allow flex child to shrink below content size */
  /* Allow long messages to wrap rather than overflow */
  white-space: normal !important;
  overflow-wrap: break-word !important;
  word-break: break-word !important;
}

.toast-notification .toast-body strong {
  font-size: 0.85rem !important;
  font-weight: 700 !important;
  color: #ffffff !important;
  display: block !important;
}

.toast-notification .toast-body small {
  font-size: 0.8rem !important;
  color: rgba(255, 255, 255, 0.8) !important;
  display: block !important;
}

.toast-notification .toast-close {
  background: transparent !important;
  border: none !important;
  color: rgba(255, 255, 255, 0.5) !important;
  font-size: 1.1rem !important;
  cursor: pointer !important;
  padding: 0 0 0 8px !important;
  line-height: 1 !important;
  flex-shrink: 0 !important;   /* never push close button off-screen */
  align-self: flex-start !important;
  padding-top: 3px !important;
}

.toast-notification .toast-close:hover {
  color: #ffffff !important;
}

@keyframes toastCapsuleIn {
  from {
    opacity: 0;
    transform: translateY(-24px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Flash alerts container */
.flash-container {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1080;
  width: 100%;
  max-width: 580px;
  padding: 0 1rem;
}

/* =================================================
   UTILITY & DETAILS
   ================================================= */
.question-detail {
  border: 1px solid var(--glass-border);
  background: var(--glass);
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}
.stat-row:last-child {
  border-bottom: none;
}

.points-guide-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
}

.hiw-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.hiw-item:last-child {
  border-bottom: none;
}

.hiw-icon {
  width: 32px;
  height: 32px;
  background: rgba(234, 133, 40, 0.1);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--amber);
  flex-shrink: 0;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.02);
  color: var(--text-1);
}
.leaderboard-item:hover {
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
}

.leaderboard-rank {
  width: 24px;
  text-align: center;
  font-weight: 700;
  color: var(--text-2);
}

.leaderboard-rank.rank-top i {
  font-size: 1.1rem;
}

.leaderboard-info {
  flex-grow: 1;
}

.leaderboard-name {
  font-weight: 600;
  font-size: 0.875rem;
}

.leaderboard-points {
  font-size: 0.75rem;
  color: var(--text-2);
}

.active-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(234, 133, 40, 0.08);
  border: 1px solid rgba(234, 133, 40, 0.2);
  border-radius: 20px;
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  color: var(--amber);
}

.filter-remove {
  color: var(--text-3);
}
.filter-remove:hover {
  color: var(--danger);
}

/* ===================================================
   FILTER BAR — Fix search alignment + equal column heights
   =================================================== */
.filter-bar .row {
  align-items: flex-end !important;
}

.filter-bar .col-md-3 {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.filter-bar .form-label {
  height: 1.5rem;
  display: flex;
  align-items: center;
  margin-bottom: 0.4rem !important;
}

/* Search input-group: match sc-select trigger height exactly */
.filter-bar .input-group {
  height: 56px !important;
  flex-wrap: nowrap !important;
}

.filter-bar .input-group .form-control,
.filter-bar .input-group .glass-input {
  height: 56px !important;
  border-top-left-radius: 14px !important;
  border-bottom-left-radius: 14px !important;
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
  font-size: 0.875rem !important;
  padding: 0 1rem !important;
  background: var(--glass) !important;
  border: 1px solid var(--glass-border) !important;
}

.filter-bar .input-group .btn {
  height: 56px !important;
  width: 48px !important;
  flex-shrink: 0 !important;
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
  border-top-right-radius: 10px !important;
  border-bottom-right-radius: 10px !important;
  min-height: unset !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-left: none !important;
  color: var(--text-2) !important;
  transition: all var(--transition-normal) !important;
}

.filter-bar .input-group .btn:hover {
  background: rgba(234, 133, 40, 0.1) !important;
  border-color: rgba(234, 133, 40, 0.3) !important;
  color: var(--amber) !important;
}

/* ===================================================
   MESSAGES LIVE BADGE — CAT Capsule Style
   =================================================== */
.messages-live-badge {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  background: #1a1a1a !important;
  border: 1.5px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 999px !important;
  padding: 4px 14px !important;
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.08em !important;
  color: #ffffff !important;
  text-transform: uppercase !important;
  position: relative;
  overflow: hidden;
}

.messages-live-badge::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  background: #4ade80;
  border-radius: 50%;
  box-shadow: 0 0 8px #4ade80;
  animation: pulse-dot 1.8s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 8px #4ade80; }
  50% { opacity: 0.7; transform: scale(1.3); box-shadow: 0 0 14px #4ade80; }
}

/* ===================================================
   ANSWER PREVIEW BUTTON — spacing fix
   =================================================== */
.answer-preview-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

#answer-preview-toggle {
  margin-left: 1rem !important;
  flex-shrink: 0;
  font-size: 0.78rem !important;
  padding: 0.3rem 0.85rem !important;
  border-radius: var(--radius-full) !important;
  min-height: unset !important;
  height: auto !important;
  display: inline-flex !important;
  align-items: center !important;
}

/* Image preview box */
.image-preview-container {
  position: relative;
  display: inline-block;
  margin-top: 0.75rem;
}

.image-preview {
  max-height: 180px;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
}

.image-remove {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  border-radius: var(--radius-full);
}

/* =================================================
   SPACING SYSTEM OVERRIDES
   ================================================= */

/* Spacing between Cards (24px) */
.questions-grid {
  gap: 24px !important;
}

.questions-grid > *,
.answers-section > .answer-card {
  margin-bottom: 24px !important;
}
.answers-section > .answer-card:last-child {
  margin-bottom: 0 !important;
}

/* Spacing between Sections (64px) */
.content-section, 
.answers-section,
.profile-header,
.error-section {
  margin-bottom: 64px !important;
}

/* Reduced Spacing for Landing Section to Statistics */
.hero-section {
  padding: 5rem 0 1.5rem !important; /* Tighten vertical padding */
  margin-bottom: 24px !important; /* Move stats closer to hero text */
}

.hero-stats {
  margin-top: 1.75rem !important; /* Move stats closer to description */
  margin-bottom: 40px !important; /* Smooth transition to questions */
}

.main-content > section:last-child {
  margin-bottom: 0 !important;
}

/* Spacing between Titles and Content (24px) */
.page-title,
.section-title,
.auth-title,
.question-detail-title,
.widget-title {
  margin-bottom: 24px !important;
}

/* Spacing between Hero buttons (20px) */
.hero-actions {
  display: flex;
  gap: 20px !important;
  flex-wrap: wrap;
}

.hero-actions .btn {
  margin-right: 0 !important; /* clear default Bootstrap margins */
}


/* =================================================
   FORM FIELD GLASSMORPHISM & ALERTS
   ================================================= */
.glass-input,
.form-control,
.form-select {
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid var(--glass-border) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--text-1) !important;
  padding: 0.65rem 1rem !important;
  font-size: 0.9rem !important;
  transition: all var(--transition-bounce) !important;
  outline: none !important;
  box-shadow: none !important;
}

.glass-input:hover,
.form-control:hover,
.form-select:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

.glass-input:focus,
.form-control:focus,
.form-select:focus {
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: var(--amber) !important;
  box-shadow: 0 0 12px var(--amber-glow) !important;
  color: #fff !important;
}

.glass-input::placeholder,
.form-control::placeholder {
  color: var(--text-3) !important;
}

.form-label {
  color: var(--text-2) !important;
  font-weight: 600 !important;
  font-size: 0.75rem !important;
  margin-bottom: 0.5rem !important;
  letter-spacing: 0.8px !important;
  text-transform: uppercase !important;
}

/* Password Visibility Toggle */
.toggle-password {
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid var(--glass-border) !important;
  border-left: none !important;
  color: var(--text-2) !important;
  border-top-right-radius: var(--radius-sm) !important;
  border-bottom-right-radius: var(--radius-sm) !important;
  transition: all var(--transition-normal) !important;
}

.toggle-password:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  color: var(--text-1) !important;
}

/* Custom checkbox elements */
.form-check-input {
  background-color: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid var(--glass-border) !important;
  cursor: pointer !important;
}

.form-check-input:checked {
  background-color: var(--amber) !important;
  border-color: var(--amber) !important;
}

.form-check-input:focus {
  box-shadow: 0 0 8px var(--amber-glow) !important;
  border-color: var(--amber) !important;
}

.form-check-label {
  color: var(--text-2) !important;
  font-size: 0.9rem !important;
  cursor: pointer !important;
  user-select: none !important;
}

.invalid-feedback {
  color: var(--danger) !important;
  font-size: 0.8rem !important;
  margin-top: 0.35rem !important;
  font-weight: 500 !important;
}

/* Performance fix to hide customized select input instantly */
select.form-select[data-customized="true"],
select.glass-input[data-customized="true"] {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* =================================================
   GLASS ALERTS & FLASH NOTIFICATIONS
   ================================================= */
.glass-alert {
  background: rgba(17, 17, 16, 0.92) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border: 1px solid var(--glass-border) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--glass-shadow) !important;
  color: var(--text-1) !important;
  padding: 1rem 1.5rem !important;
  font-weight: 500;
  display: flex;
  align-items: center;
}

.glass-alert.alert-success {
  border-color: rgba(74, 222, 128, 0.3) !important;
  color: var(--success) !important;
}

.glass-alert.alert-danger {
  border-color: rgba(239, 68, 68, 0.3) !important;
  color: var(--danger) !important;
}

.glass-alert.alert-warning {
  border-color: rgba(234, 133, 40, 0.3) !important;
  color: var(--amber) !important;
}

.glass-alert .btn-close {
  filter: invert(1) !important;
  opacity: 0.5 !important;
  transition: opacity var(--transition-normal);
}

.glass-alert .btn-close:hover {
  opacity: 1 !important;
}

/* =================================================
   BADGES & PAGINATION & TABLES
   ================================================= */
.badge, .badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  border-radius: 20px !important;
  transition: all var(--transition-normal);
}

.badge-tag {
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid var(--glass-border) !important;
  color: var(--text-2) !important;
}

.badge-tag:hover {
  background: rgba(255, 255, 255, 0.07) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  color: var(--text-1) !important;
}

.badge-tag.subject-tag {
  border-color: rgba(234, 133, 40, 0.15) !important;
  color: var(--amber) !important;
  background: rgba(234, 133, 40, 0.04) !important;
}

.badge-tag.subject-tag:hover {
  border-color: rgba(234, 133, 40, 0.3) !important;
  background: rgba(234, 133, 40, 0.08) !important;
}

.badge-tag.exam-tag {
  border-color: rgba(245, 197, 24, 0.15) !important;
  color: var(--points-gold) !important;
  background: rgba(245, 197, 24, 0.04) !important;
}

.badge-tag.exam-tag:hover {
  border-color: rgba(245, 197, 24, 0.3) !important;
  background: rgba(245, 197, 24, 0.08) !important;
}

.badge-success {
  background: rgba(74, 222, 128, 0.08) !important;
  border: 1px solid rgba(74, 222, 128, 0.2) !important;
  color: var(--success) !important;
}

.badge-warning {
  background: rgba(234, 133, 40, 0.08) !important;
  border: 1px solid rgba(234, 133, 40, 0.2) !important;
  color: var(--amber) !important;
}

/* Pagination Overrides */
.pagination {
  gap: 8px;
}

.page-item .page-link {
  background: var(--glass) !important;
  border: 1px solid var(--glass-border) !important;
  color: var(--text-2) !important;
  border-radius: var(--radius-sm) !important;
  padding: 0.5rem 0.95rem !important;
  font-weight: 500;
  transition: all var(--transition-normal);
}

.page-item .page-link:hover {
  background: var(--glass-hover) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  color: var(--text-1) !important;
}

.page-item.active .page-link {
  background: var(--amber) !important;
  border-color: var(--amber) !important;
  color: #111110 !important;
  font-weight: 700;
}

.page-item.disabled .page-link {
  background: rgba(255, 255, 255, 0.01) !important;
  border-color: rgba(255, 255, 255, 0.03) !important;
  color: var(--text-3) !important;
}

/* Alias: _pagination.html uses .glass-page-link on all page links */
.page-item .glass-page-link {
  background: var(--glass) !important;
  border: 1px solid var(--glass-border) !important;
  color: var(--text-2) !important;
  border-radius: var(--radius-sm) !important;
  padding: 0.5rem 0.95rem !important;
  font-weight: 500;
  transition: all var(--transition-normal);
}

.page-item .glass-page-link:hover {
  background: var(--glass-hover) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  color: var(--text-1) !important;
}

.page-item.active .glass-page-link {
  background: var(--amber) !important;
  border-color: var(--amber) !important;
  color: #111110 !important;
  font-weight: 700;
}

.page-item.disabled .glass-page-link {
  background: rgba(255, 255, 255, 0.01) !important;
  border-color: rgba(255, 255, 255, 0.03) !important;
  color: var(--text-3) !important;
}

/* Table Overrides */
.table {
  color: var(--text-1) !important;
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

.table th {
  background: rgba(255, 255, 255, 0.02) !important;
  border-bottom: 1px solid var(--glass-border) !important;
  color: var(--text-2) !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  padding: 1rem !important;
}

.table td {
  background: transparent !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03) !important;
  padding: 1rem !important;
  font-size: 0.9rem !important;
  vertical-align: middle !important;
  color: var(--text-1);
}

.table tr:hover td {
  background: rgba(255, 255, 255, 0.015) !important;
}

/* Glass Tab Overrides */
.glass-tabs .nav-link {
  color: var(--text-2) !important;
  border: none !important;
  border-radius: var(--radius-sm) !important;
  transition: all var(--transition-normal);
}

.glass-tabs .nav-link:hover {
  color: var(--text-1) !important;
  background: rgba(255, 255, 255, 0.03) !important;
}

/* =================================================
   PREMIUM COMPETITIVE LEADERBOARD
   ================================================= */
.leaderboard-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 40px;
}

@media (max-width: 992px) {
  .leaderboard-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 576px) {
  .leaderboard-stats-grid {
    grid-template-columns: 1fr;
  }
}

.leaderboard-stat-card {
  padding: 1.5rem !important;
  background: rgba(255, 255, 255, 0.02) !important;
  border: 1px solid var(--glass-border) !important;
  border-radius: var(--radius-md) !important;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.leaderboard-stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
}

.leaderboard-stat-icon.performer {
  color: #F5C518;
  border-color: rgba(245, 197, 24, 0.2);
  background: rgba(245, 197, 24, 0.05);
}

.leaderboard-stat-icon.climber {
  color: var(--success);
  border-color: rgba(74, 222, 128, 0.2);
  background: rgba(74, 222, 128, 0.05);
}

.leaderboard-stat-icon.streak {
  color: var(--amber);
  border-color: rgba(234, 133, 40, 0.2);
  background: rgba(234, 133, 40, 0.05);
}

.leaderboard-stat-icon.rising {
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.2);
  background: rgba(96, 165, 250, 0.05);
}

.leaderboard-stat-info {
  display: flex;
  flex-direction: column;
}

.leaderboard-stat-label {
  font-size: 0.7rem !important;
  color: var(--text-2) !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
}

.leaderboard-stat-value {
  font-size: 1rem !important;
  font-weight: 700 !important;
  color: var(--text-1) !important;
}

.leaderboard-stat-subtext {
  font-size: 0.75rem !important;
  color: var(--text-3) !important;
}

/* Premium Podium CSS */
.podium-section {
  padding: 3rem 0 2rem;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 24px;
  margin-bottom: 24px;
}

@media (max-width: 768px) {
  .podium-section {
    flex-direction: column;
    align-items: center;
    gap: 36px;
    padding-top: 2rem;
  }
}

.podium-card {
  width: 280px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  padding: 2.25rem 1.5rem 1.75rem;
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  transition: all var(--transition-bounce);
  overflow: visible !important;
}

@media (max-width: 768px) {
  .podium-card {
    width: 100%;
    max-width: 380px;
    min-height: auto !important;
  }
}

/* Heights */
.podium-card-gold {
  min-height: 330px;
  background: linear-gradient(180deg, rgba(245, 197, 24, 0.1) 0%, rgba(245, 197, 24, 0.02) 100%) !important;
  border-color: rgba(245, 197, 24, 0.3) !important;
  box-shadow: 0 8px 32px rgba(245, 197, 24, 0.05);
  animation: float-gold 6s ease-in-out infinite;
}

.podium-card-silver {
  min-height: 290px;
  background: linear-gradient(180deg, rgba(192, 192, 192, 0.08) 0%, rgba(192, 192, 192, 0.01) 100%) !important;
  border-color: rgba(192, 192, 192, 0.25) !important;
  box-shadow: 0 8px 32px rgba(192, 192, 192, 0.03);
  animation: float-silver 7s ease-in-out infinite;
}

.podium-card-bronze {
  min-height: 260px;
  background: linear-gradient(180deg, rgba(205, 127, 50, 0.08) 0%, rgba(205, 127, 50, 0.01) 100%) !important;
  border-color: rgba(205, 127, 50, 0.25) !important;
  box-shadow: 0 8px 32px rgba(205, 127, 50, 0.03);
  animation: float-bronze 8s ease-in-out infinite;
}

/* Floating Keyframes */
@keyframes float-gold {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes float-silver {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
@keyframes float-bronze {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.podium-card:hover {
  transform: translateY(-12px) scale(1.02) !important;
  border-color: var(--amber) !important;
}

.podium-card-gold:hover {
  box-shadow: 0 12px 40px rgba(245, 197, 24, 0.18) !important;
}

.podium-card-silver:hover {
  box-shadow: 0 12px 40px rgba(192, 192, 192, 0.15) !important;
}

.podium-card-bronze:hover {
  box-shadow: 0 12px 40px rgba(205, 127, 50, 0.15) !important;
}

/* Crowns and Badges */
.podium-crown {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.85rem;
  filter: drop-shadow(0 0 8px rgba(245, 197, 24, 0.5));
  animation: crown-glow 2s ease-in-out infinite alternate;
}

@keyframes crown-glow {
  from { filter: drop-shadow(0 0 4px rgba(245, 197, 24, 0.3)); }
  to { filter: drop-shadow(0 0 12px rgba(245, 197, 24, 0.7)); }
}

.podium-avatar-container {
  position: relative;
  margin-bottom: 1.25rem;
}

.podium-avatar-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.5rem;
  color: #fff;
  border: 3px solid transparent;
}

.podium-card-gold .podium-avatar-circle {
  border-color: #F5C518;
  box-shadow: 0 0 15px rgba(245, 197, 24, 0.3);
}

.podium-card-silver .podium-avatar-circle {
  border-color: #C0C0C0;
  box-shadow: 0 0 15px rgba(192, 192, 192, 0.2);
}

.podium-card-bronze .podium-avatar-circle {
  border-color: #CD7F32;
  box-shadow: 0 0 15px rgba(205, 127, 50, 0.2);
}

.podium-rank-badge {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: #111110;
  border: 1px solid var(--glass-border);
  padding: 0.15rem 0.65rem;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 700;
}

.podium-card-gold .podium-rank-badge {
  border-color: #F5C518;
  color: #F5C518;
}

.podium-card-silver .podium-rank-badge {
  border-color: #C0C0C0;
  color: #C0C0C0;
}

.podium-card-bronze .podium-rank-badge {
  border-color: #CD7F32;
  color: #CD7F32;
}

.podium-user-info {
  margin-bottom: 0.75rem;
}

.podium-username {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-1);
  margin-bottom: 0.25rem;
}

.podium-points-label {
  font-size: 0.85rem;
  color: var(--text-2);
}

.podium-points-value {
  font-weight: 800;
  font-size: 1.25rem;
}

.podium-card-gold .podium-points-value { color: #F5C518; }
.podium-card-silver .podium-points-value { color: #C0C0C0; }
.podium-card-bronze .podium-points-value { color: #CD7F32; }

/* Remaining Rankings Rows styles */
.rankings-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ranking-row-card {
  padding: 1.15rem 1.5rem !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all var(--transition-normal);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  text-decoration: none !important;
}

.ranking-row-card:hover {
  border-color: rgba(234, 133, 40, 0.2) !important;
  background: var(--glass-hover);
  transform: translateY(-2px);
}

.ranking-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.ranking-num-badge {
  width: 28px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-3);
  text-align: center;
}

.ranking-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
}

.ranking-username {
  font-weight: 600;
  color: var(--text-1);
}

.ranking-right {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.ranking-streak-badge {
  background: rgba(234, 133, 40, 0.08);
  border: 1px solid rgba(234, 133, 40, 0.2);
  color: var(--amber);
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.ranking-points-value {
  font-weight: 700;
  color: var(--amber);
  min-width: 80px;
  text-align: right;
}

.ranking-trend {
  color: var(--success);
  font-size: 0.8rem;
  width: 20px;
  text-align: center;
}

/* Flex layout ordering for Gold, Silver, Bronze */
.podium-card-gold { order: 2; }
.podium-card-silver { order: 1; }
.podium-card-bronze { order: 3; }

@media (max-width: 768px) {
  .podium-card-gold { order: 1; }
  .podium-card-silver { order: 2; }
  .podium-card-bronze { order: 3; }
}


/* =====================================================
   PREMIUM CUSTOM DROPDOWN COMPONENT
   Inspired by Linear · Raycast · Notion · Vercel
   ===================================================== */

/* Prevent clipping of custom dropdown panels in glassmorphic containers */
.filter-bar,
.glass-card:has(.sc-select),
.glass-card:has(select) {
  overflow: visible !important;
}

/* Elevate stacking context when dropdown is open to prevent click-through */
.filter-bar:has(.sc-select--open),
.glass-card:has(.sc-select--open) {
  z-index: 100 !important;
}

/* Base relative positioning and stack level for filter bar */
.filter-bar {
  position: relative;
  z-index: 5;
}

/* ---- Wrapper ---- */
.sc-select {
  position: relative;
  width: 100%;
  z-index: 10;
}

.sc-select.sc-select--open {
  z-index: 9999;
}

/* ---- Trigger Button ---- */
.sc-select__trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 56px;
  padding: 0 18px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  color: var(--text-1);
  font-family: inherit;
  font-size: 0.925rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  text-align: left;
  -webkit-appearance: none;
  appearance: none;
}

.sc-select__trigger:hover {
  background: var(--glass-hover);
  border-color: var(--glass-border-hover);
}

.sc-select__trigger:focus-visible {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-glow);
}

.sc-select--open .sc-select__trigger {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-glow);
  background: var(--glass-hover);
}

/* Trigger: Icon */
.sc-select__trigger-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid;
  font-size: 1rem;
  line-height: 1;
}

/* Trigger: Text */
.sc-select__trigger-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.sc-select__trigger-text--placeholder {
  font-weight: 400;
  color: var(--text-2);
}

/* Trigger: Chevron */
.sc-select__trigger-chevron {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  color: var(--text-3);
  transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.sc-select--open .sc-select__trigger-chevron {
  transform: rotate(180deg);
  color: var(--amber);
}


/* ---- Floating Panel ---- */
.sc-select__panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 9999;
  background: #0b0b0a !important;
  background-color: #0b0b0a !important;
  border: 1px solid rgba(234, 133, 40, 0.35) !important;
  border-radius: 16px;
  padding: 10px;
  max-height: 320px;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.95), 0 8px 24px rgba(0, 0, 0, 0.8) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;

  /* Hidden by default — animated on open */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top center;
  transition:
    opacity 200ms cubic-bezier(0.4, 0, 0.2, 1),
    transform 200ms cubic-bezier(0.4, 0, 0.2, 1),
    visibility 200ms;
  pointer-events: none;
}

.sc-select--open .sc-select__panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ---- Custom Scrollbar ---- */
.sc-select__panel::-webkit-scrollbar {
  width: 6px;
}

.sc-select__panel::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 3px;
}

.sc-select__panel::-webkit-scrollbar-thumb {
  background: rgba(234, 133, 40, 0.35);
  border-radius: 3px;
}

.sc-select__panel::-webkit-scrollbar-thumb:hover {
  background: rgba(234, 133, 40, 0.55);
}


/* ---- Individual Item ---- */
.sc-select__item {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 48px;
  padding: 0 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 180ms cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  position: relative;
}

.sc-select__item:hover,
.sc-select__item--focus {
  background: rgba(234, 133, 40, 0.10);
  transform: translateX(2px);
}

/* Item: Icon */
.sc-select__item-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid;
  font-size: 0.9rem;
  line-height: 1;
  transition: transform 180ms;
}

.sc-select__item:hover .sc-select__item-icon,
.sc-select__item--focus .sc-select__item-icon {
  transform: scale(1.08);
}

/* Item: Label */
.sc-select__item-label {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sc-select__item-label--muted {
  color: var(--text-2);
  font-weight: 400;
}

/* Item: Checkmark */
.sc-select__item-check {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  color: transparent;
  transition: color 180ms, transform 180ms;
}

/* ---- Selected Item ---- */
.sc-select__item--selected {
  background: rgba(234, 133, 40, 0.12);
  box-shadow: 0 0 12px rgba(234, 133, 40, 0.06) inset;
}

.sc-select__item--selected .sc-select__item-label {
  color: var(--amber);
  font-weight: 600;
}

.sc-select__item--selected .sc-select__item-check {
  color: var(--amber);
  transform: scale(1.1);
}

.sc-select__item--selected:hover {
  background: rgba(234, 133, 40, 0.18);
}

/* ---- Focus state (keyboard) ---- */
.sc-select__item--focus {
  outline: 1px solid rgba(234, 133, 40, 0.3);
  outline-offset: -1px;
}


/* ---- Responsive ---- */
@media (max-width: 576px) {
  .sc-select__trigger {
    height: 50px;
    padding: 0 14px;
    gap: 10px;
    font-size: 0.875rem;
    border-radius: 12px;
  }

  .sc-select__trigger-icon {
    width: 28px;
    height: 28px;
    font-size: 0.875rem;
  }

  .sc-select__panel {
    border-radius: 14px;
    padding: 8px;
  }

  .sc-select__item {
    height: 44px;
    gap: 10px;
    padding: 0 12px;
    border-radius: 8px;
  }

  .sc-select__item-icon {
    width: 26px;
    height: 26px;
    font-size: 0.8rem;
  }
}

/* ===================================================
   NAVBAR RIGHT CONTROLS PERFECT ALIGNMENT
   =================================================== */
.navbar-right {
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem !important; /* Equal 8px spacing between all right-side controls */
}

.navbar-right .notif-bell-toggle,
.navbar-right .user-avatar-toggle {
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  min-height: 36px !important;
  padding: 0 !important;
  margin: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: var(--radius-full) !important;
  transition: all var(--transition-normal);
  background: transparent;
  border: 1px solid transparent;
}

/* Remove unwanted bottom underline bar & default Bootstrap caret from toggles */
.navbar-right .notif-bell-toggle::after,
.navbar-right .user-avatar-toggle::after {
  display: none !important;
}

.navbar-right .notif-bell-toggle:hover,
.navbar-right .notif-bell-toggle[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: var(--glass-border) !important;
  color: var(--text-1) !important;
}

.navbar-right .user-avatar-toggle {
  border: 1.5px solid rgba(255, 255, 255, 0.15) !important;
  overflow: hidden !important;
}

.navbar-right .user-avatar-toggle:hover,
.navbar-right .user-avatar-toggle[aria-expanded="true"] {
  border-color: var(--amber) !important;
  box-shadow: 0 0 12px var(--amber-glow);
}

.nav-avatar-img,
.navbar-right .nav-avatar {
  width: 100% !important;
  height: 100% !important;
  border: none !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-weight: 700;
  font-size: 0.75rem;
  color: #fff;
  margin: 0 !important;
}

/* Ensure mobile touch targets scale nicely without breaking layout */
@media (max-width: 768px) {
  .navbar-right .notif-bell-toggle,
  .navbar-right .user-avatar-toggle,
  .nav-points-badge,
  .nav-streak-badge {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
  }
}

/* ===================================================
   NOTIFICATIONS STYLING & REDESIGNED DROPDOWN
   =================================================== */
.notif-unread-bg {
  background-color: rgba(234, 133, 40, 0.08) !important;
}

.notif-dropdown-menu {
  width: 360px !important;
  min-width: 340px !important;
  max-width: 90vw !important;
  padding: 0 !important;
  border-radius: var(--radius-lg) !important;
  background: rgba(15, 15, 20, 0.94) !important;
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.1), 0 0 24px rgba(234, 133, 40, 0.12) !important;
  border: 1px solid var(--glass-border) !important;
  overflow: hidden !important;
  margin-top: 0.65rem !important;
}

.notif-dropdown-header {
  background: rgba(255, 255, 255, 0.02);
}

.notif-dropdown-footer {
  background: rgba(255, 255, 255, 0.015);
}

.notif-list-scroll {
  max-height: 380px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Custom scrollbar for notifications list */
.notif-list-scroll::-webkit-scrollbar {
  width: 5px;
}
.notif-list-scroll::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}
.notif-list-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
.notif-list-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--amber);
}

.notif-item {
  color: var(--text-2);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  white-space: normal !important;
  border-radius: 0 !important;
  cursor: default;
  display: flex !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
}

.notif-item:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  color: var(--text-1) !important;
}

.notif-item--unread {
  background: rgba(234, 133, 40, 0.07) !important;
  position: relative;
}

.notif-item--unread:hover {
  background: rgba(234, 133, 40, 0.12) !important;
}

.notif-item-icon {
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.2s ease;
}

.notif-item:hover .notif-item-icon {
  background: rgba(234, 133, 40, 0.15);
  border-color: rgba(234, 133, 40, 0.3);
}

.notif-item-title {
  color: var(--text-1);
  font-size: 0.85rem;
  transition: color 0.2s ease;
}

.notif-item:hover .notif-item-title {
  color: var(--amber);
}

.notif-item-desc {
  white-space: normal !important;
  word-break: break-word !important;
  line-height: 1.4 !important;
  color: var(--text-3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notif-item:hover .notif-item-desc {
  color: rgba(255, 255, 255, 0.75);
}

.notif-unread-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: var(--amber);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--amber);
  transition: transform 0.2s ease;
}

.mark-read-btn:hover .notif-unread-dot {
  transform: scale(1.3);
  box-shadow: 0 0 12px var(--amber);
}

.notif-empty-icon {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
}

/* ===================================================
   PHASE 5D: RESPONSIVE UI & ACCESSIBILITY (WCAG 2.1 AA)
   =================================================== */

/* Visible Focus Outlines (Keyboard Accessibility) */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible, .nav-link:focus-visible, .dropdown-item:focus-visible {
  outline: 2px solid var(--amber) !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 4px var(--amber-glow) !important;
}

/* Screen Reader Only Utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Responsive Tables */
.table-responsive {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

table {
  width: 100%;
  max-width: 100%;
}

/* Mobile & Tablet Breakpoints (44x44px Touch Targets & Grid Degradation) */
@media (max-width: 992px) {
  .row-cols-lg-4 > * {
    flex: 0 0 auto;
    width: 50% !important;
  }
}

@media (max-width: 768px) {
  /* Ensure 44x44px minimum touch targets on mobile/tablet */
  button, .btn, .nav-link, .page-link, input[type="button"], input[type="submit"], .mark-read-btn, .delete-notif-btn {
    min-height: 44px !important;
    min-width: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .sc-navbar {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }

  .sc-card {
    padding: 1.25rem;
  }
}

@media (max-width: 576px) {
  .row-cols-lg-4 > *, .row-cols-md-3 > *, .row-cols-sm-2 > * {
    flex: 0 0 auto;
    width: 100% !important;
  }

  h1, .h1 {
    font-size: 1.85rem !important;
  }

  h2, .h2 {
    font-size: 1.5rem !important;
  }
}

/* StudyConnect Official Logo Pulse Loader */
.logo-loader {
  display: inline-block;
  width: 40px;
  height: 40px;
  animation: logoPulse 1.4s ease-in-out infinite;
}
.logo-loader-sm {
  width: 24px;
  height: 24px;
}
@keyframes logoPulse {
  0% { transform: scale(0.92); opacity: 0.6; filter: drop-shadow(0 0 2px rgba(234, 133, 40, 0.3)); }
  50% { transform: scale(1.08); opacity: 1; filter: drop-shadow(0 0 10px rgba(234, 133, 40, 0.8)); }
  100% { transform: scale(0.92); opacity: 0.6; filter: drop-shadow(0 0 2px rgba(234, 133, 40, 0.3)); }
}

/* ===================================================
   COMPREHENSIVE MOBILE RESPONSIVENESS — Phone Optimized
   =================================================== */

/* ---- Phone: General Layout ---- */
@media (max-width: 575.98px) {
  .glass-card {
    padding: 1.25rem !important;
    border-radius: 12px !important;
  }
  .content-section { margin-bottom: 32px !important; }
  .page-title { font-size: 1.4rem !important; margin-bottom: 16px !important; }
  .section-title { font-size: 1.1rem !important; }
  .app-layout-container { padding-left: 12px; padding-right: 12px; }
}

/* ---- Phone/Tablet: Dedicated Mobile Offcanvas ---- */
@media (max-width: 991.98px) {
  /* Offcanvas Base */
  .glass-offcanvas-mobile {
    width: 85vw !important;
    max-width: 400px;
    background-color: var(--bg) !important;
    background-image: linear-gradient(var(--glass), var(--glass)) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid rgba(255, 255, 255, 0.05) !important;
    border-radius: 20px 0 0 20px; /* Rounded on the left edge */
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  }

  .glass-offcanvas-mobile .offcanvas-header {
    padding: 1.5rem 1.5rem 1rem 1.5rem !important;
  }

  .glass-offcanvas-mobile .offcanvas-body {
    padding: 1rem 1.5rem 1.5rem 1.5rem !important;
  }
  
  /* Mobile Nav Links */
  .mobile-nav-links {
    gap: 0.25rem;
  }
  
  .mobile-link {
    display: block;
    padding: 14px 16px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-2);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
  }
  
  .mobile-link:hover {
    color: var(--text-1);
    background-color: var(--glass-hover);
  }
  
  .mobile-link.active {
    color: var(--amber) !important;
    background-color: var(--amber-glow-soft);
    border-left: 3px solid var(--amber);
    box-shadow: -10px 0 20px -10px var(--amber-glow) inset;
  }
  
  /* Divider */
  .mobile-nav-divider {
    border-top: 1px solid var(--glass-border);
    margin: 1.5rem 0;
    opacity: 1;
  }
  
  /* CTA & Footer */
  .mobile-cta-btn {
    border-radius: 999px !important;
    padding: 14px !important;
    font-family: 'Inter', sans-serif;
    font-weight: 700 !important;
    font-size: 1.1rem !important;
    background-color: var(--amber) !important;
    color: #fff !important;
    border: none !important;
    box-shadow: 0 4px 15px var(--amber-glow) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }
  
  .mobile-cta-btn:active {
    transform: scale(0.98);
  }
  
  /* Make the toggler attractive and remove ugly focus ring */
  .navbar-toggler {
    border: none !important;
    box-shadow: none !important;
    padding: 0.4rem !important;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    transition: background-color 0.2s ease;
  }
  .navbar-toggler:focus, .navbar-toggler:active {
    outline: none !important;
    box-shadow: none !important;
    background: rgba(255, 255, 255, 0.1);
  }
  
  /* Icon Toggle for Hamburger/Close */
  .navbar-toggler.collapsed .icon-close { display: none !important; }
  .navbar-toggler.collapsed .icon-open { display: inline-block !important; }
  .navbar-toggler:not(.collapsed) .icon-close { display: inline-block !important; }
  .navbar-toggler:not(.collapsed) .icon-open { display: none !important; }

  /* Allow mobile menu to scroll internally if taller than screen */
  #mobileNavCollapse {
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    overflow-x: hidden;
  }

  .navbar-right {
    margin-top: 0.75rem !important;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    justify-content: flex-start !important;
    width: 100%;
  }
  .nav-search-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    min-width: unset !important;
    margin-bottom: 0.5rem;
  }
  .community-dropdown-menu {
    width: 100% !important;
    min-width: unset !important;
    max-width: 100% !important;
    position: static !important;
    transform: none !important;
    box-shadow: none !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    margin-top: 0.25rem !important;
  }
}

/* ---- Phone: Answer card vote buttons ---- */
@media (max-width: 991.98px) {
  .vote-column {
    margin-right: 0.75rem !important;
    min-width: 40px !important;
  }
  .vote-btn {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    font-size: 0.8rem !important;
  }
  .question-detail-title {
    font-size: 1.35rem !important;
    margin-bottom: 16px !important;
  }
}



/* ---- Phone: Write Answer ---- */
@media (max-width: 575.98px) {
  .answer-preview-wrapper,
  #answer-form .d-flex.justify-content-between {
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
  }
  #answer-preview-toggle { margin-left: 0 !important; }
  #answer-body { min-height: 120px; }
}

/* ---- Phone: Footer ---- */
@media (max-width: 767.98px) {
  .glass-footer {
    padding-top: 2.5rem !important;
    padding-bottom: 2.5rem !important;
  }
  .glass-footer .col-md-4 { margin-bottom: 1.75rem; }
  .glass-footer .col-md-4:last-child { margin-bottom: 0; }
  .glass-footer .col-md-4:last-child small {
    display: block;
    text-align: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,0.05);
    width: 100%;
  }
}

/* ---- Phone: Hero Section ---- */
@media (max-width: 575.98px) {
  .hero-title { font-size: 2.2rem !important; letter-spacing: -1px !important; }
  .hero-subtitle { font-size: 0.95rem !important; }
  .hero-actions { flex-direction: column !important; gap: 0.75rem !important; }
  .hero-actions .btn { 
    width: 100% !important; 
    justify-content: center !important; 
    border-radius: 50px !important; /* Fully rounded corners */
    padding: 0.6rem 1.25rem !important; /* Smaller padding */
    font-size: 0.95rem !important; /* Smaller text */
    min-height: 48px !important;
  }
  .hero-stats { flex-wrap: nowrap !important; gap: 0.5rem !important; }
  .hero-illustration, .hero-card-stack { display: none !important; }
}

/* ---- Phone: Prevent horizontal overflow ---- */
@media (max-width: 575.98px) {
  body, html { overflow-x: hidden !important; max-width: 100vw !important; }
  .glass-card { max-width: 100%; box-sizing: border-box; }
  .filter-bar,
  .glass-card:has(.sc-select),
  .glass-card:has(select) {
    overflow: visible !important;
  }
  .question-tags { flex-wrap: wrap !important; gap: 0.4rem; }
  .question-tags .tag { font-size: 0.65rem !important; }
}

/* ---- Phone: Messages Page ---- */
@media (max-width: 767.98px) {
  .chat-container { height: calc(100vh - 80px) !important; min-height: 400px !important; }
  .chat-sidebar { border-right: none !important; border-bottom: 1px solid rgba(255,255,255,0.1); }
}

/* ---- Leaderboard phone ---- */
@media (max-width: 575.98px) {
  .leaderboard-stats-grid { grid-template-columns: 1fr; gap: 12px; }
  .podium-card { width: 100% !important; min-height: auto !important; }
}

/* ---- Extreme small (≤375px) ---- */
@media (max-width: 375px) {
  .glass-card { padding: 1rem !important; }
  .vote-column { min-width: 34px !important; margin-right: 0.5rem !important; }
  .vote-btn { width: 28px !important; height: 28px !important; min-width: 28px !important; font-size: 0.75rem !important; }
  .avatar-sm { width: 30px !important; height: 30px !important; font-size: 0.7rem !important; }
  .avatar-md { width: 40px !important; height: 40px !important; font-size: 0.9rem !important; }
}


/* =================================================================
   COMPREHENSIVE MOBILE FIX — max-width: 991px (desktop untouched)
   ================================================================= */
@media (max-width: 991.98px) {

  /* ---- Global overflow prevention ---- */
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }

  /* ---- Fix double-container padding ---- */
  /* Bootstrap .container inside .app-layout-container causes double indent.
     Override .container to be fluid with zero side padding on mobile
     so the app-layout-container's 16–24px padding is the only one. */
  .app-layout-container > * > .container,
  .app-layout-container .container {
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    width: 100% !important;
  }

  /* ---- Ensure all cards stay within viewport ---- */
  .glass-card,
  .card,
  [class*="col-"] {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* ---- Row gutter fix — prevent bleed ---- */
  .row {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  .row > [class*="col-"] {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }

  /* ---- Page headers: stack on mobile (except navbar) ---- */
  .content-section .d-flex.justify-content-between.align-items-center,
  .main-content .d-flex.justify-content-between.align-items-center,
  .d-flex.flex-wrap.justify-content-between {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
  }

  /* ---- Navbar header row: ALWAYS single inline row ---- */
  .glass-nav .container-fluid {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
  }

  .glass-nav #mobileMenuToggle,
  .glass-nav .navbar-toggler {
    margin-left: auto !important;
    align-self: center !important;
  }

  /* ---- Typography scale ---- */
  h1, .h1, .page-title { font-size: 1.65rem !important; }
  h2, .h2 { font-size: 1.35rem !important; }
  h3, .h3 { font-size: 1.15rem !important; }

  /* ---- Buttons on mobile ---- */
  .btn-glow,
  .btn-primary,
  .btn-outline-primary {
    width: 100% !important;
    text-align: center !important;
    justify-content: center !important;
  }

  /* ---- Filter bar: overflow visible for custom dropdowns ---- */
  .filter-bar,
  .glass-card:has(#filter-form) {
    overflow: visible !important;
    padding: 1.25rem 1rem !important;
  }

  #filter-form {
    row-gap: 0.75rem !important;
  }

  /* ---- Glass selects / inputs: clean full width ---- */
  .glass-input,
  .form-select,
  .form-control {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    font-size: 0.875rem !important;
    padding: 0.5rem 0.75rem !important;
    text-overflow: ellipsis !important;
  }

  /* ---- Navbar custom dropdowns: constrain to viewport ---- */
  .nav-dropdown-panel,
  [class*="dropdown-panel"],
  [class*="dropdown-menu"] {
    max-width: calc(100vw - 32px) !important;
    left: 0 !important;
    right: auto !important;
    transform: none !important;
  }

  /* ---- Stats / counter rows ---- */
  .hero-stats {
    flex-wrap: nowrap !important;
    gap: 0.5rem !important;
  }
  .stats-row,
  [class*="stats-grid"] {
    flex-wrap: wrap !important;
    gap: 0.75rem !important;
  }

  /* ---- Tables: allow horizontal scroll within card ---- */
  .table-responsive,
  table {
    width: 100% !important;
    overflow-x: auto !important;
    display: block !important;
  }

  /* ---- Input groups: stack on very small ---- */
  .input-group {
    flex-wrap: nowrap !important;
    width: 100% !important;
  }
  .input-group .form-control {
    flex: 1 1 0 !important;
    min-width: 0 !important;
  }

  /* ---- Content section top padding ---- */
  .content-section {
    padding-top: 8px !important;
  }

  /* ---- Glass card inner padding ---- */
  .glass-card {
    padding: 1.25rem 1rem !important;
    border-radius: var(--radius-lg) !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

}

/* ---- Extra small phones (≤480px) ---- */
@media (max-width: 480px) {

  .col-6, .col-sm-6 {
    width: 100% !important;
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }

  #filter-form > [class*="col-"] {
    width: 100% !important;
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }

  /* Podium / leaderboard cards */
  .podium-card { width: 100% !important; }

  /* Flash alerts */
  .flash-text { white-space: normal !important; }
  .glass-alert { width: 90vw !important; max-width: 90vw !important; }

/* =====================================================
   CENTERED TOAST NOTIFICATION CONTAINER & STYLING
   ===================================================== */
#toast-container {
  position: fixed !important;
  top: 85px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  z-index: 999999 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 10px !important;
  pointer-events: none !important;
  width: max-content !important;
  max-width: calc(100vw - 32px) !important;
  box-sizing: border-box !important;
}

.toast-notification {
  pointer-events: auto !important;
  background: rgba(15, 15, 18, 0.96) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6), 0 0 15px rgba(255, 153, 0, 0.12) !important;
  border-radius: 12px !important;
  padding: 10px 14px 10px 18px !important;
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 10px !important;
  /* Hard clamp: never exceed the viewport, even on a 360 px phone */
  width: auto !important;
  min-width: 240px !important;
  max-width: min(460px, calc(100vw - 32px)) !important;
  box-sizing: border-box !important;
  color: #ffffff !important;
  animation: toastSlideDown 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
  transition: all 0.3s ease !important;
}

.toast-notification.toast-success {
  border-left: 4px solid #28a745 !important;
}
.toast-notification.toast-error,
.toast-notification.toast-warning {
  border-left: 4px solid #ff4757 !important;
}
.toast-notification.toast-info {
  border-left: 4px solid #ff9900 !important;
}

.toast-notification .toast-icon {
  font-size: 1.25rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin-right: 8px !important;
  flex-shrink: 0 !important;
  padding-top: 2px !important;
}

.toast-notification .toast-body {
  flex: 1 1 auto !important;
  min-width: 0 !important;        /* allow flex child to shrink below content size */
  line-height: 1.35 !important;
  /* Wrap long messages — the root overflow fix */
  white-space: normal !important;
  overflow-wrap: break-word !important;
  word-break: break-word !important;
}

.toast-notification .toast-body strong {
  display: block !important;
  font-size: 0.875rem !important;
  font-weight: 700 !important;
  color: #ffffff !important;
  margin-bottom: 2px !important;
}

.toast-notification .toast-body small {
  display: block !important;
  font-size: 0.8rem !important;
  color: rgba(255, 255, 255, 0.75) !important;
}

.toast-notification .toast-close {
  background: none !important;
  border: none !important;
  color: rgba(255, 255, 255, 0.5) !important;
  font-size: 1.25rem !important;
  cursor: pointer !important;
  padding: 0 0 0 10px !important;
  line-height: 1 !important;
  transition: color 0.2s ease !important;
  flex-shrink: 0 !important;   /* keep the × button always visible */
  align-self: flex-start !important;
  padding-top: 1px !important;
}

.toast-notification .toast-close:hover {
  color: #ffffff !important;
}

@keyframes toastSlideDown {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Narrow-mobile override: switch from translate-center to edge-anchored
   so toasts can never bleed past either side of a 360-390 px screen. */
@media (max-width: 480px) {
  #toast-container,
  .toast-container {
    left: 16px !important;
    right: 16px !important;
    transform: none !important;
    width: auto !important;
    max-width: none !important;
    align-items: stretch !important;
  }
  .toast-notification {
    min-width: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 10px !important;
  }
}
