/**
 * Theme Variables
 * Central source of truth for all theme colors and variables
 * Used across all pages for consistent theming
 */

:root {
  /* ===== COLORS - DARK THEME (DEFAULT) ===== */
  --bg-primary: #0a0a0a;
  --bg-secondary: #111111;
  --bg-tertiary: #18181b;
  --bg-card: #18181b;
  
  --text-primary: #ffffff;
  --text-secondary: #a1a1aa;
  --text-tertiary: #71717a;
  
  --border-subtle: #27272a;
  --border-default: #3f3f46;
  --border-emphasis: #52525b;
  
  --accent-primary: #60a5fa;
  --accent-hover: #3b82f6;
  --accent-active: #2563eb;
  
  /* Legacy support for older CSS files */
  --accent-color: #60a5fa;
  --accent-color-light: #93c5fd;
  --accent-color-dark: #3b82f6;
  --accent-blue: #60a5fa;
  --accent-blue-dark: #3b82f6;
  --logo-color: #60a5fa;
  --bg-hover: #27272a;
  --bg-subtle: #18181b;
  --text-muted: #71717a;
  --background-start: #0a0a0a;
  --background-end: #111111;
  --background-card: #18181b;
  --background-secondary: #18181b;
  --background-tertiary: #27272a;
  --border-color: #3f3f46;
  --border-hover: #52525b;
  
  --success: #22c55e;
  --error: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  
  /* ===== SPACING ===== */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  
  /* Legacy spacing (pixel-based) */
  --space-4: 0.25rem;   /* 4px */
  --space-8: 0.5rem;    /* 8px */
  --space-12: 0.75rem;  /* 12px */
  --space-16: 1rem;     /* 16px */
  --space-20: 1.25rem;  /* 20px */
  --space-24: 1.5rem;   /* 24px */
  --space-32: 2rem;     /* 32px */
  --space-40: 2.5rem;   /* 40px */
  
  /* ===== TYPOGRAPHY ===== */
  --font-family: 'Rethink Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-family-heading: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-md: 1rem; /* Legacy */
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 2rem;
  --leading-normal: 1.5;
  
  /* ===== RADIUS ===== */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;
  --border-radius: 0.5rem; /* Legacy */
  
  /* ===== SHADOWS ===== */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
  
  /* ===== TRANSITIONS ===== */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== LIGHT THEME OVERRIDES ===== */
[data-theme='light'] {
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-tertiary: #f3f4f6;
  --bg-card: #ffffff;
  
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-tertiary: #6b7280;
  
  --border-subtle: #e5e7eb;
  --border-default: #d1d5db;
  --border-emphasis: #9ca3af;
  
  --accent-primary: #3b82f6;
  --accent-hover: #2563eb;
  --accent-active: #1d4ed8;
  
  /* Legacy support for older CSS files */
  --accent-color: #3b82f6;
  --accent-color-light: #60a5fa;
  --accent-color-dark: #2563eb;
  --accent-blue: #3b82f6;
  --accent-blue-dark: #2563eb;
  --logo-color: #3b82f6;
  --bg-hover: #f3f4f6;
  --bg-subtle: #f9fafb;
  --text-muted: #6b7280;
  --background-start: #ffffff;
  --background-end: #f9fafb;
  --background-card: #ffffff;
  --background-secondary: #f9fafb;
  --background-tertiary: #f3f4f6;
  --border-color: #d1d5db;
  --border-hover: #9ca3af;
  
  --success: #22c55e;
  --error: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
}

/**
 * Base Styles
 * Global resets and base element styles
 */

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

html {
  background: var(--bg-primary);
  transition: background-color var(--transition-base);
}

body {
  font-family: var(--font-family);
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-base), color var(--transition-base);
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-primary);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  transition: all var(--transition-fast);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-heading);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
}

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

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-emphasis);
}

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

/* Focus Visible */
:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Loading Spinner */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-subtle);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Error State */
.error {
  padding: var(--space-xl);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--error);
  border-radius: var(--radius-md);
  color: var(--text-primary);
}

/* Success Message */
.success {
  padding: var(--space-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--success);
  border-radius: var(--radius-md);
  color: var(--text-primary);
}

/**
 * Layouts
 * Page layout structures
 */

.page-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-container {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: var(--space-xl);
  padding-top: 120px; /* Account for fixed header */
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: var(--space-2xl);
  align-items: start;
}

.main-content {
  min-width: 0; /* Prevent grid blowout */
}

/* ===== DISCOVER HEADER ===== */
.discover-header {
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
}

.discover-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
  gap: var(--space-md);
}

.discover-title {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  font-family: var(--font-family-heading);
}

.discover-title i {
  color: var(--accent-primary);
  font-size: 0.9em;
}

.discover-tabs {
  display: flex;
  gap: var(--space-sm);
  background: var(--bg-tertiary);
  padding: 0.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.discover-tab {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
}

.discover-tab i {
  font-size: 0.875rem;
  opacity: 0.7;
}

.discover-tab:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.discover-tab.active {
  background: var(--accent-primary);
  color: white;
  box-shadow: 0 2px 8px rgba(96, 165, 250, 0.3);
}

.discover-tab.active i {
  opacity: 1;
}

/* Dynamic Chips */
.discover-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  min-height: 2.5rem;
}

.discover-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
}

.discover-chip i {
  font-size: 0.875rem;
  opacity: 0.8;
}

.discover-chip:hover {
  background: var(--bg-hover);
  border-color: var(--border-default);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.discover-chip:hover i {
  opacity: 1;
}

.discover-chip.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
  box-shadow: 0 2px 8px rgba(96, 165, 250, 0.3);
}

.discover-chip.active i {
  opacity: 1;
}

/* Special styling for "All" chip */
.discover-chip[data-category="all"] {
  font-weight: 600;
}

.discover-chip[data-category="all"]:not(.active) {
  border-color: var(--border-default);
}

/* Responsive */
@media (max-width: 768px) {
  .discover-title-row {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .discover-title {
    font-size: 1.75rem;
  }
  
  .discover-tabs {
    width: 100%;
    justify-content: space-between;
  }
  
  .discover-tab {
    flex: 1;
    justify-content: center;
    padding: 0.625rem 0.75rem;
  }
  
  .discover-tab i {
    display: none;
  }
}

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

/* News Feed Grid - Perplexity Style */
.news-feed {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-xl);
  grid-auto-flow: dense;
}

/* Footer */
.footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border-subtle);
  padding: var(--space-2xl) var(--space-xl);
  margin-top: var(--space-2xl);
}

.footer-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-xl);
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.footer-links {
  display: flex;
  gap: var(--space-xl);
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--text-primary);
}

.footer-social {
  display: flex;
  gap: var(--space-md);
}

.footer-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.footer-social a:hover {
  background: var(--accent-primary);
  color: white;
  transform: translateY(-2px);
}

.footer-copyright {
  width: 100%;
  text-align: center;
  margin-top: var(--space-xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border-subtle);
  color: var(--text-tertiary);
  font-size: var(--font-size-sm);
}

/* Responsive */
@media (max-width: 1200px) {
  .news-feed {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
  }
  
  .news-card--hero .card-link-wrapper {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }
  
  .news-card--hero .news-card-image {
    order: 1;
    min-height: 300px;
    border-radius: var(--radius-lg);
  }
  
  .news-card--hero .card-content-wrapper {
    order: 2;
    padding: var(--space-xl);
  }
  
  .news-card--hero.news-card--flipped .news-card-image {
    order: 1;
  }
  
  .news-card--hero.news-card--flipped .card-content-wrapper {
    order: 2;
  }
}

@media (max-width: 1024px) {
  .main-container {
    grid-template-columns: 1fr;
    padding-top: 100px;
  }

  .sidebar {
    position: relative;
    top: 0;
    max-height: none;
  }
}

@media (max-width: 768px) {
  .main-container {
    padding: var(--space-md);
    gap: var(--space-lg);
  }

  .news-feed {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
  
  .news-card--hero {
    min-height: auto;
  }
  
  .news-card--hero .news-card-image {
    min-height: 240px;
  }
  
  .news-card--hero .card-content-wrapper {
    padding: var(--space-lg);
  }
  
  .news-card--hero .news-title {
    font-size: var(--font-size-2xl);
  }
  
  .news-card--hero .news-description {
    font-size: var(--font-size-base);
  }

  .footer {
    padding: var(--space-xl) var(--space-md);
  }

  .footer-content {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }
}

/**
 * Header Component
 * Navigation header styles - matches layout.js implementation
 */

/* --- HEADER --- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(10px);
  transition: all var(--transition-base);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  max-width: 1536px;
  margin: 0 auto;
  gap: 1rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--text-primary);
  transition: opacity var(--transition-fast);
  flex-shrink: 0;
}

.logo:hover {
  opacity: 0.8;
}

.logo-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  font-family: var(--font-family-heading);
  white-space: nowrap;
}

/* Back Button */
.header-back-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  padding: 0.625rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  font-size: 1.125rem;
}

.header-back-link:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Nav Toggle Button (Mobile) */
.nav-toggle-btn {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  padding: 0.625rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  font-size: 1.125rem;
}

.nav-toggle-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

@media (max-width: 767px) {
  .nav-toggle-btn {
    display: flex;
  }
}

/* Search Container */
.search-container {
  flex: 1;
  max-width: 600px;
  position: relative;
  margin: 0 1.5rem;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
  font-size: 0.9375rem;
}

.search-input {
  width: 100%;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0.625rem 1rem 0.625rem 2.75rem;
  color: var(--text-primary);
  font-size: 0.9375rem;
  transition: all var(--transition-fast);
  line-height: 1.5;
}

.search-input:focus {
  outline: none;
  background-color: var(--bg-card);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

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

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.user-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.user-link {
  color: var(--text-secondary);
  font-size: 1.125rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  min-width: 40px;
  min-height: 40px;
}

.user-link:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.user-link.active {
  background: var(--bg-tertiary);
  color: var(--accent-primary);
}

.user-link span {
  font-size: 0.9375rem;
  font-weight: 600;
  white-space: nowrap;
}

.theme-toggle-btn {
  font-size: 1.125rem;
  padding: 0.625rem;
  min-width: 40px;
  min-height: 40px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle-btn:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Header Navigation (Tabs) */
.header-nav {
  display: none; /* Hidden on mobile by default */
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
}

.header-nav.active {
  display: block; /* Show when toggled on mobile */
}

@media (min-width: 768px) {
  .header-nav {
    display: flex !important;
    border-bottom: 1px solid var(--border-subtle);
  }
}

.nav-tabs {
  display: flex;
  gap: 0;
  padding: 0 2rem;
  max-width: 1536px;
  margin: 0 auto;
  overflow-x: auto;
  flex-direction: column;
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

@media (min-width: 768px) {
  .nav-tabs {
    flex-direction: row;
    padding: 0 2rem;
    gap: 0.5rem;
  }
}

.nav-tab {
  padding: 1rem 1.25rem;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.9375rem;
  white-space: nowrap;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  cursor: pointer;
  text-align: left;
  position: relative;
}

@media (min-width: 768px) {
  .nav-tab {
    padding: 0.875rem 1rem;
    text-align: center;
  }
}

.nav-tab:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

@media (min-width: 768px) {
  .nav-tab:hover {
    background: transparent;
  }
}

.nav-tab.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
}

@media (max-width: 767px) {
  .nav-tab {
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius-md);
    margin: 0.25rem 0;
  }
  
  .nav-tab.active {
    background: var(--bg-tertiary);
  }
}

.nav-link {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0.5rem 0;
  border-bottom: 3px solid transparent;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.nav-link:hover {
  color: var(--text-primary);
}

.nav-link.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
}

/* Filter Container */
.filter-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 2rem;
  max-width: 1536px;
  margin: 0 auto;
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  background: var(--bg-card);
  scrollbar-width: none;
}

.filter-container::-webkit-scrollbar {
  display: none;
}

.filter-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  white-space: nowrap;
  font-weight: 600;
  flex-shrink: 0;
}

.filter-chips {
  display: flex;
  gap: 0.5rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-chips::-webkit-scrollbar {
  display: none;
}

.chip {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.chip:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-default);
  transform: translateY(-1px);
}

.chip.active {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

@media (max-width: 768px) {
  .filter-container {
    padding: 0.75rem 1rem;
  }
  
  .filter-label {
    font-size: 0.8125rem;
  }
  
  .chip {
    padding: 0.4375rem 0.875rem;
    font-size: 0.8125rem;
  }
}

/* Mobile Responsive */
@media (max-width: 1024px) {
  .header-content {
    padding: 0.875rem 1.5rem;
  }

  .search-container {
    max-width: 400px;
    margin: 0 1rem;
  }
}

@media (max-width: 768px) {
  .header-content {
    padding: 0.75rem 1rem;
    gap: 0.75rem;
  }

  .header-left {
    gap: 0.75rem;
  }

  .logo-avatar {
    width: 24px;
    height: 24px;
  }

  .logo-text {
    font-size: 1.125rem;
  }

  .search-container {
    margin: 0 0.75rem;
  }

  .search-input {
    padding: 0.5rem 0.875rem 0.5rem 2.5rem;
    font-size: 0.875rem;
  }

  .user-links {
    gap: 0.25rem;
  }

  .user-link {
    padding: 0.5rem;
    min-width: 36px;
    min-height: 36px;
    font-size: 1rem;
  }

  .user-link span {
    display: none; /* Hide text labels on mobile */
  }

  .theme-toggle-btn {
    padding: 0.5rem;
    min-width: 36px;
    min-height: 36px;
    font-size: 1rem;
  }
}

@media (max-width: 640px) {
  .header-content {
    padding: 0.625rem 0.875rem;
  }

  .header-left {
    gap: 0.5rem;
  }

  .logo-text {
    font-size: 1rem;
  }

  .search-container {
    display: none; /* Hide search on small screens */
  }
}
/**
 * Card Components
 * News cards, sidebar cards, and other card styles
 */

/* News Card Base */
.news-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: all var(--transition-base);
  min-height: 420px;
}

.news-card:hover {
  border-color: var(--border-default);
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

/* Standard Cards (non-hero) */
.news-card--standard {
  min-height: 420px;
}

.news-card-image {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-bottom: 1px solid var(--border-subtle);
}

.card-content-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: var(--space-lg);
  gap: var(--space-md);
}

.news-title {
  font-size: var(--font-size-xl);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-family: var(--font-family-heading);
}

.news-description {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Card Footer with Meta and Actions */
.card-footer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border-subtle);
  gap: var(--space-md);
}

.card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  white-space: nowrap;
}

.meta-date,
.meta-time {
  font-weight: 500;
}

.meta-separator {
  opacity: 0.5;
}

.news-actions {
  display: flex;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  transition: all var(--transition-fast);
}

.action-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.action-btn.active {
  color: var(--error);
}

.bookmark-btn.active {
  color: var(--accent-primary);
}

/* Hero Card - Perplexity Style */
.news-card--hero {
  grid-column: 1 / -1;
  min-height: 500px;
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-tertiary) 100%);
}

.news-card--hero:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.news-card--hero .card-link-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 100%;
  gap: 0;
}

.news-card--hero .news-card-image {
  height: 100%;
  min-height: 500px;
  border-bottom: none;
  border-right: none;
  border-radius: 0;
  object-fit: cover;
  order: 1;
}

.news-card--hero .card-content-wrapper {
  padding: var(--space-2xl) var(--space-2xl);
  gap: var(--space-lg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  order: 2;
}

.news-card--hero .news-title {
  font-size: clamp(1.75rem, 3vw, 2.75rem);
  font-weight: 700;
  -webkit-line-clamp: 3;
  line-height: 1.2;
  margin-bottom: var(--space-md);
}

.news-card--hero .news-description {
  font-size: var(--font-size-lg);
  -webkit-line-clamp: 4;
  line-height: 1.6;
  opacity: 0.9;
}

.news-card--hero .card-chips {
  margin-bottom: var(--space-sm);
}

/* Flipped Hero Card (Image on Right) */
.news-card--hero.news-card--flipped .news-card-image {
  order: 2;
}

.news-card--hero.news-card--flipped .card-content-wrapper {
  order: 1;
}

/* Sidebar Card */
.sidebar-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  transition: all var(--transition-base);
}

.sidebar-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-family-heading);
}

/* === WEATHER CARD === */
.weather-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  margin-bottom: var(--space-lg);
  transition: all var(--transition-base);
}

.weather-card:hover {
  border-color: var(--border-default);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.weather-current {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.weather-icon {
  font-size: 2.5rem;
  color: var(--accent-primary);
}

.weather-temp {
  font-size: 2.5rem;
  font-weight: 300;
  color: var(--text-primary);
  line-height: 1;
}

.weather-temp sup {
  font-size: 1.25rem;
  font-weight: 400;
  margin-left: 0.125rem;
}

.weather-location {
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.weather-condition {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

.weather-high-low {
  display: flex;
  gap: var(--space-md);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
}

.weather-high-low .high,
.weather-high-low .low {
  display: inline-block;
}

.weather-forecast {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-sm);
  min-height: 3rem;
}

.forecast-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  text-align: center;
}

.forecast-icon {
  font-size: 1.25rem;
  color: var(--accent-primary);
  opacity: 0.9;
}

.forecast-temp {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.forecast-name {
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.weather-loading {
  text-align: center;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  padding: var(--space-md) 0;
}

.weather-error {
  text-align: center;
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  padding: var(--space-sm) 0;
}

@media (max-width: 1200px) {
  .weather-forecast {
    grid-template-columns: repeat(5, 1fr);
    gap: 0.375rem;
  }
  
  .forecast-icon {
    font-size: 1rem;
  }
  
  .forecast-temp {
    font-size: var(--font-size-xs);
  }
  
  .forecast-name {
    font-size: 0.65rem;
  }
}

/* Card Chips */
.card-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.card-chip {
  padding: 0.25rem 0.75rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.card-chip:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

/* Responsive */
@media (max-width: 1024px) {
  .news-card--hero .card-link-wrapper {
    grid-template-columns: 1fr;
  }

  .news-card--hero .news-card-image {
    min-height: 320px;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }

  .news-card--hero .card-content-wrapper {
    padding: var(--space-xl);
  }
}

@media (max-width: 768px) {
  .news-card {
    min-height: 380px;
  }

  .news-card--hero .news-card-image {
    min-height: 240px;
  }

  .news-card--hero .card-content-wrapper {
    padding: var(--space-lg);
  }

  .card-footer-actions {
    padding: var(--space-sm) var(--space-md);
    flex-wrap: wrap;
  }

  .card-meta {
    font-size: 0.7rem;
  }

  .action-btn {
    padding: var(--space-xs) var(--space-sm);
  }
}

/**
 * Article Page Components
 * Styles specific to article pages
 */

/* Article Container */
.article-content-area {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  margin-bottom: var(--space-xl);
  transition: all var(--transition-base);
}

/* Article Anchor (Sidebar Subject Card) */
.sidebar-anchor-container {
  margin-bottom: var(--space-lg);
}

.article-anchor {
  position: relative;
  display: grid;
  grid-template-columns: auto 1px 1fr;
  align-items: start;
  gap: var(--space-lg);
  padding: var(--space-lg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-tertiary);
  transition: all var(--transition-base);
}

.article-anchor__divider {
  width: 1px;
  height: 100%;
  background: var(--border-default);
  opacity: 0.5;
}

.article-anchor__label {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--accent-primary);
  white-space: nowrap;
  line-height: 1.4;
  padding-top: 0.1rem;
}

.article-anchor__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  min-width: 0;
}

.article-anchor__title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
  word-wrap: break-word;
  font-family: 'Georgia', 'Times New Roman', serif;
}

.article-anchor__meta {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  font-weight: 500;
}

/* Article Typography */
.article-content-area h1 {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--space-md);
  color: var(--text-primary);
  font-family: var(--font-family-heading);
}

.article-content-area h2 {
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-family-heading);
}

.article-content-area p {
  font-size: var(--font-size-base);
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
}

.article-content-area a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.article-content-area a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.article-content-area img,
.article-content-area video {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  margin: var(--space-xl) 0;
}

.article-content-area blockquote {
  margin: var(--space-xl) 0;
  padding-left: var(--space-lg);
  border-left: 4px solid var(--accent-primary);
  font-style: italic;
  color: var(--text-tertiary);
}

.article-meta {
  font-size: var(--font-size-sm);
  color: var(--text-tertiary);
  margin-bottom: var(--space-xl);
}

/* Comments Section */
.comments-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  transition: all var(--transition-base);
}

.comments-container h2 {
  font-size: var(--font-size-2xl);
  font-weight: 600;
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-family-heading);
}

.comment-form {
  margin-top: var(--space-xl);
}

.comment-input-wrapper {
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
}

.comment-form textarea {
  flex: 1;
  min-height: 80px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  color: var(--text-primary);
  font-size: var(--font-size-base);
  resize: vertical;
  transition: all var(--transition-fast);
}

.comment-form textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  background: var(--bg-card);
}

.comment-form button {
  background: var(--accent-primary);
  color: white;
  font-weight: 600;
  padding: var(--space-md) var(--space-xl);
  border-radius: var(--radius-md);
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.comment-form button:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.comment-form button:disabled {
  background: var(--border-default);
  color: var(--text-tertiary);
  cursor: not-allowed;
  transform: none;
}

/* Share Buttons */
.share-buttons {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.share-btn {
  flex: 1;
  min-width: 60px;
  padding: var(--space-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-lg);
  transition: all var(--transition-fast);
}

.share-btn:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
  transform: translateY(-2px);
}

/* Responsive */
@media (max-width: 768px) {
  .article-content-area {
    padding: var(--space-lg);
  }

  .comments-container {
    padding: var(--space-lg);
  }
}

/* ============================================
   ENHANCED UX/UI - Particle.news & Flipboard Inspired
   Delightful animations, micro-interactions, and visual polish
   ============================================ */

/* --- SMOOTH SCROLL BEHAVIOR --- */
html {
  scroll-behavior: smooth;
}

/* --- ENHANCED ANIMATIONS & KEYFRAMES --- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

/* --- SKELETON LOADING STATES --- */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-subtle) 0%,
    var(--bg-hover) 50%,
    var(--bg-subtle) 100%
  );
  background-size: 2000px 100%;
  animation: shimmer 2s infinite;
  border-radius: var(--radius-md);
}

.skeleton-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-20);
  margin-bottom: var(--space-24);
  animation: fadeInUp 0.4s ease-out;
}

.skeleton-image {
  width: 100%;
  height: 200px;
  margin-bottom: var(--space-16);
}

.skeleton-title {
  height: 24px;
  width: 80%;
  margin-bottom: var(--space-12);
}

.skeleton-text {
  height: 16px;
  width: 100%;
  margin-bottom: var(--space-8);
}

.skeleton-text:last-child {
  width: 60%;
}

/* --- ENHANCED NEWS CARD ANIMATIONS --- */
.news-feed {
  animation: fadeIn 0.5s ease-out;
}

.news-card {
  animation: fadeInUp 0.5s ease-out backwards;
  will-change: transform;
  position: relative; /* For ripple effect positioning */
}

/* Stagger animation for cards */
.news-card:nth-child(1) { animation-delay: 0.05s; }
.news-card:nth-child(2) { animation-delay: 0.1s; }
.news-card:nth-child(3) { animation-delay: 0.15s; }
.news-card:nth-child(4) { animation-delay: 0.2s; }
.news-card:nth-child(5) { animation-delay: 0.25s; }
.news-card:nth-child(6) { animation-delay: 0.3s; }
.news-card:nth-child(n+7) { animation-delay: 0.35s; }

/* Enhanced hover effects */
.news-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.news-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  transition: left 0.5s;
  z-index: 1;
  pointer-events: none;
}

.news-card:hover::before {
  left: 100%;
}

.news-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  border-color: var(--logo-color);
}

.news-card:active {
  transform: translateY(-4px) scale(1.01);
}

/* Enhanced image hover effect */
.news-card-image {
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.news-card:hover .news-card-image {
  transform: scale(1.08);
}

/* --- ENHANCED CATEGORY CHIPS --- */
.card-chip {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.card-chip::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.4s, height 0.4s;
}

.card-chip:hover::before {
  width: 200px;
  height: 200px;
}

.card-chip:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Filter chips enhancement */
.filter-chips .chip {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.filter-chips .chip::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--accent-color);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateX(-50%);
}

.filter-chips .chip:hover::after,
.filter-chips .chip.active::after {
  width: 80%;
}

.filter-chips .chip.active {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* --- ENHANCED ACTION BUTTONS --- */
.action-btn {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.4s, height 0.4s;
}

.action-btn:active::before {
  width: 200px;
  height: 200px;
}

.action-btn:hover {
  transform: translateY(-2px) scale(1.05);
}

.action-btn:active {
  transform: translateY(0) scale(0.98);
}

.action-btn.active.like-btn {
  animation: bounce 0.5s ease;
}

.action-btn.active.like-btn i {
  animation: pulse 0.5s ease;
}

/* --- READING TIME INDICATOR --- */
.reading-time {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  font-weight: 500;
  padding: var(--space-4) var(--space-8);
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  margin-left: var(--space-8);
}

.reading-time i {
  font-size: 0.7rem;
}

/* --- ARTICLE COUNT BADGE --- */
.article-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 var(--space-8);
  background: var(--accent-color);
  color: #ffffff;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 700;
  margin-left: var(--space-8);
  animation: scaleIn 0.3s ease-out;
}

/* --- ENHANCED HEADER --- */
.header {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.header.scrolled {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(20px) saturate(180%);
}

/* Enhanced search input */
.search-input {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-input:focus {
  transform: scale(1.02);
  box-shadow: 0 0 0 4px var(--accent-color-light);
}

/* --- ENHANCED NAVIGATION TABS --- */
@media (min-width: 768px) {
  .nav-tab::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--accent-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(-50%);
    border-radius: var(--radius-full);
  }

  .nav-tab:hover::after {
    width: 50%;
  }

  .nav-tab.active::after {
    width: 100%;
  }
}

/* --- ENHANCED HERO ARTICLE (FIRST CARD) --- */
.news-feed article:first-child {
  animation: scaleIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.news-feed article:first-child::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.05) 0%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 0;
}

.news-feed article:first-child:hover {
  transform: translateY(-4px) scale(1.01);
}

/* --- ENHANCED SIDEBAR CARDS --- */
.sidebar-card {
  animation: slideInRight 0.5s ease-out;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-card:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-md);
}

.trending-news-item {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.trending-news-item:hover {
  transform: translateX(4px);
}

.trending-rank {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.trending-news-item:hover .trending-rank {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* --- ENHANCED LOADING SPINNER --- */
.spinner {
  border: 4px solid var(--bg-subtle);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 0.8s linear infinite;
  position: relative;
}

.spinner::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  border: 3px solid transparent;
  border-top-color: var(--logo-color);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: spin 0.6s linear infinite reverse;
}

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

/* --- ENHANCED TOAST NOTIFICATIONS --- */
#toastContainer .toast {
  animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
}

/* --- ENHANCED MODAL --- */
.modal-overlay.show {
  animation: fadeIn 0.3s ease-out;
}

.modal-content {
  animation: scaleIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- ENHANCED FOOTER --- */
.footer {
  animation: fadeInUp 0.6s ease-out;
}

.footer-social a {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.footer-social a:hover {
  transform: translateY(-4px) scale(1.1);
}

/* --- READING PROGRESS INDICATOR --- */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--accent-color),
    var(--logo-color)
  );
  z-index: 9999;
  transition: width 0.1s ease-out;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

/* --- ENHANCED SCROLL TO TOP BUTTON --- */
.scroll-to-top {
  position: fixed;
  bottom: var(--space-24);
  right: var(--space-24);
  width: 48px;
  height: 48px;
  background: var(--accent-color);
  color: #ffffff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-lg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  animation: fadeIn 0.3s ease-out;
}

.scroll-to-top.show {
  display: flex;
}

.scroll-to-top:hover {
  transform: translateY(-4px) scale(1.1);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.scroll-to-top:active {
  transform: translateY(-2px) scale(1.05);
}

/* --- ENHANCED LOAD MORE BUTTON --- */
#loadMoreBtn {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#loadMoreBtn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.4s, height 0.4s;
}

#loadMoreBtn:hover::before {
  width: 300px;
  height: 300px;
}

#loadMoreBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

#loadMoreBtn:active {
  transform: translateY(0);
}

/* --- ENHANCED WEATHER CARD --- */
.weather-card {
  position: relative;
  overflow: hidden;
}

.weather-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 70%
  );
  animation: pulse 3s ease-in-out infinite;
}

.weather-card:hover {
  transform: translateY(-4px) scale(1.02);
}

/* Removed old source-avatar styles - using new card-meta layout */

/* --- ENHANCED FILTER CONTAINER --- */
.filter-container {
  transition: all 0.3s ease-out;
}

/* --- SMOOTH PAGE TRANSITIONS --- */
.page-container {
  animation: fadeIn 0.4s ease-out;
}

/* --- ENHANCED RESPONSIVE BEHAVIOR --- */
@media (max-width: 768px) {
  .news-card:hover {
    transform: translateY(-4px) scale(1.01);
  }

  .scroll-to-top {
    bottom: var(--space-16);
    right: var(--space-16);
    width: 44px;
    height: 44px;
  }

  .reading-progress {
    height: 2px;
  }
}

/* --- REDUCE MOTION FOR ACCESSIBILITY --- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- ENHANCED FOCUS STATES FOR ACCESSIBILITY --- */
.news-card:focus-visible,
.action-btn:focus-visible,
.chip:focus-visible,
.nav-tab:focus-visible {
  outline: 3px solid var(--accent-color);
  outline-offset: 2px;
}

/* --- ENHANCED EMPTY STATE --- */
.empty-state {
  text-align: center;
  padding: var(--space-64) var(--space-24);
  animation: fadeInUp 0.5s ease-out;
}

.empty-state-icon {
  font-size: 4rem;
  color: var(--text-muted);
  margin-bottom: var(--space-24);
  opacity: 0.5;
}

.empty-state-title {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-12);
}

.empty-state-description {
  font-size: var(--font-size-base);
  color: var(--text-secondary);
  max-width: 400px;
  margin: 0 auto;
}

/* ============================================
   PARTICLE.NEWS INSPIRED POLISH
   Ultra-refined, minimal, delightful design
   ============================================ */

/* --- ULTRA-CLEAN TYPOGRAPHY --- */
.news-title {
  font-weight: 800 !important;
  letter-spacing: -0.02em !important;
  line-height: 1.3 !important;
  color: var(--text-primary) !important;
  transition: color 0.2s ease !important;
}

.news-card:hover .news-title {
  color: var(--logo-color) !important;
}

/* --- PARTICLE-STYLE CARD REFINEMENT --- */
.news-card {
  background: var(--bg-primary) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: 12px !important;
  overflow: hidden !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  cursor: pointer;
  display: flex !important;
  flex-direction: column !important;
  min-height: 100% !important;
}

.news-card:hover {
  border-color: var(--border-color) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08) !important;
  transform: translateY(-4px) !important;
}

/* --- CLEAN CARD LINK WRAPPER --- */
.card-link-wrapper {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  text-decoration: none !important;
  color: inherit !important;
  cursor: pointer !important;
}

.card-link-wrapper:focus {
  outline: 2px solid var(--accent-color) !important;
  outline-offset: 2px !important;
  border-radius: 12px !important;
}

/* --- REFINED IMAGE STYLING --- */
.news-card-image {
  width: 100% !important;
  height: 220px !important;
  object-fit: cover !important;
  background: var(--bg-subtle) !important;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
  border-bottom: 1px solid var(--border-subtle) !important;
  aspect-ratio: 16 / 10 !important;
}

.news-card:hover .news-card-image {
  transform: scale(1.03) !important;
}

/* --- PARTICLE-STYLE CONTENT WRAPPER --- */
.card-content-wrapper {
  padding: 1.5rem !important;
  display: flex !important;
  flex-direction: column !important;
  flex-grow: 1 !important;
  gap: 0.75rem !important;
  flex: 1 1 auto !important;
}

.card-chips {
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  flex-wrap: wrap !important;
}

.news-description {
  color: var(--text-secondary) !important;
  font-size: 0.95rem !important;
  line-height: 1.6 !important;
  margin: 0 !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* --- MINIMAL CATEGORY CHIPS --- */
.card-chip {
  font-size: 0.7rem !important;
  font-weight: 700 !important;
  padding: 0.25rem 0.75rem !important;
  border-radius: 6px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  background: var(--bg-secondary) !important;
  color: var(--text-secondary) !important;
  border: none !important;
  transition: all 0.2s ease !important;
}

.card-chip:hover {
  background: var(--bg-hover) !important;
  color: var(--text-primary) !important;
  transform: translateY(-1px) !important;
}

/* Removed duplicate news-actions - defined in main card styles */

.action-btn {
  padding: 0.5rem 0.75rem !important;
  border-radius: 8px !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  color: var(--text-secondary) !important;
  background: transparent !important;
  border: none !important;
  transition: all 0.2s ease !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  gap: 0.4rem !important;
}

.action-btn:hover {
  background: var(--bg-hover) !important;
  color: var(--text-primary) !important;
  transform: translateY(-1px) !important;
}

.action-btn.active {
  color: var(--accent-color) !important;
}

.action-btn.active.like-btn {
  color: #ef4444 !important;
}

.action-btn i {
  font-size: 0.9rem !important;
}

.action-btn .like-count {
  font-size: 0.8rem !important;
  font-weight: 600 !important;
}

/* --- PERPLEXITY-STYLE GRID --- */
.news-feed {
  display: grid !important;
  /* 3-column grid for Perplexity pattern */
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 2rem !important;
  grid-auto-flow: dense !important;
}

@media (max-width: 1200px) {
  .news-feed {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1.5rem !important;
  }
}

@media (max-width: 768px) {
  .news-feed {
    /* Single column on mobile */
    grid-template-columns: 1fr !important;
    gap: 1.25rem !important;
  }
}

/* --- PERPLEXITY-STYLE HERO CARDS --- */
.news-card--hero {
  grid-column: 1 / -1 !important;
  display: block !important;
  min-height: 500px !important;
}

.news-card--hero .card-link-wrapper {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 0 !important;
  height: 100% !important;
  align-items: stretch !important;
}

.news-card--hero .news-card-image {
  height: 100% !important;
  min-height: 500px !important;
  border-bottom: none !important;
  border-radius: 0 !important;
  aspect-ratio: auto !important;
  object-fit: cover !important;
}

.news-card--hero .card-content-wrapper {
  padding: clamp(2rem, 3vw, 3rem) !important;
  justify-content: center !important;
  gap: 1.5rem !important;
  display: flex !important;
  flex-direction: column !important;
}

.news-card--hero .news-title {
  font-size: clamp(1.75rem, 3vw, 2.75rem) !important;
  line-height: 1.2 !important;
  font-weight: 700 !important;
  margin-bottom: 1rem !important;
  -webkit-line-clamp: 3 !important;
}

.news-card--hero .news-description {
  display: block !important;
  font-size: 1.125rem !important;
  line-height: 1.6 !important;
  color: var(--text-secondary) !important;
  -webkit-line-clamp: 4 !important;
  margin-bottom: 1.5rem !important;
  opacity: 0.9 !important;
}

.news-card--hero .card-chips {
  gap: 0.75rem !important;
  margin-bottom: 0.5rem !important;
}

.news-card--hero .card-chip {
  padding: 0.35rem 0.9rem !important;
  font-size: 0.75rem !important;
  letter-spacing: 0.08em !important;
}

.news-card--hero .news-actions {
  padding: 1rem 2.5rem 2.5rem !important;
}

.news-card--standard {
  min-height: 420px !important;
  display: flex !important;
  flex-direction: column !important;
}

.news-card--standard .card-link-wrapper {
  flex: 1 1 auto !important;
}

.news-card--standard .card-content-wrapper {
  min-height: 220px !important;
}

.news-card--standard .news-title {
  font-size: 1.15rem !important;
  -webkit-line-clamp: 2 !important;
}

.news-card--standard .news-description {
  -webkit-line-clamp: 3 !important;
}

.news-card--hero:not(.has-image) {
  min-height: 0 !important;
}

.news-card--hero:not(.has-image) .card-link-wrapper {
  grid-template-columns: 1fr !important;
}

.news-card--standard .news-card-image {
  min-height: 220px !important;
}

@media (max-width: 1200px) {
  .news-card--hero .card-link-wrapper {
    grid-template-columns: 1fr !important;
  }
  
  .news-card--hero .news-card-image {
    min-height: 300px !important;
  }
  
  .news-card--hero .card-content-wrapper {
    padding: 2rem !important;
  }
}

@media (max-width: 1024px) {
  .news-card--hero {
    min-height: auto !important;
  }

  .news-card--hero .card-link-wrapper {
    grid-template-columns: 1fr !important;
  }

  .news-card--hero .news-card-image {
    min-height: 300px !important;
  }

  .news-card--hero .card-content-wrapper {
    padding: 2rem !important;
  }

  .news-card--hero .news-actions {
    padding: 0.75rem 2rem 2rem !important;
  }
}

@media (max-width: 768px) {
  .news-card--hero .news-card-image {
    min-height: 240px !important;
  }

  .news-card--hero .card-content-wrapper {
    padding: 1.75rem !important;
  }
  
  .news-card--hero .news-title {
    font-size: 1.5rem !important;
  }
  
  .news-card--hero .news-description {
    font-size: 1rem !important;
  }
}

/* --- PARTICLE-STYLE HEADER ENHANCEMENTS --- */
.header {
  background: var(--bg-card) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border-bottom: 1px solid var(--border-subtle) !important;
}

/* --- PARTICLE-STYLE FILTER CHIPS ENHANCEMENTS --- */
.filter-container {
  background: var(--bg-card) !important;
}

/* --- PARTICLE-STYLE NAV TABS ENHANCEMENTS --- */
.nav-tabs {
  scrollbar-width: none !important;
}

.nav-tabs::-webkit-scrollbar {
  display: none !important;
}

/* --- CLEAN SPACING --- */
.main-container {
  padding: 7rem 1.5rem !important;
  max-width: 1400px !important;
  margin: 0 auto !important;
}

.content-section {
  margin-bottom: 3rem !important;
}

.section-title {
  font-size: 1.75rem !important;
  font-weight: 800 !important;
  letter-spacing: -0.02em !important;
  margin-bottom: 1.5rem !important;
  color: var(--text-primary) !important;
  font-family: var(--font-family-heading) !important;
}

/* --- PARTICLE-STYLE SIDEBAR --- */
.sidebar-card {
  background: var(--bg-primary) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: 12px !important;
  padding: 1.5rem !important;
  margin-bottom: 1.5rem !important;
}

.sidebar-card-header {
  font-size: 1rem !important;
  font-weight: 700 !important;
  margin-bottom: 1.25rem !important;
  padding-bottom: 0.75rem !important;
  border-bottom: 1px solid var(--border-subtle) !important;
  font-family: var(--font-family-heading) !important;
}

.trending-news-item {
  padding: 0.75rem 0 !important;
  border-bottom: 1px solid var(--border-subtle) !important;
  transition: all 0.2s ease !important;
}

.trending-news-item:last-child {
  border-bottom: none !important;
}

.trending-news-link:hover {
  background: var(--bg-hover) !important;
  border-radius: 8px !important;
  padding: 0.75rem !important;
  margin: 0 -0.75rem !important;
}

.trending-rank {
  width: 24px !important;
  height: 24px !important;
  font-size: 0.75rem !important;
  background: var(--logo-color) !important;
  color: #ffffff !important;
  border-radius: 6px !important;
}

/* --- READING TIME STYLING --- */
.reading-time {
  font-size: 0.75rem !important;
  color: var(--text-muted) !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.25rem !important;
  margin-left: 0.5rem !important;
}

.reading-time i {
  font-size: 0.7rem !important;
}

/* --- ARTICLE COUNT BADGE --- */
.article-count-badge {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 20px !important;
  height: 20px !important;
  padding: 0 0.5rem !important;
  background: var(--accent-color) !important;
  color: #ffffff !important;
  border-radius: 10px !important;
  font-size: 0.7rem !important;
  font-weight: 700 !important;
  margin-left: 0.5rem !important;
}

/* --- REMOVE EXCESSIVE ANIMATIONS FOR POLISH --- */
.news-card {
  transform: none !important;
}

.news-card:hover {
  transform: translateY(-4px) !important;
}

/* --- ENSURE CLICKABLE AREAS --- */
.card-link-wrapper,
.news-card {
  cursor: pointer !important;
}

/* --- FIX Z-INDEX FOR CLICKABLE ELEMENTS --- */
.card-link-wrapper {
  position: relative !important;
  z-index: 1 !important;
}

.news-actions {
  position: relative !important;
  z-index: 2 !important;
  background: var(--bg-primary) !important;
}

/* --- SMOOTH PAGE TRANSITIONS --- */
.page-container {
  animation: fadeIn 0.3s ease-out !important;
}

/* --- RESPONSIVE REFINEMENTS --- */
@media (max-width: 768px) {
  .card-content-wrapper {
    padding: 1.25rem !important;
  }

  .news-actions {
    padding: 0.75rem 1.25rem 1.25rem !important;
  }

  .news-title {
    font-size: 1.1rem !important;
  }
}

