/* --- Theme Design System (Dark Glassmorphism) --- */
:root {
  /* Colors */
  --bg-base: #080b11;
  --bg-surface: rgba(17, 24, 39, 0.45);
  --bg-surface-hover: rgba(17, 24, 39, 0.65);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --bg-glass-active: rgba(255, 255, 255, 0.08);
  
  --border-glass: rgba(255, 255, 255, 0.06);
  --border-glass-highlight: rgba(139, 92, 246, 0.3);
  
  --accent-primary: #8b5cf6;       /* Violet */
  --accent-primary-rgb: 139, 92, 246;
  --accent-primary-glow: rgba(139, 92, 246, 0.15);
  --accent-secondary: #0d9488;     /* Teal */
  --accent-secondary-glow: rgba(13, 148, 136, 0.2);
  --accent-alert: #f43f5e;         /* Rose */
  
  --text-primary: #f8fafc;         /* Slate 50 */
  --text-secondary: #94a3b8;       /* Slate 400 */
  --text-muted: #64748b;           /* Slate 500 */
  
  /* Layout constraints */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --glass-blur: blur(12px);
}

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

body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  letter-spacing: -0.02em;
}

a {
  color: var(--accent-secondary);
  text-decoration: none;
  transition: var(--transition-smooth);
}

a:hover {
  color: #2dd4bf;
  text-shadow: 0 0 8px rgba(45, 212, 191, 0.4);
}

/* --- Glow Background Elements --- */
.bg-glow {
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(140px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.15;
}

.bg-glow-1 {
  background: var(--accent-primary);
  top: -100px;
  right: -100px;
}

.bg-glow-2 {
  background: var(--accent-secondary);
  top: 40%;
  left: -200px;
}

.bg-glow-3 {
  background: var(--accent-primary);
  bottom: -100px;
  right: 10%;
}

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

::-webkit-scrollbar-track {
  background: rgba(8, 11, 17, 0.5);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* --- Layout Container --- */
.app-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 40px 24px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 30px;
  position: relative;
}

/* --- Glass Panel Class --- */
.glass-panel {
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  box-shadow: var(--glass-shadow);
  transition: var(--transition-smooth);
}

/* --- Header / Profile Banner --- */
.app-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 30px;
  align-items: center;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 30px 40px;
  box-shadow: var(--glass-shadow);
}

.profile-section {
  display: flex;
  align-items: center;
  gap: 25px;
}

.profile-badge {
  background: linear-gradient(135deg, var(--accent-primary) 0%, #6d28d9 100%);
  width: 70px;
  height: 70px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.3);
}

.profile-badge i {
  width: 35px;
  height: 35px;
  color: #fff;
}

.profile-info h1 {
  font-size: 2.2rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.profile-info .subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
  font-weight: 500;
  margin-bottom: 12px;
}

.profile-tags {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tag {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.tag i {
  width: 12px;
  height: 12px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 160px);
  gap: 15px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 15px;
  text-align: center;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-glass-highlight);
  background: rgba(139, 92, 246, 0.05);
}

.stat-icon {
  color: var(--accent-primary);
  margin-bottom: 8px;
  background: rgba(139, 92, 246, 0.1);
  padding: 8px;
  border-radius: 50%;
  display: inline-flex;
}

.stat-icon i {
  width: 20px;
  height: 20px;
}

.stat-val {
  font-family: 'Outfit', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  display: block;
}

.stat-lbl {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* --- Main Layout --- */
.main-layout {
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 30px;
  align-items: start;
}

/* --- Sidebar Filters --- */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.filter-card {
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--glass-shadow);
}

.filter-card h3 {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 15px;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 10px;
}

/* Search Wrapper */
.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  width: 18px;
  height: 18px;
}

.search-box-container input {
  width: 100%;
  background: rgba(8, 11, 17, 0.6);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 10px 38px 10px 38px;
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: var(--transition-smooth);
}

.search-box-container input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 12px var(--accent-primary-glow);
  background: rgba(8, 11, 17, 0.8);
}

.clear-btn {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition-smooth);
}

.clear-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
}

.clear-btn i {
  width: 14px;
  height: 14px;
}

/* Filter Buttons */
.filter-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  text-align: left;
  padding: 8px 12px;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  width: 100%;
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-primary);
}

.filter-btn.active {
  background: rgba(139, 92, 246, 0.08);
  border-color: rgba(139, 92, 246, 0.25);
  color: var(--text-primary);
}

.indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: var(--transition-smooth);
}

.filter-btn.active .indicator {
  background: var(--accent-primary);
  box-shadow: 0 0 8px var(--accent-primary);
}

.filter-btn[data-theme="survey-methods"].active .indicator {
  background: #3b82f6; /* Blue */
  box-shadow: 0 0 8px #3b82f6;
}
.filter-btn[data-theme="social-epi"].active .indicator {
  background: #0d9488; /* Teal */
  box-shadow: 0 0 8px #0d9488;
}
.filter-btn[data-theme="substance-abuse"].active .indicator {
  background: #f59e0b; /* Amber */
  box-shadow: 0 0 8px #f59e0b;
}
.filter-btn[data-theme="covid-academia"].active .indicator {
  background: #ec4899; /* Pink */
  box-shadow: 0 0 8px #ec4899;
}
.filter-btn[data-theme="cancer-health"].active .indicator {
  background: #10b981; /* Emerald */
  box-shadow: 0 0 8px #10b981;
}

/* Co-Authors List & Journals List */
.coauthors-list, .journals-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 4px;
}

.list-item-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-align: left;
  transition: var(--transition-smooth);
  width: 100%;
}

.list-item-btn:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
}

.list-item-btn.active {
  background: rgba(13, 148, 136, 0.08);
  color: var(--text-primary);
  border-left: 2px solid var(--accent-secondary);
}

.list-item-count {
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 100px;
  color: var(--text-muted);
}

.list-item-btn:hover .list-item-count,
.list-item-btn.active .list-item-count {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
}

/* --- Content Area --- */
.content-area {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

/* Sections */
.visualizer-section, .publications-section {
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--glass-shadow);
}

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

.section-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.01em;
}

.section-header h2 i {
  color: var(--accent-primary);
  width: 24px;
  height: 24px;
}

.results-badge {
  background: var(--accent-primary-glow);
  color: var(--accent-primary);
  font-size: 0.85rem;
  padding: 2px 10px;
  border-radius: 100px;
  border: 1px solid rgba(139, 92, 246, 0.2);
  margin-left: 10px;
  font-weight: 700;
}

/* Timeline SVG Chart */
.timeline-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.timeline-scroll {
  width: 100%;
  overflow-x: auto;
  padding-bottom: 10px;
}

.timeline-chart {
  display: block;
  min-height: 180px;
  width: 100%;
  min-width: 600px;
}

.timeline-helper-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
}

/* Bar styles in SVG */
.chart-bar {
  fill: rgba(139, 92, 246, 0.3);
  stroke: rgba(139, 92, 246, 0.5);
  stroke-width: 1px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.chart-bar:hover {
  fill: var(--accent-primary);
  filter: drop-shadow(0px 0px 8px rgba(139, 92, 246, 0.6));
}

.chart-bar.active {
  fill: var(--accent-secondary);
  stroke: #2dd4bf;
  filter: drop-shadow(0px 0px 8px rgba(13, 148, 136, 0.6));
}

.chart-label {
  font-size: 10px;
  font-family: 'Outfit', sans-serif;
  fill: var(--text-secondary);
  text-anchor: middle;
}

.chart-value {
  font-size: 9px;
  font-weight: bold;
  fill: var(--text-muted);
  text-anchor: middle;
  opacity: 0;
  transition: var(--transition-smooth);
}

.chart-bar-group:hover .chart-value {
  opacity: 1;
  fill: var(--text-primary);
}

.chart-grid-line {
  stroke: rgba(255, 255, 255, 0.04);
  stroke-width: 1;
}

.chart-bar--citations {
  fill: rgba(13, 148, 136, 0.35);
  stroke: rgba(13, 148, 136, 0.5);
}
.chart-bar--citations:hover {
  fill: var(--accent-secondary);
  filter: drop-shadow(0px 0px 8px rgba(13, 148, 136, 0.6));
}

/* Sort dropdown */
.sort-container {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
}

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

.sort-container select {
  background: rgba(8, 11, 17, 0.6);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.sort-container select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 10px var(--accent-primary-glow);
}

/* Active Filters Bar */
.active-filters-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  background: rgba(255, 255, 255, 0.01);
  border: 1px dashed var(--border-glass);
  padding: 10px 15px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.active-filters-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.active-filters-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-tag {
  background: rgba(13, 148, 136, 0.1);
  border: 1px solid rgba(13, 148, 136, 0.2);
  color: #2dd4bf;
  padding: 4px 10px;
  font-size: 0.75rem;
  border-radius: 100px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.filter-tag button {
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  padding: 1px;
  border-radius: 50%;
  transition: var(--transition-smooth);
}

.filter-tag button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.filter-tag button i {
  width: 10px;
  height: 10px;
}

.text-btn {
  background: transparent;
  border: none;
  color: var(--accent-secondary);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition-smooth);
}

.text-btn:hover {
  color: #2dd4bf;
  text-decoration: underline;
}

.clear-all-btn {
  background: transparent;
  border: none;
  color: var(--accent-alert);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  transition: var(--transition-smooth);
  margin-left: auto;
}

.clear-all-btn:hover {
  text-decoration: underline;
}

/* --- Papers Grid & Cards --- */
.papers-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.paper-card {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 24px;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

.paper-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent-primary);
  opacity: 0;
  transition: var(--transition-smooth);
}

.paper-card:hover {
  transform: translateX(4px);
  background: var(--bg-surface-hover);
  border-color: rgba(139, 92, 246, 0.2);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.paper-card:hover::after {
  opacity: 1;
}

/* Specific theme indicators */
.paper-card.theme-survey-methods::after        { background: #3b82f6; }
.paper-card.theme-cross-cultural::after        { background: #a855f7; }
.paper-card.theme-alcohol-drug::after          { background: #f59e0b; }
.paper-card.theme-tobacco::after               { background: #ef4444; }
.paper-card.theme-mental-health::after         { background: #8b5cf6; }
.paper-card.theme-cancer-screening::after      { background: #10b981; }
.paper-card.theme-nutrition-pa::after          { background: #22c55e; }
.paper-card.theme-homeless::after              { background: #06b6d4; }
.paper-card.theme-immigrant-refugee::after     { background: #0ea5e9; }
.paper-card.theme-criminal-justice::after      { background: #dc2626; }
.paper-card.theme-disadvantaged-health::after  { background: #f97316; }
.paper-card.theme-public-health::after         { background: #0d9488; }
.paper-card.theme-general::after               { background: #64748b; }

.paper-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 15px;
}

.paper-title {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
}

.paper-card:hover .paper-title {
  color: #fff;
}

.paper-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.meta-item i {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.paper-authors {
  font-size: 0.85rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.paper-snippet {
  font-size: 0.85rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.5;
}

.paper-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 5px;
}

.paper-theme-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg-glass);
}

.paper-theme-badge.theme-survey-methods       { background: rgba(59, 130, 246, 0.12);  color: #93c5fd; }
.paper-theme-badge.theme-cross-cultural       { background: rgba(168, 85, 247, 0.12);  color: #d8b4fe; }
.paper-theme-badge.theme-alcohol-drug         { background: rgba(245, 158, 11, 0.12);  color: #fde68a; }
.paper-theme-badge.theme-tobacco              { background: rgba(239, 68, 68, 0.12);   color: #fca5a5; }
.paper-theme-badge.theme-mental-health        { background: rgba(139, 92, 246, 0.12);  color: #c4b5fd; }
.paper-theme-badge.theme-cancer-screening     { background: rgba(16, 185, 129, 0.12);  color: #a7f3d0; }
.paper-theme-badge.theme-nutrition-pa         { background: rgba(34, 197, 94, 0.12);   color: #bbf7d0; }
.paper-theme-badge.theme-homeless             { background: rgba(6, 182, 212, 0.12);   color: #a5f3fc; }
.paper-theme-badge.theme-immigrant-refugee    { background: rgba(14, 165, 233, 0.12);  color: #bae6fd; }
.paper-theme-badge.theme-criminal-justice     { background: rgba(220, 38, 38, 0.12);   color: #fecaca; }
.paper-theme-badge.theme-disadvantaged-health { background: rgba(249, 115, 22, 0.12);  color: #fed7aa; }
.paper-theme-badge.theme-public-health        { background: rgba(13, 148, 136, 0.12);  color: #99f6e4; }
.paper-theme-badge.theme-general              { background: rgba(100, 116, 139, 0.12); color: #cbd5e1; }

.read-more {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition-smooth);
}

.paper-card:hover .read-more {
  color: #2dd4bf;
  gap: 8px;
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 60px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
}

.empty-icon {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  stroke-width: 1.5px;
}

.empty-state h3 {
  font-size: 1.2rem;
  color: var(--text-secondary);
}

.empty-state p {
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 400px;
}

.btn {
  background: var(--accent-primary);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn:hover {
  background: #7c3aed;
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
}

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

.btn-secondary:hover {
  background: var(--bg-glass-active);
  border-color: var(--text-secondary);
  box-shadow: none;
}

/* --- App Footer --- */
.app-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding-top: 20px;
  border-top: 1px solid var(--border-glass);
  margin-top: auto;
}

/* --- Detail Dialog / Modal (Top-layer animations) --- */
dialog {
  margin: auto;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  background: rgba(11, 15, 25, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  max-width: 750px;
  width: 90%;
  color: var(--text-primary);
  outline: none;
  overflow: hidden;
}

/* Entry Animation (using @starting-style) */
dialog[open] {
  opacity: 1;
  transform: scale(1) translateY(0);

  @starting-style {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }
}

/* Closed state & Exit transition behavior */
dialog {
  opacity: 0;
  transform: scale(0.95) translateY(20px);
  transition-property: opacity, transform, display, overlay;
  transition-duration: 0.35s;
  transition-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
  transition-behavior: allow-discrete;
}

/* Backdrop */
dialog::backdrop {
  background-color: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  transition:
    display 0.35s allow-discrete,
    overlay 0.35s allow-discrete,
    background-color 0.35s ease-out,
    backdrop-filter 0.35s ease-out;
}

dialog[open]::backdrop {
  background-color: rgba(8, 11, 17, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);

  @starting-style {
    background-color: rgba(8, 11, 17, 0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
  }
}

/* Motion Preferences */
@media (prefers-reduced-motion: reduce) {
  dialog {
    transform: none;
    transition-duration: 0.1s;
  }
  @starting-style {
    dialog[open] {
      transform: none;
    }
  }
}

/* Dialog Inner Elements */
.dialog-content {
  padding: 35px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  gap: 25px;
  overflow-y: auto;
}

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

.dialog-category {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 4px;
  background: var(--accent-primary-glow);
  color: var(--accent-primary);
  border: 1px solid rgba(139, 92, 246, 0.2);
}

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

.dialog-close-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.dialog-close-btn i {
  width: 20px;
  height: 20px;
}

.dialog-title {
  font-size: 1.5rem;
  line-height: 1.3;
  color: #fff;
}

.dialog-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 15px;
}

.dialog-meta .meta-item i {
  color: var(--accent-secondary);
}

.dialog-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dialog-section h3 {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.dialog-authors {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 15px;
}

.dialog-abstract {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-secondary);
  white-space: pre-line;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 10px;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 15px;
  background: rgba(8, 11, 17, 0.3);
}

.dialog-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-glass);
  padding-top: 20px;
  margin-top: 10px;
}

.dialog-pmid {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.dialog-pmid strong {
  color: var(--text-primary);
}


/* --- Responsive Media Queries --- */
@media (max-width: 1024px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
  
  .app-header {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 25px;
  }
  
  .profile-section {
    flex-direction: column;
    text-align: center;
  }
  
  .profile-tags {
    justify-content: center;
  }
  
  .stats-grid {
    justify-content: center;
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
  }
}

@media (max-width: 640px) {
  .app-container {
    padding: 20px 12px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .dialog-content {
    padding: 20px;
  }
  
  .dialog-meta {
    flex-direction: column;
    gap: 10px;
  }
  
  .dialog-title {
    font-size: 1.25rem;
  }
  
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .sort-container {
    width: 100%;
    justify-content: space-between;
  }
}

/* --- Google Scholar Integration --- */
.scholar-tag {
  background: rgba(139, 92, 246, 0.1) !important;
  border: 1px solid rgba(139, 92, 246, 0.3) !important;
  color: #a78bfa !important;
  font-weight: 600;
  transition: var(--transition-smooth);
}

.scholar-tag:hover {
  background: rgba(139, 92, 246, 0.2) !important;
  border-color: rgba(139, 92, 246, 0.6) !important;
  color: #c084fc !important;
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.3);
}

.scholar-info-card {
  border-color: rgba(13, 148, 136, 0.2);
  background: linear-gradient(180deg, var(--bg-surface) 0%, rgba(13, 148, 136, 0.03) 100%);
}

.scholar-info-text {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 15px;
}

.scholar-card-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(13, 148, 136, 0.1);
  border: 1px solid rgba(13, 148, 136, 0.3);
  color: #2dd4bf;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  transition: var(--transition-smooth);
  width: 100%;
}

.scholar-card-btn:hover {
  background: rgba(13, 148, 136, 0.2);
  border-color: #2dd4bf;
  color: #fff;
  box-shadow: 0 0 12px var(--accent-secondary-glow);
}

/* --- View Switcher Tabs --- */
.view-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 25px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  padding: 6px;
  border-radius: var(--radius-md);
  width: fit-content;
  align-self: flex-start;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
}

.view-tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition-smooth);
}

.view-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.02);
}

.view-tab-btn.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent-primary) 0%, #6d28d9 100%);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.25);
  border-color: rgba(255, 255, 255, 0.1);
}

/* --- Network Graph Canvas --- */
.network-section {
  position: relative;
}

.network-controls {
  display: flex;
  align-items: center;
  gap: 15px;
}

.network-controls label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.network-controls select {
  background: rgba(8, 11, 17, 0.6);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.network-controls select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 10px var(--accent-primary-glow);
}

.network-container-wrapper {
  position: relative;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  background: rgba(8, 11, 17, 0.5);
  margin-bottom: 20px;
  overflow: hidden;
  box-shadow: var(--glass-shadow);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.network-canvas {
  width: 100%;
  height: 620px;
  display: block;
}

.orbit-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.network-legend {
  display: flex;
  flex-direction: row;
  gap: 20px;
  padding: 10px 16px;
  margin-top: 10px;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  background: rgba(8, 11, 17, 0.5);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.main-dot {
  background: #8b5cf6;
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.7);
  border: 1px solid #a78bfa;
}

.coauthor-dot {
  background: linear-gradient(135deg, #a78bfa 0%, #2dd4bf 50%, #3b82f6 100%);
  box-shadow: 0 0 10px rgba(45, 212, 191, 0.5);
  border: 1px solid rgba(255,255,255,0.15);
}

/* --- Mobile redirect notice --- */
.mobile-notice {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  text-align: center;
  overflow-y: auto;
}

.mobile-notice-inner {
  max-width: 400px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.mobile-notice-glow {
  position: absolute;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  filter: blur(100px);
  background: var(--accent-primary);
  opacity: 0.08;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

.mobile-notice-icon {
  width: 80px;
  height: 80px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--accent-primary) 0%, #6d28d9 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 36px rgba(139, 92, 246, 0.35);
  color: #fff;
  flex-shrink: 0;
}

.mobile-notice-icon i {
  width: 40px;
  height: 40px;
}

.mobile-notice h2 {
  font-size: 1.55rem;
  color: var(--text-primary);
  line-height: 1.2;
}

.mobile-notice p {
  font-size: 0.93rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.mobile-notice-actions {
  display: flex;
  flex-direction: column;
  gap: 11px;
  width: 100%;
  margin-top: 4px;
}

.mobile-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  border-radius: var(--radius-md);
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  border: none;
  width: 100%;
  transition: var(--transition-smooth);
  min-height: 48px;
}

.mobile-btn i { width: 18px; height: 18px; }

.mobile-btn-primary {
  background: linear-gradient(135deg, var(--accent-primary) 0%, #6d28d9 100%);
  color: #fff;
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.35);
}

.mobile-btn-primary:hover { opacity: 0.9; color: #fff; }

.mobile-btn-secondary {
  background: rgba(13, 148, 136, 0.12);
  border: 1px solid rgba(13, 148, 136, 0.3);
  color: #2dd4bf;
}

.mobile-btn-secondary:hover { background: rgba(13, 148, 136, 0.22); color: #fff; }

.mobile-btn-ghost {
  background: transparent;
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.mobile-btn-ghost:hover { color: var(--text-secondary); border-color: rgba(255,255,255,0.15); }

