/* Beautiful Modern Design System + Bootstrap Integration */
:root {
  /* Enhanced Color Palette */
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --secondary: #f59e0b;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  
  /* Bootstrap Theme Integration */
  --bs-body-bg: var(--background);
  --bs-body-color: var(--text-primary);
  --bs-border-color: var(--border);
  
  /* Background & Surfaces */
  --background: #0f0f23;
  --background-secondary: #1a1a2e;
  --surface: rgba(255, 255, 255, 0.05);
  --surface-hover: rgba(255, 255, 255, 0.1);
  --surface-glass: rgba(255, 255, 255, 0.08);
  
  /* Text Colors */
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  
  /* Borders & Dividers */
  --border: rgba(255, 255, 255, 0.1);
  --border-hover: rgba(255, 255, 255, 0.2);
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
  
  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #1e3a8a 0%, #3730a3 100%);
  --gradient-surface: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
  --gradient-border: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.1) 100%);
  
  /* Typography */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

[data-theme="light"] {
  --background: #fafaff;
  --background-secondary: #f1f5f9;
  --surface: rgba(255, 255, 255, 0.8);
  --surface-hover: rgba(255, 255, 255, 0.95);
  --surface-glass: rgba(255, 255, 255, 0.7);
  
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  --border: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.12);
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.15);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
  
  --gradient-surface: linear-gradient(135deg, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.7) 100%);
  --gradient-border: linear-gradient(135deg, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.05) 100%);
}

[data-theme="light"] .header {
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 2px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .filters {
  background: rgba(255, 255, 255, 0.95);
}

/* Fix light theme filter button text visibility */
[data-theme="light"] .filter-btn {
  color: #000000 !important;
  border-color: rgba(0, 0, 0, 0.5) !important;
  background: rgba(255, 255, 255, 0.95) !important;
  font-weight: 600 !important;
  text-shadow: none !important;
}

[data-theme="light"] .filter-btn:hover {
  background: rgba(0, 0, 0, 0.15) !important;
  color: #000000 !important;
  border-color: rgba(0, 0, 0, 0.6) !important;
  font-weight: 700 !important;
}

[data-theme="light"] .filter-btn.active {
  background: var(--gradient-primary) !important;
  color: white !important;
  border-color: var(--primary) !important;
  font-weight: 700 !important;
}

/* Override any btn-outline-light styling in light theme */
[data-theme="light"] .btn-outline-light {
  color: #000000 !important;
  border-color: rgba(0, 0, 0, 0.5) !important;
  background: rgba(255, 255, 255, 0.95) !important;
  font-weight: 600 !important;
}

[data-theme="light"] .btn-outline-light:hover {
  background: rgba(0, 0, 0, 0.15) !important;
  color: #000000 !important;
  border-color: rgba(0, 0, 0, 0.6) !important;
  font-weight: 700 !important;
}

/* Fix light theme card text visibility */
[data-theme="light"] .card {
  background: rgba(255, 255, 255, 0.95) !important;
  border-color: rgba(0, 0, 0, 0.25) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .card-header {
  background: rgba(0, 0, 0, 0.08) !important;
  border-color: rgba(0, 0, 0, 0.2) !important;
  color: #000000 !important;
  font-weight: 600 !important;
}

[data-theme="light"] .card-header h6 {
  color: #1e293b !important;
  font-weight: 700 !important;
}

[data-theme="light"] .text-light {
  color: #000000 !important;
}

[data-theme="light"] .mobile-filter-toggle {
  background: var(--gradient-primary);
}

/* Fix light theme filter section headers visibility */
[data-theme="light"] .filter-label {
  color: #1e293b !important;
  font-weight: 700 !important;
}

[data-theme="light"] .filter-header .filter-label {
  color: #1e293b !important;
  font-weight: 600 !important;
}

[data-theme="light"] .filter-header {
  background: rgba(0, 0, 0, 0.05) !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .filter-header:hover {
  background: rgba(0, 0, 0, 0.08) !important;
  border-color: rgba(0, 0, 0, 0.15) !important;
}

/* Fix light theme card annotations visibility */
[data-theme="light"] .entity-tag {
  background: rgba(0, 0, 0, 0.08) !important;
  color: #1e293b !important;
  border-color: rgba(0, 0, 0, 0.15) !important;
  font-weight: 600 !important;
}

[data-theme="light"] .category {
  background: rgba(0, 0, 0, 0.08) !important;
  color: #1e293b !important;
  border-color: rgba(0, 0, 0, 0.15) !important;
  font-weight: 600 !important;
}

[data-theme="light"] .difficulty,
[data-theme="light"] .confidence {
  background: rgba(0, 0, 0, 0.08) !important;
  color: #1e293b !important;
  border-color: rgba(0, 0, 0, 0.15) !important;
  font-weight: 600 !important;
}

[data-theme="light"] .source-name {
  color: #1e293b !important;
  font-weight: 700 !important;
}

[data-theme="light"] .pub-time {
  color: #475569 !important;
  background: rgba(0, 0, 0, 0.05) !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .article-title {
  color: #1e293b !important;
  background: linear-gradient(135deg, #1e293b 0%, #6366f1 100%) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
}

[data-theme="light"] .article-summary {
  color: #475569 !important;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-primary);
  background: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  padding-top: 100px; /* Space for fixed navbar */
}

/* Beautiful background pattern */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 40% 80%, rgba(120, 219, 255, 0.1) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

/* Bootstrap Navbar Customizations */
.custom-navbar {
  background: rgba(15, 15, 35, 0.98) !important;
  backdrop-filter: blur(20px);
  border-bottom: 2px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  padding: 0.75rem 0;
  min-height: 80px;
}

.navbar-brand {
  text-decoration: none !important;
  transition: all 0.3s ease;
}

.navbar-brand:hover .brand-title {
  animation-duration: 3s;
  filter: drop-shadow(0 0 25px rgba(0, 217, 255, 0.6));
}

.navbar-brand:hover .brand-subtitle {
  animation-duration: 4s;
  opacity: 1;
}

.brand-title {
  font-size: 1.85rem;
  font-weight: 900;
  background: linear-gradient(135deg, #00D9FF 0%, #FFB800 25%, #00FFB8 50%, #FF6B9D 75%, #00D9FF 100%);
  background-size: 400% 400%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
  letter-spacing: -0.8px;
  filter: drop-shadow(0 0 20px rgba(0, 217, 255, 0.4));
  animation: gradientShift 10s ease-in-out infinite;
  position: relative;
  text-transform: uppercase;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', system-ui, sans-serif;
}

@keyframes gradientShift {
  0%, 100% { 
    background-position: 0% 50%; 
    filter: drop-shadow(0 0 20px rgba(0, 217, 255, 0.4));
  }
  25% { 
    background-position: 25% 50%; 
    filter: drop-shadow(0 0 25px rgba(255, 184, 0, 0.5));
  }
  50% { 
    background-position: 100% 50%; 
    filter: drop-shadow(0 0 30px rgba(0, 255, 184, 0.6));
  }
  75% { 
    background-position: 75% 50%; 
    filter: drop-shadow(0 0 25px rgba(255, 107, 157, 0.5));
  }
}

.brand-subtitle {
  font-size: 0.875rem;
  font-weight: 600;
  background: linear-gradient(90deg, #94a3b8, #00D9FF, #FFB800, #94a3b8);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
  margin-top: 2px;
  letter-spacing: 0.3px;
  animation: subtitleGlow 8s ease-in-out infinite;
  opacity: 0.95;
}

/* Responsive subtitle visibility */
.brand-subtitle-full {
  display: block;
}

.brand-subtitle-medium,
.brand-subtitle-short {
  display: none;
}

@keyframes subtitleGlow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.navbar-toggler {
  border: none !important;
  padding: 0.25rem 0.5rem;
}

.navbar-toggler:focus {
  box-shadow: none !important;
}

.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.8%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

/* Bootstrap Cards in Dark Theme */
.card {
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
  backdrop-filter: blur(10px);
}

.card-header {
  background: rgba(255, 255, 255, 0.02) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
}

/* Bootstrap Buttons */
.btn-primary {
  background: var(--gradient-primary) !important;
  border: none !important;
  color: white !important;
}

.btn-outline-light {
  border-color: var(--border) !important;
  color: var(--text-secondary) !important;
}

.btn-outline-light:hover {
  background: var(--surface-hover) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-hover) !important;
}

/* Bootstrap Form Controls */
.form-control, .form-select {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-primary) !important;
}

.form-control:focus, .form-select:focus {
  background: var(--surface-hover) !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.25) !important;
  color: var(--text-primary) !important;
}

.form-control::placeholder {
  color: var(--text-secondary) !important;
}

/* Mobile Navbar Collapse Background - ONLY on mobile screens */
@media (max-width: 991.98px) {
  .navbar-collapse {
    background: rgba(15, 15, 35, 1) !important;
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 0.5rem;
    padding: 1rem 0;
    position: relative;
    z-index: 1050;
  }

  /* Light theme mobile navbar collapse */
  [data-theme="light"] .navbar-collapse {
    background: rgba(255, 255, 255, 0.98) !important;
    border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1) !important;
  }
}

/* Bootstrap Accordion for Mobile Filters */
.accordion-button {
  background: transparent !important;
  border: none !important;
  color: var(--text-primary) !important;
  padding: 0.75rem 0 !important;
}

/* Fix light theme accordion buttons */
[data-theme="light"] .accordion-button {
  color: #1e293b !important;
  font-weight: 600 !important;
}

[data-theme="light"] .accordion-button:not(.collapsed) {
  color: #1e293b !important;
  font-weight: 700 !important;
}

/* Fix light theme accordion arrows */
[data-theme="light"] .accordion-button::after {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23334155'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e") !important;
}

/* Fix light theme mobile filter buttons */
[data-theme="light"] .filter-btn {
  background: rgba(30, 41, 59, 0.08) !important;
  color: #1e293b !important;
  border-color: rgba(30, 41, 59, 0.15) !important;
}

[data-theme="light"] .filter-btn:hover {
  background: rgba(30, 41, 59, 0.12) !important;
  color: #0f172a !important;
  border-color: rgba(30, 41, 59, 0.25) !important;
}

[data-theme="light"] .filter-btn.active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.9) 0%, rgba(147, 51, 234, 0.9) 100%) !important;
  color: white !important;
  border-color: rgba(59, 130, 246, 0.6) !important;
}

.accordion-button:not(.collapsed) {
  background: transparent !important;
  color: var(--text-primary) !important;
  box-shadow: none !important;
}

.accordion-button:focus {
  box-shadow: none !important;
  border: none !important;
}

.accordion-button::after {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23f1f5f9'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e") !important;
}

.accordion-body {
  padding: 0.5rem 0 1rem 0 !important;
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 0.5rem !important;
}

/* Mobile filter buttons in accordion */
.mobile-filter {
  display: inline-block !important;
  margin: 0.25rem !important;
  white-space: nowrap !important;
}

/* Main Container Spacing */
.main-container {
  padding-top: 1rem;
  margin-top: 0;
}

.sidebar-filters {
  padding-right: 1rem;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  position: sticky;
  top: 120px;
}

/* Articles Grid with Bootstrap */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
  margin-top: 1rem;
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
  body {
    padding-top: 120px; /* More space for mobile navbar */
  }
  
  .main-container {
    padding-top: 0.5rem;
  }
  
  .articles-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 0.5rem;
  }
  
  /* Ensure mobile navbar collapse fully covers content */
  .navbar-collapse {
    background: rgba(15, 15, 35, 1) !important;
    margin-left: -15px;
    margin-right: -15px;
    padding-left: 15px;
    padding-right: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
  }
  
  /* Light theme mobile navbar background */
  [data-theme="light"] .navbar-collapse {
    background: rgba(255, 255, 255, 0.98) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15) !important;
  }
  
  /* Add extra background protection */
  .navbar-collapse::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 15, 35, 1);
    z-index: -1;
  }
  
  /* Light theme background protection */
  [data-theme="light"] .navbar-collapse::before {
    background: rgba(255, 255, 255, 0.98);
  }
}

/* Enhanced Header */
.header {
  background: rgba(15, 15, 35, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 2px solid rgba(255, 255, 255, 0.15);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 1rem 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}

/* Enhanced Logo Design */
.logo-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo:hover {
  transform: translateY(-1px);
}

.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--gradient-primary);
  box-shadow: var(--shadow-md);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo-icon:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-lg);
}

.logo-icon svg {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
  transition: all 0.3s ease;
}

.logo-icon svg circle {
  animation: neuralPulse 3s ease-in-out infinite;
}

.logo-icon svg circle:nth-child(2) { animation-delay: 0.2s; }
.logo-icon svg circle:nth-child(3) { animation-delay: 0.4s; }
.logo-icon svg circle:nth-child(4) { animation-delay: 0.6s; }
.logo-icon svg circle:nth-child(5) { animation-delay: 0.8s; }
.logo-icon svg circle:nth-child(6) { animation-delay: 1.0s; }

@keyframes neuralPulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; transform: scale(1.1); }
}

.logo-text {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.logo-title {
  font-size: 1.5rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.logo-subtitle {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.3;
  opacity: 0.9;
}

/* Beautiful Search Container */
.search-container {
  flex: 1;
  max-width: 500px;
  position: relative;
}

.search-input {
  width: 100%;
  background: var(--surface-glass);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.875rem 1.25rem;
  font-size: 0.95rem;
  color: var(--text-primary);
  backdrop-filter: blur(10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
  transform: translateY(-1px);
}

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

.clear-search {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  opacity: 0.9;
}

.clear-search:hover {
  background: var(--primary-dark);
  opacity: 1;
  transform: translateY(-50%) scale(1.05);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.date-selector {
  position: relative;
}

.date-select {
  background: var(--surface-glass);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.625rem 1rem;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(10px);
  min-width: 120px;
}

.date-select:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.date-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Beautiful Theme Toggle */
.theme-toggle {
  background: var(--surface-glass);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
}

.theme-toggle:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px) scale(1.05);
  box-shadow: var(--shadow-lg);
}

.theme-icon {
  font-size: 1.25rem;
  transition: transform 0.3s;
}

.theme-toggle:hover .theme-icon {
  transform: rotate(180deg);
}

.stats {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
  background: var(--surface-glass);
  padding: 0.625rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

/* Beautiful Sidebar Filters */
.filters {
  background: var(--surface-glass);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.5rem 0;
  position: sticky;
  top: 90px;
  z-index: 99;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg);
}

.filters-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.filter-group {
  margin-bottom: 1.5rem;
}

.filter-group:last-child {
  margin-bottom: 0;
}

.filter-label {
  font-size: 1rem;
  font-weight: 700;
  color: rgba(241, 245, 249, 0.95);
  margin-bottom: 0.75rem;
  display: block;
  letter-spacing: -0.025em;
}

.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-btn {
  background: rgba(255, 255, 255, 0.03);
  color: rgba(241, 245, 249, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.625rem 1rem;
  border-radius: 16px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
  min-width: 80px;
  max-width: 180px;
  text-align: center;
  text-overflow: ellipsis;
}

.filter-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity 0.3s;
  z-index: -1;
}

.filter-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
  color: rgba(241, 245, 249, 0.95);
  background: rgba(255, 255, 255, 0.08);
}

.filter-btn.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.8) 0%, rgba(139, 92, 246, 0.8) 100%);
  color: rgba(255, 255, 255, 1);
  border-color: rgba(99, 102, 241, 0.6);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3), 0 0 0 1px rgba(99, 102, 241, 0.4);
  transform: translateY(-2px);
  font-weight: 600;
}

.filter-btn.active::before {
  opacity: 1;
}

/* Collapsible filter headers */
.filter-header {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.25rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: 0.75rem;
  backdrop-filter: blur(10px);
}

.filter-header:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.filter-header .filter-label {
  margin: 0;
  pointer-events: none;
  font-size: 1rem;
  font-weight: 600;
  color: rgba(241, 245, 249, 0.95);
}

.filter-toggle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  background: var(--surface);
  border-radius: 8px;
  padding: 0.25rem 0.5rem;
}

/* Global filter collapse/expand functionality for all screen sizes */
.filter-group:not(.expanded) .filter-buttons {
  display: none;
}

.filter-group:not(.expanded) .filter-toggle {
  transform: rotate(-90deg);
}

.filter-group.expanded .filter-toggle {
  transform: rotate(0deg);
}

.filter-group.expanded .filter-buttons {
  display: flex;
}

/* Beautiful Main Content */
.main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
  grid-auto-rows: 1fr;
}

/* Desktop sidebar layout */
@media (min-width: 969px) {
  body {
    display: flex;
    flex-direction: column;
  }
  
  /* Create sidebar layout after header */
  .filters {
    position: fixed;
    left: 0;
    top: 90px;
    width: 320px;
    height: calc(100vh - 90px);
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.02);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: none;
    border-radius: 0;
    border-top-right-radius: 24px;
    backdrop-filter: blur(20px);
    z-index: 98;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  }
  
  .filters-content {
    padding: 2rem 1.5rem;
  }
  
  /* Adjust main content for sidebar */
  .main {
    margin-left: 320px !important;
    max-width: none !important;
    padding: 2rem 1.5rem 2rem 2rem !important;
  }
  
  /* Optimize grid for remaining space */
  .articles-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    grid-auto-rows: 1fr;
    max-width: 1200px;
  }
}

/* Stunning Article Cards */
.news-item {
  background: rgba(255, 255, 255, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 24px;
  padding: 2rem;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(20px);
  cursor: default;
  display: flex;
  flex-direction: column;
  min-height: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.news-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary);
  transform: scaleX(0);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 24px 24px 0 0;
}

.news-item:hover {
  transform: translateY(-8px);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  border-color: var(--primary-light);
  background: rgba(255, 255, 255, 0.35);
}

.news-item:hover::before {
  transform: scaleX(1);
}

/* Beautiful source bar */
.source-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  padding: 0.75rem 1rem;
  background: var(--surface);
  border-radius: 16px;
  border: 1px solid var(--border);
}

.source-bar img {
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.source-name {
  font-weight: 600;
  flex: 1;
  color: var(--text-primary);
}

.pub-time {
  font-size: 0.8125rem;
  opacity: 0.9;
  color: rgba(241, 245, 249, 0.8);
  background: var(--surface);
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}

/* Enhanced article titles */
.article-title {
  margin-bottom: 1.5rem;
  line-height: 1.4;
}

.article-title {
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.025em;
}

/* AI Summary Highlighting */
.article-summary {
  margin-bottom: 1.5rem;
  padding: 1.25rem !important;
  background: linear-gradient(135deg, 
    rgba(139, 92, 246, 0.15) 0%,
    rgba(99, 102, 241, 0.12) 100%) !important;
  border: 1px solid rgba(139, 92, 246, 0.3) !important;
  border-radius: 16px !important;
  font-size: 0.9rem;
  line-height: 1.6;
  color: rgba(241, 245, 249, 0.95) !important;
  font-style: italic;
  position: relative;
  backdrop-filter: blur(15px) !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.1) !important;
}

.article-summary::before {
  content: '🤖 AI Summary';
  position: absolute;
  top: -12px;
  left: 16px;
  background: linear-gradient(135deg, #a855f7 0%, #6366f1 100%);
  color: white;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid rgba(139, 92, 246, 0.4);
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
  font-style: normal;
}

/* Set Cards to 100% Height */
/* Cards with natural content height - will be equalized by JavaScript */
.news-item {
  display: flex;
  flex-direction: column;
  min-height: auto;
  overflow: hidden;
}
/* Beautiful entity tags */
.entities {
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.entity-tag {
  font-size: 0.8125rem;
  padding: 0.375rem 0.75rem;
  border-radius: 12px;
  font-weight: 600;
  display: inline-block;
  backdrop-filter: blur(10px);
  transition: all 0.2s;
  border: 1px solid transparent;
}

.entity-tag:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.entity-tag.org {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border-color: rgba(99, 102, 241, 0.3);
}

.entity-tag.product {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.3);
}

.entity-tag.tech {
  background: rgba(139, 92, 246, 0.15);
  color: #c4b5fd;
  border-color: rgba(139, 92, 246, 0.3);
}

/* Enhanced metadata section */
.metadata {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.category {
  font-size: 0.8125rem;
  padding: 0.5rem 1rem;
  border-radius: 16px;
  font-weight: 700;
  text-transform: capitalize;
  letter-spacing: 0.025em;
  backdrop-filter: blur(10px);
  border: 1px solid transparent;
  transition: all 0.2s;
}

.category:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* Enhanced category colors with gradients */
.category-company { 
  background: rgba(59, 130, 246, 0.2); 
  color: #93c5fd; 
  border-color: rgba(59, 130, 246, 0.3);
}
.category-news { 
  background: rgba(16, 185, 129, 0.2); 
  color: #6ee7b7; 
  border-color: rgba(16, 185, 129, 0.3);
}
.category-research { 
  background: rgba(139, 92, 246, 0.2); 
  color: #c4b5fd; 
  border-color: rgba(139, 92, 246, 0.3);
}
.category-community { 
  background: rgba(245, 158, 11, 0.2); 
  color: #fbbf24; 
  border-color: rgba(245, 158, 11, 0.3);
}
.category-tools { 
  background: rgba(6, 182, 212, 0.2); 
  color: #67e8f9; 
  border-color: rgba(6, 182, 212, 0.3);
}
.category-model-release { 
  background: rgba(239, 68, 68, 0.2); 
  color: #fca5a5; 
  border-color: rgba(239, 68, 68, 0.3);
}
.category-developer-tool { 
  background: rgba(6, 182, 212, 0.2); 
  color: #67e8f9; 
  border-color: rgba(6, 182, 212, 0.3);
}
.category-product-launch { 
  background: rgba(245, 158, 11, 0.2); 
  color: #fbbf24; 
  border-color: rgba(245, 158, 11, 0.3);
}
.category-tutorial-guide { 
  background: rgba(16, 185, 129, 0.2); 
  color: #6ee7b7; 
  border-color: rgba(16, 185, 129, 0.3);
}
.category-industry-news { 
  background: rgba(100, 116, 139, 0.2); 
  color: #cbd5e1; 
  border-color: rgba(100, 116, 139, 0.3);
}
.category-ai-agents { 
  background: rgba(139, 92, 246, 0.2); 
  color: #c4b5fd; 
  border-color: rgba(139, 92, 246, 0.3);
}
.category-creative-ai { 
  background: rgba(236, 72, 153, 0.2); 
  color: #f9a8d4; 
  border-color: rgba(236, 72, 153, 0.3);
}
.category-infrastructure { 
  background: rgba(107, 114, 128, 0.2); 
  color: #d1d5db; 
  border-color: rgba(107, 114, 128, 0.3);
}
.category-safety-ethics { 
  background: rgba(249, 115, 22, 0.2); 
  color: #fdba74; 
  border-color: rgba(249, 115, 22, 0.3);
}
.category-research-paper { 
  background: rgba(124, 58, 237, 0.2); 
  color: #ddd6fe; 
  border-color: rgba(124, 58, 237, 0.3);
}

/* Enhanced difficulty indicator */
.difficulty {
  font-size: 0.8125rem;
  color: var(--warning);
  font-weight: 700;
  letter-spacing: 0.1em;
  background: var(--surface);
  padding: 0.375rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  transition: all 0.2s;
}

.difficulty:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* Enhanced confidence indicator */
.confidence {
  font-size: 1rem;
  font-weight: 700;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--success);
  color: white;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.confidence:hover {
  transform: translateY(-1px) scale(1.1);
  box-shadow: var(--shadow-md);
}

.confidence:contains('?') {
  background: var(--warning);
}

/* Beautiful Load More Button */
.load-more {
  display: block;
  margin: 3rem auto 0;
  padding: 1rem 2.5rem;
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: 20px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
  letter-spacing: 0.025em;
  position: relative;
  overflow: hidden;
}

.load-more::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.load-more:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: var(--shadow-xl);
}

.load-more:hover::before {
  left: 100%;
}

.load-more:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.load-more:disabled:hover::before {
  left: -100%;
}

/* Mobile hamburger menu styles */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  width: 30px;
  height: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1001;
}

.mobile-menu-toggle span {
  display: block;
  height: 3px;
  width: 100%;
  background: var(--text-primary);
  border-radius: 1.5px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: center;
}

.mobile-menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

/* Bootstrap-style navbar collapse */
/* Ensure navbar collapse only shows on mobile */
@media (max-width: 991.98px) {
  .navbar-collapse {
    display: none;
    background: var(--surface-glass);
    border-top: 1px solid var(--border);
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.4s ease-in-out;
  }

  .navbar-collapse.show {
    display: block;
    max-height: 80vh;
    overflow-y: auto;
  }
}

/* Force hide on desktop */
@media (min-width: 992px) {
  .navbar-collapse {
    display: none !important;
  }
}

.navbar-nav {
  display: flex;
  flex-direction: column;
  padding: 1rem 0;
}

.nav-item {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.desktop-controls {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex: 1;
}

.header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

/* Mobile filter sections in navbar */
.mobile-filter-section {
  margin-bottom: 1rem;
}

.mobile-filter-section:last-child {
  margin-bottom: 0;
}

.filter-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin: 0 0 0.5rem 0;
}

.filter-buttons-mobile {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.filter-buttons-mobile .filter-btn {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  border-radius: 20px;
  background: var(--surface-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  min-width: 70px;
  max-width: 160px;
  text-align: center;
  text-overflow: ellipsis;
}

.filter-buttons-mobile .filter-btn:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.filter-buttons-mobile .filter-btn.active {
  background: var(--gradient-primary);
  color: white;
  border-color: transparent;
}

.nav-controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.nav-controls .date-selector,
.nav-controls .theme-toggle,
.nav-controls .stats {
  align-self: flex-start;
}

/* Enhanced Mobile Responsive Design */
@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: flex;
  }
  
  .desktop-controls {
    display: none;
  }
  
  .header-content {
    padding: 0.75rem 1rem;
  }
  
  .header-main {
    padding-bottom: 0;
  }
  
  /* Fix: Reduce brand title size for mobile to prevent cropping */
  .brand-title {
    font-size: 1.25rem !important; /* Reduced from 1.85rem */
    line-height: 1.2 !important;
    letter-spacing: -0.5px !important;
  }
  
  /* Switch to medium subtitle on tablets */
  .brand-subtitle-full {
    display: none;
  }
  
  .brand-subtitle-medium {
    display: block;
    font-size: 0.65rem;
    line-height: 1.2;
    margin-top: 0px; /* Reduced from 1px */
  }
  
  .brand-subtitle-short {
    display: none;
  }
  
  .navbar-brand {
    min-width: 0; /* Allow text to wrap */
    flex: 1; /* Take available space */
    padding: 0.25rem 0; /* Add vertical padding to prevent cropping */
  }
  
  .brand-text {
    min-width: 0; /* Allow text to wrap */
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  
  /* Ensure navbar has sufficient height for content */
  .custom-navbar {
    min-height: 60px; /* Ensure minimum height */
  }
  
  /* Fix: Reduce logo icon size for better proportion */
  .logo-icon {
    width: 30px;
    height: 30px;
  }
  
  .logo-icon svg {
    width: 24px;
    height: 24px;
  }
  
  /* Hide desktop filters on mobile by default */
  .filters {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 15, 35, 0.98);
    backdrop-filter: blur(20px);
    z-index: 999;
    margin: 0;
    padding: 2rem 1rem 1rem;
    border-radius: 0;
    transform: translateY(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    display: block;
  }
  
  .filters.mobile-filters-open {
    transform: translateY(0);
  }
  
  .main {
    margin-left: 0 !important;
    padding: 1rem !important;
  }
  
  .filters-content {
    padding: 0 1rem;
  }
  
  .articles-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: 1fr;
    gap: 1.5rem;
    margin: 1rem;
  }
  
  .news-item {
    padding: 1.5rem;
    border-radius: 20px;
    /* Remove fixed height on mobile for flexible content-based sizing */
    height: auto !important;
    min-height: unset;
  }
  
  .metadata {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  
  .entities {
    margin-bottom: 1rem;
  }
  
  /* Optimize spacing for mobile cards with varying content */
  .news-item .source-bar {
    margin-bottom: 1rem;
  }
  
  .news-item .article-title {
    margin-bottom: 1rem;
  }
  
  .news-item .article-summary {
    margin-bottom: 1rem;
  }
  
  /* Compact metadata for mobile */
  .news-item .metadata {
    padding-top: 0.75rem;
    margin-top: 0.5rem;
  }
  
  .filter-buttons {
    gap: 0.375rem;
  }
  
  .filter-btn {
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
    border-radius: 12px;
    min-width: 70px;
    max-width: 160px;
  }

  /* Beautiful collapsed mobile filters */
  .filter-group {
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
    margin-bottom: 0.5rem;
  }

  .filter-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
  }

  .filter-group:not(.expanded) {
    margin-bottom: 0.5rem;
  }

  .filter-group:not(.expanded) .filter-buttons {
    display: none;
  }

  .filter-group:not(.expanded) .filter-toggle {
    transform: rotate(-90deg);
  }

  .filter-header {
    background: var(--surface-glass);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    backdrop-filter: blur(20px);
  }

  .filter-header:hover {
    background: var(--surface-hover);
    margin: 0 0 0.5rem 0;
    transform: translateY(-1px);
  }
  
  .main {
    padding: 1rem;
    margin-left: 0;
    padding-top: 0.5rem; /* Reduced top padding */
  }
  
  .load-more {
    margin: 2rem auto 0;
    padding: 0.875rem 2rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .header-content {
    padding: 0.25rem 1rem; /* Ultra compact for very small screens */
  }
  
  .main {
    padding: 0.5rem;
  }
  
  .news-item {
    padding: 1.25rem;
    /* Flexible height for very small screens */
    height: auto !important;
  }
  
  /* Further optimize spacing on small screens */
  .news-item .source-bar {
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
  }
  
  .news-item .article-title {
    margin-bottom: 0.75rem;
  }
  
  .news-item .article-summary {
    margin-bottom: 0.75rem;
    padding: 0.75rem 1rem;
  }
  
  .news-item .entities {
    margin-bottom: 0.75rem;
  }
  
  .news-item .metadata {
    padding-top: 0.5rem;
    margin-top: 0.25rem;
  }
  
  .article-title {
    font-size: 1.125rem;
  }
  
  .logo-section {
    gap: 0.25rem; /* Reduced gap */
  }
  
  .logo {
    gap: 0.25rem; /* Reduced gap */
  }
  
  .logo-icon {
    width: 28px; /* Smaller icon */
    height: 28px;
    border-radius: 6px;
  }
  
  .logo-icon svg {
    width: 20px; /* Smaller SVG */
    height: 20px;
  }
  
  .brand-title {
    font-size: 1.125rem !important; /* Smaller title for very small screens */
  }
  
  /* Switch to shortest subtitle on very small screens */
  .brand-subtitle-full,
  .brand-subtitle-medium {
    display: none;
  }
  
  .brand-subtitle-short {
    display: block;
    font-size: 0.625rem;
    line-height: 1.2;
    margin-top: 0px; /* Remove extra margin */
  }
  
  .search-input {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
  }
  
  .header-controls {
    flex-wrap: wrap;
    gap: 0.75rem;
  }
  
  .theme-toggle, .date-select {
    padding: 0.5rem;
    min-width: auto;
  }
}

/* Beautiful Dark Theme Enhancements */
@media (prefers-color-scheme: dark) {
  img {
    opacity: 0.9;
  }
  
  .news-item {
    box-shadow: var(--shadow-lg);
  }
  
  .filter-btn:hover {
    box-shadow: var(--shadow-md);
  }
}

/* Enhanced Focus Styles for Accessibility */
.filter-btn:focus,
.search-input:focus,
.load-more:focus,
.theme-toggle:focus,
.date-select:focus,
.read-more-btn:focus,
.navbar-toggler:focus,
.mobile-filter-hint:focus,
.mobile-theme-hint:focus,
.accordion-button:focus,
button:focus,
[role="button"]:focus {
  outline: 3px solid var(--primary) !important;
  outline-offset: 2px !important;
  z-index: 999 !important;
}

/* Focus styles for light theme */
[data-theme="light"] .filter-btn:focus,
[data-theme="light"] .search-input:focus,
[data-theme="light"] .load-more:focus,
[data-theme="light"] .theme-toggle:focus,
[data-theme="light"] .date-select:focus,
[data-theme="light"] .read-more-btn:focus,
[data-theme="light"] .navbar-toggler:focus,
[data-theme="light"] .mobile-filter-hint:focus,
[data-theme="light"] .mobile-theme-hint:focus,
[data-theme="light"] button:focus {
  outline: 3px solid #1e40af !important;
}

/* Skip Link for Screen Readers */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--primary);
  color: white;
  padding: 8px;
  border-radius: 4px;
  text-decoration: none;
  z-index: 9999;
  font-weight: 600;
  font-size: 0.875rem;
  transition: top 0.3s;
}

.skip-link:focus {
  top: 6px;
  outline: 3px solid white !important;
  outline-offset: 2px !important;
}

/* Improve focus visibility for interactive elements */
.news-item .read-more-btn:focus {
  background: linear-gradient(135deg, #1e40af 0%, #4338ca 100%) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 25px rgba(30, 64, 175, 0.4) !important;
}

/* Focus management for filter buttons */
.filter-btn:focus {
  background: var(--surface-hover) !important;
  transform: translateY(-1px) !important;
  box-shadow: var(--shadow-md) !important;
}

.filter-btn.active:focus {
  background: var(--gradient-primary) !important;
  color: white !important;
}

/* Enhanced navbar toggle focus */
.navbar-toggler:focus {
  background: rgba(255, 255, 255, 0.1) !important;
  border-radius: 8px !important;
}

/* Focus for mobile context buttons */
.mobile-filter-hint:focus,
.mobile-theme-hint:focus {
  background: var(--primary) !important;
  color: white !important;
  transform: translateY(-2px) !important;
  box-shadow: var(--shadow-md) !important;
}

/* Ensure accordion buttons are focusable and visible */
.accordion-button:focus {
  background: rgba(99, 102, 241, 0.1) !important;
  border-radius: 8px !important;
}

/* Beautiful Loading Animation */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-secondary);
  background: var(--surface-glass);
  border-radius: 20px;
  backdrop-filter: blur(20px);
  margin: 2rem;
}

.loading::after {
  content: '';
  width: 1.5rem;
  height: 1.5rem;
  margin-left: 0.75rem;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Beautiful Article Slide-in Animation */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.news-item {
  animation: slideInUp 0.6s ease-out;
}

/* Staggered animation for multiple articles */
.news-item:nth-child(1) { animation-delay: 0.1s; }
.news-item:nth-child(2) { animation-delay: 0.2s; }
.news-item:nth-child(3) { animation-delay: 0.3s; }
.news-item:nth-child(4) { animation-delay: 0.4s; }
.news-item:nth-child(5) { animation-delay: 0.5s; }
.news-item:nth-child(6) { animation-delay: 0.6s; }

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

/* Beautiful Custom Scrollbar */
::-webkit-scrollbar {
  width: 12px;
}

::-webkit-scrollbar-track {
  background: var(--background);
  border-radius: 6px;
}

::-webkit-scrollbar-thumb {
  background: var(--gradient-primary);
  border-radius: 6px;
  border: 2px solid var(--background);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

/* Enhanced Selection Colors */
::selection {
  background: var(--primary-light);
  color: white;
}

::-moz-selection {
  background: var(--primary-light);
  color: white;
}

/* Beautiful Empty State */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 2rem;
  background: var(--surface-glass);
  border-radius: 24px;
  border: 1px solid var(--border);
  backdrop-filter: blur(20px);
  margin: 2rem 0;
}

.empty-state h3 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.6;
}

/* Duplicate Badge Enhancement */
.duplicate-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--gradient-primary);
  color: white;
  font-size: 0.75rem;
  padding: 0.375rem 0.75rem;
  border-radius: 12px;
  font-weight: 700;
  z-index: 2;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Enhanced Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

/* Beautiful Backdrop Blur Support Detection */
@supports (backdrop-filter: blur(20px)) {
  .filters,
  .header,
  .news-item,
  .filter-btn,
  .search-input {
    backdrop-filter: blur(20px);
  }
}

/* Smooth scroll behavior */
html {
  scroll-behavior: smooth;
}

/* Footer Styles */
.site-footer {
  margin-top: 4rem;
  padding: 2rem 1.5rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  text-align: center;
}

.site-footer p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 400;
  margin: 0;
  opacity: 0.8;
}

@media (max-width: 768px) {
  .site-footer {
    margin-top: 2rem;
    padding: 1.5rem 1rem;
  }
  
  .site-footer p {
    font-size: 0.8125rem;
  }
}

/* Custom positioning for desktop controls */
@media (min-width: 992px) {
  .d-lg-flex.justify-content-end {
    margin-left: auto;
    padding-right: 2rem;
  }
  
  /* Ensure proper spacing between brand and controls */
  .navbar-brand {
    margin-right: auto;
  }
}

/* Enhanced Mobile Controls Styling */
@media (max-width: 991px) {
  .nav-item.p-3 {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
    margin: 0.5rem;
  }
  
  [data-theme="light"] .nav-item.p-3 {
    background: rgba(0, 0, 0, 0.05);
  }
  
  #dateSelectMobile {
    border-radius: 12px !important;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
  }
  
  [data-theme="light"] #dateSelectMobile {
    border: 1px solid rgba(0, 0, 0, 0.2) !important;
  }
  
  #themeToggleMobile {
    border-radius: 12px !important;
    min-width: 48px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  #themeToggleMobile .theme-icon {
    font-size: 1.1rem;
  }
  
  .mobile-stats-badge {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-weight: 600;
  }
  
[data-theme="light"] .mobile-stats-badge {
  background: transparent !important;
  border: none !important;
  color: #1e293b !important;
  padding: 0 !important;
  font-weight: 500 !important;
}}

/* Light Mode Desktop Stats Enhancement - remove button styling */
[data-theme="light"] .custom-navbar .text-light.small {
  background: transparent !important;
  color: #1e293b !important;
  padding: 0 !important;
  border-radius: 0 !important;
  border: none !important;
  font-weight: 500 !important;
  backdrop-filter: none !important;
}
/* Article Actions */
.article-actions {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

.read-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--gradient-primary);
  color: white !important;
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.read-more-btn:hover {
  background: linear-gradient(135deg, #1e40af 0%, #4338ca 100%);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  color: white !important;
  text-decoration: none;
}

.read-more-btn:focus {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

/* Light theme adjustments */
[data-theme="light"] .read-more-btn {
  background: var(--gradient-primary);
  color: white !important;
  border-color: rgba(255, 255, 255, 0.2);
}

[data-theme="light"] .read-more-btn:hover {
  background: linear-gradient(135deg, #1e40af 0%, #4338ca 100%);
  color: white !important;
}

/* Mobile responsive adjustments for read more button */
@media (max-width: 768px) {
  .article-actions {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
  }
  
  .read-more-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.8125rem;
    width: 100%;
    justify-content: center;
  }
}

/* Mobile Context Section - Only visible on mobile/tablet */
.mobile-context-section {
  padding: 1rem;
  margin-bottom: 1rem;
}

.mobile-context-card {
  background: var(--surface-glass);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.context-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #00D9FF 0%, #FFB800 50%, #00FFB8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.context-subtitle {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  font-weight: 500;
}

.context-stats {
  display: flex;
  justify-content: space-around;
  margin-bottom: 1.25rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

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

.stat-number {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-light);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.context-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.mobile-filter-hint,
.mobile-theme-hint {
  flex: 1;
  max-width: 140px;
  font-size: 0.8125rem;
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.mobile-filter-hint:hover,
.mobile-theme-hint:hover {
  background: var(--surface-hover) !important;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* Light theme adjustments */
[data-theme="light"] .mobile-context-card {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .context-subtitle {
  color: #475569;
}

[data-theme="light"] .stat-label {
  color: #64748b;
}

[data-theme="light"] .mobile-filter-hint,
[data-theme="light"] .mobile-theme-hint {
  color: #1e293b !important;
  border-color: rgba(0, 0, 0, 0.2) !important;
  background: rgba(255, 255, 255, 0.8) !important;
}

[data-theme="light"] .mobile-filter-hint:hover,
[data-theme="light"] .mobile-theme-hint:hover {
  background: rgba(0, 0, 0, 0.1) !important;
  color: #1e293b !important;
}

/* Enhanced Navbar Controls */
.navbar-controls {
  padding-right: 1rem;
  min-width: 0;
}

.navbar-controls .search-group {
  max-width: 350px;
  min-width: 250px;
}

.navbar-controls .search-group input {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 0.875rem;
}

.navbar-controls .search-group input:focus {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.25);
}

.navbar-controls .search-group input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.navbar-controls .date-select-desktop {
  max-width: 140px;
  min-width: 120px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 0.875rem;
}

.navbar-controls .date-select-desktop:focus {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.25);
}

.navbar-controls .theme-toggle-desktop {
  width: 40px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.2s ease;
}

.navbar-controls .theme-toggle-desktop:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.navbar-controls .stats-desktop {
  font-size: 0.8rem;
  white-space: nowrap;
  opacity: 0.9;
  font-weight: 500;
  margin-left: 0.5rem;
}

/* Mobile Controls Enhanced */
.mobile-control-input {
  background: rgba(255, 255, 255, 0.1) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  color: white !important;
  font-size: 0.875rem !important;
  flex: 1;
}

.mobile-control-input:focus {
  background: rgba(255, 255, 255, 0.15) !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.25) !important;
}

.mobile-control-btn {
  width: 40px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  flex-shrink: 0;
}

.mobile-control-btn:hover {
  background: rgba(255, 255, 255, 0.2) !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
}

.mobile-stats-badge {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.375rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
}

/* Responsive breakpoints */
@media (max-width: 1200px) {
  .navbar-controls .search-group {
    max-width: 300px;
    min-width: 220px;
  }
  
  .navbar-controls .date-select-desktop {
    max-width: 130px;
    min-width: 110px;
  }
}

@media (max-width: 1024px) {
  .navbar-controls {
    padding-right: 0.5rem;
  }
  
  .navbar-controls .search-group {
    max-width: 280px;
    min-width: 200px;
  }
  
  .navbar-controls .stats-desktop {
    font-size: 0.75rem;
  }
}

/* Light theme adjustments */
[data-theme="light"] .navbar-controls .search-group input {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.2);
  color: #1e293b;
}

[data-theme="light"] .navbar-controls .search-group input:focus {
  background: rgba(0, 0, 0, 0.1);
  border-color: var(--primary);
}

[data-theme="light"] .navbar-controls .search-group input::placeholder {
  color: rgba(0, 0, 0, 0.6);
}

[data-theme="light"] .navbar-controls .date-select-desktop {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.2);
  color: #1e293b;
}

[data-theme="light"] .navbar-controls .date-select-desktop:focus {
  background: rgba(0, 0, 0, 0.1);
  border-color: var(--primary);
}

[data-theme="light"] .navbar-controls .theme-toggle-desktop {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.2);
  color: #1e293b;
}

[data-theme="light"] .navbar-controls .theme-toggle-desktop:hover {
  background: rgba(0, 0, 0, 0.1);
  border-color: rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .navbar-controls .stats-desktop {
  color: #1e293b !important;
}

[data-theme="light"] .mobile-control-input {
  background: rgba(0, 0, 0, 0.05) !important;
  border: 1px solid rgba(0, 0, 0, 0.2) !important;
  color: #1e293b !important;
}

[data-theme="light"] .mobile-control-input:focus {
  background: rgba(0, 0, 0, 0.1) !important;
  border-color: var(--primary) !important;
}

[data-theme="light"] .mobile-control-btn {
  background: rgba(0, 0, 0, 0.05) !important;
  border: 1px solid rgba(0, 0, 0, 0.2) !important;
  color: #1e293b !important;
}

[data-theme="light"] .mobile-control-btn:hover {
  background: rgba(0, 0, 0, 0.1) !important;
  border-color: rgba(0, 0, 0, 0.3) !important;
}

[data-theme="light"] .mobile-stats-badge {
  background: transparent !important;
  border: none !important;
  color: #1e293b !important;
  padding: 0 !important;
  font-weight: 500 !important;
}
/* Enhanced Navbar Controls - TRULY Right Aligned */
.navbar-controls-right {
  margin-right: 1rem !important;
  padding-right: 0;
  min-width: 0;
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
}

/* Base width rules for navbar-controls-right */
.navbar-controls-right .search-group {
  max-width: 350px;
  min-width: 250px;
}

.navbar-controls-right .date-select-desktop {
  max-width: 140px;
  min-width: 120px;
}

/* Force right alignment on larger screens */
@media (min-width: 1400px) {
  .navbar-controls-right {
    right: 2rem;
  }
}

/* Additional responsive adjustments for right alignment */
@media (max-width: 1400px) {
  .navbar-controls-right {
    right: 1.5rem;
  }
}

@media (max-width: 1200px) {
  .navbar-controls-right {
    right: 1rem;
  }
  
  .navbar-controls-right .search-group {
    max-width: 300px;
    min-width: 220px;
  }
  
  .navbar-controls-right .date-select-desktop {
    max-width: 130px;
    min-width: 110px;
  }
}

@media (max-width: 1024px) {
  .navbar-controls-right {
    right: 0.5rem;
  }
  
  .navbar-controls-right .search-group {
    max-width: 280px;
    min-width: 200px;
  }
  
  .navbar-controls-right .stats-desktop {
    font-size: 0.75rem;
  }
}

[data-theme="light"] .mobile-stats-badge {
  background: transparent !important;
  border: none !important;
  color: #1e293b !important;
  padding: 0 !important;
  font-weight: 500 !important;
}
/* Light theme adjustments for right-aligned controls */
[data-theme="light"] .navbar-controls-right .search-group input {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.2);
  color: #1e293b;
}

[data-theme="light"] .navbar-controls-right .search-group input:focus {
  background: rgba(0, 0, 0, 0.1);
  border-color: var(--primary);
}

[data-theme="light"] .navbar-controls-right .search-group input::placeholder {
  color: rgba(0, 0, 0, 0.6);
}

[data-theme="light"] .navbar-controls-right .date-select-desktop {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.2);
  color: #1e293b;
}

[data-theme="light"] .navbar-controls-right .date-select-desktop:focus {
  background: rgba(0, 0, 0, 0.1);
  border-color: var(--primary);
}

[data-theme="light"] .navbar-controls-right .theme-toggle-desktop {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.2);
  color: #1e293b;
}

[data-theme="light"] .navbar-controls-right .theme-toggle-desktop:hover {
  background: rgba(0, 0, 0, 0.1);
  border-color: rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .navbar-controls-right .stats-desktop {
  color: #1e293b !important;
}
/* USER REQUESTED CHANGES */

/* Highlight AI Summary */
.article-summary {
  margin-bottom: 1.5rem !important;
  padding: 1.25rem !important;
  background: linear-gradient(135deg, 
    rgba(139, 92, 246, 0.15) 0%,
    rgba(99, 102, 241, 0.12) 100%) !important;
  border: 1px solid rgba(139, 92, 246, 0.3) !important;
  border-radius: 16px !important;
  font-size: 0.9rem !important;
  line-height: 1.6 !important;
  color: rgba(241, 245, 249, 0.95) !important;
  font-style: italic !important;
  position: relative !important;
  backdrop-filter: blur(15px) !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.1) !important;
}

.article-summary::before {
  content: '🤖 AI Summary' !important;
  position: absolute !important;
  top: -12px !important;
  left: 16px !important;
  background: linear-gradient(135deg, #a855f7 0%, #6366f1 100%) !important;
  color: white !important;
  padding: 0.25rem 0.75rem !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  border-radius: 8px !important;
  border: 1px solid rgba(139, 92, 246, 0.4) !important;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3) !important;
  font-style: normal !important;
  z-index: 10 !important;
}


/* Ensure content fits properly in 90vh cards */
.news-item .source-bar {
  flex-shrink: 0 !important;
}

.news-item .article-title {
  flex-shrink: 0 !important;
}

.news-item .entities {
  flex-shrink: 0 !important;
}

.news-item .metadata {
  margin-top: auto !important;
  flex-shrink: 0 !important;
}
/* Horizontal Rule After Title (Before AI Summary) */
.article-title + hr,
.news-item hr {
  margin: 1.5rem 0 !important;
  border: none !important;
  height: 1px !important;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(139, 92, 246, 0.5) 20%, 
    rgba(99, 102, 241, 0.6) 50%, 
    rgba(139, 92, 246, 0.5) 80%, 
    transparent 100%) !important;
  position: relative !important;
}

.article-title + hr::before,
.news-item hr::before {
  content: '' !important;
  position: absolute !important;
  top: -2px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  width: 60px !important;
  height: 3px !important;
  background: linear-gradient(90deg, #a855f7 0%, #6366f1 100%) !important;
  border-radius: 2px !important;
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.3) !important;
}

/* Ensure proper spacing around hr */
.news-item .article-title {
  margin-bottom: 0.75rem !important;
}

.news-item hr + .article-summary {
  margin-top: 0.75rem !important;
}
/* Difficulty Specific Styling */
.difficulty::after {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.9) 0%, rgba(249, 115, 22, 0.95) 100%) !important;
  border-color: rgba(245, 158, 11, 0.3) !important;
}

.difficulty::before {
  border-top-color: rgba(245, 158, 11, 0.9) !important;
}

/* Confidence Specific Styling */
.confidence::after {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.9) 0%, rgba(5, 150, 105, 0.95) 100%) !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
}

.confidence::before {
  border-top-color: rgba(16, 185, 129, 0.9) !important;
}

/* Low confidence styling */
.confidence[title*="Lower confidence"]::after {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.9) 0%, rgba(249, 115, 22, 0.95) 100%) !important;
  border-color: rgba(245, 158, 11, 0.3) !important;
}

.confidence[title*="Lower confidence"]::before {
  border-top-color: rgba(245, 158, 11, 0.9) !important;
}

/* Difficulty Specific Styling */
.difficulty::after {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.9) 0%, rgba(249, 115, 22, 0.95) 100%) !important;
  border-color: rgba(245, 158, 11, 0.3) !important;
}

.difficulty::before {
  border-top-color: rgba(245, 158, 11, 0.9) !important;
}

/* Confidence Specific Styling */
.confidence::after {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.9) 0%, rgba(5, 150, 105, 0.95) 100%) !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
}

.confidence::before {
  border-top-color: rgba(16, 185, 129, 0.9) !important;
}

/* Low confidence styling */


.article-card .metadata {
  overflow: visible !important;
}

/* Dynamic positioning based on element position */
.difficulty:hover::after {
  top: calc(var(--element-top, 0px) - 12px) !important;
  left: var(--element-left, 50%) !important;
}

.difficulty:hover::before {
  top: calc(var(--element-top, 0px) - 6px) !important;
  left: var(--element-left, 50%) !important;
}

.confidence:hover::after {
  top: calc(var(--element-top, 0px) - 12px) !important;
  left: var(--element-left, 50%) !important;
}

.confidence:hover::before {
  top: calc(var(--element-top, 0px) - 6px) !important;
  left: var(--element-left, 50%) !important;
}

/* Difficulty Specific Styling */
.difficulty::after {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.9) 0%, rgba(249, 115, 22, 0.95) 100%) !important;
  border-color: rgba(245, 158, 11, 0.3) !important;
}

.difficulty::before {
  border-top-color: rgba(245, 158, 11, 0.9) !important;
}

/* Confidence Specific Styling */
.confidence::after {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.9) 0%, rgba(5, 150, 105, 0.95) 100%) !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
}

.confidence::before {
  border-top-color: rgba(16, 185, 129, 0.9) !important;
}

/* Low confidence styling */


.article-card .metadata {
  overflow: visible !important;
}




/* Difficulty Specific Styling */
.difficulty::after {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.9) 0%, rgba(249, 115, 22, 0.95) 100%) !important;
  border-color: rgba(245, 158, 11, 0.3) !important;
}

.difficulty::before {
  border-top-color: rgba(245, 158, 11, 0.9) !important;
}

/* Confidence Specific Styling */
.confidence::after {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.9) 0%, rgba(5, 150, 105, 0.95) 100%) !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
}

.confidence::before {
  border-top-color: rgba(16, 185, 129, 0.9) !important;
}

/* Low confidence styling */


/* Difficulty specific styling */
.difficulty::after {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.95) 0%, rgba(249, 115, 22, 0.98) 100%) !important;
  border-color: rgba(245, 158, 11, 0.4) !important;
}

.difficulty::before {
  border-top-color: rgba(245, 158, 11, 0.95) !important;
}

/* Confidence specific styling */
.confidence::after {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.95) 0%, rgba(5, 150, 105, 0.98) 100%) !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
}

.confidence::before {
  border-top-color: rgba(16, 185, 129, 0.95) !important;
}

/* Low confidence styling */


.difficulty.show-below::before,
.confidence.show-below::before {
  bottom: auto !important;
  top: calc(100% + 6px) !important;
  border-top: none !important;
  border-bottom: 8px solid rgba(0, 0, 0, 0.95) !important;
}

.difficulty.show-below::before {
  border-bottom-color: rgba(245, 158, 11, 0.95) !important;
}

.confidence.show-below::before {
  border-bottom-color: rgba(16, 185, 129, 0.95) !important;
}

/* Enhanced hover effects */
.difficulty:hover,
.confidence:hover {
  transform: translateY(-1px) scale(1.02) !important;
  transition: transform 0.2s ease !important;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .difficulty::after,
  .confidence::after {
    font-size: 0.7rem !important;
    padding: 0.6rem 0.8rem !important;
    min-width: 180px !important;
    max-width: 280px !important;
  }
}

/* Ensure Bootstrap containers don't interfere */
.container,
.container-fluid,
.row,
.col,
.col-* {
  overflow: visible !important;
}
/* Mobile adjustments for better readability */
@media (max-width: 768px) {
  .difficulty::after,
  .confidence::after {
    max-width: 280px !important;
    min-width: 180px !important;
    font-size: 0.7rem !important;
    padding: 0.6rem 0.8rem !important;
  }
}
/* Style the new indicator labels */
.indicators {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.indicator-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* General indicator labels (for Difficulty and Confidence) */
.indicator-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.8;
}

/* Special styling for Title label - make it distinct */
.article-title .indicator-label {
  font-size: 0.9rem;
  font-weight: 800;
  color: transparent;
  background: linear-gradient(135deg, #a855f7 0%, #6366f1 50%, #3b82f6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-transform: none;
  letter-spacing: 0.025em;
  margin-right: 0.75rem;
  padding: 0.25rem 0;
  border-left: 3px solid #a855f7;
  padding-left: 0.5rem;
  opacity: 1;
  text-shadow: none;
  position: relative;
}

/* Add a subtle glow effect for title label */
.article-title .indicator-label::before {
  content: '';
  position: absolute;
  left: -3px;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(135deg, #a855f7 0%, #6366f1 100%);
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.4);
  border-radius: 2px;
}

/* Light theme adjustments for indicator labels */
[data-theme="light"] .indicator-label {
  color: var(--text-secondary);
  opacity: 0.7;
}

/* Light theme for Title label */
[data-theme="light"] .article-title .indicator-label {
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 50%, #2563eb 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  border-left-color: #7c3aed;
  opacity: 1;
}

[data-theme="light"] .article-title .indicator-label::before {
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
  box-shadow: 0 0 6px rgba(124, 58, 237, 0.3);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .indicators {
    gap: 0.75rem;
  }
  
  .indicator-item {
    gap: 0.375rem;
  }
  
  .indicator-label {
    font-size: 0.7rem;
  }
}
/* Update metadata layout for better organization */
.metadata {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* Ensure category doesn't take too much space */
.metadata .category {
  flex-shrink: 0;
}

/* Mobile adjustments for metadata */
@media (max-width: 768px) {
  .metadata {
    gap: 0.75rem;
  }
  
  .metadata .indicators {
    flex: 1;
    justify-content: flex-end;
  }
}

@media (max-width: 480px) {
  .metadata {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  
  .metadata .indicators {
    justify-content: center;
  }
}

/* Fix mobile title truncation issue */
@media (max-width: 768px) {
  /* Ensure navbar brand has enough space for full title */
  .navbar-brand {
    min-width: 180px !important; /* Reserve minimum space for "AI News Daily" */
    max-width: none !important; /* Remove any max-width constraints */
    flex: 0 0 auto !important; /* Don't let it shrink */
    white-space: nowrap !important; /* Prevent title wrapping */
  }
  
  /* Adjust brand text container */
  .brand-text {
    min-width: 0 !important; /* Allow text to use full available space */
    flex: 1 1 auto !important;
  }
  
  /* Ensure title doesn't get truncated */
  .brand-title {
    font-size: 1.2rem !important;
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: unset !important;
    min-width: fit-content !important;
  }
  
  /* Adjust navbar for better spacing */
  .custom-navbar .container-fluid {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }
  
  /* Ensure hamburger menu doesn't interfere */
  .navbar-toggler {
    margin-left: auto !important;
    flex-shrink: 0 !important;
  }
}

@media (max-width: 480px) {
  /* For very small screens, slightly smaller font but still visible */
  .brand-title {
    font-size: 1.1rem !important;
  }
  
  /* Ensure minimum space for brand */
  .navbar-brand {
    min-width: 170px !important;
  }
}

/* Ensure content fits properly in 100vh cards */
.news-item .source-bar {
  flex-shrink: 0 !important;
}

