/* CSS Variables for theming - Glance-inspired neutral UI */
:root {
  /* Background colors */
  --bg-primary: #F6F7F9;
  --bg-secondary: #FAFBFC;
  --bg-card: #FFFFFF;
  --bg-card-hover: #FAFBFC;
  --bg-input: #FFFFFF;

  /* Text colors */
  --text-primary: #1F2937;
  --text-secondary: #374151;
  --text-muted: #6B7280;
  --text-dim: #9CA3AF;
  --text-tertiary: #D1D5DB;

  /* Accent colors (used sparingly) */
  --accent-primary: #3B82F6;
  --accent-secondary: #2DD4BF;
  --accent-link: #3B82F6;
  --accent-amber: #F59E0B;
  --accent-red: #EF4444;

  /* Border colors */
  --border-color: #E5E7EB;
  --border-subtle: #F3F4F6;

  /* Typography scale */
  --font-size-xs: 10px;
  --font-size-sm: 12px;
  --font-size-base: 14px;
  --font-size-md: 14px;
  --font-size-lg: 18px;
  --font-size-xl: 22px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.1);

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 12px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;

  /* Recency-based colors */
  --recency-today: #3b82f6;
  --recency-week: #60a5fa;
  --recency-month: #93c5fd;
  --recency-old: #9ca3af;
}

/* Dark theme */
[data-theme="dark"] {
  /* Background colors */
  --bg-primary: #0f0f0f;
  --bg-secondary: #1a1a1a;
  --bg-card: #1a1a1a;
  --bg-card-hover: #252525;
  --bg-input: #252525;

  /* Text colors */
  --text-primary: #f0f0f0;
  --text-secondary: #c0c0c0;
  --text-muted: #888888;
  --text-dim: #666666;
  --text-tertiary: #555555;

  /* Border colors */
  --border-color: #2a2a2a;
  --border-subtle: #252525;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* Dark theme - no card backgrounds, only borders */

/* Reset and base styles */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Screen reader only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Sticky Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 16px 20px;
}

.header-content {
  width: 100%;
  padding: 0 20px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

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

.header-center {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.header-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo h1 {
  font-size: var(--font-size-xl);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.logo-icon {
  width: 24px;
  height: 24px;
  color: var(--accent-primary);
  flex-shrink: 0;
}

/* Header Tabs */
.header-tabs {
  display: flex;
  gap: 8px;
  align-items: center;
}

.header-tab {
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-radius: 8px;
  font-size: var(--font-size-base);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
  white-space: nowrap;
}

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

.header-tab.active {
  background: var(--accent-primary);
  color: white;
}

.live-loading-status {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  min-height: 18px;
  text-align: center;
  user-select: none;
}

.live-loading-status.complete {
  color: var(--accent-secondary);
}

/* Theme Toggle */
.theme-toggle {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-primary);
  border-radius: 8px;
}

.theme-btn {
  padding: 6px 10px;
  background: transparent;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-btn:hover {
  background: var(--bg-card);
}

.theme-btn.active {
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

/* Hamburger Button (Mobile Only) */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 36px;
  height: 36px;
  padding: 6px;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  margin-left: 12px;
}

.hamburger-btn:hover {
  background: var(--bg-primary);
}

.hamburger-line {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-primary);
  border-radius: 1px;
  transition: all var(--transition-fast);
}

.hamburger-btn.active .hamburger-line:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.hamburger-btn.active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.hamburger-btn.active .hamburger-line:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* Mobile Theme Button */
.mobile-theme-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
}

.mobile-theme-btn:hover {
  background: var(--bg-card-hover);
}

/* Mobile Navigation Dropdown */
.mobile-nav-dropdown {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-normal), padding var(--transition-normal);
}

.mobile-nav-dropdown.active {
  display: flex;
  max-height: 300px;
  padding: 12px;
}

.mobile-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-radius: 8px;
  font-size: var(--font-size-base);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: all var(--transition-fast);
  font-family: inherit;
}

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

.mobile-nav-item.active {
  background: var(--accent-primary);
  color: white;
}

/* Mobile Theme Dropdown */
.mobile-theme-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 12px;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  z-index: 200;
}

.mobile-theme-dropdown.active {
  display: flex;
}

.mobile-theme-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-radius: 6px;
  font-size: var(--font-size-base);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.mobile-theme-option:hover {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.mobile-theme-option.active {
  background: var(--accent-primary);
  color: white;
}

/* Mobile Responsive - Hide desktop elements, show mobile */
@media (max-width: 768px) {

  .desktop-tabs,
  .desktop-theme,
  .desktop-title {
    display: none !important;
  }

  .hamburger-btn,
  .mobile-theme-btn {
    display: flex;
  }

  .header {
    padding: 12px 16px;
    position: relative;
  }

  .header-content {
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 12px;
    align-items: center;
    position: relative !important;
    /* For absolute centering */
  }

  .header-left {
    flex: 0 1 auto;
    /* Allow shrink but stay left */
    justify-content: flex-start;
  }

  /* Center the hamburger absolutely */
  .hamburger-btn {
    display: flex;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    margin: 0 !important;
  }

  .header-center {
    display: none;
  }

  .header-right {
    flex: 0 1 auto;
    justify-content: flex-end;
  }

  .logo-icon {
    width: 28px;
    height: 28px;
  }
}

/* Main Container */
.main-container {
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px;
}

/* Section Headers */
.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.section-header h2 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.section-badge {
  background: var(--accent-primary);
  color: white;
  font-size: var(--font-size-sm);
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Section Content - Centered */
/* Section Content - Full Width */
.section-content {
  width: 100%;
  margin: 0 auto;
  padding: 20px;
}

/* Feed Grid */
.feed-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  gap: 16px;
  margin-bottom: 40px;
}

/* Timeline Mode Modifier for Grid */
.feed-grid.timeline-mode {
  display: block;
  /* Override grid layout */
  width: 100%;
}

.feed-grid.timeline-mode .feed-card {
  display: none;
  /* Ensure remnants are hidden */
}

/* Feed Card */
.feed-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow var(--transition-normal);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

/* No colored left border on cards */

.feed-card:hover {
  box-shadow: var(--shadow-md);
}

.feed-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
  gap: 12px;
}

.feed-card-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Feed card clickable title */
.feed-card-title-link {
  color: inherit;
  text-decoration: none;
}

.feed-card-title-link:hover {
  text-decoration: underline;
}

.feed-card-title {
  font-weight: 600;
  font-size: var(--font-size-md);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed-card-count {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  background: var(--bg-primary);
  padding: 3px 10px;
  border-radius: 12px;
}

/* Feed Items List */
.feed-items {
  list-style: none;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.feed-item {
  border-bottom: 1px solid var(--border-subtle);
  flex: 1;
  display: flex;
}

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

.feed-item-link {
  display: flex;
  gap: 12px;
  padding: 14px 18px;
  text-decoration: none;
  color: inherit;
  transition: background var(--transition-fast);
  width: 100%;
}

.feed-item-link:hover {
  background: var(--bg-card-hover);
}

.feed-item-thumbnail {
  width: 120px;
  height: 68px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  background: var(--bg-primary);
}

.feed-item-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.feed-item-title {
  font-size: var(--font-size-md);
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 6px;
  transition: color var(--transition-fast);
}

.feed-item-link:hover .feed-item-title {
  color: var(--accent-link);
}

.feed-item-text {
  font-size: var(--font-size-base);
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.feed-item-meta {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

/* Article-level recency colors - cascade to all text elements */
.feed-item.recency-today .feed-item-title,
.feed-item.recency-today .feed-item-text,
.feed-item.recency-today .feed-item-meta {
  color: var(--recency-today);
}

.feed-item.recency-today .feed-item-title {
  font-weight: 600;
}

.feed-item.recency-week .feed-item-title,
.feed-item.recency-week .feed-item-text,
.feed-item.recency-week .feed-item-meta {
  color: var(--recency-week);
}

.feed-item.recency-month .feed-item-title,
.feed-item.recency-month .feed-item-text,
.feed-item.recency-month .feed-item-meta {
  color: var(--recency-month);
}

.feed-item.recency-old .feed-item-title,
.feed-item.recency-old .feed-item-text,
.feed-item.recency-old .feed-item-meta {
  color: var(--recency-old);
  opacity: 0.8;
}

/* Loading State */
.feed-card.loading .feed-items {
  padding: 24px 18px;
}

.loading-skeleton {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skeleton-line {
  height: 14px;
  background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-primary) 50%, var(--bg-secondary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

.skeleton-line:nth-child(1) {
  width: 80%;
}

.skeleton-line:nth-child(2) {
  width: 60%;
}

.skeleton-line:nth-child(3) {
  width: 70%;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* Error State */
.feed-card.error .feed-card-header {
  border-bottom-color: rgba(239, 68, 68, 0.2);
}

.error-message {
  padding: 20px 18px;
  text-align: center;
  color: var(--text-muted);
  font-size: var(--font-size-md);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: var(--font-size-md);
}

/* Footer */
.footer {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-muted);
  font-size: var(--font-size-base);
  border-top: 1px solid var(--border-color);
  margin-top: 40px;
}

.footer a {
  color: var(--accent-link);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* Responsive Design - Tablet */
@media (min-width: 768px) {
  .feed-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

/* Responsive Design - Mobile */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 12px;
  }

  .header-left,
  .header-center,
  .header-right {
    width: 100%;
    justify-content: center;
  }

  .header-left {
    order: 1;
  }

  .header-center {
    order: 2;
  }

  .header-right {
    order: 3;
  }

  .header-tabs {
    width: 100%;
    justify-content: center;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .logo {
    justify-content: center;
  }

  .logo h1 {
    font-size: var(--font-size-lg);
  }
}

/* Responsive Design - Desktop */
@media (min-width: 1200px) {
  .feed-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .main-container {
    padding: 32px 24px;
  }

  .header {
    padding: 16px 24px;
  }
}



/* Focus states for accessibility */
.feed-item-link:focus-visible,
.search-input:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

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

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

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* Load More Button in Card Header (Pill Style) */
.load-more-btn {
  background: var(--accent-primary);
  color: white;
  border: none;
  padding: 4px 12px;
  border-radius: 16px;
  cursor: pointer;
  font-size: var(--font-size-xs);
  font-weight: 500;
  transition: all var(--transition-fast);
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
}

.load-more-btn:hover {
  background: #2563eb;
  transform: scale(1.05);
}

.load-more-btn:active {
  transform: scale(0.98);
}

/* Footer removed - Load More button now in header */

/* Offline Section */
.offline-section {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 2px solid var(--border-color);
}

.offline-section .section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 12px 0;
  user-select: none;
}

.offline-section .section-header:hover {
  opacity: 0.8;
}

.offline-card {
  opacity: 0.7;
  border-color: var(--accent-red);
}

.offline-card .feed-card-header {
  background: rgba(239, 68, 68, 0.05);
}



/* Sections Container */
.sections-container {
  overflow: hidden;
  position: relative;
  max-width: 1400px;
  margin: 0 auto;
}

/* Floating view toggle FAB */
.view-fab {
  position: fixed;
  right: 18px;
  bottom: 22px;
  z-index: 950;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--accent-primary);
  color: #fff;
  box-shadow: var(--shadow-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), filter var(--transition-fast);
}

.view-fab:hover {
  transform: translateY(-1px) scale(1.04);
  filter: brightness(1.05);
}

.view-fab:active {
  transform: scale(0.96);
}

.view-fab:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.sections-wrapper {
  display: flex;
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
  /* Hardware acceleration for 60fps */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.section {
  min-width: 100%;
  width: 100%;
  flex-shrink: 0;
  display: none;
}

.section.active {
  display: block;
}

.section-content {
  padding: 24px 20px;
  min-height: 50vh;
}

/* Touch indicators for swipe */
.sections-container.swiping {
  cursor: grabbing;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 200ms ease-out;
}

.modal-overlay.active {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  max-width: 700px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 250ms ease-out;
  /* Hardware acceleration for smooth animations */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  will-change: transform, opacity;
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  transition: color var(--transition-fast);
  border-radius: 4px;
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-primary);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.modal-body .feed-items {
  list-style: none;
}

.modal-body .feed-item {
  border-bottom: 1px solid var(--border-subtle);
}

.modal-body .feed-item:last-child {
  border-bottom: none;
}

.modal-loading {
  padding: 30px;
  text-align: center;
  color: var(--text-muted);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 16px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

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

/* Offline Feeds Section Styles */
.offline-section {
  max-width: 1400px;
  margin: 40px auto 0;
  padding: 0 20px;
  border-top: 2px solid var(--border-color);
  padding-top: 20px;
}

.offline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  user-select: none;
  transition: background var(--transition-fast);
}

.offline-header:hover {
  background: var(--bg-primary);
}

.offline-header h2 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.offline-content {
  display: none;
  padding-top: 16px;
}

.offline-content.expanded {
  display: block;
}

.collapse-indicator {
  font-size: 12px;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}

.offline-content.expanded~.offline-header .collapse-indicator,
.offline-header.expanded .collapse-indicator {
  transform: rotate(180deg);
}

/* Mobile optimizations */
@media (max-width: 639px) {
  .view-fab {
    right: 14px;
    bottom: 16px;
    width: 52px;
    height: 52px;
    font-size: 22px;
  }

  .section-content {
    padding: 16px 12px;
  }

  .modal {
    max-height: 90vh;
    margin: 10px;
  }

  .modal-header {
    padding: 16px 20px;
  }

  .header-tab {
    padding: 6px 12px;
    font-size: var(--font-size-sm);
  }
}

/* Desktop optimizations */
@media (min-width: 1024px) {
  .sections-container {
    padding: 0 24px;
  }

  .section-content {
    padding: 32px 0;
  }
}

/* Prevent scroll chaining on modal */
.modal-overlay.active {
  overscroll-behavior: contain;
}

body.modal-open {
  overflow: hidden;
}

/* Touch feedback */
@media (hover: none) and (pointer: coarse) {
  .tab-btn:active {
    transform: scale(0.96);
  }

  .modal-close:active {
    transform: scale(0.9);
  }

  .feed-item-link:active {
    background: var(--bg-primary);
  }
}

/* Timeline View Styles - Day Grouped */
.timeline-container {
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Day Group Container */
.timeline-day-group {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* Day Header */
.timeline-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.timeline-day-label {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.timeline-day-count {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

/* Day group recency colors */
.timeline-day-group.recency-today .timeline-day-label {
  color: var(--recency-today);
}

.timeline-day-group.recency-week .timeline-day-label {
  color: var(--recency-week);
}

.timeline-day-group.recency-month .timeline-day-label {
  color: var(--recency-month);
}

/* Horizontal scrollable articles row */
/* Multi-row grid layout for articles */
/* Global Loader */
#global-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-primary);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity var(--transition-normal);
}

.loader-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

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

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

.timeline-day-articles {
  width: 100%;
  /* Ensure full width usage */
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 16px;
}

/* Responsive grid adjustments */
@media (max-width: 1200px) {
  .timeline-day-articles {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  .timeline-day-articles {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .timeline-day-articles {
    grid-template-columns: 1fr;
  }
}

/* Timeline Item (Compact Card) */
.timeline-item {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-fast), transform var(--transition-fast);
  display: flex;
  flex-direction: column;
}

.timeline-item:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.timeline-item-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
  color: inherit;
  transition: background var(--transition-fast);
}

.timeline-item-link:hover {
  background: var(--bg-card-hover);
}

.timeline-item-thumbnail {
  width: 100%;
  height: 140px;
  object-fit: cover;
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.timeline-item-content {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.timeline-item-title {
  font-size: var(--font-size-md);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  transition: color var(--transition-fast);
}

.timeline-item-link:hover .timeline-item-title {
  color: var(--accent-link);
}



.timeline-item-text {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.timeline-item-meta {
  font-size: var(--font-size-xs);
  color: var(--text-dim);
}

/* Timeline item recency colors - cascade to all text elements */
.timeline-item.recency-today .timeline-item-title,
.timeline-item.recency-today .timeline-item-text,
.timeline-item.recency-today .timeline-item-meta {
  color: var(--recency-today);
}

.timeline-item.recency-today .timeline-item-title {
  font-weight: 600;
}

.timeline-item.recency-week .timeline-item-title,
.timeline-item.recency-week .timeline-item-text,
.timeline-item.recency-week .timeline-item-meta {
  color: var(--recency-week);
}

.timeline-item.recency-month .timeline-item-title,
.timeline-item.recency-month .timeline-item-text,
.timeline-item.recency-month .timeline-item-meta {
  color: var(--recency-month);
}

.timeline-item.recency-old .timeline-item-title,
.timeline-item.recency-old .timeline-item-text,
.timeline-item.recency-old .timeline-item-meta {
  color: var(--recency-old);
  opacity: 0.8;
}

/* Timeline empty state */
.timeline-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.timeline-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.timeline-empty h3 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.timeline-empty p {
  font-size: var(--font-size-md);
}

/* Timeline mobile styles */
@media (max-width: 640px) {
  .timeline-item-link {
    flex-direction: column;
    gap: 12px;
  }

  .timeline-item-thumbnail {
    width: 100%;
    height: 180px;
  }
}