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

/* THEME VARIABLES */
:root {
  --bg: #f7f8fa;
  --card-bg: rgba(255, 255, 255, 0.9);
  --text: #1a1a1a;
  --text-soft: #555;
  --border: #e5e7eb;
  --accent: #2A6CF0;
  --accent-soft: rgba(42, 108, 240, 0.12);
  --ad-bg: #f3f4f6;

  --reader-bg: #ffffff;
  --reader-text: #1a1a1a;

  --shimmer-bg: #e6e8eb;
  --shimmer-highlight: #f5f6f7;
}

/* DARK THEME BASE */
[data-theme="dark"] {
  --bg: #0f1115;
  --card-bg: rgba(20, 22, 28, 0.96);
  --text: #f3f4f6;
  --text-soft: #cbd5f5;
  --border: #2a2d33;
  --accent: #7ea6ff;
  --accent-soft: rgba(126, 166, 255, 0.35);
  --ad-bg: #111827;

  --reader-bg: #1a1d24;
  --reader-text: #e5e7eb;

  --shimmer-bg: #1f232b;
  --shimmer-highlight: #2a2f38;
}

/* ACCENT THEMES */
[data-theme-accent="default"] {
  --accent: #2A6CF0;
  --accent-soft: rgba(42, 108, 240, 0.12);
}

[data-theme-accent="sunrise"] {
  --accent: #f97316;
  --accent-soft: rgba(249, 115, 22, 0.18);
}

[data-theme-accent="forest"] {
  --accent: #16a34a;
  --accent-soft: rgba(22, 163, 74, 0.18);
}

[data-theme-accent="midnight"] {
  --accent: #6366f1;
  --accent-soft: rgba(99, 102, 241, 0.22);
}

/* BASE */
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: radial-gradient(circle at top, #eef2ff 0, var(--bg) 40%);
  color: var(--text);
  line-height: 1.6;
  padding-bottom: 140px;
  transition: background 0.25s ease, color 0.25s ease;
}

/* COMPACT MODE */
body.compact .rss-container {
  gap: 12px;
}

body.compact .news-item {
  padding: 10px 12px;
}

body.compact .news-item h2 {
  font-size: 0.96rem;
}

/* HEADER */
.site-header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 25px 20px;
  text-align: center;
}

/* NAV */
.nav-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

.nav-bar a {
  text-decoration: none;
  color: var(--text-soft);
  font-weight: 600;
  font-size: 0.95rem;
}

.nav-bar a.active {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
}

.nav-spacer {
  flex: 1;
}

/* NAV META (v0.9.9) */
.nav-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-right: 12px;
  font-size: 0.8rem;
  color: var(--text-soft);
  white-space: nowrap;
}

.nav-last-updated {
  font-weight: 500;
}

.nav-refresh {
  opacity: 0.8;
}

/* NAV META RESPONSIVE */
@media (max-width: 1200px) {
  .nav-meta {
    display: none;
  }
}

.search-input {
  min-width: 180px;
  max-width: 260px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.7);
  outline: none;
}

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

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
  background: #fff;
}

/* Dark-mode search */
[data-theme="dark"] .search-input {
  background: rgba(15, 17, 21, 0.95);
  color: var(--text);
  border-color: var(--border);
}

[data-theme="dark"] .search-input::placeholder {
  color: var(--text-soft);
}

/* NO RESULTS (v0.10.0) */
.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-soft);
}

.no-results p {
  font-size: 1.1rem;
  margin-bottom: 20px;
}

.clear-search-btn {
  padding: 10px 24px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--accent-soft);
  color: var(--accent);
  cursor: pointer;
  font-weight: 600;
}

.clear-search-btn:hover {
  background: var(--accent);
  color: white;
}

/* TOGGLES */
.theme-toggle,
.compact-toggle,
.settings-toggle {
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text);
}

.compact-toggle.active,
.toggle-pill.active {
  background: var(--accent-soft);
  color: var(--accent);
}

/* CONTENT */
.content {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 20px;
}

/* DESKTOP LAYOUT */
@media (min-width: 1024px) {
  .layout-desktop {
    display: grid;
    grid-template-columns: 260px 1fr 320px 260px;
    gap: 28px;
    align-items: start;
    height: auto;
  }

  .top-stories-rail {
    position: static !important;
    display: flex;
    flex-direction: column;
    height: 100%;
  }

  .top-stories-rail .rail-inner {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
  }
}

/* Rails stretch full height */
.left-rail,
.top-stories-rail,
.right-rail {
  position: static !important;
  align-self: stretch;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Only the inner content is sticky */
.rail-inner {
  position: sticky;
  top: 72px;
  bottom: 140px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* TOP STORIES RAIL - COMPACT FIXED HEIGHT (v0.11.1) */
@media (min-width: 1024px) {
  .top-stories-rail .rail-inner {
    height: calc(100vh - 72px - 140px);
    max-height: calc(100vh - 72px - 140px);
    min-height: 400px;
    overflow-y: auto;
    bottom: auto;
    padding: 16px;
  }

  /* Other rails maintain natural height */
  .left-rail .rail-inner,
  .right-rail .rail-inner {
    height: auto;
    max-height: none;
    overflow-y: visible;
    bottom: 140px;
  }

  /* Smooth scrollbar for top stories only */
  .top-stories-rail .rail-inner::-webkit-scrollbar {
    width: 6px;
  }

  .top-stories-rail .rail-inner::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
  }
}

/* UNIFIED SECTION SIZING - ALL 3 TILES EQUAL (v0.11.1) */
.top-stories-rail .rail-inner > * {
  flex-shrink: 0;
}

/* Top Stories - compact */
#top-stories {
  max-height: 120px;
  overflow-y: auto;
  margin-bottom: 12px;
}

/* Trending in Feed - compact */
#trending-feed {
  max-height: 100px;
  overflow-y: auto;
  margin-bottom: 12px;
}

/* Saved Articles - compact */
#saved-articles {
  max-height: 80px;
  overflow-y: auto;
  margin-bottom: 0;
}

/* Consistent scrollbar styling for all 3 sections */
#top-stories::-webkit-scrollbar,
#trending-feed::-webkit-scrollbar,
#saved-articles::-webkit-scrollbar {
  width: 4px;
}

#top-stories::-webkit-scrollbar-thumb,
#trending-feed::-webkit-scrollbar-thumb,
#saved-articles::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* Section headers - tighter spacing (v0.11.1) */
.top-stories-rail h3,
.top-stories-rail .analytics-header,
.top-stories-rail .saved-header {
  font-size: 0.9rem;
  margin-bottom: 8px;
  margin-top: 0;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

/* First h3 (after ad) no top margin */
.top-stories-rail .rail-inner > h3:first-of-type {
  margin-top: 12px;
}

/* Mobile: Reset top stories dynamic height */
@media (max-width: 1023px) {
  .top-stories-rail .rail-inner {
    height: auto;
    max-height: none;
    min-height: auto;
    overflow-y: visible;
    padding-top: 14px;
    padding-bottom: 14px;
  }

  #top-stories,
  #trending-feed,
  #saved-articles {
    max-height: none;
    overflow-y: visible;
  }

  .nav-meta {
    display: none;
  }
}

/* REGIONS DROPDOWN (v0.10.5) */
.nav-dropdown {
  position: relative;
  display: inline-block;
}

.nav-dropdown-toggle {
  background: none;
  border: none;
  color: var(--text-soft);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-dropdown-toggle:hover {
  color: var(--accent);
}

.nav-dropdown-toggle::after {
  content: "▼";
  font-size: 0.7rem;
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 0;
  min-width: 160px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.15);
  z-index: 100;
  display: none;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.active .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-menu a {
  display: block;
  padding: 8px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
}

.nav-dropdown-menu a:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-dropdown-menu a.active {
  color: var(--accent);
  font-weight: 600;
}

/* Mobile: Convert dropdown to scrollable row */
@media (max-width: 1023px) {
  .nav-dropdown {
    position: static;
  }

  .nav-dropdown-toggle::after {
    display: none;
  }

  .nav-dropdown-menu {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
    background: none;
    border: none;
    box-shadow: none;
  }

  .nav-dropdown-menu a {
    padding: 4px 12px;
    background: var(--bg);
    border-radius: 999px;
    border: 1px solid var(--border);
  }
}

/* MAP PLACEHOLDER ENHANCED (v0.10.5) */
.map-placeholder {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, var(--ad-bg) 0%, var(--bg) 100%);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  font-size: 0.9rem;
  text-align: center;
  gap: 8px;
  border: 2px dashed var(--border);
}

.map-placeholder div:first-child {
  font-size: 2.5rem;
  opacity: 0.8;
}

.map-placeholder small {
  opacity: 0.7;
}

/* LEFT RAIL */
.left-rail {
  position: static !important;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.lr-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.lr-card h3 {
  margin-bottom: 10px;
  font-size: 1rem;
}

/* WEATHER WIDGET (v0.9.8) */
.weather-loading {
  color: var(--text-soft);
  font-size: 0.9rem;
}

.weather-content {
  text-align: center;
}

.weather-temp {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
}

.weather-desc {
  font-size: 0.9rem;
  color: var(--text-soft);
  text-transform: capitalize;
  margin-bottom: 8px;
}

.weather-location {
  font-size: 0.8rem;
  color: var(--text-soft);
}

.weather-error {
  color: #ef4444;
  font-size: 0.85rem;
}

/* WEATHER LOCATION SELECTOR (v0.10.0) */
.weather-location-selector {
  margin-bottom: 12px;
}

.weather-location-selector select {
  width: 100%;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
}

.weather-location-selector select:focus {
  border-color: var(--accent);
  outline: none;
}

[data-theme="dark"] .weather-location-selector select {
  background: rgba(15, 17, 21, 0.6);
  color: var(--text);
}

.weather-location-name {
  font-size: 0.8rem;
  color: var(--text-soft);
  margin-top: 4px;
}

/* TIMEZONE ROWS (v0.9.9) */
.tz-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  line-height: 1.4;
}

.tz-row:last-child {
  border-bottom: none;
}

.tz-city {
  color: var(--text-soft);
  font-weight: 500;
}

.tz-time {
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

[data-theme="dark"] .tz-time {
  color: var(--accent);
}

/* QUICK LINKS (v0.9.8) */
.quick-link-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 10px;
}

.quick-link-input-wrap input {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  background: var(--bg);
  color: var(--text);
  margin-bottom: 6px;
}

.quick-link-input-wrap input:last-of-type {
  margin-bottom: 8px;
}

.quick-link-input-wrap button {
  width: 100%;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--accent-soft);
  color: var(--accent);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
}

.quick-link-input-wrap button:hover {
  background: var(--accent);
  color: white;
}

[data-theme="dark"] .quick-link-input-wrap input {
  background: rgba(15, 17, 21, 0.6);
  border-color: var(--border);
  color: var(--text);
}

#quickLinksList {
  margin-bottom: 10px;
}

.quick-link-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

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

.quick-link-item a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

.quick-link-item a:hover {
  text-decoration: underline;
}

.quick-link-delete {
  background: none;
  border: none;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0 4px;
  line-height: 1;
}

.quick-link-delete:hover {
  color: #ef4444;
}

/* Empty state text */
#quickLinksList p,
#saved-articles p,
#trending-feed p {
  margin: 0;
  padding: 8px 0;
  color: var(--text-soft);
  font-size: 0.85rem;
}

/* RIGHT RAIL - MATCH TOP STORIES PADDING (v0.11.1) */
.right-rail {
  position: static !important;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.right-rail .rail-inner {
  position: sticky;
  top: 72px;
  bottom: 140px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
}

.rr-placeholder {
  background: var(--card-bg);
  border: 1px dashed var(--border);
  padding: 20px;
  border-radius: 14px;
  text-align: center;
  color: var(--text-soft);
}

/* RIGHT RAIL CARDS - CONSISTENT PADDING (v0.11.1) */
.rr-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.rr-card h3 {
  font-size: 0.95rem;
  margin-bottom: 12px;
  margin-top: 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* WEATHER MAP CONTAINER (v0.10.0) */
.map-container {
  width: 100%;
  height: 200px;
  background: var(--ad-bg);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

/* MAP CONTAINER - FIXED HEIGHT (v0.11.1) */
#rr-map .map-container {
  height: 160px;
  min-height: 160px;
}

.map-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  font-size: 0.9rem;
}

/* VIDEO RAIL */
.video-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* VIDEO RAIL - FIXED HEIGHT (v0.11.1) */
#rr-videos .video-list {
  max-height: 180px;
  overflow-y: auto;
}

.video-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.video-thumb {
  width: 100px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--shimmer-bg);
}

.video-info a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
}

.video-info a:hover {
  text-decoration: underline;
}

.video-source {
  font-size: 0.75rem;
  color: var(--text-soft);
  margin-top: 2px;
}

/* AI SUMMARY - ABSOLUTE POSITION APPROACH (v0.11.3) */
#rr-ai-summary {
  max-height: 200px;
  height: 200px;
  position: relative;
  overflow: hidden;
  padding-top: 44px;
}

.ai-summary-header {
  position: absolute;
  top: 0;
  left: 16px;
  right: 16px;
  height: 36px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  background: var(--card-bg);
}

.ai-summary-header h3 {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1;
}

.ai-summary-timestamp {
  font-size: 0.75rem;
  color: var(--text-soft);
  line-height: 1;
}

#rr-ai-summary .ai-summary-body {
  height: 100%;
  overflow-y: auto;
  padding-right: 4px;
}

#rr-ai-summary .ai-summary-body p {
  margin: 0 0 8px 0;
  font-size: 0.9rem;
  line-height: 1.4;
}

#rr-ai-summary .ai-summary-body ul {
  margin: 0;
  padding-left: 16px;
}

#rr-ai-summary .ai-summary-body li {
  margin-bottom: 4px;
  font-size: 0.85rem;
  line-height: 1.3;
}

/* AI Summary scrollbar styling */
#rr-ai-summary .ai-summary-body::-webkit-scrollbar {
  width: 6px;
}

#rr-ai-summary .ai-summary-body::-webkit-scrollbar-track {
  background: transparent;
}

#rr-ai-summary .ai-summary-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

#rr-ai-summary.hidden {
  display: none !important;
}

/* TRENDING IN FEED (v0.9.8) */
.trending-feed-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

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

.trending-feed-rank {
  font-weight: 700;
  color: var(--accent);
  font-size: 0.85rem;
  min-width: 20px;
}

.trending-feed-title {
  font-size: 0.85rem;
  color: var(--text);
  text-decoration: none;
  line-height: 1.4;
}

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

/* MOBILE LAYOUT */
@media (max-width: 1023px) {
  .layout-desktop {
    display: block;
  }

  .rail-inner {
    top: 70px;
  }

  .top-stories-rail {
    position: static !important;
    margin-top: 20px;
  }

  .top-stories-rail .rail-inner {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
  }

  .right-rail .rail-inner {
    padding: 14px;
  }

  /* Mobile: reset AI summary fixed heights */
  #rr-ai-summary {
    max-height: none;
    height: auto;
    position: static;
    padding-top: 0;
    overflow: visible;
  }

  .ai-summary-header {
    position: static;
    height: auto;
    padding-bottom: 8px;
    margin-bottom: 8px;
  }

  #rr-ai-summary .ai-summary-body {
    height: auto;
    overflow-y: visible;
  }

  .search-input {
    max-width: 180px;
  }
}

/* FEED META */
.feed-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-soft);
  margin-bottom: 8px;
}

[data-theme="dark"] .feed-meta {
  color: #d7dbff;
}

.loading-indicator {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.loading-indicator.visible {
  opacity: 1;
}

/* SOURCE FILTER CHIPS */
.source-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 0.8rem;
}

.source-chip {
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 2px 10px;
  background: transparent;
  cursor: pointer;
  color: var(--text);
  opacity: 0.8;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.source-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  opacity: 1;
}

.source-chip.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
  opacity: 1;
}

/* TRENDING KEYWORDS */
.trending-keywords {
  font-size: 0.85rem;
  color: var(--text-soft);
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.trending-label {
  font-weight: 600;
}

[data-theme="dark"] .trending-label {
  color: #e0e4ff;
}

.trending-chip {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.trending-chip:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-1px);
}

/* TWO-COLUMN FEED */
.rss-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

/* NEWS CARDS */
.news-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 14px 12px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  animation: fadeIn 0.25s ease;
  position: relative;
}

.news-item h2 {
  font-size: 1.02rem;
  margin-bottom: 4px;
  line-height: 1.35;
  display: flex;
  align-items: center;
  gap: 6px;
}

.news-item h2 a {
  color: var(--text);
  text-decoration: none;
}

.news-item h2 a:hover {
  text-decoration: underline;
}

.news-date {
  font-size: 0.78rem;
  color: var(--text-soft);
  margin-bottom: 6px;
}

.news-desc {
  font-size: 0.88rem;
  color: var(--text-soft);
  margin-bottom: 8px;
}

/* AUTO-SUMMARY */
.auto-summary {
  display: none;
}

/* BOOKMARK ICON */
.bookmark-icon {
  cursor: pointer;
  font-size: 1.1rem;
  margin-left: auto;
  color: var(--text-soft);
  transition: color 0.15s ease, transform 0.15s ease;
}

.bookmark-icon:hover {
  color: var(--accent);
  transform: scale(1.1);
}

.bookmark-icon.saved {
  color: var(--accent);
}

/* SAVED ARTICLES */
#saved-articles {
  margin-bottom: 0;
}

.saved-article-item {
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.saved-article-item a {
  color: var(--accent);
  text-decoration: none;
}

.saved-article-item a:hover {
  text-decoration: underline;
}

/* SHIMMER */
.shimmer-card {
  height: 140px;
  border-radius: 14px;
  background: var(--shimmer-bg);
  position: relative;
  overflow: hidden;
  margin-bottom: 10px;
}

.shimmer-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: -150px;
  width: 150px;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    var(--shimmer-highlight),
    transparent
  );
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  0% { left: -150px; }
  100% { left: 100%; }
}

/* IMAGES */
.news-image {
  width: 100%;
  max-height: 180px;
  height: 180px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 8px;
  display: block;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.news-image.loaded {
  opacity: 1;
}

/* INFINITE SCROLL LOADING */
#scroll-loading {
  display: none;
  margin-top: 16px;
}

#scroll-loading.visible {
  display: block;
}

/* TOP STORIES */
.top-story-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.top-story-bullet {
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
  margin-top: 6px;
  opacity: 0.9;
}

.top-story-content a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.86rem;
}

.top-story-content a:hover {
  text-decoration: underline;
}

/* ANALYTICS (DEPRECATED) */
.analytics-count,
.top-source-count {
  color: var(--accent);
  font-weight: 600;
  margin-left: 4px;
}

.top-source-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

/* ADS */
.ad-card {
  background: var(--ad-bg);
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 20px;
  text-align: center;
}

.ad-label {
  font-size: 0.75rem;
  color: var(--text-soft);
  margin-bottom: 6px;
}

/* INLINE AD */
.ad-inline-card {
  background: var(--ad-bg);
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
  font-size: 0.85rem;
}

/* Sticky bottom ad */
.bottom-ad-banner {
  position: sticky;
  bottom: 0;
  z-index: 60;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  padding: 12px 20px;
}

.bottom-ad-inner {
  max-width: 1200px;
  margin: 0 auto;
}

/* READER MODE */
.reader-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
  z-index: 200;
}

.reader-modal.open {
  display: flex;
}

.reader-modal-content {
  background: var(--reader-bg);
  color: var(--reader-text);
  max-width: 720px;
  width: 100%;
  padding: 30px;
  border-radius: 16px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

.reader-close {
  float: right;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--reader-text);
}

.reader-original-link {
  display: inline-block;
  margin-top: 20px;
  font-size: 0.95rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.reader-original-link:hover {
  text-decoration: underline;
}

/* READER BUTTON */
.reader-btn {
  margin-top: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text-soft);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.reader-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* SETTINGS PANEL */
.settings-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 140;
}

.settings-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

.settings-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  max-width: 100%;
  height: 100%;
  background: var(--card-bg);
  border-left: 1px solid var(--border);
  box-shadow: -10px 0 30px rgba(15, 23, 42, 0.35);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 150;
  display: flex;
  flex-direction: column;
}

.settings-panel.open {
  transform: translateX(0);
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.settings-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-soft);
}

.settings-section {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.settings-help {
  font-size: 0.8rem;
  color: var(--text-soft);
}

.feed-selector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.feed-selector-actions button {
  font-size: 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  padding: 3px 8px;
  cursor: pointer;
  color: var(--text-soft);
}

.feed-selector-actions button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.feed-group-label {
  font-size: 0.8rem;
  font-weight: 600;
  margin: 10px 0 6px;
  color: var(--text-soft);
}

.feed-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.feed-label-text {
  color: var(--text);
}

/* THEME SWATCHES */
.theme-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.theme-swatch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-soft);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.theme-swatch-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--accent);
}

.theme-swatch-default .theme-swatch-dot {
  background: #2A6CF0;
}

.theme-swatch-sunrise .theme-swatch-dot {
  background: #f97316;
}

.theme-swatch-forest .theme-swatch-dot {
  background: #16a34a;
}

.theme-swatch-midnight .theme-swatch-dot {
  background: #6366f1;
}

.theme-swatch.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

/* DISPLAY TOGGLE ROW */
.settings-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
}

/* FOOTER */
.site-footer {
  text-align: center;
  padding: 22px;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  margin-top: 18px;
}

/* ANIMATIONS */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* LIVE REFRESH REMOVED (v0.9.9) - hide if still present */
.live-refresh {
  display: none;
}