/* --- ABSOLUTE PRIORITY OVERRIDE FOR AUTH INPUT WITH ICON (LOGIN / REGISTER) --- */
.auth-form .input-with-icon input,
.form-group .input-with-icon input,
.input-with-icon input,
div.input-with-icon > input {
  padding-left: 56px !important;
  padding-right: 50px !important;
}

@media (max-width: 992px) {
  .auth-form .input-with-icon input,
  .form-group .input-with-icon input,
  .input-with-icon input,
  div.input-with-icon > input {
    padding-left: 56px !important;
    padding-right: 50px !important;
  }
}

.auth-form .input-with-icon input, .form-group .input-with-icon input, .input-with-icon input { padding-left: 56px !important; }
/* ========================================================
   Quizzygram - Responsive & Layout Master Stylesheet
   Fixes phantom container gaps, button wrapping, contrast,
   mobile viewports, and card grid alignments across all screen sizes.
   ======================================================== */

/* --- ROOT CONTAINER FIXES --- */
html, body {
  overflow-x: hidden !important;
  width: 100% !important;
}

.container {
  display: flex !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  min-height: 100vh;
  position: relative;
  box-sizing: border-box !important;
  flex-direction: row !important;
}

/* --- DESKTOP VIEWPORT (> 992px) --- */
@media (min-width: 993px) {
  /* Keep sidebar strictly locked to 260px at x=0 */
  .sidebar {
    display: flex !important;
    flex-direction: column !important;
    width: 260px !important;
    min-width: 260px !important;
    max-width: 260px !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    height: 100vh !important;
    background-color: var(--color-sidebar-bg, #ffffff) !important;
    border-right: 1px solid var(--color-border, #e5e7eb) !important;
    box-sizing: border-box !important;
    z-index: 100 !important;
    overflow-y: auto !important;
    padding: 24px 18px !important;
  }

  /* Main content wrapper starts right after sidebar (no phantom gap) */
  .main-content-wrapper {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .main-content {
    margin-left: 260px !important;
    width: calc(100% - 260px) !important;
    max-width: calc(100% - 260px) !important;
    padding: 28px 36px 60px 36px !important;
    box-sizing: border-box !important;
    min-height: 100vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  .mobile-top-bar,
  .mobile-bottom-nav {
    display: none !important;
  }
}

/* --- TABLET & MOBILE VIEWPORT (<= 992px) --- */
@media (max-width: 992px) {
  /* Hide desktop sidebar on mobile/tablet */
  .sidebar {
    display: none !important;
  }

  /* Show mobile top header */
  .mobile-top-bar {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 56px !important;
    background: var(--card-bg, #ffffff) !important;
    border-bottom: 1px solid var(--border-color, #e5e7eb) !important;
    padding: 0 16px !important;
    z-index: 999999 !important;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05) !important;
    pointer-events: auto !important;
  }

  .mobile-actions {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    pointer-events: auto !important;
    z-index: 1000000 !important;
  }

  .mobile-theme-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 38px !important;
    height: 38px !important;
    border-radius: 50% !important;
    background: var(--color-sidebar-bg, #f1f5f9) !important;
    border: 1px solid var(--color-border, #cbd5e1) !important;
    color: var(--text-dark, #1e293b) !important;
    cursor: pointer !important;
    font-size: 1.05rem !important;
    pointer-events: auto !important;
    position: relative !important;
    z-index: 1000001 !important;
  }

  /* Hide mobile bottom navigation and global top header in active chat views or when modals are active */
  body.world-chat-active .mobile-bottom-nav,
  body.chat-conversation-active .mobile-bottom-nav,
  body.buy-stars-modal-open .mobile-bottom-nav,
  body:has(.chat-container.active-chat-open) .mobile-bottom-nav {
    display: none !important;
  }

  /* body.world-chat-active keeps mobile-top-bar visible */

  body.world-chat-active .container,
  body.world-chat-active .main-content-wrapper,
  body.world-chat-active main.main-content {
    padding-top: 0 !important;
    margin-top: 0 !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
  }

  /* Show mobile bottom navigation - Floating Capsule Bar matching screenshot media_1793383773680_2831f322.png */
  .mobile-bottom-nav {
    display: flex !important;
    align-items: center !important;
    justify-content: space-around !important;
    position: fixed !important;
    bottom: max(6px, env(safe-area-inset-bottom, 6px)) !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: calc(100% - 24px) !important;
    max-width: 440px !important;
    height: 58px !important;
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border: 1px solid rgba(229, 231, 235, 0.8) !important;
    border-radius: 9999px !important;
    padding: 0 8px !important;
    z-index: 99999 !important;
    box-shadow: 0 12px 32px -4px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.06) !important;
    box-sizing: border-box !important;
  }

  [data-theme="dark"] .mobile-bottom-nav,
  body.dark-theme .mobile-bottom-nav {
    background: rgba(17, 24, 39, 0.9) !important;
    border-color: rgba(55, 65, 81, 0.8) !important;
    box-shadow: 0 12px 32px -4px rgba(0, 0, 0, 0.5) !important;
  }

  .mobile-bottom-nav a.mobile-nav-link {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-decoration: none !important;
    color: #64748b !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    padding: 6px 4px !important;
    min-width: 0 !important;
    text-align: center !important;
    border-radius: 9999px !important;
    transition: background-color 0.15s ease, color 0.15s ease !important;
    position: relative !important;
    -webkit-tap-highlight-color: transparent !important;
    -webkit-touch-callout: none !important;
    user-select: none !important;
    outline: none !important;
    box-shadow: none !important;
  }

  .mobile-bottom-nav a.mobile-nav-link:focus,
  .mobile-bottom-nav a.mobile-nav-link:focus-visible {
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
    color: inherit !important;
  }

  .mobile-bottom-nav a.mobile-nav-link i.icon {
    font-size: 1.15rem !important;
    margin: 0 auto 3px auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 24px !important;
    height: 22px !important;
    line-height: 1 !important;
    transition: transform 0.2s ease !important;
  }

  .mobile-bottom-nav a.mobile-nav-link.active {
    color: #10b981 !important;
    background: transparent !important;
    font-weight: 700 !important;
  }

  .mobile-bottom-nav a.mobile-nav-link.active i.icon {
    transform: scale(1.1) !important;
  }

  [data-theme="dark"] .mobile-bottom-nav a.mobile-nav-link {
    color: #94a3b8 !important;
  }

  [data-theme="dark"] .mobile-bottom-nav a.mobile-nav-link.active {
    color: #34d399 !important;
    background: transparent !important;
  }

  [data-theme="dark"] .mobile-bottom-nav .nav-active-pill {
    background: rgba(16, 185, 129, 0.22) !important;
  }

  /* Allow normal document scrolling on mobile */
  .container {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    padding-top: 56px !important;
    padding-bottom: 80px !important;
    height: auto !important;
    overflow: visible !important;
  }

  .main-content-wrapper {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 8px 14px 40px 14px !important;
    height: auto !important;
    overflow: visible !important;
    box-sizing: border-box !important;
  }
}

/* --- SECTION HEADERS & BUTTONS POLISH --- */
.section-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 12px !important;
  margin-bottom: 20px !important;
  width: 100% !important;
}

.section-title-group {
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
  min-width: 140px !important;
}

.section-title-group h2 {
  font-size: 1.45rem !important;
  font-weight: 700 !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  margin: 0 !important;
}

/* Action Buttons Container (New Quiz / New Post / Join Live Quiz) */
.new-quiz-button {
  display: inline-flex !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Prevent squashed buttons; ensure text and icons are clean and visible */
.new-quiz-button .btn,
.section-header .btn {
  height: 40px !important;
  min-height: 40px !important;
  width: auto !important;
  min-width: 110px !important;
  max-width: none !important;
  padding: 8px 16px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  font-size: 0.92rem !important;
  font-weight: 600 !important;
  border-radius: 10px !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  text-decoration: none !important;
  cursor: pointer !important;
  box-sizing: border-box !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease !important;
}

.new-quiz-button .btn:hover,
.section-header .btn:hover {
  transform: translateY(-1px) !important;
}

/* --- HERO SECTION CONTRAST & RESPONSIVE POLISH --- */
.hero-section {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  background: linear-gradient(135deg, #059669 0%, #10B981 100%) !important;
  border-radius: 20px !important;
  padding: 36px 32px !important;
  gap: 28px !important;
  margin-bottom: 32px !important;
  box-shadow: 0 10px 30px rgba(5, 150, 105, 0.18) !important;
  color: #ffffff !important;
  box-sizing: border-box !important;
}

.hero-content {
  flex: 1 1 500px !important;
  max-width: 580px !important;
}

.hero-content h1 {
  font-size: 2.5rem !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
  margin-bottom: 14px !important;
  color: #ffffff !important;
}

/* High-contrast, clean radiant styling for 'Quizzygram' highlight */
.hero-content h1 .highlight,
.hero-content h1 .vibrant-text {
  color: #ffffff !important;
  background: none !important;
  -webkit-text-fill-color: #ffffff !important;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.25) !important;
  font-weight: 800 !important;
  display: inline-block !important;
}

.hero-content p {
  color: #e6fffa !important;
  font-size: 1.1rem !important;
  line-height: 1.6 !important;
  margin-bottom: 24px !important;
  opacity: 0.95 !important;
}

.hero-actions {
  display: flex !important;
  align-items: center !important;
  gap: 14px !important;
  flex-wrap: wrap !important;
}

.hero-actions .btn {
  padding: 10px 22px !important;
  font-size: 0.98rem !important;
  font-weight: 600 !important;
  border-radius: 9999px !important;
  white-space: nowrap !important;
  text-decoration: none !important;
}

.hero-actions .primary-btn {
  background: #ffffff !important;
  color: #047857 !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1) !important;
}

.hero-actions .secondary-btn {
  background: rgba(255, 255, 255, 0.18) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.4) !important;
}

.hero-visual {
  flex: 0 0 auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.hero-image {
  width: 280px !important;
  max-width: 100% !important;
  height: auto !important;
  border-radius: 16px !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
  object-fit: cover !important;
}

@media (max-width: 820px) {
  .hero-section {
    flex-direction: row !important;
    text-align: left !important;
    padding: 16px 18px !important;
    gap: 14px !important;
    align-items: center !important;
    justify-content: space-between !important;
    min-height: auto !important;
    margin-top: 4px !important;
    margin-bottom: 24px !important;
    overflow: hidden !important;
  }

  .hero-content {
    flex: 1 1 auto !important;
    max-width: calc(100% - 130px) !important;
  }

  .hero-content h1 {
    font-size: 1.45rem !important;
    line-height: 1.15 !important;
    margin-bottom: 6px !important;
  }

  .hero-content p {
    font-size: 0.88rem !important;
    line-height: 1.35 !important;
    margin-bottom: 12px !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
  }

  .hero-actions {
    justify-content: flex-start !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .hero-actions .btn {
    padding: 8px 14px !important;
    font-size: 0.85rem !important;
  }

  .hero-visual {
    flex-shrink: 0 !important;
    width: auto !important;
  }

  .hero-image {
    width: 120px !important;
    height: 110px !important;
    object-fit: cover !important;
    border-radius: 12px !important;
  }
}

/* --- SEARCH BAR CENTERING & RESPONSIVENESS --- */
.search-section {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  width: 100% !important;
  margin: 0 auto 32px auto !important;
}

/* Search Bar Container & Input Vertical Centering Fix */
.search-form {
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
  max-width: 520px !important;
  background: var(--card-bg, #ffffff) !important;
  border: 1px solid var(--border-color, #e2e8f0) !important;
  border-radius: 9999px !important;
  padding: 4px 8px 4px 20px !important;
  min-height: 48px !important;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.05) !important;
  box-sizing: border-box !important;
}

.search-input {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  height: 38px !important;
  line-height: 38px !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
  font-size: 0.98rem !important;
  color: var(--text-color, #1e293b) !important;
  padding: 0 8px 0 0 !important;
  margin: 0 !important;
  vertical-align: middle !important;
  box-sizing: border-box !important;
}

.search-input:focus,
.search-input:focus-visible,
input#search-input:focus,
input#search-input:focus-visible {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

/* Subtle elegant glow only on the outer search capsule when input is focused */
.search-form:focus-within {
  border-color: var(--primary-color, #10b981) !important;
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.18) !important;
}

.search-btn {
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  min-height: 40px !important;
  max-width: 40px !important;
  max-height: 40px !important;
  border-radius: 50% !important;
  background: var(--primary-color, #10B981) !important;
  color: #ffffff !important;
  border: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
  transition: transform 0.15s ease, background 0.15s ease !important;
}

/* --- RESPONSIVE CARD GRIDS --- */
.cards-container,
.posts-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
  gap: 22px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.quiz-card,
.post-card {
  width: 100% !important;
  box-sizing: border-box !important;
  background: var(--card-bg, #ffffff) !important;
  border-radius: 18px !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06) !important;
  border: 1px solid var(--border-color, #e2e8f0) !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

.quiz-card:hover,
.post-card:hover {
  transform: translateY(-4px) !important;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.1) !important;
}

/* Post card image */
.post-image {
  width: 100% !important;
  height: 175px !important;
  object-fit: cover !important;
  display: block !important;
  margin-bottom: 0 !important;
}

/* Generous, balanced interior padding for all post cards */
.post-card .post-content,
.post-content {
  padding: 18px 24px 22px 24px !important;
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  box-sizing: border-box !important;
  width: 100% !important;
}

.post-card .post-title,
.post-title {
  font-size: 1.15rem !important;
  font-weight: 700 !important;
  line-height: 1.4 !important;
  color: var(--text-color, #1e293b) !important;
  margin: 0 0 8px 0 !important;
  word-break: break-word !important;
  padding-right: 8px !important;
}

.post-card .post-meta,
.post-meta {
  font-size: 0.85rem !important;
  color: #64748b !important;
  margin-bottom: 12px !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
}

/* Post excerpt text with clean right/bottom margin & proper line clamping */
.post-card .post-excerpt,
.post-excerpt {
  font-size: 0.95rem !important;
  line-height: 1.65 !important;
  color: var(--text-secondary, #475569) !important;
  margin: 0 0 16px 0 !important;
  padding-right: 12px !important;
  word-break: break-word !important;
  overflow-wrap: break-word !important;
  box-sizing: border-box !important;
}

.post-card .post-footer,
.post-footer {
  margin-top: auto !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
  padding-top: 10px !important;
  border-top: 1px solid var(--border-light, #f1f5f9) !important;
  padding-right: 8px !important;
}

.post-card .post-tag {
  background: rgba(16, 185, 129, 0.12) !important;
  color: #059669 !important;
  border-radius: 9999px !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  padding: 4px 12px !important;
  display: inline-block !important;
}

.post-card .post-tag.channel-tag {
  background: rgba(79, 70, 229, 0.1) !important;
  color: #4f46e5 !important;
}

@media (max-width: 600px) {
  .cards-container,
  .posts-grid,
  .categories-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .post-card .post-content {
    padding: 16px 18px 18px 18px !important;
  }

  .section-header h2 {
    font-size: 1.25rem !important;
  }
}

/* ========================================================
   GLOBAL ICON & BUTTON SPACING RULES
   Prevents icons/favicons from touching adjacent text
   ======================================================== */
.btn, button, .action-btn, .tab-btn, .theme-toggle-btn, .google-btn, .subscribe-btn, .create-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
}

.btn i, button i, a.btn i, .action-btn i, .google-btn i, .theme-toggle-btn i {
  margin: 0 !important;
  flex-shrink: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
}

.loading-spinner, .loading-container, .loading-state, .loading-indicator {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
}

.loading-spinner i, .loading-container i, .loading-state i, .loading-indicator i {
  margin: 0 !important;
  flex-shrink: 0 !important;
}

.stat-item, .post-meta, .meta-item, .author-info, .badge {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
}

.stat-item i, .post-meta i, .meta-item i, .badge i {
  margin: 0 !important;
  flex-shrink: 0 !important;
}

/* ========================================================
   INPUT FIELD & PLACEHOLDER ICON SPACING (REGISTER / LOGIN)
   Guarantees 52px left padding so icon never overlaps placeholder text
   ======================================================== */
.form-group .input-with-icon,
.input-with-icon {
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.auth-form .input-with-icon input,
.form-group .input-with-icon input,
.input-with-icon input {
  width: 100% !important;
  box-sizing: border-box !important;
  padding-top: 14px !important;
  padding-bottom: 14px !important;
  padding-left: 52px !important; /* Crucial: leaves plenty of clearance for left icon */
  padding-right: 50px !important; /* Clearance for right password toggle icon */
  font-size: 1rem !important;
  line-height: 1.5 !important;
  border-radius: 12px !important;
  border: 1px solid #d1d5db !important;
  background-color: #ffffff !important;
  color: #1f2937 !important;
}

.auth-form .input-with-icon select,
.form-group .input-with-icon select,
.input-with-icon select,
.language-select-wrapper select {
  width: 100% !important;
  box-sizing: border-box !important;
  padding-top: 14px !important;
  padding-bottom: 14px !important;
  padding-left: 52px !important;
  padding-right: 40px !important;
  font-size: 1rem !important;
  border-radius: 12px !important;
}

.input-with-icon > i:first-child,
.input-with-icon > .fas:first-child,
.input-with-icon > .fab:first-child,
.input-with-icon > .far:first-child {
  position: absolute !important;
  left: 18px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  font-size: 1.05rem !important;
  color: #64748b !important;
  pointer-events: none !important;
  z-index: 10 !important;
  margin: 0 !important;
}

.input-with-icon .toggle-password {
  position: absolute !important;
  right: 18px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  color: #64748b !important;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
  cursor: pointer !important;
  font-size: 1.05rem !important;
  z-index: 10 !important;
}

/* Fix rankings table dark mode striped rows */
[data-theme="dark"] .rankings-table,
body.dark-theme .rankings-table {
  background-color: transparent !important;
  color: #f8fafc !important;
}

[data-theme="dark"] .rankings-table th,
body.dark-theme .rankings-table th {
  background-color: #0f172a !important;
  color: #f8fafc !important;
  border-bottom: 2px solid #334155 !important;
}

[data-theme="dark"] .rankings-table td,
body.dark-theme .rankings-table td {
  border-bottom: 1px solid #1e293b !important;
  color: #f8fafc !important;
}

[data-theme="dark"] .rankings-table tr,
body.dark-theme .rankings-table tr {
  background-color: #0b1120 !important;
}

[data-theme="dark"] .rankings-table tr:hover,
body.dark-theme .rankings-table tr:hover {
  background-color: #1e293b !important;
}

[data-theme="dark"] .rankings-table .user-name,
body.dark-theme .rankings-table .user-name {
  color: #f8fafc !important;
}

[data-theme="dark"] .rankings-table .user-role,
body.dark-theme .rankings-table .user-role {
  color: #94a3b8 !important;
}
#search-channel.input,
input#search-channel {
  height: 46px !important;
  min-height: 46px !important;
  line-height: normal !important;
  padding: 10px 16px 10px 46px !important;
  box-sizing: border-box !important;
  margin: 0 !important;
}
.post-card {
  padding-bottom: 14px !important;
}
.post-card .post-content {
  padding: 16px 20px 8px 20px !important;
}
.post-card .post-footer {
  margin-top: 14px !important;
  margin-bottom: 4px !important;
}

/* ========================================================
   DARK THEME ENHANCEMENTS & HIGH-CONTRAST POLISH
   Supports both [data-theme="dark"] and body.dark-theme
   ======================================================== */
[data-theme="dark"],
body.dark-theme {
  --bg-dark: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #24344d;
  --border-color: #334155;
  --color-border: #334155;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --surface-color: #1e293b;
  --surface-alt: #0f172a;
  background-color: #0f172a !important;
  color: #f8fafc !important;
}

[data-theme="dark"] .sidebar,
body.dark-theme .sidebar {
  background-color: #0f172a !important;
  border-right-color: #1e293b !important;
}

[data-theme="dark"] .main-content,
body.dark-theme .main-content {
  background-color: #0b1120 !important;
  color: #f8fafc !important;
}

[data-theme="dark"] .quiz-card,
[data-theme="dark"] .post-card,
[data-theme="dark"] .channel-card,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .profile-header:not([data-custom-bg="true"]),
[data-theme="dark"] .profile-tab-container,
[data-theme="dark"] .tab-content,
[data-theme="dark"] .discussion-card,
[data-theme="dark"] .world-messages > div > div:last-child,
body.dark-theme .quiz-card,
body.dark-theme .post-card,
body.dark-theme .channel-card,
body.dark-theme .stat-card,
body.dark-theme .profile-header:not([data-custom-bg="true"]),
body.dark-theme .profile-tab-container,
body.dark-theme .tab-content,
body.dark-theme .discussion-card {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35) !important;
}

[data-theme="dark"] .quiz-card:hover,
[data-theme="dark"] .post-card:hover,
[data-theme="dark"] .channel-card:hover,
body.dark-theme .quiz-card:hover,
body.dark-theme .post-card:hover,
body.dark-theme .channel-card:hover {
  background-color: #24344d !important;
  border-color: #10b981 !important;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.15) !important;
}

[data-theme="dark"] .quiz-card h3,
[data-theme="dark"] .post-card h3,
[data-theme="dark"] .post-card .post-title,
[data-theme="dark"] .channel-name,
[data-theme="dark"] .section-title,
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
body.dark-theme .quiz-card h3,
body.dark-theme .post-card h3,
body.dark-theme .post-card .post-title,
body.dark-theme .channel-name,
body.dark-theme .section-title,
body.dark-theme h1,
body.dark-theme h2,
body.dark-theme h3,
body.dark-theme h4 {
  color: #f8fafc !important;
}

[data-theme="dark"] .quiz-card p,
[data-theme="dark"] .post-card p,
[data-theme="dark"] .channel-description,
[data-theme="dark"] .stat-label,
[data-theme="dark"] .text-muted,
body.dark-theme .quiz-card p,
body.dark-theme .post-card p,
body.dark-theme .channel-description,
body.dark-theme .stat-label,
body.dark-theme .text-muted {
  color: #94a3b8 !important;
}

[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not(.tg-chat-text-input):not(.channel-broadcast-input):not(.search-input),
[data-theme="dark"] textarea:not(.tg-chat-text-input):not(.channel-broadcast-input),
[data-theme="dark"] select,
body.dark-theme input:not([type="checkbox"]):not([type="radio"]):not(.tg-chat-text-input):not(.channel-broadcast-input):not(.search-input),
body.dark-theme textarea:not(.tg-chat-text-input):not(.channel-broadcast-input),
body.dark-theme select {
  background-color: #0f172a !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder,
body.dark-theme input::placeholder,
body.dark-theme textarea::placeholder {
  color: #64748b !important;
}

[data-theme="dark"] .secondary-btn,
body.dark-theme .secondary-btn {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}

[data-theme="dark"] .secondary-btn:hover,
body.dark-theme .secondary-btn:hover {
  background-color: #24344d !important;
  border-color: #10b981 !important;
  color: #10b981 !important;
}

[data-theme="dark"] .mobile-top-bar,
body.dark-theme .mobile-top-bar {
  background-color: #0f172a !important;
  border-bottom-color: #1e293b !important;
}

/* Mobile top bar and main container: keep strictly standard 56px height without safe-area duplication (SafeArea is handled natively by Expo/App wrapper) */
.mobile-top-bar {
  height: 56px !important;
  padding-top: 0 !important;
  margin-top: 0 !important;
  box-sizing: border-box !important;
}

@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .mobile-bottom-nav {
    bottom: calc(16px + env(safe-area-inset-bottom)) !important;
  }
}

[data-theme="dark"] .mobile-bottom-nav,
body.dark-theme .mobile-bottom-nav {
  background-color: #0f172a !important;
  border-top-color: #1e293b !important;
}

[data-theme="dark"] .gateway-card,
body.dark-theme .gateway-card {
  background-color: #1e293b !important;
  border-color: #334155 !important;
}

/* Ensure mobile nav is strictly hidden on desktop screens */
@media (min-width: 769px) {
  .mobile-bottom-nav,
  .mobile-top-bar {
    display: none !important;
    visibility: hidden !important;
  }
}

/* Vertical centering for search icons */
.search-icon-fixed,
.search-wrapper i.fa-search,
.search-box i.fa-search {
  position: absolute;
  left: 16px;
  top: 50% !important;
  transform: translateY(-50%) !important;
  pointer-events: none;
}

/* Comprehensive Dark Mode Polish for Dashboard, Chat, Create Quiz, and Profile */
[data-theme="dark"] .dashboard-section,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .form-card,
[data-theme="dark"] .question-block,
[data-theme="dark"] .balance-card,
[data-theme="dark"] .withdraw-section,
[data-theme="dark"] .transfer-section,
[data-theme="dark"] .profile-tabs,
[data-theme="dark"] .tab-content,
body.dark-theme .dashboard-section,
body.dark-theme .stat-card,
body.dark-theme .form-card,
body.dark-theme .question-block,
body.dark-theme .balance-card,
body.dark-theme .withdraw-section,
body.dark-theme .transfer-section,
body.dark-theme .tab-content {
  background-color: var(--color-sidebar-bg, #111827) !important;
  border-color: var(--color-border, #374151) !important;
  color: var(--color-text-primary, #F9FAFB) !important;
}

[data-theme="dark"] .stat-info p,
[data-theme="dark"] .dashboard-section h1,
[data-theme="dark"] .dashboard-section h2,
[data-theme="dark"] .dashboard-section h3,
[data-theme="dark"] .dashboard-section h4,
[data-theme="dark"] .activity-list div,
body.dark-theme .stat-info p,
body.dark-theme .dashboard-section h1,
body.dark-theme .dashboard-section h2,
body.dark-theme .dashboard-section h3,
body.dark-theme .dashboard-section h4 {
  color: var(--color-text-primary, #F9FAFB) !important;
}

[data-theme="dark"] .stat-info h3,
[data-theme="dark"] .dashboard-section p,
[data-theme="dark"] .activity-list span,
body.dark-theme .stat-info h3,
body.dark-theme .dashboard-section p,
body.dark-theme .activity-list span {
  color: var(--color-text-secondary, #D1D5DB) !important;
}

[data-theme="dark"] .chat-container,
body.dark-theme .chat-container {
  background-color: var(--color-main-bg, #1F2937) !important;
}

[data-theme="light"] .chat-container,
body:not(.dark-theme) .chat-container {
  background-color: var(--color-main-bg, #F8FAFC) !important;
  color: var(--color-text-primary, #0F172A) !important;
}

[data-theme="dark"] .chat-sidebar,
[data-theme="dark"] .chat-main,
body.dark-theme .chat-sidebar,
body.dark-theme .chat-main {
  background-color: var(--color-sidebar-bg, #111827) !important;
  border-color: var(--color-border, #374151) !important;
}

[data-theme="light"] .chat-sidebar,
[data-theme="light"] .chat-main,
body:not(.dark-theme) .chat-sidebar,
body:not(.dark-theme) .chat-main {
  background-color: var(--color-sidebar-bg, #FFFFFF) !important;
  border-color: var(--color-border, #E2E8F0) !important;
  color: var(--color-text-primary, #0F172A) !important;
}

[data-theme="dark"] .question-block input,
[data-theme="dark"] .question-block textarea,
[data-theme="dark"] .form-card input,
[data-theme="dark"] .form-card textarea,
[data-theme="dark"] .form-card select,
[data-theme="dark"] .profile-form input,
[data-theme="dark"] .profile-form textarea,
body.dark-theme .question-block input,
body.dark-theme .question-block textarea,
body.dark-theme .form-card input,
body.dark-theme .form-card textarea,
body.dark-theme .form-card select,
body.dark-theme .profile-form input,
body.dark-theme .profile-form textarea {
  background-color: var(--color-main-bg, #1F2937) !important;
  border-color: var(--color-border, #374151) !important;
  color: var(--color-text-primary, #F9FAFB) !important;
}






/* --- DARK THEME AUTH REQUIRED PROFILE CARD FIX --- */
[data-theme='dark'] .profile-auth-required-card,
.dark .profile-auth-required-card,
body.dark-theme .profile-auth-required-card {
  background: #111827 !important;
  background-color: #111827 !important;
  border: 1px solid #374151 !important;
  color: #f9fafb !important;
}

[data-theme='dark'] .profile-auth-required-card h2,
.dark .profile-auth-required-card h2,
body.dark-theme .profile-auth-required-card h2 {
  color: #f9fafb !important;
}

[data-theme='dark'] .profile-auth-required-card p,
.dark .profile-auth-required-card p,
body.dark-theme .profile-auth-required-card p {
  color: #94a3b8 !important;
}

/* --- DARK THEME SEARCH PILL FIX (Image 2) --- */
[data-theme="dark"] .search-form,
body.dark-theme .search-form {
  background: var(--color-sidebar-bg, #111827) !important;
  border: 1px solid var(--color-border, #374151) !important;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] .search-input,
body.dark-theme .search-input {
  background: transparent !important;
  color: var(--color-text-primary, #F9FAFB) !important;
}

/* --- DARK THEME LEADERBOARD CHANNEL CARDS & LOADING (Image 1 & 4) --- */
[data-theme="dark"] .leaderboard-channel-card,
[data-theme="dark"] .leaderboard-loading-card,
body.dark-theme .leaderboard-channel-card,
body.dark-theme .leaderboard-loading-card {
  background-color: var(--color-sidebar-bg, #111827) !important;
  border: 1px solid var(--color-border, #374151) !important;
  color: var(--color-text-primary, #F9FAFB) !important;
}

[data-theme="dark"] .leaderboard-channel-card h3,
[data-theme="dark"] .leaderboard-loading-card h3,
body.dark-theme .leaderboard-channel-card h3,
body.dark-theme .leaderboard-loading-card h3 {
  color: var(--color-text-primary, #F9FAFB) !important;
}


/* ========================================================
   NOTIFICATION BELL, SEARCH BAR & RESULT CARD MASTER POLISH
   ======================================================== */

/* Hide desktop notification bell on small screens where mobile top bar has it */
@media (max-width: 992px) {
  .desktop-notif-bell-container {
    display: none !important;
  }
}

/* Perfect Search Form in Dark Mode without white borders */
[data-theme="dark"] .search-form,
body.dark-theme .search-form {
  background: var(--color-sidebar-bg, #111827) !important;
  border: 1px solid var(--color-border, #374151) !important;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] .search-input,
body.dark-theme .search-input,
[data-theme="dark"] input#search-input {
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  color: #f9fafb !important;
  height: 38px !important;
  line-height: 38px !important;
  padding: 0 !important;
  margin: 0 !important;
  vertical-align: middle !important;
}

/* Settings & Profile Tab Bottom Padding Fix so Save Preferences is never clipped */
.tab-content,
#settings-tab,
#security-tab,
.profile-content,
.profile-container {
  padding-bottom: 70px !important;
  margin-bottom: 30px !important;
}

/* Beautiful Quiz Completed Result Card */
.quiz-results-card-modern {
  max-width: 540px;
  margin: 20px auto 40px auto;
  background: var(--color-sidebar-bg, #ffffff);
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.12);
  border: 1px solid var(--color-border, #e5e7eb);
  overflow: hidden;
  text-align: center;
}

.quiz-results-header-modern {
  background: #10B981;
  color: #ffffff;
  padding: 30px 20px;
}

.quiz-results-header-modern h2 {
  color: #ffffff !important;
  font-size: 1.8rem;
  font-weight: 800;
  margin: 0;
}

.score-circle-modern {
  width: 170px;
  height: 170px;
  margin: 30px auto 20px auto;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: conic-gradient(#10B981 var(--progress, 0%), #e2e8f0 0deg);
  transition: background 1.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.score-circle-modern::before {
  content: "";
  position: absolute;
  inset: 14px;
  background: var(--color-sidebar-bg, #ffffff);
  border-radius: 50%;
  z-index: 1;
}

.score-percentage-modern {
  position: relative;
  z-index: 2;
  font-size: 40px;
  font-weight: 800;
  color: #10B981;
}

[data-theme="dark"] .score-circle-modern {
  background: conic-gradient(#10B981 var(--progress, 0%), #374151 0deg);
}

[data-theme="dark"] .score-circle-modern::before {
  background: var(--color-sidebar-bg, #111827);
}

[data-theme="dark"] .quiz-results-card-modern {
  background: var(--color-sidebar-bg, #111827);
  border-color: var(--color-border, #374151);
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}


/* ========================================================
   CRITICAL DARK MODE, SCROLL & Z-INDEX MASTER FIXES
   ======================================================== */

/* Fix 1: Notification panel must appear ON TOP of everything */
.desktop-notif-bell-container {
  position: absolute !important;
  right: 0 !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  z-index: 999999 !important;
}

.search-section {
  position: relative !important;
  z-index: 1000 !important;
}

.notif-dropdown {
  z-index: 9999999 !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] .notif-dropdown,
body.dark-theme .notif-dropdown {
  background: var(--color-sidebar-bg, #111827) !important;
  border-color: var(--color-border, #374151) !important;
}

[data-theme="dark"] .notif-header,
body.dark-theme .notif-header {
  border-bottom-color: var(--color-border, #374151) !important;
}

.new-quiz-button,
.create-post-container,
.hero-section {
  position: relative !important;
  z-index: 1 !important;
}

/* Fix 2: Global Profile page scrolling fix */
html, body {
  height: auto !important;
  min-height: 100vh !important;
  overflow-y: auto !important;
}

.container {
  min-height: 100vh !important;
  height: auto !important;
  overflow: visible !important;
}

.main-content {
  min-height: 100vh !important;
  height: auto !important;
  overflow-y: visible !important;
}

/* Fix 3: Create Post Form in Dark Mode */
[data-theme="dark"] .create-post-container form,
body.dark-theme .create-post-container form {
  background: var(--color-sidebar-bg, #111827) !important;
  border: 1px solid var(--color-border, #374151) !important;
  color: #f9fafb !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] .create-post-container input,
[data-theme="dark"] .create-post-container textarea,
[data-theme="dark"] .create-post-container select {
  background: #0f172a !important;
  border: 1px solid var(--color-border, #374151) !important;
  color: #f9fafb !important;
}

[data-theme="dark"] .create-post-container label {
  color: #f9fafb !important;
}

/* Fix 4: Single Channel Header Card in Dark Mode */
[data-theme="dark"] .channel-header-card,
body.dark-theme .channel-header-card {
  background: var(--color-sidebar-bg, #111827) !important;
  border: 1px solid var(--color-border, #374151) !important;
  color: #f9fafb !important;
}

[data-theme="dark"] .channel-header-card h1,
[data-theme="dark"] .channel-header-card p {
  color: #f9fafb !important;
}

/* Fix 5: Logout Modal in Dark Mode */
[data-theme="dark"] .modal-content,
body.dark-theme .modal-content,
[data-theme="dark"] .modal-card,
body.dark-theme .modal-card {
  background: var(--color-sidebar-bg, #111827) !important;
  border: 1px solid var(--color-border, #374151) !important;
  color: #f9fafb !important;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6) !important;
}

[data-theme="dark"] .modal-content h3,
[data-theme="dark"] .modal-content p {
  color: #f9fafb !important;
}

/* Fix 6: Dark mode loading state spinner */
[data-theme="dark"] .loading-container,
body.dark-theme .loading-container {
  color: #f9fafb !important;
}

.spinner {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(16, 185, 129, 0.15);
  border-top-color: var(--primary-color, #10B981);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 15px auto;
}

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

/* Fix 8: Remove phantom top blank spaces across all pages */
@media (max-width: 1023px) {
  .main-content {
    min-height: auto !important;
    padding-top: 12px !important;
  }

  .world-gateway {
    min-height: auto !important;
    padding: 16px 14px !important;
  }

  .gateway-content {
    margin-top: 0 !important;
  }

  .gateway-subtitle {
    margin-bottom: 24px !important;
  }
}

.world-gateway {
  position: relative !important;
  inset: auto !important;
  min-height: calc(100vh - 160px) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 30px 20px !important;
}

/* ========================================================
   TELEGRAM-STYLE CHAT INPUT & MESSAGE BUBBLES
   ======================================================== */
.tg-chat-bar-container {
  padding: 12px 18px !important;
  background: var(--surface-color, #ffffff) !important;
  border-top: 1px solid var(--border-color, rgba(0,0,0,0.08)) !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  position: relative !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

[data-theme='dark'] .tg-chat-bar-container,
.dark .tg-chat-bar-container {
  background: #17212b !important;
  border-top: 1px solid rgba(255,255,255,0.08) !important;
}

.tg-chat-input-pill {
  flex: 1 !important;
  display: flex !important;
  align-items: center !important;
  background: #f1f5f9 !important;
  border-radius: 22px !important;
  padding: 4px 6px 4px 14px !important;
  border: 1px solid #e2e8f0 !important;
  transition: all 0.2s ease !important;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.04) !important;
}

[data-theme='dark'] .tg-chat-input-pill,
body.dark-theme .tg-chat-input-pill,
.dark .tg-chat-input-pill {
  background: #242f3d !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.2) !important;
}

.tg-chat-input-pill:focus-within {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2) !important;
  background: #ffffff !important;
  outline: none !important;
}

[data-theme='dark'] .tg-chat-input-pill:focus-within,
body.dark-theme .tg-chat-input-pill:focus-within,
.dark .tg-chat-input-pill:focus-within {
  background: #1e2c3a !important;
  border-color: #10b981 !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25) !important;
  outline: none !important;
}

.tg-chat-emoji-btn {
  background: transparent !important;
  border: none !important;
  color: #82868a !important;
  font-size: 1.25rem !important;
  cursor: pointer !important;
  padding: 6px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 50% !important;
  transition: color 0.15s ease, transform 0.15s ease !important;
}

.tg-chat-emoji-btn:hover {
  color: #10b981 !important;
  transform: scale(1.1) !important;
}

.tg-chat-text-input,
input.tg-chat-text-input,
textarea.tg-chat-text-input,
.tg-chat-input-pill .tg-chat-text-input,
[data-theme='dark'] input.tg-chat-text-input,
[data-theme='dark'] textarea.tg-chat-text-input,
[data-theme='light'] input.tg-chat-text-input,
[data-theme='light'] textarea.tg-chat-text-input,
body.dark-theme input.tg-chat-text-input,
body.dark-theme textarea.tg-chat-text-input,
body.light-theme input.tg-chat-text-input,
body.light-theme textarea.tg-chat-text-input,
html body.dark-theme .tg-chat-input-pill .tg-chat-text-input,
html[data-theme="dark"] .tg-chat-input-pill .tg-chat-text-input,
[data-theme="dark"] input[type="text"].tg-chat-text-input,
[data-theme="dark"] textarea.tg-chat-text-input {
  flex: 1 !important;
  border: 0 !important;
  border-width: 0 !important;
  border-style: none !important;
  border-color: transparent !important;
  outline: none !important;
  box-shadow: none !important;
  -webkit-box-shadow: none !important;
  background: transparent !important;
  background-color: transparent !important;
  border-radius: 0 !important;
  font-size: 0.95rem !important;
  font-family: inherit !important;
  line-height: 1.4 !important;
  min-height: 24px !important;
  max-height: 110px !important;
  padding: 6px 10px !important;
  margin: 0 !important;
  vertical-align: middle !important;
  resize: none !important;
  overflow-y: auto !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}

.tg-chat-text-input:focus,
.tg-chat-text-input:focus-visible {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

[data-theme='dark'] .tg-chat-text-input,
.dark .tg-chat-text-input {
  color: #f8fafc !important;
}

.tg-chat-text-input::placeholder {
  color: #94a3b8 !important;
}

.tg-chat-send-btn {
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  border-radius: 50% !important;
  background: #10b981 !important; /* Quizzygram emerald green */
  color: #ffffff !important;
  border: none !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35) !important;
  transition: all 0.2s ease !important;
  padding: 0 !important;
}

.tg-chat-send-btn:hover:not(:disabled) {
  background: #059669 !important;
  transform: scale(1.05) !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.45) !important;
}

.tg-chat-send-btn:disabled {
  opacity: 0.5 !important;
  cursor: not-allowed !important;
  transform: none !important;
  background: #10b981 !important;
}

.tg-chat-send-btn i {
  font-size: 1.05rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  line-height: 1 !important;
  transform: translate(-1px, 0.5px) !important; /* Perfect optical center for paper plane */
}

/* Sidebar navigation item curvature (pill) */
.sidebar .main-nav li a,
.sidebar .main-nav a,
.main-nav a {
  border-radius: 9999px !important;
  margin-left: 8px !important;
  margin-right: 8px !important;
  padding: 10px 18px !important;
  transition: all 0.2s ease !important;
}

/* Perfect Bell centering in circle */
.search-container .bell-icon-btn,
.search-section button.bell-btn,
button.notification-bell-btn,
.header-actions button:has(.fa-bell) {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  line-height: 1 !important;
  text-align: center !important;
}

.search-container .bell-icon-btn i,
.search-section button.bell-btn i,
button.notification-bell-btn i,
.header-actions button:has(.fa-bell) i {
  display: inline-block !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1 !important;
  vertical-align: middle !important;
}

/* Perfect mathematical centering for notification bell button and icon */
.notif-bell-btn,
button.notif-bell-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  margin: 0 !important;
  line-height: 1 !important;
  box-sizing: border-box !important;
}

.notif-bell-btn i,
button.notif-bell-btn i,
.notif-bell-btn .fa-bell {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 1em !important;
  height: 1em !important;
  line-height: 1 !important;
  margin: 0 auto !important;
  padding: 0 !important;
  vertical-align: middle !important;
  transform: translateY(-0.5px) !important;
}


/* ========================================================
   UNIVERSAL CONTRAST, CENTERING & RESPONSIVENESS OVERRIDES
   ======================================================== */

/* 1. Perfect centering and uniform size for Search button and all search icons */
.search-btn,
button.search-btn,
#search-form .search-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  min-height: 40px !important;
  max-width: 40px !important;
  max-height: 40px !important;
  padding: 0 !important;
  line-height: 1 !important;
  text-align: center !important;
  border-radius: 50% !important;
  box-sizing: border-box !important;
  font-size: 1rem !important;
}

.search-btn i,
button.search-btn i,
#search-form .search-btn i,
.search-btn .fa-search {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 1em !important;
  height: 1em !important;
  line-height: 1 !important;
  font-size: 1rem !important;
  margin: 0 auto !important;
  padding: 0 !important;
  vertical-align: middle !important;
  transform: translate(0, 0) !important;
}

/* 2. Text visibility inside green badges/tags/boxes across dark and light themes */
.post-tag,
.post-tag.channel-tag,
.quiz-category,
.badge,
.tag,
span[style*="#10b981"],
div[style*="#10b981"],
span[style*="rgb(16, 185, 129)"] {
  font-weight: 600 !important;
}

/* Ensure text on solid green background is crisp white with maximum contrast */
[data-theme='dark'] .post-tag,
.dark .post-tag,
[data-theme='dark'] .btn.primary-btn,
.dark .btn.primary-btn {
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2) !important;
}

/* Ensure text inside secondary tags or pill badges in dark mode is high contrast */
[data-theme='dark'] .post-tag.channel-tag,
.dark .post-tag.channel-tag {
  background: rgba(251, 191, 36, 0.18) !important;
  color: #fef08a !important;
  border-color: rgba(251, 191, 36, 0.4) !important;
}

[data-theme='dark'] .quiz-category,
.dark .quiz-category {
  background-color: rgba(16, 185, 129, 0.2) !important;
  color: #6ee7b7 !important;
}

/* 3. Channels Card Grid Layout & Equal Height */
.channel-card {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  text-align: left !important;
  gap: 16px !important;
  min-height: 104px !important;
  box-sizing: border-box !important;
}

.channel-card .channel-info {
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  text-align: left !important;
  flex: 1 !important;
  min-width: 0 !important;
}

.channel-card .channel-name,
.channel-card .channel-subscribers,
.channel-card .channel-description {
  text-align: left !important;
}

/* 4. Telegram-style Green Send Button Always Crisp & Pop */
.tg-chat-send-btn,
button.tg-chat-send-btn {
  background: #10b981 !important;
  color: #ffffff !important;
  opacity: 1 !important;
}

.tg-chat-send-btn:disabled {
  background: #10b981 !important;
  opacity: 0.55 !important;
  color: #ffffff !important;
}


/* ========================================================
   ADMIN PANEL DARK THEME & TABLE VISIBILITY FIXES
   ======================================================== */

/* Ensure admin content containers adapt cleanly to dark theme */
[data-theme='dark'] .admin-content,
.dark .admin-content,
[data-theme='dark'] .main-content:has(.admin-header),
.dark .main-content:has(.admin-header),
[data-theme='dark'] .main-content:has(h1),
.dark .main-content:has(h1) {
  color: #f8fafc !important;
}

/* Fix white box on dark theme in admin moderation tables, forms, inputs */
[data-theme='dark'] div:has(> table),
.dark div:has(> table),
[data-theme='dark'] .table-container,
.dark .table-container,
[data-theme='dark'] .admin-section,
.dark .admin-section,
[data-theme='dark'] .admin-table,
.dark .admin-table,
[data-theme='dark'] form:has(button[type="submit"]):not(:has(.tg-chat-input-pill)),
.dark form:has(button[type="submit"]):not(:has(.tg-chat-input-pill)) {
  background: #111827 !important;
  border-color: #374151 !important;
  color: #f9fafb !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4) !important;
}

/* Ensure inputs, selects, textareas in admin adapt to dark theme */
[data-theme='dark'] .admin-content input,
.dark .admin-content input,
[data-theme='dark'] .admin-content select,
.dark .admin-content select,
[data-theme='dark'] .admin-content textarea,
.dark .admin-content textarea {
  background: #1e293b !important;
  border-color: #374151 !important;
  color: #f8fafc !important;
}

[data-theme='dark'] .admin-content input::placeholder,
.dark .admin-content input::placeholder {
  color: #94a3b8 !important;
}

/* Ensure table headers and cells are crisp white and contrast-rich in dark theme */
[data-theme='dark'] table th,
.dark table th {
  color: #94a3b8 !important;
  border-bottom: 2px solid #374151 !important;
  background: #1f2937 !important;
}

[data-theme='dark'] table td,
.dark table td {
  color: #f1f5f9 !important;
  border-bottom: 1px solid #1f2937 !important;
}

[data-theme='dark'] table tr:hover,
.dark table tr:hover {
  background: rgba(255, 255, 255, 0.04) !important;
}

/* Fix light table containers on dark background */
[data-theme='dark'] div[style*="background: var(--card-bg, #fff)"],
.dark div[style*="background: var(--card-bg, #fff)"],
[data-theme='dark'] div[style*="background: var(--color-sidebar-bg, #ffffff)"],
.dark div[style*="background: var(--color-sidebar-bg, #ffffff)"] {
  background: #111827 !important;
  border-color: #374151 !important;
  color: #f9fafb !important;
}

/* Ensure action view/inspect buttons in tables pop */
[data-theme='dark'] table td .btn.secondary-btn,
.dark table td .btn.secondary-btn {
  background: #1f2937 !important;
  border: 1px solid #4b5563 !important;
  color: #ffffff !important;
}

[data-theme='dark'] table td .btn.secondary-btn:hover,
.dark table td .btn.secondary-btn:hover {
  background: #10b981 !important;
  border-color: #10b981 !important;
  color: #ffffff !important;
}

/* ========================================================
   SECTION HEADER ALIGNMENT (LEFT CORNER FOR TITLES & VIEW ALL)
   Keeps section titles, "View All", and actions aligned left
   ======================================================== */
.section-header {
  display: flex !important;
  flex-direction: row !important;
  justify-content: space-between !important;
  align-items: center !important;
  text-align: left !important;
  width: 100% !important;
  margin-bottom: 20px !important;
  gap: 12px !important;
}

.section-title-group {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  text-align: left !important;
  margin: 0 !important;
}

.section-title-group h2,
.section-header h2 {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  text-align: left !important;
  margin: 0 !important;
}

.section-title-group .view-all,
.section-header .view-all {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  text-align: left !important;
  margin-top: 4px !important;
}

/* Action button container on right side (or left aligned if wrapped) */
.new-quiz-button {
  display: inline-flex !important;
  align-items: center !important;
  flex-shrink: 0 !important;
  margin-left: auto !important;
}

@media (max-width: 768px) {
  .section-header {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    text-align: left !important;
    gap: 10px !important;
    width: 100% !important;
  }

  .section-title-group {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    text-align: left !important;
  }

  .section-title-group h2,
  .section-header h2 {
    text-align: left !important;
    justify-content: flex-start !important;
  }

  .section-title-group .view-all,
  .section-header .view-all {
    text-align: left !important;
    justify-content: flex-start !important;
  }

  .new-quiz-button {
    margin-left: auto !important;
    display: inline-flex !important;
  }
}

@media (max-width: 540px) {
  .section-header {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    text-align: left !important;
    gap: 10px !important;
  }

  .section-title-group {
    width: auto !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    text-align: left !important;
  }

  .section-title-group h2,
  .section-header h2 {
    width: auto !important;
    font-size: 1.2rem !important;
    text-align: left !important;
    justify-content: flex-start !important;
  }

  .section-title-group .view-all,
  .section-header .view-all {
    text-align: left !important;
    justify-content: flex-start !important;
  }

  .new-quiz-button {
    margin-left: auto !important;
    align-self: center !important;
    display: inline-flex !important;
    justify-content: flex-end !important;
    width: auto !important;
    gap: 8px !important;
  }

  .new-quiz-button .btn {
    margin: 0 !important;
  }
}

/* ========================================================
   AUTH (LOGIN / REGISTER) DARK THEME FIXES & ACCIDENTAL BLACK REMOVAL
   ======================================================== */
[data-theme='dark'] .auth-container,
.dark .auth-container,
[data-theme='dark'] body.auth-body,
body.dark-theme .auth-container {
  background-color: #0b1120 !important;
}

[data-theme='dark'] .auth-wrapper,
.dark .auth-wrapper,
body.dark-theme .auth-wrapper {
  background-color: #111827 !important;
  border: 1px solid #1e293b !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
}

[data-theme='dark'] .auth-card,
.dark .auth-card,
body.dark-theme .auth-card {
  background-color: #111827 !important;
  color: #f8fafc !important;
}

[data-theme='dark'] .auth-card h2,
.dark .auth-card h2,
body.dark-theme .auth-card h2 {
  color: #ffffff !important;
}

[data-theme='dark'] .auth-subtitle,
.dark .auth-subtitle,
body.dark-theme .auth-subtitle {
  color: #94a3b8 !important;
}

[data-theme='dark'] .form-group label,
.dark .form-group label,
body.dark-theme .form-group label {
  color: #e2e8f0 !important;
}

/* Remove awkward pure-black background on auth inputs in dark mode */
[data-theme='dark'] .auth-form .input-with-icon input,
.dark .auth-form .input-with-icon input,
[data-theme='dark'] .form-group .input-with-icon input,
.dark .form-group .input-with-icon input,
body.dark-theme .input-with-icon input {
  background-color: #1e293b !important;
  border: 1px solid #334155 !important;
  color: #f8fafc !important;
}

[data-theme='dark'] .auth-form .input-with-icon input:focus,
.dark .auth-form .input-with-icon input:focus,
body.dark-theme .input-with-icon input:focus {
  background-color: #1e293b !important;
  border-color: #10b981 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25) !important;
}

[data-theme='dark'] .auth-form .input-with-icon input::placeholder,
.dark .auth-form .input-with-icon input::placeholder,
body.dark-theme .input-with-icon input::placeholder {
  color: #64748b !important;
}

[data-theme='dark'] .input-with-icon > i,
.dark .input-with-icon > i,
body.dark-theme .input-with-icon > i {
  color: #94a3b8 !important;
}

[data-theme='dark'] .divider span,
.dark .divider span,
body.dark-theme .divider span {
  background-color: #111827 !important;
  color: #94a3b8 !important;
}

[data-theme='dark'] .divider::before,
.dark .divider::before,
[data-theme='dark'] .divider::after,
.dark .divider::after {
  background-color: #334155 !important;
}

[data-theme='dark'] .google-btn,
.dark .google-btn,
body.dark-theme .google-btn {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}

[data-theme='dark'] .google-btn:hover,
.dark .google-btn:hover,
body.dark-theme .google-btn:hover {
  background-color: #334155 !important;
  color: #ffffff !important;
}

/* ========================================================
   SIGN IN REQUIRED CARD (PROFILE PAGE) DARK THEME FIX
   ======================================================== */
[data-theme='dark'] div[style*="max-width: 440px"],
.dark div[style*="max-width: 440px"],
body.dark-theme div[style*="max-width: 440px"] {
  background: #111827 !important;
  border-color: #374151 !important;
  color: #f9fafb !important;
}

/* ========================================================
   DARK THEME SELECT / DROPDOWN NATIVE BUTTON RESET
   (Eliminates white square up/down select box in Blink/Webkit)
   ======================================================== */
select,
[data-theme='dark'] select,
.dark select,
body.dark-theme select {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") !important;
  background-repeat: no-repeat !important;
  background-position: right 14px center !important;
  background-size: 16px 16px !important;
  padding-right: 38px !important;
}

[data-theme='dark'] select,
.dark select,
body.dark-theme select {
  background-color: #1e293b !important;
  color: #f8fafc !important;
  border: 1px solid #334155 !important;
}

[data-theme='dark'] select option,
.dark select option,
body.dark-theme select option {
  background-color: #0f172a !important;
  color: #f8fafc !important;
}

/* ========================================================
   QUIZ STATUS & SOLID GREEN BADGE HIGH CONTRAST LABELS
   (Fixes missing/invisible text on top-right card badges)
   ======================================================== */
.quiz-status,
.quiz-status.public,
.quiz-status.private,
.quiz-status.pending,
.quiz-card .quiz-status,
[data-theme='dark'] .quiz-status,
.dark .quiz-status,
body.dark-theme .quiz-status {
  position: absolute !important;
  top: 12px !important;
  right: 12px !important;
  z-index: 5 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 4px 12px !important;
  border-radius: 9999px !important;
  font-size: 0.75rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.5px !important;
  text-transform: uppercase !important;
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4) !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.quiz-status span,
.quiz-card .quiz-status span,
[data-theme='dark'] .quiz-status span,
.dark .quiz-status span,
body.dark-theme .quiz-status span {
  display: inline-block !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.quiz-status.public,
[data-theme='dark'] .quiz-status.public,
.dark .quiz-status.public {
  background-color: #10b981 !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4) !important;
}

.quiz-status.private,
[data-theme='dark'] .quiz-status.private,
.dark .quiz-status.private {
  background-color: #475569 !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.quiz-status.pending,
[data-theme='dark'] .quiz-status.pending,
.dark .quiz-status.pending {
  background-color: #f59e0b !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
}

/* ========================================================
   CHECKBOX & RADIO VERTICAL ALIGNMENT WITH LABELS
   (Fixes checkbox drooping below or misaligning with text)
   ======================================================== */
input[type="checkbox"],
input[type="radio"] {
  vertical-align: middle !important;
  margin: 0 !important;
  flex-shrink: 0 !important;
  display: inline-block !important;
}

.admin-content input[type="checkbox"],
.form-group input[type="checkbox"],
div:has(> input[type="checkbox"]) input[type="checkbox"] {
  align-self: center !important;
}

.admin-content label[for],
div:has(> input[type="checkbox"]) label {
  display: inline-flex !important;
  align-items: center !important;
  margin: 0 !important;
  line-height: normal !important;
}

/* ========================================================
   REMOVE UGLY NUMBER INPUT SPINNER ARROWS ACROSS BROWSERS
   (Webkit / Blink / Firefox)
   ======================================================== */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none !important;
  margin: 0 !important;
}

input[type="number"] {
  -moz-appearance: textfield !important;
  appearance: textfield !important;
}

/* ========================================================
   QUIZZES CREATE & GLOBAL FORM BEAUTIFICATION (DARK THEME)
   ======================================================== */
.create-quiz-container,
.create-post-container,
.form-card {
  border-radius: 16px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04) !important;
}

[data-theme='dark'] .create-quiz-container,
.dark .create-quiz-container,
body.dark-theme .create-quiz-container {
  background-color: #111827 !important;
  border-color: #1e293b !important;
  color: #f8fafc !important;
}

[data-theme='dark'] .question-item,
.dark .question-item,
body.dark-theme .question-item {
  background-color: #1e293b !important;
  border: 1px solid #334155 !important;
  border-radius: 14px !important;
  padding: 20px !important;
}

[data-theme='dark'] .question-time,
.dark .question-time,
body.dark-theme .question-time {
  background-color: #0f172a !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}

/* Sleek modern sidebar theme toggle button */
.sidebar-theme-pill-btn:hover {
  border-color: #10b981 !important;
  background: rgba(16, 185, 129, 0.1) !important;
}

[data-theme='dark'] .sidebar-theme-pill-btn,
.dark .sidebar-theme-pill-btn,
body.dark-theme .sidebar-theme-pill-btn {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}

[data-theme='dark'] .sidebar-theme-pill-btn span,
.dark .sidebar-theme-pill-btn span,
body.dark-theme .sidebar-theme-pill-btn span {
  color: #f8fafc !important;
}

[data-theme='light'] .sidebar-theme-pill-btn,
body:not(.dark-theme) .sidebar-theme-pill-btn {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

[data-theme='light'] .sidebar-theme-pill-btn span,
body:not(.dark-theme) .sidebar-theme-pill-btn span {
  color: #0f172a !important;
}

[data-theme='light'] .sidebar-theme-switch-container,
body:not(.dark-theme) .sidebar-theme-switch-container {
  border-top-color: #e2e8f0 !important;
}

[data-theme='dark'] .sidebar-theme-switch-container,
body.dark-theme .sidebar-theme-switch-container {
  border-top-color: #334155 !important;
}

/* --- Post reaction pill counts in dark theme & single-line alignment --- */
.post-stats .like-btn,
.post-stats button.like-btn {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
  white-space: nowrap !important;
}

.post-stats .like-btn i,
.post-stats button.like-btn i {
  display: inline-block !important;
  margin-right: 0 !important;
  vertical-align: middle !important;
}

.post-stats .like-btn span,
.post-stats button.like-btn span {
  display: inline !important;
  margin: 0 !important;
}

[data-theme='dark'] .post-stats button,
.dark .post-stats button,
body.dark-theme .post-stats button {
  color: #f8fafc !important;
}

[data-theme='dark'] .post-stats button span,
.dark .post-stats button span,
body.dark-theme .post-stats button span {
  color: #f8fafc !important;
}

[data-theme='dark'] .post-stats .like-btn.liked span,
.dark .post-stats .like-btn.liked span,
body.dark-theme .post-stats .like-btn.liked span {
  color: #ef4444 !important;
}

/* ========================================================
   LIVE MULTIPLAYER QUIZ ROOM POLISH & THEME SUPPORT
   ======================================================== */
.live-lobby-card,
.live-question-card {
  background: var(--color-sidebar-bg, #1e293b) !important;
  border: 1px solid var(--color-border, #334155) !important;
  border-radius: 20px !important;
  color: var(--color-text-primary, #f8fafc) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
}

.live-player-pill {
  background: #0f172a !important;
  border: 1px solid #334155 !important;
  color: #f8fafc !important;
  transition: all 0.2s ease !important;
}

.live-player-pill:hover {
  border-color: #10b981 !important;
  transform: translateY(-2px);
}

.live-option-btn {
  transition: all 0.2s ease !important;
}

.live-option-btn:hover:not(:disabled) {
  border-color: #10b981 !important;
  transform: translateY(-2px);
}

/* Skeleton Shimmer pulse animation */
@keyframes quizzyShimmer {
  0% {
    opacity: 0.55;
    background-position: -200% 0;
  }
  50% {
    opacity: 1;
    background-position: 200% 0;
  }
  100% {
    opacity: 0.55;
    background-position: -200% 0;
  }
}

.quizzy-skeleton-pulse {
  animation: quizzyShimmer 1.8s infinite ease-in-out;
}

/* ========================================================
   PROFILE USERNAME AT-CONTAINER UNIFORM BACKGROUND FIX
   ======================================================== */
.profile-username-group,
.form-group .profile-username-group {
  display: flex !important;
  align-items: center !important;
  background-color: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 12px !important;
  height: 48px !important;
  padding: 0 10px !important;
  box-sizing: border-box !important;
  position: relative !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow: hidden !important;
  gap: 6px !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease !important;
}

.profile-username-group:focus-within {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15) !important;
}

.profile-username-at,
.form-group .profile-username-at {
  color: #10b981 !important;
  font-weight: 700 !important;
  font-size: 1.15rem !important;
  user-select: none !important;
  margin-right: 2px !important;
  display: inline-flex !important;
  align-items: center !important;
  line-height: 1 !important;
  flex-shrink: 0 !important;
}

.profile-username-input,
.form-group .profile-username-input,
.form-group input#user-username {
  flex: 1 1 0% !important;
  min-width: 0 !important;
  width: auto !important;
  max-width: 100% !important;
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  color: #0f172a !important;
  font-size: 0.95rem !important;
  font-weight: 500 !important;
  height: 100% !important;
  padding: 0 4px 0 0 !important;
  color: #0f172a !important;
  font-size: 0.95rem !important;
  font-weight: 500 !important;
  height: 100% !important;
  padding: 0 8px 0 0 !important;
  margin: 0 !important;
  width: auto !important;
}

[data-theme='dark'] .profile-username-group,
.dark .profile-username-group,
body.dark-theme .profile-username-group {
  background-color: #1e293b !important;
  border: 1px solid #334155 !important;
}

[data-theme='dark'] .profile-username-input,
.dark .profile-username-input,
body.dark-theme .profile-username-input,
[data-theme='dark'] .form-group input#user-username,
.dark .form-group input#user-username,
body.dark-theme .form-group input#user-username {
  color: #f8fafc !important;
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* ==========================================================================
   QUIZ CREATE & INPUTS - LIGHT & DARK MODE BEAUTIFICATION
   ========================================================================== */
body:not(.dark-theme) .create-quiz-container,
[data-theme="light"] .create-quiz-container {
  color: #0f172a;
}

body:not(.dark-theme) .create-quiz-container .form-card,
[data-theme="light"] .create-quiz-container .form-card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05) !important;
}

body:not(.dark-theme) .create-quiz-container h1,
body:not(.dark-theme) .create-quiz-container h2,
body:not(.dark-theme) .create-quiz-container h3,
body:not(.dark-theme) .create-quiz-container label,
[data-theme="light"] .create-quiz-container h1,
[data-theme="light"] .create-quiz-container h2,
[data-theme="light"] .create-quiz-container h3,
[data-theme="light"] .create-quiz-container label {
  color: #0f172a !important;
}

body:not(.dark-theme) .create-quiz-container input,
body:not(.dark-theme) .create-quiz-container textarea,
body:not(.dark-theme) .create-quiz-container select,
[data-theme="light"] .create-quiz-container input,
[data-theme="light"] .create-quiz-container textarea,
[data-theme="light"] .create-quiz-container select {
  background-color: #f8fafc !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #0f172a !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03) !important;
}

body:not(.dark-theme) .create-quiz-container input:focus,
body:not(.dark-theme) .create-quiz-container textarea:focus,
body:not(.dark-theme) .create-quiz-container select:focus,
[data-theme="light"] .create-quiz-container input:focus,
[data-theme="light"] .create-quiz-container textarea:focus,
[data-theme="light"] .create-quiz-container select:focus {
  background-color: #ffffff !important;
  border-color: #10b981 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15) !important;
}

body:not(.dark-theme) .create-quiz-container input::placeholder,
body:not(.dark-theme) .create-quiz-container textarea::placeholder,
[data-theme="light"] .create-quiz-container input::placeholder,
[data-theme="light"] .create-quiz-container textarea::placeholder {
  color: #94a3b8 !important;
}

/* Light Theme - Theme toggle button readable text */
body:not(.dark-theme) .theme-toggle-label,
[data-theme="light"] .theme-toggle-label {
  color: #1e293b !important;
  font-weight: 600 !important;
}

body.dark-theme .theme-toggle-label,
[data-theme="dark"] .theme-toggle-label {
  color: #f8fafc !important;
  font-weight: 600 !important;
}

/* Align checkbox with label nicely across forms */
input[type="checkbox"] {
  accent-color: #10b981;
  vertical-align: middle;
}

/* ========================================================
   GLOBAL CAPSULE & TEXT INPUT CLEAN FOCUS (REMOVE INNER RECTANGLES)
   ======================================================== */
.search-input,
.search-input:focus,
.search-input:focus-visible,
#search-input,
#search-input:focus,
#search-input:focus-visible,
.channel-broadcast-input,
.channel-broadcast-input:focus,
.channel-broadcast-input:focus-visible,
.tg-chat-text-input,
.tg-chat-text-input:focus,
.tg-chat-text-input:focus-visible,
[data-theme='dark'] .tg-chat-text-input,
[data-theme='light'] .tg-chat-text-input,
body.dark-theme .tg-chat-text-input,
body.light-theme .tg-chat-text-input,
.dark .tg-chat-text-input,
html body.dark-theme .tg-chat-input-pill .tg-chat-text-input,
html body.dark-theme .tg-chat-input-pill input.tg-chat-text-input,
html body.dark-theme .tg-chat-input-pill textarea.tg-chat-text-input,
[data-theme="dark"] input[type="text"].tg-chat-text-input,
[data-theme="dark"] textarea.tg-chat-text-input,
[data-theme="dark"] input[type="text"].channel-broadcast-input,
[data-theme="dark"] textarea.channel-broadcast-input {
  border: none !important;
  border-width: 0 !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
  background-color: transparent !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}

.search-form:focus-within {
  border-color: #10b981 !important;
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.2) !important;
}

.channel-broadcast-bottom-bar:focus-within {
  border-color: #10b981 !important;
  box-shadow: 0 8px 30px rgba(16, 185, 129, 0.25) !important;
}


/* ========================================================
   CHANNEL BROADCAST STREAM & BOTTOM BAR - DARK & LIGHT THEME
   ======================================================== */
.channel-stream-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

[data-theme="dark"] .channel-header-card,
body.dark-theme .channel-header-card {
  background: #111827 !important;
  border: 1px solid #1f2937 !important;
  color: #f9fafb !important;
}

[data-theme="dark"] .channel-stream-card,
body.dark-theme .channel-stream-card {
  background: #111827 !important;
  border-color: #1f2937 !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
}

[data-theme="dark"] .channel-stream-text,
body.dark-theme .channel-stream-text {
  color: #e5e7eb !important;
}

[data-theme="dark"] .channel-stream-footer,
body.dark-theme .channel-stream-footer {
  color: #9ca3af !important;
}

[data-theme="dark"] .channel-broadcast-bottom-bar,
body.dark-theme .channel-broadcast-bottom-bar {
  background: #111827 !important;
  border-color: #10b981 !important;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5) !important;
}

.channel-broadcast-bottom-bar {
  display: flex !important;
  align-items: center !important;
  min-height: 52px !important;
  box-sizing: border-box !important;
}

[data-theme="dark"] .channel-broadcast-input,
body.dark-theme .channel-broadcast-input,
.channel-broadcast-input {
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  height: 38px !important;
  line-height: 38px !important;
  font-size: 0.95rem !important;
  color: #f3f4f6 !important;
  vertical-align: middle !important;
  box-sizing: border-box !important;
}

[data-theme="dark"] .channel-broadcast-input:focus,
body.dark-theme .channel-broadcast-input:focus,
.channel-broadcast-input:focus {
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

[data-theme="dark"] .channel-broadcast-input::placeholder,
body.dark-theme .channel-broadcast-input::placeholder,
.channel-broadcast-input::placeholder {
  line-height: normal !important;
  color: #6b7280 !important;
}

[data-theme="dark"] .channel-broadcast-input::placeholder,
body.dark-theme .channel-broadcast-input::placeholder {
  color: #6b7280 !important;
}

[data-theme="light"] .channel-stream-card,
body:not(.dark-theme) .channel-stream-card {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
}

[data-theme="light"] .channel-stream-text,
body:not(.dark-theme) .channel-stream-text {
  color: #0f172a !important;
}

[data-theme="light"] .channel-broadcast-bottom-bar,
body:not(.dark-theme) .channel-broadcast-bottom-bar {
  background: #ffffff !important;
  border-color: #10b981 !important;
}

[data-theme="light"] .channel-broadcast-input,
body:not(.dark-theme) .channel-broadcast-input {
  color: #0f172a !important;
}


/* ============================================================== */
/* === THEME & NOTIFICATION BELL & HERO ACTION CONTRAST FIXES === */
/* ============================================================== */

/* 1. Light Theme Profile Sign In Required Card */
[data-theme='light'] .profile-auth-required-card,
body:not(.dark-theme) .profile-auth-required-card {
  background: #ffffff !important;
  background-color: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  color: #0f172a !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08) !important;
}

[data-theme='light'] .profile-auth-required-card h2,
body:not(.dark-theme) .profile-auth-required-card h2 {
  color: #0f172a !important;
}

[data-theme='light'] .profile-auth-required-card p,
body:not(.dark-theme) .profile-auth-required-card p {
  color: #475569 !important;
}

/* 2. Hero Action Buttons Contrast Fix (Get Started & Browse Quizzes) in Dark Mode */
[data-theme='dark'] .hero-actions .primary-btn,
.dark .hero-actions .primary-btn,
body.dark-theme .hero-actions .primary-btn,
[data-theme='dark'] #btns-forstart,
body.dark-theme #btns-forstart {
  background: #ffffff !important;
  background-color: #ffffff !important;
  color: #047857 !important;
  font-weight: 700 !important;
  border: none !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25) !important;
  text-shadow: none !important;
}

[data-theme='dark'] .hero-actions .secondary-btn,
.dark .hero-actions .secondary-btn,
body.dark-theme .hero-actions .secondary-btn {
  background: rgba(0, 0, 0, 0.35) !important;
  background-color: rgba(0, 0, 0, 0.35) !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  border: 1px solid rgba(255, 255, 255, 0.4) !important;
}

/* 3. Notification Dropdown Panel Full Theming & Stacking */
.notif-wrapper {
  position: relative !important;
  z-index: 999999 !important;
}

.notif-dropdown-panel {
  z-index: 9999999 !important;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25) !important;
}

[data-theme='dark'] .notif-dropdown-panel,
body.dark-theme .notif-dropdown-panel {
  background: #111827 !important;
  background-color: #111827 !important;
  border: 1px solid #374151 !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6) !important;
}

[data-theme='dark'] .notif-dropdown-panel span[style*="var(--color-text-primary"],
body.dark-theme .notif-dropdown-panel span[style*="var(--color-text-primary"] {
  color: #f9fafb !important;
}

[data-theme='dark'] .notif-dropdown-panel p,
body.dark-theme .notif-dropdown-panel p {
  color: #94a3b8 !important;
}

[data-theme='dark'] .notif-dropdown-panel div[style*="borderBottom"],
body.dark-theme .notif-dropdown-panel div[style*="borderBottom"] {
  border-bottom-color: #374151 !important;
}

/* --- Notifications Scrollbar (Light & Dark Theme) --- */
.notif-scroll-list {
  scrollbar-width: thin !important;
  scrollbar-color: rgba(148, 163, 184, 0.45) transparent !important;
}

.notif-scroll-list::-webkit-scrollbar {
  width: 5px !important;
}

.notif-scroll-list::-webkit-scrollbar-track {
  background: transparent !important;
}

.notif-scroll-list::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.45) !important;
  border-radius: 10px !important;
}

.notif-scroll-list::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.7) !important;
}

[data-theme='dark'] .notif-scroll-list,
.dark .notif-scroll-list,
body.dark-theme .notif-scroll-list {
  scrollbar-width: thin !important;
  scrollbar-color: #374151 transparent !important;
}

[data-theme='dark'] .notif-scroll-list::-webkit-scrollbar-thumb,
.dark .notif-scroll-list::-webkit-scrollbar-thumb,
body.dark-theme .notif-scroll-list::-webkit-scrollbar-thumb {
  background: #374151 !important;
  border-radius: 10px !important;
}

[data-theme='dark'] .notif-scroll-list::-webkit-scrollbar-thumb:hover,
.dark .notif-scroll-list::-webkit-scrollbar-thumb:hover,
body.dark-theme .notif-scroll-list::-webkit-scrollbar-thumb:hover {
  background: #4b5563 !important;
}

/* Ensure Parent Container doesn't clip notification dropdown */
.desktop-notif-bell-container {
  overflow: visible !important;
  z-index: 999999 !important;
}

.search-section {
  overflow: visible !important;
  z-index: 1000 !important;
}

.latest-posts-section,
.all-posts-section {
  position: relative !important;
  z-index: 1 !important;
}

/* ========================================================================= */
/* --- MOBILE & TABLET TOP GAP & HEADER BUTTON PROPORTIONS FIX --- */
/* ========================================================================= */
@media (max-width: 992px) {
  body, html {
    padding-top: 0 !important;
    margin-top: 0 !important;
  }

  .container {
    padding-top: 56px !important;
    padding-bottom: 72px !important;
  }

  .main-content {
    padding-top: 18px !important;
  }

  .search-section {
    margin-top: 6px !important;
    margin-bottom: 18px !important;
  }
}

@media (max-width: 768px) {
  body, html {
    padding-top: 0 !important;
    margin-top: 0 !important;
  }

  .container {
    padding-top: 72px !important;
  }

  .main-content {
    padding-top: 14px !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  /* Clean top breathing room & proportional headers across all pages on mobile */
  .discussion-header,
  .page-header,
  .dashboard-header,
  .leaderboard-header {
    margin-top: 14px !important;
    margin-bottom: 20px !important;
  }

  .discussion-header {
    padding-bottom: 14px !important;
    gap: 10px !important;
  }

  .discussion-header h1,
  .page-header h1,
  .dashboard-header h1,
  .leaderboard-header h1 {
    font-size: 1.45rem !important;
    line-height: 1.25 !important;
  }

  .gateway-title {
    font-size: 1.55rem !important;
    line-height: 1.25 !important;
  }

  /* Compact, proportional top action buttons (+ Create Channel, + Create Quiz, + Create Post, Cancel, Subscribe) */
  .discussion-header .btn,
  .create-channel-top-btn,
  .section-header .btn,
  .new-quiz-button .btn {
    height: 32px !important;
    min-height: 32px !important;
    min-width: auto !important;
    padding: 5px 11px !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    gap: 5px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }

  .discussion-header .btn i,
  .create-channel-top-btn i,
  .section-header .btn i,
  .new-quiz-button .btn i {
    margin-right: 0 !important;
    font-size: 0.75rem !important;
  }

  /* Channel detail header card mobile polish: hide desktop card, show compact Telegram top bar */
  .channel-header-card {
    display: none !important;
  }
  .channel-desktop-back {
    display: none !important;
  }
  .channel-mobile-bar {
    display: flex !important;
  }
}

/* ========================================================================= */
/* --- WHATSAPP / TELEGRAM STYLE FULLSCREEN MOBILE CHAT SYSTEM --- */
/* ========================================================================= */
/* Apply at <= 1024px so tablets and all mobile screens get full bleed chat when active */
@media (max-width: 1024px) {
  /* Show back arrow inside chat conversation header */
  .chat-mobile-back-btn {
    display: inline-flex !important;
  }

  /* Chat Container on Mobile */
  .chat-container {
    position: relative !important;
    width: 100% !important;
    height: 100vh !important;
    height: 100dvh !important;
    overflow: hidden !important;
  }

  /* When inside active chat: hide global mobile top bar and mobile bottom nav, just like in Channel view */
  body.chat-conversation-active .mobile-top-bar,
  body:has(.chat-container.active-chat-open) .mobile-top-bar {
    display: none !important;
  }

  body.world-chat-active .container,
  body.chat-conversation-active .container,
  body:has(.chat-container.active-chat-open) .container,
  body.chat-conversation-active .main-content-wrapper,
  body:has(.chat-container.active-chat-open) .main-content-wrapper,
  body.chat-conversation-active .main-content,
  body:has(.chat-container.active-chat-open) .main-content {
    padding-top: 0 !important;
    margin-top: 0 !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
  }

  /* Hide outer page scrollbar when inside World Chat or Direct Chat */
  body.world-chat-active,
  body.chat-conversation-active,
  body:has(.chat-container.active-chat-open) {
    overflow: hidden !important;
    height: 100vh !important;
    height: 100dvh !important;
  }

  body.world-chat-active::-webkit-scrollbar,
  body.chat-conversation-active::-webkit-scrollbar,
  body:has(.chat-container.active-chat-open)::-webkit-scrollbar,
  html:has(body.world-chat-active)::-webkit-scrollbar,
  html:has(body.chat-conversation-active)::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
  }

  body.world-chat-active,
  body.chat-conversation-active {
    scrollbar-width: none !important;
  }

  /* Internal message container scrollbar styling */
  .chat-messages,
  .world-content {
    scrollbar-width: thin !important;
    scrollbar-color: rgba(16, 185, 129, 0.4) transparent !important;
  }

  .chat-messages::-webkit-scrollbar,
  .world-content::-webkit-scrollbar {
    width: 5px !important;
  }

  .chat-messages::-webkit-scrollbar-thumb,
  .world-content::-webkit-scrollbar-thumb {
    background: rgba(16, 185, 129, 0.35) !important;
    border-radius: 999px !important;
  }

  /* When no active chat is open: Chat list takes 100% full width */
  .chat-container.chat-list-only .chat-sidebar {
    display: flex !important;
    width: 100% !important;
    height: 100% !important;
    border-right: none !important;
    position: relative !important;
    z-index: 10 !important;
    background: var(--color-sidebar-bg, #111827) !important;
  }

  [data-theme="light"] .chat-container.chat-list-only .chat-sidebar,
  body:not(.dark-theme) .chat-container.chat-list-only .chat-sidebar {
    background: #ffffff !important;
    color: #1e293b !important;
  }

  .chat-container.chat-list-only .chat-sidebar .chat-list {
    background: var(--color-sidebar-bg, #111827) !important;
    padding-bottom: 80px !important;
  }

  [data-theme="light"] .chat-container.chat-list-only .chat-sidebar .chat-list,
  body:not(.dark-theme) .chat-container.chat-list-only .chat-sidebar .chat-list {
    background: #ffffff !important;
    color: #1e293b !important;
  }

  .chat-container.chat-list-only .chat-main {
    display: none !important;
  }

  /* When active chat is opened: Chat main conversation takes 100% full width and full viewport height */
  .chat-container.active-chat-open .chat-sidebar {
    display: none !important;
  }

  .chat-container.active-chat-open {
    height: 100vh !important;
    height: 100dvh !important;
    height: var(--chat-vv-height, 100dvh) !important;
    position: fixed !important;
    top: var(--chat-vv-top, 0px) !important;
    left: 0 !important;
    right: 0 !important;
    bottom: auto !important;
    width: 100vw !important;
    max-width: 100vw !important;
    z-index: 999999 !important; /* Always sits securely above mobile bottom navigation bar */
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .chat-container.active-chat-open .chat-main {
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
    position: relative !important;
    overflow: hidden !important;
    z-index: 20 !important;
  }

  .chat-container.active-chat-open .chat-main > div:first-child,
  .chat-container.active-chat-open .chat-header-top-bar {
    flex: 0 0 60px !important;
    flex-shrink: 0 !important;
    position: relative !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 60px !important;
    min-height: 60px !important;
    max-height: 60px !important;
    padding: 0 14px !important;
    z-index: 1000 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
    box-sizing: border-box !important;
  }

  .chat-container.active-chat-open .chat-main .chat-messages {
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    min-height: 0 !important;
    padding-top: 14px !important;
    padding-bottom: 14px !important;
  }

  .chat-container.active-chat-open .chat-main .tg-chat-bar-container {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    position: relative !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 10000 !important;
    margin-bottom: 0 !important;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px)) !important;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.12) !important;
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  /* Unconditionally hide mobile bottom nav during active chat conversation */
  body.chat-conversation-active .mobile-bottom-nav,
  body:has(.chat-container.active-chat-open) .mobile-bottom-nav,
  body:has(.chat-container.active-chat-open) [class*="mobile-bottom-nav"],
  body.chat-conversation-active [class*="mobile-bottom-nav"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: -10 !important;
  }

  /* Adjust chat composer on mobile */
  .chat-main [style*="borderTop"] {
    padding: 8px 12px !important;
  }
}

/* ========================================================================= */
/* --- PREVENT NESTED DOUBLE SCROLLBAR ON CHAT & WORLD FEED --- */
/* ========================================================================= */
main.main-content:has(.chat-container),
main.main-content:has(#chat-header) {
  overflow: hidden !important;
  height: 100vh !important;
  padding: 0 !important;
}

.chat-container {
  height: 100vh !important;
  max-height: 100vh !important;
  overflow: hidden !important;
}

.chat-sidebar {
  height: 100% !important;
  overflow: hidden !important;
}

.chat-list {
  flex: 1 !important;
  overflow-y: auto !important;
  scrollbar-width: thin;
}

.chat-main {
  height: 100% !important;
  overflow: hidden !important;
}

/* Fix Live PIN input text visibility in Light Theme */
body:not(.dark-theme) .live-pin-input,
[data-theme='light'] .live-pin-input {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}

body.dark-theme .live-pin-input,
[data-theme='dark'] .live-pin-input {
  background-color: #1e293b !important;
  color: #f8fafc !important;
  border-color: #334155 !important;
}

/* ========================================================================= */
/* --- IOS NATIVE APP POLISH: FROSTED GLASS, SPRING TABS & TAP FIXES --- */
/* ========================================================================= */
.mobile-top-bar,
.mobile-top-bar *,
.mobile-actions,
.mobile-actions *,
.mobile-theme-btn,
.mobile-more-dots-btn,
.notif-bell-btn,
.mobile-bottom-nav,
.mobile-bottom-nav * {
  -webkit-tap-highlight-color: transparent !important;
  -webkit-touch-callout: none !important;
  outline: none !important;
}

.mobile-top-bar {
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
}

.mobile-more-dots-btn:active,
.notif-bell-btn:active {
  transform: scale(0.9) !important;
  transition: transform 0.15s cubic-bezier(0.32, 0.72, 0, 1) !important;
}

/* iOS Spring tab icon bounce & haptic feedback */
.mobile-bottom-nav a.mobile-nav-link {
  transition: transform 0.22s cubic-bezier(0.32, 0.72, 0, 1), background-color 0.22s cubic-bezier(0.32, 0.72, 0, 1), color 0.18s ease !important;
}

.mobile-bottom-nav a.mobile-nav-link:active {
  transform: scale(0.88) !important;
}

.mobile-bottom-nav a.mobile-nav-link.active i.icon {
  transform: scale(1.12) !important;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

/* Snappy, instant page rendering on mobile tabs without delay */
@media (max-width: 992px) {
  main.main-content {
    animation: none !important;
  }
}

/* ========================================================
   HOME LATEST POSTS PREMIUM SKELETON LOADING (LIGHT & DARK)
   ======================================================== */
.post-card-skeleton {
  border-radius: 18px !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  transition: all 0.25s ease !important;
  position: relative !important;
}

body.light-theme .post-card-skeleton {
  background: #ffffff !important;
  border: 1px solid rgba(226, 232, 240, 0.85) !important;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.04) !important;
}

body:not(.light-theme) .post-card-skeleton {
  background: var(--color-sidebar-bg, #111827) !important;
  border: 1px solid var(--color-border, #1e293b) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25) !important;
}

.skeleton-shimmer {
  position: relative !important;
  overflow: hidden !important;
}

.skeleton-shimmer::after {
  content: '' !important;
  position: absolute !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  transform: translateX(-100%) !important;
  animation: skeletonShimmerWave 1.6s infinite ease-in-out !important;
}

body.light-theme .skeleton-shimmer::after {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.65) 50%,
    rgba(255, 255, 255, 0) 100%
  ) !important;
}

body:not(.light-theme) .skeleton-shimmer::after {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0) 100%
  ) !important;
}

body.light-theme .skeleton-bone {
  background: #f1f5f9 !important;
}

body:not(.light-theme) .skeleton-bone {
  background: rgba(255, 255, 255, 0.07) !important;
}

@keyframes skeletonShimmerWave {
  100% {
    transform: translateX(100%);
  }
}

/* ========================================================
   QUIZ QUESTION TEXT VISIBILITY FIX FOR DARK & LIGHT THEMES
   ======================================================== */
.question-text h3 {
  color: var(--color-text-primary, #0f172a) !important;
  font-weight: 700 !important;
}

[data-theme='dark'] .question-text h3,
.dark .question-text h3,
body.dark-theme .question-text h3 {
  color: #f8fafc !important;
}

.live-modal-overlay {
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  display: flex !important;
  align-items: flex-start !important;
  justify-content: center !important;
  z-index: 10000000 !important;
  padding: 16px !important;
  padding-top: max(16px, min(14vh, 90px)) !important;
  box-sizing: border-box !important;
  overscroll-behavior: contain !important;
  touch-action: none !important;
}

.live-modal-content {
  margin: 0 auto !important;
  max-width: 440px !important;
  width: 100% !important;
  transform: none !important;
  touch-action: auto !important;
}

/* ========================================================
   GLOBAL MODAL BACKGROUND SCROLL LOCK & OVERSCROLL CONTAINMENT
   ======================================================== */
.modal-overlay,
.modal,
.profile-popup,
.image-viewer-modal,
.lb-modal {
  overscroll-behavior: contain !important;
}

.modal-content,
.modal-card,
.profile-popup-card,
.lb-modal-card {
  overscroll-behavior: contain !important;
}

/* ========================================================
   GLOBAL COMPACT TYPOGRAPHY & SCALING FOR MOBILE DEVICES
   ======================================================== */
@media (max-width: 768px) {
  :root {
    --text-xs: 0.68rem !important;
    --text-sm: 0.78rem !important;
    --text-base: 0.88rem !important;
    --text-lg: 0.98rem !important;
    --text-xl: 1.1rem !important;
    --text-2xl: 1.25rem !important;
    --text-3xl: 1.45rem !important;
    --text-4xl: 1.7rem !important;
    --space-4: 0.85rem !important;
  }

  html, body {
    font-size: 14.5px !important;
    -webkit-text-size-adjust: 100% !important;
  }

  /* Form groups, inputs, and labels */
  .form-group label {
    font-size: 0.84rem !important;
    font-weight: 600 !important;
    margin-bottom: 5px !important;
  }

  .form-group input:not(#user-username):not(.profile-username-input):not(.auth-form input),
  .form-group:not(.input-with-icon) > input:not(#user-username):not(.profile-username-input),
  .form-group select:not(.auth-form select),
  .form-group textarea {
    font-size: 0.88rem !important;
    padding: 9px 12px !important;
  }

  .profile-username-group input {
    font-size: 0.88rem !important;
    padding: 0 !important;
    min-width: 0 !important;
    width: auto !important;
    flex: 1 1 0% !important;
  }

  .form-group small,
  .help-text {
    font-size: 0.75rem !important;
    line-height: 1.4 !important;
  }

  /* Profile page tabs & sections */
  .profile-tabs .tab-btn {
    font-size: 0.82rem !important;
    padding: 8px 12px !important;
  }

  #account-tab h3,
  .tab-content h3,
  .profile-info h2 {
    font-size: 1.2rem !important;
    margin-bottom: 14px !important;
  }

  .profile-stats .stat-value {
    font-size: 1.1rem !important;
  }

  .profile-stats .stat-label {
    font-size: 0.72rem !important;
  }

  /* Feed post text and card titles */
  .feed-post-title,
  .post-card-title,
  .channel-stream-card h3 {
    font-size: 1.05rem !important;
  }

  .feed-post-content,
  .post-card-content,
  .channel-stream-card p {
    font-size: 0.88rem !important;
    line-height: 1.5 !important;
  }

  /* Related Posts Mobile Polish (Left Align, Smaller Images, Compact Fonts) */
  .related-posts {
    padding: 16px 12px !important;
    text-align: left !important;
  }

  .related-posts h2 {
    font-size: 1.15rem !important;
    margin-bottom: 12px !important;
    text-align: left !important;
  }

  .related-posts-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .related-post-card {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    text-align: left !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    height: auto !important;
    max-height: 110px !important;
  }

  .related-post-image {
    width: 100px !important;
    min-width: 100px !important;
    height: 100% !important;
    min-height: 100px !important;
    max-height: 110px !important;
    flex-shrink: 0 !important;
  }

  .related-post-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }

  .related-post-content {
    padding: 10px 12px !important;
    text-align: left !important;
    flex: 1 !important;
    min-width: 0 !important;
  }

  .related-post-content h3 {
    font-size: 0.88rem !important;
    font-weight: 700 !important;
    margin: 0 0 4px 0 !important;
    line-height: 1.3 !important;
    text-align: left !important;
  }

  .related-post-content p {
    font-size: 0.75rem !important;
    margin-bottom: 4px !important;
    line-height: 1.35 !important;
    text-align: left !important;
    -webkit-line-clamp: 2 !important;
    line-clamp: 2 !important;
  }

  .read-more {
    font-size: 0.75rem !important;
    text-align: left !important;
  }

  /* General headings across mobile */
  h1 {
    font-size: 1.45rem !important;
  }

  h2 {
    font-size: 1.25rem !important;
  }

  h3 {
    font-size: 1.1rem !important;
  }

  h4 {
    font-size: 0.98rem !important;
  }

  /* Channel broadcast bottom bar mobile optimizations */
  .channel-broadcast-bottom-bar {
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    transform: none !important;
    width: 100% !important;
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: none !important;
    padding: 8px 12px !important;
    gap: 8px !important;
    box-sizing: border-box !important;
  }

  .channel-stream-container {
    margin-bottom: 70px !important;
  }

  .channel-btn-label {
    display: none !important;
  }

  .channel-home-req-btn {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
  }

  .channel-home-req-btn i {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
    width: 100% !important;
    height: 100% !important;
  }

  .channel-broadcast-btn {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
  }

  .channel-broadcast-btn i {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
    width: 100% !important;
    height: 100% !important;
  }

  .channel-broadcast-input {
    font-size: 0.88rem !important;
  }

  .channel-broadcast-card .broadcast-text,
  .channel-stream-container .post-content {
    font-size: 0.88rem !important;
    line-height: 1.45 !important;
  }
}






/* ========================================================
   QUIZ RESULTS SCORE CIRCLE POLISH (Inside circle centering)
   ======================================================== */
.quiz-results-card .score-circle {
  width: 170px !important;
  height: 170px !important;
  border-radius: 50% !important;
  background: conic-gradient(#10b981 var(--progress, 0%), #e2e8f0 0deg) !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
  border: none !important;
  margin: 0 auto 24px !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08) !important;
}

.quiz-results-card .score-circle::before {
  content: "" !important;
  position: absolute !important;
  inset: 10px !important;
  background: #ffffff !important;
  border-radius: 50% !important;
  z-index: 1 !important;
}

[data-theme="dark"] .quiz-results-card .score-circle::before,
body.dark-theme .quiz-results-card .score-circle::before {
  background: #111827 !important;
}

.quiz-results-card .score-circle span,
.quiz-results-card .score-circle .score-percentage,
.quiz-results-card .score-circle #score-percentage {
  position: relative !important;
  z-index: 2 !important;
  font-size: 30px !important;
  font-weight: 800 !important;
  color: #10b981 !important;
  line-height: 1.1 !important;
  margin: 0 !important;
  text-align: center !important;
  display: block !important;
}

.quiz-results-card .score-circle .score-text {
  position: relative !important;
  z-index: 2 !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  color: #10b981 !important;
  line-height: 1.2 !important;
  margin-top: 4px !important;
  text-align: center !important;
  display: block !important;
}


/* ========================================================
   BATCH 6 MOBILE POLISH & CENTERING OVERRIDES
   ======================================================== */

/* 1. Related Posts: Full Width Card on Mobile, No Right-side Clipping */
.related-posts {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow: visible !important;
}

.related-posts-grid {
  width: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  box-sizing: border-box !important;
}

.related-post-card {
  width: 100% !important;
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  text-align: left !important;
  overflow: hidden !important;
}

.related-post-content {
  flex: 1 !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

/* 2. Profile Tabs: Move active indicator line 1mm down */
.profile-tabs .tab-btn.active::after,
.tab-btn.active::after {
  bottom: -4px !important;
  height: 3px !important;
  border-radius: 2px !important;
}

/* 3. Perfect Centering for Profile Camera Button & Mobile 3-Dots */
.avatar-edit {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  text-align: center !important;
}

.avatar-edit i {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1 !important;
}

/* Sharp mathematical centering for circle icon action buttons and sharing icons */
.channel-home-req-btn,
.channel-broadcast-btn,
.share-action-circle,
.mobile-more-dots-btn,
button.mobile-more-dots-btn,
div:has(> i.fa-share-alt),
div:has(> i.fa-whatsapp),
div:has(> i.fa-telegram-plane),
div:has(> i.fa-instagram),
div:has(> i.fa-envelope) {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  line-height: 1 !important;
  box-sizing: border-box !important;
}

.channel-home-req-btn i,
.channel-broadcast-btn i,
.share-action-circle i,
.mobile-more-dots-btn i,
div:has(> i.fa-share-alt) i,
div:has(> i.fa-whatsapp) i,
div:has(> i.fa-telegram-plane) i,
div:has(> i.fa-instagram) i,
div:has(> i.fa-envelope) i,
i.fa-ellipsis-v {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1 !important;
  text-align: center !important;
  vertical-align: middle !important;
}

/* 4. Quiz Intro Stats Row: Force all 3 stats into a single neat row on Mobile */
.quiz-info-card .quiz-stats {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 6px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.quiz-info-card .quiz-stats .stat-item {
  flex: 1 1 0 !important;
  min-width: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  text-align: center !important;
  padding: 6px 2px !important;
  font-size: 0.72rem !important;
}

.quiz-info-card .quiz-stats .stat-item i {
  font-size: 1.1rem !important;
  margin-bottom: 4px !important;
  margin-right: 0 !important;
}

.quiz-info-card .quiz-stats .stat-item span {
  display: block !important;
  white-space: normal !important;
  line-height: 1.2 !important;
  word-break: break-word !important;
}

/* 5. Quiz Leaderboard Modal: Strict Viewport Center Alignment */
#quiz-leaderboard-modal {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  padding: 16px !important;
  box-sizing: border-box !important;
  z-index: 10000005 !important;
  touch-action: none !important;
  overscroll-behavior: contain !important;
}

#quiz-leaderboard-modal .modal-card {
  margin: auto !important;
  width: 100% !important;
  max-width: 520px !important;
  max-height: 80vh !important;
  max-height: 80dvh !important;
  transform: none !important;
  overflow: hidden !important;
  touch-action: auto !important;
  overscroll-behavior: contain !important;
}

#quiz-leaderboard-body {
  overscroll-behavior: contain !important;
  -webkit-overflow-scrolling: touch !important;
}


/* Hide mobile bottom navigation bar in channel view */
body.channel-view-active .mobile-bottom-nav,
body:has(.channel-slug-container) .mobile-bottom-nav {
  display: none !important;
}

/* Hide standard top header bar when inside active channel so channel sticky header replaces it */
body:has(.channel-slug-container) .mobile-top-bar,
body.channel-view-active .mobile-top-bar {
  display: none !important;
}

@media (max-width: 992px) {
  body:has(.channel-slug-container) .container,
  body.channel-view-active .container,
  body:has(.channel-slug-container) .main-content-wrapper,
  body.channel-view-active .main-content-wrapper {
    padding-top: 0 !important;
    margin-top: 0 !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
  }

  body:has(.channel-slug-container) .main-content.channel-slug-container,
  body.channel-view-active .main-content.channel-slug-container {
    padding-top: 0 !important;
    margin-top: 0 !important;
  }

  .channel-mobile-bar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 60px !important;
    min-height: 60px !important;
    max-height: 60px !important;
    padding: 0 14px !important;
    margin: 0 !important;
    z-index: 1000 !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15) !important;
    box-sizing: border-box !important;
  }

  body:has(.channel-slug-container) .channel-stream-container,
  body.channel-view-active .channel-stream-container {
    padding-top: 72px !important;
  }

  /* Pin Channel broadcast composer flush to very bottom on all mobile devices with no floating gap */
  .channel-broadcast-bottom-bar {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    transform: none !important;
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: none !important;
    padding: 8px 12px !important;
    padding-bottom: max(10px, env(safe-area-inset-bottom)) !important;
    gap: 8px !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    z-index: 9999 !important;
  }

  .channel-stream-container {
    margin-bottom: 75px !important;
    padding-bottom: max(20px, env(safe-area-inset-bottom)) !important;
  }
}

  /* Expand floating bottom capsule slightly so all 5 tabs fit comfortably */
  .mobile-bottom-nav {
    max-width: 480px !important;
    padding: 0 6px !important;
  }

  .mobile-bottom-nav a.mobile-nav-link {
    padding: 6px 8px !important;
    font-size: 10.5px !important;
    min-width: 58px !important;
  }

/* Ensure View Post Content Fits Screen on Mobile with No Giant Margins */
@media (max-width: 768px) {
  main.main-content:has(.post-content),
  main.main-content:has(.single-post-article) {
    padding: 10px 8px 60px 8px !important;
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
  }

  .single-post-article,
  .post-content {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 12px !important;
  }

  .post-body-container,
  .post-header,
  .back-link {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .post-body img,
  .post-image-container img,
  .featured-image-container img {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 12px !important;
  }
}

.mobile-brand {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  height: 100% !important;
  max-height: 60px !important;
  overflow: visible !important;
}

.mobile-brand img {
  height: 36px !important;
  width: 36px !important;
  max-width: 36px !important;
  max-height: 36px !important;
  object-fit: contain !important;
  flex-shrink: 0 !important;
  display: block !important;
}

.mobile-brand h2 {
  font-size: 1.18rem !important;
  font-weight: 700 !important;
  color: var(--primary-color, #10b981) !important;
  margin: 0 !important;
  line-height: 1.6 !important;
  padding-bottom: 8px !important;
  padding-top: 2px !important;
  white-space: nowrap !important;
  overflow: visible !important;
  display: inline-block !important;
}

/* --- Fix for Create Quiz Translation Lock Box in Dark Theme --- */
[data-theme="dark"] .translation-lock-box,
body.dark-theme .translation-lock-box {
  background: #1e293b !important;
  border-color: #334155 !important;
}

[data-theme="dark"] .translation-lock-box div[style*="font-weight: 600"],
body.dark-theme .translation-lock-box div[style*="font-weight: 600"] {
  color: #f8fafc !important;
}

[data-theme="dark"] .translation-lock-box div[style*="font-size: 0.82rem"],
body.dark-theme .translation-lock-box div[style*="font-size: 0.82rem"] {
  color: #94a3b8 !important;
}

/* --- Fix for Create Quiz Question Action Icons (Up / Down / Delete) in Light & Dark Mode --- */
.question-block button.icon-btn,
.question-actions button.icon-btn,
.question-block .icon-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 8px !important;
  padding: 8px 12px !important;
  color: var(--color-text-primary, #0f172a) !important;
  cursor: pointer !important;
  box-sizing: border-box !important;
}

.question-block button.icon-btn i,
.question-actions button.icon-btn i,
.question-block .icon-btn i {
  display: inline-block !important;
  visibility: visible !important;
  opacity: 1 !important;
  font-size: 0.95rem !important;
  line-height: 1 !important;
  color: inherit !important;
}

.question-block button.icon-btn[title="Move Up"] i,
.question-block button.icon-btn[title="Move Down"] i {
  color: var(--color-text-primary, #1e293b) !important;
}

body.dark-theme .question-block button.icon-btn[title="Move Up"] i,
body.dark-theme .question-block button.icon-btn[title="Move Down"] i,
[data-theme="dark"] .question-block button.icon-btn[title="Move Up"] i,
[data-theme="dark"] .question-block button.icon-btn[title="Move Down"] i {
  color: #f8fafc !important;
}

.question-block button.icon-btn[title="Delete Question"],
.question-block button.icon-btn[title="Delete Question"] i {
  color: #ef4444 !important;
}

/* Remove excess top spacing on mobile so main content sits directly beneath the top bar */
@media (max-width: 992px) {
  .main-content {
    padding-top: 6px !important;
  }

  .search-section {
    margin-top: 0px !important;
    margin-bottom: 14px !important;
  }
}

/* Standardize mobile top bar buttons (Notification bell, Profile avatar, 3-dots) to uniform 38px circular capsules */
.mobile-top-bar .notif-bell-btn,
.mobile-top-bar button.notif-bell-btn {
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  min-height: 38px !important;
  border-radius: 50% !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

.mobile-top-bar .mobile-more-dots-btn {
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  min-height: 38px !important;
  border-radius: 50% !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

.mobile-top-bar .mobile-profile-avatar-btn {
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  min-height: 38px !important;
  border-radius: 50% !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

.mobile-top-bar .mobile-profile-avatar-btn img {
  width: 36px !important;
  height: 36px !important;
}

/* Ensure group and chat avatars are always perfectly circular, never oval/stretched */
.chat-container img,
.chat-avatar-wrapper img,
.header-info img,
.chat-header img,
img.chat-avatar-circle {
  aspect-ratio: 1 / 1 !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  flex-shrink: 0 !important;
}


/* ========================================================================= */
/* --- WORLD CHAT MOBILE FULL VIEWPORT & HEADER/INPUT PINNED FIX --- */
/* ========================================================================= */
@media (max-width: 1024px) {
  /* In World Chat view, hide global mobile top bar and mobile bottom nav so World Chat has full viewport and its own pinned header */
  body.world-chat-active .mobile-top-bar {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  body.world-chat-active .world-chat-viewport {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100% !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    z-index: 9999 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    background: var(--surface-color, #111827) !important;
  }

  body.world-chat-active #chat-header,
  body.world-chat-active .world-header {
    flex: 0 0 60px !important;
    flex-shrink: 0 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 60px !important;
    min-height: 60px !important;
    max-height: 60px !important;
    z-index: 1000 !important;
    background: var(--surface-color, #ffffff) !important;
    border-bottom: 1px solid var(--border-color, #e5e7eb) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
    display: flex !important;
    align-items: center !important;
    padding: 0 14px !important;
    box-sizing: border-box !important;
  }

  [data-theme="dark"] body.world-chat-active #chat-header,
  [data-theme="dark"] body.world-chat-active .world-header,
  body.dark-theme.world-chat-active #chat-header,
  body.dark-theme.world-chat-active .world-header {
    background: #111827 !important;
    border-bottom-color: #374151 !important;
  }

  body.world-chat-active .world-content {
    flex: 1 1 0% !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    min-height: 0 !important;
    padding-top: 68px !important;
    padding-bottom: 12px !important;
    height: auto !important;
  }

  /* Message composer sits flush at the very bottom edge of screen */
  body.world-chat-active .container {
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
  }

  body.world-chat-active .tg-chat-bar-container {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    position: relative !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 1000 !important;
    margin-top: auto !important;
    margin-bottom: 0 !important;
    padding: 8px 12px 10px 12px !important;
    padding-bottom: max(10px, env(safe-area-inset-bottom, 0px)) !important;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1) !important;
  }
}


/* When on /chat in list mode (no active conversation), align under global MobileTopBar and above MobileBottomNav */
@media (max-width: 992px) {
  body:not(.chat-conversation-active) .chat-container.chat-list-only {
    height: calc(100vh - 56px - 65px) !important;
    height: calc(100dvh - 56px - 65px) !important;
    min-height: calc(100dvh - 56px - 65px) !important;
    max-height: calc(100dvh - 56px - 65px) !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
    overflow: hidden !important;
  }

  body:not(.chat-conversation-active) .chat-container.chat-list-only .chat-sidebar {
    height: 100% !important;
    min-height: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    background: var(--color-sidebar-bg, #111827) !important;
    border-right: none !important;
    width: 100% !important;
  }

  [data-theme="light"] body:not(.chat-conversation-active) .chat-container.chat-list-only .chat-sidebar,
  body:not(.dark-theme) body:not(.chat-conversation-active) .chat-container.chat-list-only .chat-sidebar {
    background: #ffffff !important;
    color: #1e293b !important;
  }

  body:not(.chat-conversation-active) .chat-container.chat-list-only .chat-sidebar .chat-list {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    padding-bottom: 80px !important;
    box-sizing: border-box !important;
    background: var(--color-sidebar-bg, #111827) !important;
  }

  [data-theme="light"] body:not(.chat-conversation-active) .chat-container.chat-list-only .chat-sidebar .chat-list,
  body:not(.dark-theme) body:not(.chat-conversation-active) .chat-container.chat-list-only .chat-sidebar .chat-list {
    background: #ffffff !important;
    color: #1e293b !important;
  }

  /* Light theme Chat Item styling so it doesn't stay dark blue */
  [data-theme="light"] .chat-sidebar,
  body:not(.dark-theme) .chat-sidebar,
  [data-theme="light"] .chat-list,
  body:not(.dark-theme) .chat-list {
    background-color: #ffffff !important;
    color: #0f172a !important;
  }

  [data-theme="light"] .chat-sidebar input,
  body:not(.dark-theme) .chat-sidebar input {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
  }

  [data-theme="light"] .chat-sidebar h2,
  body:not(.dark-theme) .chat-sidebar h2 {
    color: #0f172a !important;
  }

  /* Force chat-main to be completely hidden on mobile list view with 0 height/space */
  body:not(.chat-conversation-active) .chat-container.chat-list-only .chat-main {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
  }
}

/* --- Fix long quiz category and difficulty badges from overlapping / sticking together --- */
.quiz-meta {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 10px !important;
  margin-bottom: 8px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.quiz-category {
  max-width: 65% !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  display: inline-block !important;
  border-radius: 6px !important;
  padding: 3px 10px !important;
}

.quiz-difficulty {
  flex-shrink: 0 !important;
  white-space: nowrap !important;
  border-radius: 6px !important;
  padding: 3px 10px !important;
  font-weight: 600 !important;
}

/* --- Absolute lock for Channel Mobile Top Bar --- */
.channel-mobile-bar {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  z-index: 10000 !important;
  box-sizing: border-box !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15) !important;
}

body:has(.channel-slug-container) .channel-mobile-bar,
body.channel-view-active .channel-mobile-bar {
  display: flex !important;
}

/* ========================================================
   CREATE GROUP & IMAGE CROP MODALS - CLEAN RESPONSIVE & SCROLL FIX
   ======================================================== */
/* When Create Group or Crop Modal is open: firmly hide global top bar & bottom navigation to prevent peek-through */
body.create-group-modal-open .mobile-top-bar,
body:has(#create-group-modal) .mobile-top-bar,
body.image-crop-modal-open .mobile-top-bar,
body:has(#image-crop-modal-overlay) .mobile-top-bar,
body.create-group-modal-open .mobile-bottom-nav,
body:has(#create-group-modal) .mobile-bottom-nav,
body.image-crop-modal-open .mobile-bottom-nav,
body.buy-stars-modal-open .mobile-bottom-nav,
body:has(#image-crop-modal-overlay) .mobile-bottom-nav {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

#create-group-modal {
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  z-index: 99999999 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 16px !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  background: rgba(0, 0, 0, 0.88) !important;
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
}

/* Hide duplicate sub-headers and bottom bars during specific modals */
body.has-star-modal-open .channel-subscriber-bottom-bar,
body:has(#star-reaction-overlay) .channel-subscriber-bottom-bar {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

#create-group-modal .modal-card {
  width: 100% !important;
  max-width: 480px !important;
  max-height: 82vh !important;
  max-height: 82dvh !important;
  margin: auto !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 20px 22px 18px 22px !important;
  border-radius: 24px !important;
  border: 1px solid var(--modal-border, rgba(0, 0, 0, 0.1)) !important;
  background: var(--modal-bg, #ffffff) !important;
  color: var(--color-text-primary, #0f172a) !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2) !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  position: relative !important;
}

[data-theme="dark"] #create-group-modal .modal-card,
body.dark-theme #create-group-modal .modal-card {
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  background: #111827 !important;
  color: #F9FAFB !important;
  box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.85) !important;
}

#create-group-modal .modal-card::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

#create-group-modal .modal-card > div:first-child {
  flex-shrink: 0 !important;
  margin-bottom: 14px !important;
}

/* Modal form body scrolls seamlessly inside the modal card while action buttons stay accessible */
#create-group-modal .modal-card > div:nth-child(2),
#create-group-modal .modal-form-body {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  padding-right: 4px !important;
  padding-bottom: 20px !important;
  box-sizing: border-box !important;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

#create-group-modal .modal-card > div:nth-child(2)::-webkit-scrollbar,
#create-group-modal .modal-form-body::-webkit-scrollbar,
#create-group-modal *::-webkit-scrollbar {
  display: none !important; /* Hide scrollbars on modern mobile WebKit */
  width: 0 !important;
  height: 0 !important;
}

#create-group-modal .modal-card .modal-actions {
  flex-shrink: 0 !important;
  margin-top: 12px !important;
  padding-top: 14px !important;
  border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
  background: inherit !important;
  display: flex !important;
  justify-content: flex-end !important;
  gap: 12px !important;
  z-index: 10 !important;
}

[data-theme="dark"] #create-group-modal .modal-card .modal-actions,
body.dark-theme #create-group-modal .modal-card .modal-actions {
  border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
  background: #111827 !important;
}

/* Eliminate nested background box in Group Handle field */
#create-group-modal .group-handle-wrapper {
  background: #f8fafc !important;
  background-color: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 12px !important;
  display: flex !important;
  align-items: center !important;
  padding: 0 12px !important;
  box-sizing: border-box !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
}

[data-theme="dark"] #create-group-modal .group-handle-wrapper,
body.dark-theme #create-group-modal .group-handle-wrapper {
  background: rgba(255, 255, 255, 0.04) !important;
  background-color: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid #374151 !important;
}

#create-group-modal .group-handle-wrapper:focus-within {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25) !important;
}

#create-group-modal .group-handle-input,
.group-handle-input,
input.group-handle-input {
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  border-width: 0 !important;
  box-shadow: none !important;
  padding: 10px 8px !important;
  margin: 0 !important;
  width: 100% !important;
  min-width: 0 !important;
  color: #0f172a !important;
  outline: none !important;
}

[data-theme="dark"] #create-group-modal input.group-handle-input,
[data-theme="dark"] .group-handle-wrapper input.group-handle-input,
body.dark-theme #create-group-modal input.group-handle-input,
body.dark-theme .group-handle-wrapper input.group-handle-input {
  color: #F9FAFB !important;
}

/* Clean default group/user avatars - no harsh borders or jumbled layouts */
.chat-container img[src*="group-avatar"],
.chat-container img[src*="default-avatar"],
#create-group-modal img[src*="group-avatar"] {
  border-radius: 50% !important;
  object-fit: cover !important;
  border: 1.5px solid rgba(16, 185, 129, 0.4) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
  background-color: #0f172a !important;
}

/* ========================================================
   iOS-STYLE SLIDE ANIMATIONS FOR CHATS & SUB-VIEWS
   ======================================================== */
@media (max-width: 1024px) {
  .chat-container {
    position: relative !important;
    width: 100% !important;
    overflow: hidden !important;
  }

  /* Smooth entrance fade in for chat conversation without transform stacking bugs */
  .chat-container.active-chat-open {
    animation: iosChatFadeIn 0.2s cubic-bezier(0.22, 1, 0.36, 1) forwards !important;
  }

  /* Slide in sidebar list smoothly from the left when navigating back */
  .chat-container.chat-list-only .chat-sidebar {
    animation: iosSlideInFromLeft 0.26s cubic-bezier(0.22, 1, 0.36, 1) forwards !important;
  }
}

@keyframes iosSlideInFromRight {
  0% {
    transform: translate3d(100%, 0, 0);
    opacity: 0.85;
  }
  100% {
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }
}

@keyframes iosSlideInFromLeft {
  0% {
    transform: translate3d(-20%, 0, 0);
    opacity: 0.85;
  }
  100% {
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }
}

/* ========================================================
   POPUP MENUS & ATTACHMENT DROPDOWNS: NATIVE ANIMATIONS & CLEAN ALIGNMENT
   ======================================================== */
.chat-popup-menu,
.chat-msg-actions-popup,
.attach-popup-menu {
  animation: popupScaleFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
  transform-origin: top right;
  will-change: transform, opacity;
}

.attach-popup-menu {
  transform-origin: bottom left !important;
}

@keyframes popupScaleFadeIn {
  0% {
    opacity: 0;
    transform: scale(0.92) translateY(6px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.chat-popup-menu button,
.attach-popup-menu button,
.chat-msg-actions-popup button {
  transition: background 0.15s ease, transform 0.12s ease !important;
}

.chat-popup-menu button:active,
.attach-popup-menu button:active,
.chat-msg-actions-popup button:active {
  transform: scale(0.98);
}

/* ========================================================
   iOS-STYLE MODAL & BOTTOM SHEET ENTRANCE ANIMATIONS
   ======================================================== */
.modal-overlay,
.live-modal-overlay,
.image-viewer-modal,
.lb-modal {
  animation: iosBackdropFadeIn 0.24s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

.modal-card,
.profile-popup-card,
.lb-modal-card {
  animation: iosModalScaleIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
  will-change: transform, opacity;
}

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

@keyframes iosModalScaleIn {
  0% {
    opacity: 0;
    transform: scale(0.94) translateY(12px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ========================================================
   REACTION POP & BOUNCE ANIMATION (TELEGRAM / IOS STYLE)
   ======================================================== */
.reaction-badge,
.reaction-bubble,
.chat-messages button[style*="borderRadius: 999px"],
.chat-messages button[style*="border-radius: 999px"],
.post-reaction-btn {
  transition: transform 0.18s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.2s ease, border-color 0.2s ease !important;
  will-change: transform;
}

.reaction-badge:active,
.reaction-bubble:active,
.chat-messages button[style*="borderRadius: 999px"]:active,
.chat-messages button[style*="border-radius: 999px"]:active,
.post-reaction-btn:active {
  transform: scale(1.28) !important;
}

@keyframes reactionPop {
  0% {
    transform: scale(0.5);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.35);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.reaction-pop-animate {
  animation: reactionPop 0.28s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards !important;
}






/* ========================================================
   PROFILE POPUP THEME HARDENING & CONTRAST PROTECTION
   (Honors custom user?.profileHeaderBg if present)
   ======================================================== */
[data-theme="dark"] .profile-popup-card:not([data-has-custom-bg="true"]),
body.dark-theme .profile-popup-card:not([data-has-custom-bg="true"]) {
  background-color: #0d131f !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.75) !important;
}

[data-theme="dark"] .profile-popup-card h2,
[data-theme="dark"] .profile-popup-card .profile-name,
body.dark-theme .profile-popup-card h2,
body.dark-theme .profile-popup-card .profile-name {
  color: #ffffff !important;
}

[data-theme="dark"] .profile-popup-close,
body.dark-theme .profile-popup-close {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #94a3b8 !important;
}

[data-theme="dark"] .profile-popup-close:hover,
body.dark-theme .profile-popup-close:hover {
  background: rgba(255, 255, 255, 0.16) !important;
  color: #ffffff !important;
}

.profile-popup {
  z-index: 100005 !important;
}

html[data-theme="light"] .profile-popup-card:not([data-has-custom-bg="true"]),
body.light-theme:not(.dark-theme) .profile-popup-card:not([data-has-custom-bg="true"]) {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.12) !important;
}

html[data-theme="light"] .profile-popup-card:not([data-has-custom-bg="true"]) h2,
html[data-theme="light"] .profile-popup-card:not([data-has-custom-bg="true"]) .profile-name,
body.light-theme:not(.dark-theme) .profile-popup-card:not([data-has-custom-bg="true"]) h2,
body.light-theme:not(.dark-theme) .profile-popup-card:not([data-has-custom-bg="true"]) .profile-name {
  color: #0f172a !important;
}

/* ========================================================
   QUIZZYGRAM SPARKS ACTION BUTTONS & PLUS BUTTON CENTERING
   ======================================================== */
.spark-action-circle,
.spark-plus-btn,
.spark-action-circle i,
.spark-plus-btn i {
  margin: 0 !important;
  margin-right: 0 !important;
  margin-left: 0 !important;
  padding: 0 !important;
}

.spark-action-circle {
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
  min-height: 48px !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  line-height: 1 !important;
}

.spark-action-circle i {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  line-height: 1 !important;
}

.spark-plus-btn {
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  min-height: 38px !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  line-height: 1 !important;
}

.spark-plus-btn i {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  line-height: 1 !important;
}


/* ========================================================
   CHANNEL STREAM 100% FULL-VIEWPORT WALLPAPER EXTENSION
   ======================================================== */
body:has(.channel-slug-container),
body.channel-view-active {
  background-attachment: fixed !important;
}

body:has(.channel-slug-container) .container,
body.channel-view-active .container,
body:has(.channel-slug-container) .main-content-wrapper,
body.channel-view-active .main-content-wrapper {
  min-height: 100dvh !important;
  display: flex !important;
  flex-direction: column !important;
  flex: 1 !important;
  background: transparent !important;
}

main.main-content.channel-slug-container,
[data-theme="dark"] main.main-content.channel-slug-container,
body.dark-theme main.main-content.channel-slug-container,
[data-theme="light"] main.main-content.channel-slug-container,
body:not(.dark-theme) main.main-content.channel-slug-container {
  min-height: 100dvh !important;
  display: flex !important;
  flex-direction: column !important;
  flex: 1 !important;
  background-color: transparent !important;
  background-attachment: fixed !important;
}

.channel-stream-container {
  flex: 1 !important;
  min-height: 50vh !important;
  display: flex !important;
  flex-direction: column !important;
}
