/* assets/css/style.css */
/* Modern Dark-Themed Glassmorphism Design System for NormLink (Standards & Compliance Hub) */

/* Google Fonts loaded via HTML links for performance optimization */

:root {
  --font-primary: 'Outfit', 'Noto Sans JP', sans-serif;
  
  /* Color System */
  --bg-base: hsl(224, 71%, 4%);
  --bg-surface: hsla(222, 47%, 11%, 0.7);
  --bg-surface-elevated: hsla(222, 47%, 16%, 0.95);
  --border-color: hsla(217, 30%, 60%, 0.15);
  --border-glow: hsla(180, 100%, 50%, 0.2);
  
  --primary: hsl(180, 100%, 50%); /* Neon Cyan */
  --primary-glow: hsla(180, 100%, 50%, 0.35);
  --secondary: hsl(263, 90%, 60%); /* Electric Purple */
  --secondary-glow: hsla(263, 90%, 60%, 0.35);
  
  --text-primary: hsl(210, 40%, 98%);
  --text-secondary: hsl(215, 20%, 75%);
  --text-muted: hsl(215, 12%, 55%);
  
  --success: hsl(142, 70%, 45%);
  --warning: hsl(38, 92%, 50%);
  --danger: hsl(350, 80%, 55%);
  
  --grad-primary: linear-gradient(135deg, var(--primary), var(--secondary));
  --grad-dark: linear-gradient(180deg, hsl(224, 71%, 4%), hsl(222, 47%, 8%));
  
  --shadow-sm: 0 2px 8px -1px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 16px -6px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px 2px var(--primary-glow);
  
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  
  --transition-smooth: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Prevent image copying and selection */
img {
  pointer-events: none !important;
  -webkit-touch-callout: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

body {
  font-family: var(--font-primary);
  background-color: var(--bg-base);
  background-image: 
    radial-gradient(at 0% 0%, hsla(263, 90%, 50%, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, hsla(180, 100%, 50%, 0.08) 0px, transparent 50%),
    radial-gradient(at 50% 50%, hsla(220, 50%, 10%, 0.5) 0px, transparent 100%);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-smooth);
}
a:hover {
  color: hsl(180, 100%, 70%);
}

/* App Layout Container */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: hsla(224, 71%, 4%, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 2rem;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo span {
  font-weight: 300;
}

.logo-icon {
  background: var(--grad-primary);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-block;
  position: relative;
}

.logo-icon::after {
  content: '';
  position: absolute;
  top: 6px;
  left: 6px;
  width: 16px;
  height: 16px;
  border: 2px solid var(--bg-base);
  border-radius: 4px;
}

.menu-toggle-btn {
  display: none;
}

nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-link {
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition-smooth);
}
.nav-link:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
  color: var(--primary);
  background-color: hsla(180, 100%, 50%, 0.08);
}

.nav-btn {
  background: var(--grad-primary);
  color: var(--bg-base) !important;
  font-weight: 700;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-md);
  transition: transform var(--transition-smooth), box-shadow var(--transition-smooth);
}
.nav-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem;
}

footer {
  background-color: hsla(224, 71%, 2%, 0.85);
  border-top: 1px solid var(--border-color);
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Glassmorphism Card Utility */
.glass-card {
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  transition: border-color var(--transition-smooth), box-shadow var(--transition-smooth), transform var(--transition-smooth);
}

.glass-card:hover {
  border-color: hsla(180, 100%, 50%, 0.25);
  box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.5), 0 0 15px 1px var(--primary-glow);
}

/* Inputs & Form Styling */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.form-input {
  width: 100%;
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.8rem 1rem;
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 1rem;
  transition: all var(--transition-smooth);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  background-color: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.form-select {
  width: 100%;
  background-color: hsla(222, 47%, 12%, 0.95);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.8rem 1rem;
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 1rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300f0ff' 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");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1.25rem;
  transition: all var(--transition-smooth);
}

.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

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

/* Button Component */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-primary);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-smooth);
  text-align: center;
}

.btn-primary {
  background: var(--grad-primary);
  color: var(--bg-base);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}
.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary);
}

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover {
  box-shadow: 0 0 15px hsla(350, 80%, 55%, 0.4);
  transform: translateY(-2px);
}

/* Hero Search Dashboard */
.hero {
  text-align: center;
  margin-bottom: 3rem;
  padding: 2rem 0;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  color: var(--text-secondary);
  font-size: 1.2rem;
  max-width: 600px;
  margin: 0 auto 2rem auto;
}

/* Search Box Container */
.search-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 800px;
  margin: 0 auto;
}

.search-bar-row {
  display: flex;
  gap: 1rem;
  width: 100%;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
}

.search-icon {
  position: absolute;
  left: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary);
  pointer-events: none;
}

.search-input-wrapper .form-input {
  padding-left: 3rem;
  height: 52px;
  font-size: 1.1rem;
  border-radius: var(--radius-lg);
}

.category-filter-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--border-color);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.category-slider-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.subcategory-scroll-container {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.4rem 2rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
  width: 100%;
  position: relative;
  scroll-behavior: smooth;
  -webkit-mask-image: linear-gradient(to right, transparent, white 24px, white calc(100% - 24px), transparent);
  mask-image: linear-gradient(to right, transparent, white 24px, white calc(100% - 24px), transparent);
}

.subcategory-scroll-container::-webkit-scrollbar {
  display: none;
}

.subcategory-scroll-track {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-start;
  min-width: max-content;
}

.slider-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(20, 24, 33, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, background-color 0.2s ease, border-color 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.slider-arrow.visible {
  opacity: 1;
  pointer-events: auto;
}

.slider-arrow:hover {
  background: rgba(20, 24, 33, 0.95);
  border-color: var(--primary);
  color: var(--primary);
}

.slider-arrow.prev-arrow {
  left: 0;
}

.slider-arrow.next-arrow {
  right: 0;
}

.filter-badge {
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.4rem 1rem;
  border-radius: 99px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-smooth);
  white-space: nowrap;
}

.filter-badge:hover, .filter-badge.active {
  border-color: var(--primary);
  background-color: hsla(180, 100%, 50%, 0.08);
  color: var(--primary);
}

.filter-sort-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
  border-top: 1px dashed var(--border-color);
  padding-top: 0.8rem;
}

/* Responsive Overrides (Smartphone screen sizes) */
@media (max-width: 768px) {
  header {
    padding: 0.75rem 1rem;
    position: sticky;
    top: 0;
  }
  
  .header-inner {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    position: relative;
  }
  
  .menu-toggle-btn {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 110;
  }
  
  .menu-toggle-btn .bar {
    display: block;
    width: 100%;
    height: 2px;
    background-color: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
  }
  
  .menu-toggle-btn.active .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }
  
  .menu-toggle-btn.active .bar:nth-child(2) {
    opacity: 0;
  }
  
  .menu-toggle-btn.active .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }
  
  nav {
    display: none;
    position: absolute;
    top: calc(100% + 0.75rem);
    left: -1rem;
    right: -1rem;
    width: calc(100% + 2rem);
    background-color: hsla(224, 71%, 4%, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    z-index: 99;
  }
  
  nav.menu-open {
    display: flex;
  }
  
  .nav-link, .nav-btn, #theme-toggle {
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 0.9rem;
    padding: 0.6rem 0.8rem;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
  }
  
  .nav-btn {
    padding: 0.6rem 1rem;
    background: var(--grad-primary);
    color: var(--bg-base) !important;
  }
  
  #theme-toggle {
    padding: 0.6rem 1rem !important;
    font-size: 1.1rem !important;
  }

  /* Hero Section Mobile styling updates */
  .hero {
    padding: 1rem 0;
    margin-bottom: 1.5rem;
  }
  
  .hero-title {
    font-size: 1.5rem !important;
    margin-bottom: 0.75rem;
    line-height: 1.35;
  }
  
  .hero p {
    font-size: 0.8rem !important;
    line-height: 1.45;
    max-width: 440px;
    margin: 0 auto 1.25rem auto;
  }

  .category-filter-container {
    padding: 0.75rem 0.5rem;
    gap: 0.5rem;
  }
  
  .subcategory-scroll-container {
    padding: 0.4rem 0.5rem;
    -webkit-mask-image: linear-gradient(to right, transparent, white 12px, white calc(100% - 12px), transparent);
    mask-image: linear-gradient(to right, transparent, white 12px, white calc(100% - 12px), transparent);
  }
  
  .slider-arrow {
    display: none !important;
  }
}

/* Light Mode Overrides for Category Filter */
body.light-theme .category-filter-container {
  background: rgba(0, 0, 0, 0.01);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

body.light-theme .slider-arrow {
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--border-color);
  color: var(--text-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

body.light-theme .slider-arrow:hover {
  background: rgba(255, 255, 255, 1);
  border-color: var(--primary);
  color: var(--primary);
}

body.light-theme .filter-badge {
  background-color: rgba(0, 0, 0, 0.02);
}

body.light-theme .filter-badge:hover, body.light-theme .filter-badge.active {
  background-color: hsla(190, 100%, 35%, 0.08);
}

/* Feed & Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.interpretation-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.category-tag {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  background-color: hsla(180, 100%, 50%, 0.1);
  color: var(--primary);
  border: 1px solid hsla(180, 100%, 50%, 0.25);
}

/* Category color families */
/* Data/AI: AI Act, Data Act, GDPR */
.category-tag.ai-act, .category-tag.data-act, .category-tag.gdpr { background-color: hsla(263, 90%, 60%, 0.1); color: hsl(263, 90%, 75%); border-color: hsla(263, 90%, 60%, 0.2); }

/* Radio/Wireless/EMC: EMC, RED */
.category-tag.emc, .category-tag.red { background-color: hsla(180, 100%, 50%, 0.1); color: hsl(180, 100%, 50%); border-color: hsla(180, 100%, 50%, 0.2); }

/* Safety: LVD, GPSR, Machinery */
.category-tag.lvd, .category-tag.gpsr, .category-tag.machinery { background-color: hsla(38, 92%, 50%, 0.1); color: hsl(38, 92%, 60%); border-color: hsla(38, 92%, 50%, 0.2); }

/* Environmental/Battery: RoHS, REACH, ESPR, WEEE, Battery, POPs, PPWR */
.category-tag.rohs, .category-tag.reach, .category-tag.espr, .category-tag.weee, .category-tag.battery, .category-tag.pops, .category-tag.ppwr { background-color: hsla(142, 70%, 45%, 0.1); color: hsl(142, 70%, 55%); border-color: hsla(142, 70%, 45%, 0.2); }

/* Medical: MDR, IVDR */
.category-tag.mdr, .category-tag.ivdr, .category-tag.md-mr { background-color: hsla(200, 90%, 50%, 0.1); color: hsl(200, 90%, 60%); border-color: hsla(200, 90%, 50%, 0.2); }

/* Cyber/Ex/Other: CRA, ATEX, CMRR */
.category-tag.cra, .category-tag.atex, .category-tag.cmrr { background-color: hsla(320, 80%, 60%, 0.1); color: hsl(320, 80%, 70%); border-color: hsla(320, 80%, 60%, 0.2); }

/* Other */
.category-tag.other { background-color: hsla(0, 0%, 50%, 0.1); color: hsl(0, 0%, 75%); border-color: hsla(0, 0%, 50%, 0.2); }

.rank-badge {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.rank-badge .score-value {
  color: var(--secondary);
  font-weight: 700;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.standard-info {
  display: flex;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--primary);
  margin-bottom: 1rem;
  font-weight: 600;
}

.card-summary {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 4.8rem;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 1rem;
  margin-top: auto;
}

.creator-info {
  display: flex;
  flex-direction: column;
}

.creator-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.creator-type {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.stats-row {
  display: flex;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.stat-item.active {
  color: var(--primary);
}

/* Detail View Layout */
.detail-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
}

@media (max-width: 900px) {
  .detail-layout {
    grid-template-columns: 1fr;
  }
}

.detail-main {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.detail-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.5rem;
}

.detail-title {
  font-size: 2.25rem;
  font-weight: 800;
  margin: 0.5rem 0;
}

.detail-meta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  align-items: center;
}

.detail-content {
  font-size: 1.05rem;
  line-height: 1.7;
}

.detail-content p {
  margin-bottom: 1.5rem;
}

.detail-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Sidebar Info & Citation Graph */
.detail-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.creator-profile-card {
  text-align: center;
}

.creator-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--grad-primary);
  margin: 0 auto 1rem auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--bg-base);
}

.sidebar-heading {
  font-size: 1.1rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.citation-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.citation-item {
  display: block;
  font-size: 0.9rem;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.citation-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: var(--primary);
}

.citation-title {
  font-weight: 600;
  display: block;
  color: var(--text-primary);
}

.citation-code {
  font-size: 0.8rem;
  color: var(--primary);
}

/* JSON-LD Code Block Style */
.json-ld-box {
  background-color: hsl(222, 47%, 5%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  overflow-x: auto;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  color: #a9ffcc;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Visual JSON-LD Editor Setup */
.editor-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 1000px) {
  .editor-layout {
    grid-template-columns: 1fr;
  }
}

.json-live-container {
  position: sticky;
  top: 100px;
}

/* Form Helper Suggestions */
.suggestions-box {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
  box-shadow: var(--shadow-md);
}

.suggestion-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background-color var(--transition-smooth);
}

.suggestion-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--primary);
}

/* Native Dialog Modals & Animation */
dialog {
  margin: auto;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(180, 100, 50, 0.2);
  color: var(--text-primary);
  width: 90%;
  max-width: 500px;
  padding: 2rem;
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
}

dialog::backdrop {
  background-color: rgba(0, 0, 0, 0);
  transition: 
    display 0.3s allow-discrete, 
    overlay 0.3s allow-discrete, 
    background-color 0.3s ease-out;
}

dialog[open]::backdrop {
  background-color: rgba(4, 7, 15, 0.8);
  @starting-style {
    background-color: rgba(0, 0, 0, 0);
  }
}

dialog {
  opacity: 0;
  transform: scale(0.92);
  transition: 
    opacity 0.3s ease-out, 
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), 
    display 0.3s allow-discrete, 
    overlay 0.3s allow-discrete;
  transition-behavior: allow-discrete;
}

dialog[open] {
  opacity: 1;
  transform: scale(1);
  @starting-style {
    opacity: 0;
    transform: scale(0.92);
  }
}

/* Scout inbox styling */
.scout-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.scout-card {
  background-color: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.scout-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 0.5rem;
}

.scout-company-name {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--primary);
}

.scout-subject {
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.scout-message {
  font-size: 0.95rem;
  color: var(--text-secondary);
  white-space: pre-wrap;
  margin-bottom: 1rem;
}

.scout-contact {
  font-size: 0.85rem;
  color: var(--text-muted);
  background-color: rgba(255, 255, 255, 0.03);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  display: inline-block;
}

/* User Type Badges */
.badge-type {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
}

.badge-type.individual {
  background-color: hsla(180, 100%, 50%, 0.1);
  color: var(--primary);
}

.badge-type.company {
  background-color: hsla(263, 90%, 60%, 0.1);
  color: hsl(263, 90%, 70%);
}

/* Profile Edit Box */
.profile-meta-edit {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 600px) {
  .profile-meta-edit {
    grid-template-columns: 1fr;
  }
}

/* Notifications toasts */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 1rem 1.5rem;
  color: var(--text-primary);
  font-size: 0.95rem;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 280px;
  animation: toast-slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toast-slide-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

/* --- Premium Light Theme Styles --- */
body.light-theme {
  --bg-base: hsl(210, 40%, 96%); /* Light cool grey/white background */
  --bg-surface: hsla(0, 0%, 100%, 0.7); /* White glass */
  --bg-surface-elevated: hsla(0, 0%, 100%, 0.95);
  --border-color: hsla(217, 30%, 20%, 0.1);
  --border-glow: hsla(190, 100%, 35%, 0.2);
  
  --primary: hsl(190, 100%, 32%); /* Deep teal/cyan for accessible contrast */
  --primary-glow: hsla(190, 100%, 32%, 0.15);
  --secondary: hsl(263, 60%, 45%); /* Soft purple */
  --secondary-glow: hsla(263, 60%, 45%, 0.15);
  
  --text-primary: hsl(222, 47%, 12%); /* Dark blue-grey text */
  --text-secondary: hsl(217, 19%, 30%); /* Mid-tone grey text */
  --text-muted: hsl(215, 16%, 47%); /* Cool grey text */
  
  color: var(--text-primary);
  background-color: var(--bg-base);
  background-image: 
    radial-gradient(at 0% 0%, hsla(263, 90%, 85%, 0.2) 0px, transparent 50%),
    radial-gradient(at 100% 100%, hsla(190, 100%, 75%, 0.15) 0px, transparent 50%),
    radial-gradient(at 50% 50%, hsla(210, 40%, 96%, 0.9) 0px, transparent 100%);
}

body.light-theme a {
  color: var(--primary);
}
body.light-theme a:hover {
  color: hsl(190, 100%, 22%);
}

/* Light Mode Overrides */
body.light-theme header {
  background-color: hsla(210, 40%, 96%, 0.8);
  border-bottom: 1px solid var(--border-color);
}

body.light-theme footer {
  background-color: hsla(210, 40%, 92%, 0.85);
  border-top: 1px solid var(--border-color);
}

body.light-theme .nav-link:hover {
  background-color: rgba(0, 0, 0, 0.03);
}

body.light-theme .nav-link.active {
  background-color: hsla(190, 100%, 35%, 0.08);
}

body.light-theme .nav-btn {
  color: white !important;
}

body.light-theme .glass-card {
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 16px -6px rgba(0, 0, 0, 0.05);
}

body.light-theme .glass-card:hover {
  border-color: hsla(190, 100%, 35%, 0.25);
  box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.08), 0 0 15px 1px var(--primary-glow);
}

body.light-theme .form-input {
  background-color: rgba(0, 0, 0, 0.015);
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: var(--text-primary);
}

body.light-theme .form-input:focus {
  background-color: white;
  border-color: var(--primary);
}

body.light-theme .form-select {
  background-color: white;
  color: var(--text-primary);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

body.light-theme .btn-primary {
  color: white;
}

body.light-theme .btn-secondary {
  background: rgba(0, 0, 0, 0.02);
  color: var(--text-primary);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

body.light-theme .btn-secondary:hover {
  background: rgba(0, 0, 0, 0.05);
  border-color: var(--primary);
}

body.light-theme .citation-item {
  background-color: rgba(0, 0, 0, 0.01);
  border: 1px solid rgba(0, 0, 0, 0.03);
}

body.light-theme .citation-item:hover {
  background-color: rgba(0, 0, 0, 0.03);
  border-color: var(--primary);
}

body.light-theme .json-ld-box {
  background-color: hsl(210, 40%, 98%);
  color: hsl(222, 47%, 12%);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

body.light-theme .suggestion-item:hover {
  background-color: rgba(0, 0, 0, 0.03);
}

body.light-theme .scout-card {
  background-color: rgba(0, 0, 0, 0.005);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

body.light-theme .scout-contact {
  background-color: rgba(0, 0, 0, 0.015);
}

body.light-theme dialog {
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15), 0 0 30px rgba(0, 0, 0, 0.05);
}

/* Standalone KB System adjustments for Light Mode */
body.light-theme .back-nav {
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

body.light-theme .tab-btn {
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--text-secondary);
}

body.light-theme .tab-btn:hover {
  background: rgba(190, 100, 50, 0.05);
  color: var(--primary);
}

body.light-theme .tab-btn.active {
  background: linear-gradient(180deg, rgba(190, 100, 50, 0.08) 0%, white 100%);
  border-color: var(--primary);
  border-bottom: 1px solid var(--bg-base);
  color: var(--primary);
}

body.light-theme .section-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.05);
}

body.light-theme input[type="text"],
body.light-theme input[type="date"],
body.light-theme textarea,
body.light-theme select {
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.15);
  color: var(--text-primary);
}

body.light-theme input:focus,
body.light-theme textarea:focus,
body.light-theme select:focus {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.2), inset 0 0 8px rgba(0, 240, 255, 0.05);
}

body.light-theme .tooltip-box {
  background: white;
  border: 1px solid var(--primary);
  color: var(--text-primary);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

body.light-theme .tooltip-box strong {
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

body.light-theme .tooltip-box em {
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

body.light-theme .merge-zone {
  background: rgba(0, 0, 0, 0.01);
  border-color: var(--primary);
}

body.light-theme .merge-zone:hover {
  background: rgba(190, 100, 50, 0.05);
}

body.light-theme .file-list {
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

body.light-theme .case-card {
  border: 1px solid rgba(124, 58, 237, 0.2);
  background: rgba(124, 58, 237, 0.02);
}

body.light-theme .case-card:hover {
  border-color: var(--secondary);
}

/* --- Direct Messaging & Donation custom styles --- */

/* Nav Badge */
.nav-link-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.nav-badge {
  position: absolute;
  top: -2px;
  right: -6px;
  background-color: var(--danger);
  color: white;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 8px rgba(255, 0, 0, 0.5);
  animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); box-shadow: 0 0 12px rgba(255, 0, 0, 0.7); }
  100% { transform: scale(1); }
}

/* Chat Layout */
.chat-container {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1.5rem;
  height: 650px;
  margin-top: 1rem;
}

@media (max-width: 768px) {
  .chat-container {
    grid-template-columns: 1fr;
    height: auto;
  }
  .chat-sidebar {
    max-height: 200px;
  }
}

.chat-sidebar {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-sidebar-header {
  padding: 1.25rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
  background: rgba(255,255,255,0.02);
}

.chat-user-list {
  flex: 1;
  overflow-y: auto;
  list-style: none;
}

.chat-user-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: background var(--transition-smooth);
}

.chat-user-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.chat-user-item.active {
  background: hsla(180, 100%, 50%, 0.08);
  border-left: 3px solid var(--primary);
}

.chat-user-details {
  flex: 1;
  min-width: 0;
  margin-right: 0.5rem;
}

.chat-user-name {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.chat-user-last-msg {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.25rem;
}

.chat-user-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.chat-user-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.chat-user-unread-badge {
  background: var(--danger);
  color: white;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
}

.chat-main {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-main-header {
  padding: 1.25rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
  background: rgba(255,255,255,0.02);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-history {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-bubble-wrapper {
  display: flex;
  flex-direction: column;
  max-width: 70%;
}

.chat-bubble-wrapper.sent {
  align-self: flex-end;
  align-items: flex-end;
}

.chat-bubble-wrapper.received {
  align-self: flex-start;
  align-items: flex-start;
}

.chat-bubble {
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  line-height: 1.5;
  word-break: break-all;
  white-space: pre-wrap;
}

.chat-bubble-wrapper.sent .chat-bubble {
  background: var(--grad-primary);
  color: var(--bg-base);
  border-bottom-right-radius: 2px;
  font-weight: 500;
}

.chat-bubble-wrapper.received .chat-bubble {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-bottom-left-radius: 2px;
  border: 1px solid var(--border-color);
}

.chat-bubble-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.chat-input-area {
  padding: 1.25rem;
  border-top: 1px solid var(--border-color);
  background: rgba(255,255,255,0.01);
}

.chat-input-form {
  display: flex;
  gap: 0.75rem;
}

.chat-input-form .form-input {
  border-radius: var(--radius-lg);
  height: 44px;
}

.chat-input-form .btn {
  border-radius: var(--radius-lg);
  padding: 0 1.5rem;
  height: 44px;
}

/* Donation UI Styles */
.donation-card {
  margin-top: 1.5rem;
  background: hsla(263, 90%, 50%, 0.05);
  border: 1px dashed var(--secondary);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-smooth);
}

.donation-card:hover {
  background: hsla(263, 90%, 50%, 0.08);
  border-color: var(--primary);
  box-shadow: 0 0 15px rgba(124, 58, 237, 0.2);
}

.donation-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.donation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.donation-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-smooth);
  border: 1px solid var(--border-color);
  text-decoration: none;
}

.donation-btn.paypay {
  background: rgba(255, 0, 50, 0.1);
  color: #ff3355;
  border-color: rgba(255, 0, 50, 0.2);
}
.donation-btn.paypay:hover {
  background: rgba(255, 0, 50, 0.2);
  border-color: #ff3355;
}

.donation-btn.kofi {
  background: rgba(255, 180, 0, 0.1);
  color: #ffb800;
  border-color: rgba(255, 180, 0, 0.2);
}
.donation-btn.kofi:hover {
  background: rgba(255, 180, 0, 0.2);
  border-color: #ffb800;
}

.donation-btn.custom {
  background: rgba(0, 240, 255, 0.1);
  color: var(--primary);
  border-color: rgba(0, 240, 255, 0.2);
}
.donation-btn.custom:hover {
  background: rgba(0, 240, 255, 0.2);
  border-color: var(--primary);
}

.donation-btn.crypto {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  border-color: var(--border-color);
}
.donation-btn.crypto:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--primary);
}

.crypto-info-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  font-size: 0.8rem;
  margin-top: 0.5rem;
  display: none;
  animation: fadeIn 0.3s ease;
}

.crypto-address-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.crypto-address-row:last-child {
  margin-bottom: 0;
}

.crypto-address {
  font-family: 'Courier New', Courier, monospace;
  word-break: break-all;
  color: #a9ffcc;
  flex: 1;
}

.crypto-copy-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all var(--transition-smooth);
}

.crypto-copy-btn:hover {
  background: var(--primary);
  color: var(--bg-base);
  border-color: var(--primary);
}

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

/* Light Theme overrides for DMs */
body.light-theme .chat-sidebar,
body.light-theme .chat-main {
  background: white;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

body.light-theme .chat-user-item {
  border-bottom-color: rgba(0, 0, 0, 0.04);
}

body.light-theme .chat-user-item.active {
  background: rgba(0, 240, 255, 0.05);
}

body.light-theme .chat-bubble-wrapper.received .chat-bubble {
  background: #f3f4f6;
  border-color: rgba(0, 0, 0, 0.05);
  color: #1f2937;
}

body.light-theme .donation-card {
  background: rgba(124, 58, 237, 0.02);
  border-color: rgba(124, 58, 237, 0.3);
}

body.light-theme .crypto-info-box {
  background: #f9fafb;
  border-color: rgba(0, 0, 0, 0.06);
}

body.light-theme .crypto-address {
  color: #065f46;
}

/* --- Ranking Dashboard Styles --- */
.ranking-tabs {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.ranking-tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.5rem 1rem;
  position: relative;
  transition: color var(--transition-smooth);
}

.ranking-tab-btn:hover {
  color: var(--text-primary);
}

.ranking-tab-btn.active {
  color: var(--primary);
}

.ranking-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -0.85rem;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--grad-primary);
  border-radius: 99px;
}

.ranking-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.period-toggle-group {
  display: flex;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 99px;
  padding: 0.25rem;
}

.period-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 0.4rem 1.2rem;
  border-radius: 99px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-smooth);
}

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

.period-btn.active {
  background: var(--grad-primary);
  color: var(--bg-base);
}

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

.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.25rem 1.5rem;
  transition: transform var(--transition-smooth), border-color var(--transition-smooth);
}

.leaderboard-row:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.rank-position {
  font-size: 1.5rem;
  font-weight: 800;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
}

.rank-position.rank-1 {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.rank-position.rank-2 {
  background: rgba(156, 163, 175, 0.15);
  color: #9ca3af;
  border: 1px solid rgba(156, 163, 175, 0.3);
}

.rank-position.rank-3 {
  background: rgba(180, 83, 9, 0.15);
  color: #b45309;
  border: 1px solid rgba(180, 83, 9, 0.3);
}

.rank-position.rank-other {
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  font-size: 1.1rem;
}

.leaderboard-content {
  flex-grow: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.leaderboard-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.leaderboard-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
}

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

.leaderboard-author {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.leaderboard-stats {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.leaderboard-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.leaderboard-stat-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.leaderboard-score-badge {
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.25);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  text-align: center;
  min-width: 90px;
}

.leaderboard-score-value {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--primary);
}

.leaderboard-score-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-top: 0.15rem;
}

/* Light theme overrides for Rankings */
body.light-theme .ranking-tab-btn:hover {
  color: black;
}
body.light-theme .ranking-tab-btn.active {
  color: var(--primary-light, #7c3aed);
}
body.light-theme .period-toggle-group {
  background: rgba(0, 0, 0, 0.02);
}
body.light-theme .leaderboard-score-badge {
  background: rgba(124, 58, 237, 0.05);
  border-color: rgba(124, 58, 237, 0.2);
}
body.light-theme .leaderboard-score-value {
  color: #7c3aed;
}

/* Accessibility screen-reader-only styling */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Feed Tabs (Segmented Control) */
.feed-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}
.feed-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--transition-smooth);
  border-bottom: 2px solid transparent;
}
.feed-tab:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.05);
}
.feed-tab.active {
  color: var(--primary);
  background-color: var(--primary-glow);
  border-bottom: 2px solid var(--primary);
}

body.light-theme .feed-tab:hover {
  background-color: rgba(0, 0, 0, 0.03);
}

/* Twitter-like Composer Card */
.news-composer-card {
  padding: 1.25rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
}
.news-composer-form {
  display: flex;
  width: 100%;
  gap: 1rem;
}
.news-composer-avatar, .news-tweet-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--bg-base);
  font-size: 1.1rem;
  flex-shrink: 0;
}
.news-composer-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.news-composer-textarea {
  width: 100%;
  min-height: 80px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.75rem;
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
  transition: all var(--transition-smooth);
}
.news-composer-textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 10px var(--primary-glow);
}
.news-composer-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.news-char-counter {
  font-size: 0.8rem;
  color: var(--text-muted);
}

body.light-theme .news-composer-textarea {
  background: rgba(0, 0, 0, 0.01);
}
body.light-theme .news-composer-textarea:focus {
  background: rgba(0, 0, 0, 0.03);
}

/* Twitter-like News Card */
.news-tweet-card {
  display: flex;
  gap: 1rem;
  padding: 1.25rem;
  margin-bottom: 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  transition: transform var(--transition-smooth), border-color var(--transition-smooth);
}
.news-tweet-card:hover {
  border-color: var(--primary-glow);
  transform: translateY(-2px);
}
.news-tweet-main {
  flex-grow: 1;
}
.news-tweet-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}
.news-tweet-author a {
  color: var(--text-primary);
  font-weight: 700;
  text-decoration: none;
}
.news-tweet-author a:hover {
  color: var(--primary);
}
.news-tweet-badge {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}
body.light-theme .news-tweet-badge {
  background: rgba(0, 0, 0, 0.05);
}
.news-tweet-time {
  color: var(--text-muted);
  font-size: 0.8rem;
}
.news-tweet-content {
  color: var(--text-secondary);
  font-size: 0.95rem;
  word-break: break-all;
  line-height: 1.5;
  margin-bottom: 0.75rem;
  white-space: pre-wrap;
}
.news-tweet-footer {
  display: flex;
  align-items: center;
}
.btn-news-like {
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.9rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: all 0.2s;
}
.btn-news-like:hover {
  background-color: var(--primary-glow) !important;
  color: var(--primary) !important;
}

/* Premium Segmented and Sort Controls (Homepage) */
.filter-controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  width: 100%;
}

.segmented-control {
  display: flex;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  padding: 4px;
  border-radius: var(--radius-md);
  gap: 2px;
}

body.light-theme .segmented-control {
  background: rgba(0, 0, 0, 0.02);
}

.segment-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.5rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: calc(var(--radius-md) - 2px);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

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

.segment-btn.active {
  background: var(--grad-primary);
  color: #000;
  font-weight: 700;
  box-shadow: 0 4px 12px var(--primary-glow);
}

body.light-theme .segment-btn.active {
  color: #fff;
}

.sort-selector-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.sort-selector-wrapper::before {
  content: "⇅";
  position: absolute;
  left: 0.75rem;
  color: var(--primary);
  font-size: 0.9rem;
  pointer-events: none;
  opacity: 0.6;
}

.sort-select {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.03) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2300f0ff'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E") no-repeat right 0.75rem center;
  background-size: 1rem;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.5rem 2.25rem 0.5rem 2rem;
  font-size: 0.9rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
  font-family: var(--font-primary);
}

.sort-select:hover {
  border-color: var(--primary);
  background-color: rgba(255, 255, 255, 0.06);
}

.sort-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

body.light-theme .sort-select {
  background: rgba(0, 0, 0, 0.01) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23333333'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E") no-repeat right 0.75rem center;
  background-size: 1rem;
}

/* Detail Case Sections */
.case-details-section {
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  margin-top: 1.5rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.01);
}

body.light-theme .case-details-section {
  background: rgba(0, 0, 0, 0.005);
}

.case-sections-container {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 1rem;
}

body.light-theme .case-sections-container {
  background: rgba(0, 0, 0, 0.015);
}

.case-section-card {
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02) !important;
  border: none !important;
  border-left: 4px solid var(--border-color) !important;
  margin-bottom: 0 !important;
  transition: background-color 0.2s ease;
}

.case-section-card:hover {
  transform: none !important;
  box-shadow: none !important;
  background: rgba(255, 255, 255, 0.04) !important;
}

.case-section-card.problem-card {
  border-left: 4px solid var(--danger) !important;
}

.case-section-card.mitigation-card {
  border-left: 4px solid var(--primary) !important;
}

.case-section-card.evaluation-card {
  border-left: 4px solid var(--success) !important;
}

body.light-theme .case-section-card {
  background: rgba(0, 0, 0, 0.02) !important;
}

body.light-theme .case-section-card:hover {
  background: rgba(0, 0, 0, 0.035) !important;
}

.case-section-card h4 {
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.case-section-body {
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

.case-section-body p {
  margin-bottom: 0.75rem;
}

.case-section-body p:last-child {
  margin-bottom: 0;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .filter-controls-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  
  .segmented-control {
    width: 100%;
    justify-content: space-between;
  }
  
  .segment-btn {
    flex: 1;
    text-align: center;
    padding: 0.5rem 0.5rem;
    font-size: 0.85rem;
  }
  
  .sort-selector-wrapper {
    width: 100%;
  }
  
  .sort-select {
    width: 100%;
  }
}

/* Custom Tooltip for Donation Settings */
.tooltip-container {
  position: relative;
}

.donation-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  width: 320px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4), 0 0 10px rgba(180, 100, 50, 0.15);
  z-index: 1100;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.donation-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: var(--border-color) transparent transparent transparent;
}

/* Trigger tooltip display on hover or focus of input/badge */
.tooltip-container:hover .donation-tooltip,
.tooltip-container:focus-within .donation-tooltip {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

body.light-theme .donation-tooltip {
  background: #ffffff;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12), 0 0 10px rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
}

/* --- Technical Blog Styles --- */
.blog-feed-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.blog-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.blog-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), 0 0 15px rgba(180, 100, 50, 0.05);
}

.blog-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.blog-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--grad-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.blog-author-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex-grow: 1;
}

.blog-author-name {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.blog-author-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.blog-title-link {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.25rem;
  margin: 0.5rem 0;
  display: block;
}

.blog-title-link:hover {
  color: var(--primary);
}

.blog-content-preview {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1rem;
  white-space: pre-wrap;
}

.blog-linked-reference {
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

body.light-theme .blog-linked-reference {
  background: rgba(0, 0, 0, 0.02);
}

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

.blog-linked-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--secondary);
}

.blog-linked-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
}

.blog-linked-title:hover {
  color: var(--primary);
}

.blog-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  margin-top: 1rem;
}

body.light-theme .blog-footer {
  border-top-color: rgba(0, 0, 0, 0.05);
}

.blog-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.blog-stats {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.blog-score-pill {
  background: hsla(38, 92%, 50%, 0.1);
  color: hsl(38, 92%, 60%);
  border: 1px solid hsla(38, 92%, 50%, 0.2);
  border-radius: 50px;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.blog-score-pill.linked {
  background: hsla(180, 100%, 50%, 0.1);
  color: hsl(180, 100%, 50%);
  border-color: hsla(180, 100%, 50%, 0.2);
}

.btn-blog-like {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: background-color 0.2s, color 0.2s;
}

.btn-blog-like:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--primary);
}

body.light-theme .btn-blog-like:hover {
  background: rgba(0, 0, 0, 0.05);
}

.btn-blog-like.liked {
  color: var(--primary);
  font-weight: 700;
}

/* --- Q&A Portal and Highlighting styles --- */
.qa-card {
  transition: transform var(--transition-smooth), border-color var(--transition-smooth), box-shadow var(--transition-smooth);
}

.qa-card:hover {
  transform: translateY(-2px);
}

.qa-best-answer {
  position: relative;
  overflow: hidden;
}

/* Glowing background effect for best answer */
.qa-best-answer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at top right, rgba(255, 215, 0, 0.04), transparent 70%);
  pointer-events: none;
}

/* Search Term Highlighting */
mark.search-highlight {
  background-color: hsla(180, 100%, 50%, 0.25);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 0 0.15rem;
  font-weight: inherit;
}

body.light-theme mark.search-highlight {
  background-color: hsla(180, 100%, 35%, 0.2);
  color: var(--text-primary);
}
