@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Outfit:wght@400;500;600;700&display=swap');

:root {
  /* Dark Mode Palette (Default) */
  --bg-primary: #0b0f19;
  --bg-secondary: #131a26;
  --bg-glass: rgba(19, 26, 38, 0.7);
  --bg-active: rgba(139, 92, 246, 0.15);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --accent: #8b5cf6;
  --accent-hover: #a78bfa;
  --accent-gradient: linear-gradient(135deg, #8b5cf6, #d946ef);
  --border-color: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.05);
  --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --inset-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
  --scroll-track: #0f131d;
  --scroll-thumb: #2d3748;
  --transition-speed: 0.25s;
  --font-title: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
}

[data-theme="light"] {
  /* Light Mode Palette */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.75);
  --bg-active: rgba(109, 40, 217, 0.08);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent: #6d28d9;
  --accent-hover: #7c3aed;
  --accent-gradient: linear-gradient(135deg, #6d28d9, #ec4899);
  --border-color: rgba(15, 23, 42, 0.08);
  --glass-border: rgba(255, 255, 255, 0.6);
  --card-shadow: 0 10px 30px -10px rgba(109, 40, 217, 0.08);
  --inset-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.8);
  --scroll-track: #f1f5f9;
  --scroll-thumb: #cbd5e1;
}

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

body {
  --font-size-modifier: 0px;
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  display: flex;
  transition: background-color var(--transition-speed), color var(--transition-speed);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--scroll-track);
}
::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* Layout */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  position: relative;
}

/* Sidebar Styling */
.sidebar {
  width: 280px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 10;
  transition: transform var(--transition-speed) ease, background-color var(--transition-speed);
}

.sidebar-header {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
}

.logo-img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.logo-text {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-nav {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
  font-size: 14px;
  border: 1px solid transparent;
}

.nav-item:hover, .nav-item.active {
  color: var(--text-primary);
  background-color: var(--bg-active);
  border-color: var(--glass-border);
}

.nav-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

.badge {
  background: var(--accent-gradient);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}

.sidebar-section {
  flex-grow: 1;
  overflow-y: auto;
  padding: 12px;
  border-top: 1px solid var(--border-color);
}

.section-title {
  font-family: var(--font-title);
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  padding-left: 12px;
}

.feed-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.feed-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  font-size: 13px;
  position: relative;
  group: hover;
}

.feed-item:hover, .feed-item.active {
  background-color: var(--bg-active);
  color: var(--text-primary);
}

.feed-item-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-grow: 1;
  min-width: 0;
}

.feed-favicon {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  flex-shrink: 0;
  object-fit: cover;
  background-color: var(--bg-primary);
}

.feed-favicon-placeholder {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: var(--accent-gradient);
  opacity: 0.7;
  flex-shrink: 0;
}

.feed-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.delete-feed-btn, .mark-feed-read-btn, .mark-feed-unread-btn {
  opacity: 0.6; /* Always show buttons on touch screens */
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px; /* Larger tap target for mobile */
  border-radius: 4px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.delete-feed-btn svg, .mark-feed-read-btn svg, .mark-feed-unread-btn svg, .feed-properties-btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
}

.mark-all-read-btn, .mark-all-unread-btn {
  opacity: 0.6;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mark-all-read-btn svg, .mark-all-unread-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
}

/* For desktops supporting hover, hide it by default */
@media (hover: hover) {
  .delete-feed-btn, .mark-feed-read-btn, .mark-feed-unread-btn, .feed-properties-btn {
    opacity: 0;
  }
  .feed-item:hover .delete-feed-btn, .feed-item:hover .mark-feed-read-btn, .feed-item:hover .mark-feed-unread-btn, .feed-item:hover .feed-properties-btn {
    opacity: 1;
  }
  .mark-all-read-btn, .mark-all-unread-btn {
    opacity: 0;
  }
  .nav-item:hover .mark-all-read-btn, .nav-item:hover .mark-all-unread-btn {
    opacity: 1;
  }
}

.feed-item.active .delete-feed-btn, .feed-item.active .mark-feed-read-btn, .feed-item.active .mark-feed-unread-btn, .feed-item.active .feed-properties-btn {
  opacity: 1;
}

.nav-item.active .mark-all-read-btn, .nav-item.active .mark-all-unread-btn {
  opacity: 1;
}

.delete-feed-btn:hover {
  color: #ef4444;
  background-color: rgba(239, 68, 68, 0.1);
}

.feed-properties-btn:hover {
  color: var(--accent);
  background-color: rgba(139, 92, 246, 0.1);
}

.mark-feed-read-btn:hover, .mark-all-read-btn:hover {
  color: #10b981;
  background-color: rgba(16, 185, 129, 0.1);
}

.mark-feed-unread-btn:hover, .mark-all-unread-btn:hover {
  color: var(--accent);
  background-color: rgba(139, 92, 246, 0.1);
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-actions-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.sidebar-actions-row .btn {
  flex: 1;
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 8px;
  white-space: nowrap;
  min-width: 0;
}

.sidebar-settings {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  border-top: 1px dashed var(--border-color);
  padding-top: 12px;
  gap: 8px;
}

.sidebar-settings button {
  flex: 1;
  height: 36px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  outline: none;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

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

.btn-secondary:hover {
  background-color: var(--border-color);
}

/* Main Content Area */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  position: relative;
  background-color: var(--bg-primary);
}

/* Header */
.main-header {
  height: 80px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background-color: var(--bg-secondary);
  z-index: 5;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
}

.view-title {
  font-family: var(--font-title);
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
}

.header-count-badge {
  font-size: 13px;
  background-color: var(--bg-active);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.search-container {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  width: 220px;
  padding: 8px 12px 8px 36px;
  border-radius: 8px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  outline: none;
  font-size: 13px;
  transition: all 0.2s ease;
}

.search-input:focus {
  border-color: var(--accent);
  width: 280px;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

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

.theme-toggle, .view-mode-toggle {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.theme-toggle:hover, .view-mode-toggle:hover {
  background-color: var(--border-color);
  color: var(--text-primary);
}

.theme-toggle svg, .view-mode-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

/* Article List */
.articles-wrapper {
  flex-grow: 1;
  overflow-y: auto;
  padding: 24px;
  position: relative;
}

.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.articles-grid.list-view {
  grid-template-columns: 1fr;
  max-width: 800px;
}

/* Article Card */
.article-card {
  background-color: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  box-shadow: var(--card-shadow);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.article-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.article-card:hover {
  transform: translateY(-4px);
  border-color: var(--glass-border);
}

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

.article-card.read {
  opacity: 0.65;
}

.article-card.read::after {
  background: var(--text-muted);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

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

.card-date {
  white-space: nowrap;
}

.unread-dot {
  width: 6px;
  height: 6px;
  background-color: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent);
}

.article-card.read .unread-dot {
  display: none;
}

.card-title {
  font-family: var(--font-title);
  font-size: calc(16px + var(--font-size-modifier));
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-description {
  font-size: calc(13px + var(--font-size-modifier));
  line-height: 1.5;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* List view adjustments */
.list-view .article-card {
  flex-direction: row;
  align-items: center;
  padding: 16px 20px;
}

.list-view .card-content-wrap {
  flex-grow: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.list-view .card-description {
  -webkit-line-clamp: 1;
}

/* Card Controls */
.card-controls {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
  margin-top: auto;
}

.list-view .card-controls {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
  align-self: center;
}

.card-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.card-btn:hover {
  color: var(--text-primary);
  background-color: var(--border-color);
}

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

.card-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  pointer-events: none; /* Make click trigger directly on button tag */
}

.card-btn.active svg {
  fill: currentColor;
}

/* Empty State / Welcome Screen */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 40px;
  max-width: 480px;
  margin: 0 auto;
}

.empty-icon {
  width: 64px;
  height: 64px;
  color: var(--text-muted);
  margin-bottom: 24px;
  opacity: 0.6;
}

.empty-title {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
}

.empty-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* --- Onboarding / Feed Discovery --- */
.onboarding-container {
  padding: 32px 24px 48px;
  max-width: 720px;
  margin: 0 auto;
  animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.onboarding-hero {
  text-align: center;
  margin-bottom: 32px;
}

.onboarding-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #a855f7));
  color: #fff;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.onboarding-title {
  font-family: var(--font-title);
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 8px;
}

.onboarding-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 400px;
  margin: 0 auto;
}

.onboarding-tips {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 36px;
}

.onboarding-tip {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-secondary);
  transition: border-color 0.2s;
}

.onboarding-tip:hover {
  border-color: var(--accent);
}

.onboarding-tip strong {
  display: block;
  color: var(--text-primary);
  margin-bottom: 2px;
  font-size: 14px;
}

.onboarding-tip code {
  background: var(--border-color);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.tip-icon {
  font-size: 22px;
  flex-shrink: 0;
  margin-top: 2px;
}

.discover-section-title {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.discover-category {
  margin-bottom: 28px;
}

.discover-category-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.discover-cat-icon {
  font-size: 18px;
}

.discover-feeds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}

.discover-feed-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.discover-feed-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.discover-feed-card.added {
  opacity: 0.6;
  border-color: #22c55e;
}

.discover-feed-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  flex-shrink: 0;
  object-fit: contain;
}

.discover-feed-info {
  flex: 1;
  min-width: 0;
}

.discover-feed-name {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.discover-feed-desc {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-add-feed-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1.5px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quick-add-feed-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  transform: scale(1.1);
}

.quick-add-feed-btn.loading {
  pointer-events: none;
  animation: spin-icon 1s linear infinite;
  opacity: 0.6;
}

@keyframes spin-icon {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.quick-add-feed-btn.added {
  background: #22c55e;
  border-color: #22c55e;
  color: #fff;
  pointer-events: none;
}

@media (max-width: 768px) {
  .onboarding-container {
    padding: 20px 16px 40px;
  }
  
  .onboarding-title {
    font-size: 22px;
  }
  
  .discover-feeds-grid {
    grid-template-columns: 1fr;
  }
}

/* Modal Dialogs */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background-color: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  width: 90%;
  max-width: 460px;
  padding: 28px;
  box-shadow: var(--card-shadow);
  transform: translateY(20px);
  transition: transform 0.3s ease;
  position: relative;
}

.modal-overlay.open .modal-content {
  transform: translateY(0);
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.modal-close svg {
  width: 20px;
  height: 20px;
}

.modal-title {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
}

/* Modal Tabs & Feed Browse Catalog styles */
.add-feed-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.add-feed-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.add-feed-tab.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.add-feed-tab svg {
  stroke: currentColor;
}

.add-feed-tab-content {
  display: none;
}

.add-feed-tab-content.active {
  display: block;
}

#addFeedModalContent {
  transition: max-width 0.3s ease, transform 0.3s ease;
}

#addFeedModalContent.browse-mode {
  max-width: 680px;
}

.modal-catalog-scroll {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 6px;
  margin-top: 10px;
}

/* Custom scrollbar for catalog list */
.modal-catalog-scroll::-webkit-scrollbar {
  width: 6px;
}
.modal-catalog-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.modal-catalog-scroll::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
.modal-catalog-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.modal-grid {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}


.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  outline: none;
  font-size: 14px;
  transition: border-color 0.2s ease;
}

.form-input:focus {
  border-color: var(--accent);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Article Reader Panel */
.reader-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 650px;
  max-width: 100%;
  background-color: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  z-index: 50;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.reader-panel.open {
  transform: translateX(0);
  pointer-events: auto;
}

.reader-header {
  height: 70px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background-color: var(--bg-secondary);
}

.reader-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-title);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 0;
  flex: 1;
  justify-content: center;
  padding: 0 16px;
  text-align: center;
}

.reader-header-title .feed-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

.reader-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.reader-close-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  transition: background-color 0.2s ease;
}

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

/* Reader Navigation Arrows */
.reader-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--bg-glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 60;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0.35;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.reader-nav-btn:hover {
  opacity: 0.95;
  background-color: var(--bg-secondary);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-50%) scale(1.08);
}

.reader-nav-btn:active {
  transform: translateY(-50%) scale(0.95);
}

.reader-nav-btn svg {
  width: 22px;
  height: 22px;
}

.reader-nav-prev {
  left: 12px;
}

.reader-nav-next {
  right: 12px;
}

.reader-nav-btn.disabled {
  opacity: 0 !important;
  pointer-events: none;
}

/* Mobile optimizations for navigation buttons */
@media (max-width: 768px) {
  .reader-nav-btn {
    width: 38px;
    height: 38px;
    opacity: 0.2;
    background: rgba(19, 26, 38, 0.6);
  }
  
  .reader-nav-btn svg {
    width: 18px;
    height: 18px;
  }
  
  .reader-nav-prev {
    left: 6px;
  }
  
  .reader-nav-next {
    right: 6px;
  }
}

.reader-body {
  flex-grow: 1;
  overflow-y: auto;
  padding: 36px 40px 100px 40px;
}

.reader-meta-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: calc(12px + var(--font-size-modifier) * 0.5);
  color: var(--text-muted);
  margin-bottom: 16px;
}

.reader-feed-name {
  color: var(--accent);
  font-weight: 600;
}

.reader-title {
  font-family: var(--font-title);
  font-size: calc(28px + var(--font-size-modifier));
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 24px;
  color: var(--text-primary);
}

.reader-content {
  font-size: calc(16px + var(--font-size-modifier));
  line-height: 1.75;
  color: var(--text-secondary);
}

.reader-content p {
  margin-bottom: 20px;
}

.reader-content a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

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

.reader-content img {
  max-width: 100%;
  border-radius: 8px;
  margin: 16px 0;
  box-shadow: var(--card-shadow);
}

.reader-content blockquote {
  border-left: 4px solid var(--accent);
  padding-left: 20px;
  margin: 24px 0;
  font-style: italic;
  color: var(--text-muted);
}

.reader-content pre {
  background-color: var(--bg-primary);
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 20px 0;
  font-size: 14px;
}

.reader-footer {
  padding: 24px 40px;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  display: flex;
  justify-content: space-between;
}

/* Offline Banner */
.offline-banner {
  background-color: #f59e0b;
  color: #0b0f19;
  text-align: center;
  padding: 8px;
  font-size: 13px;
  font-weight: 600;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: none;
}

body.offline .offline-banner {
  display: block;
}

/* Skeleton Loading Screens */
.skeleton {
  background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--border-color) 50%, var(--bg-secondary) 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

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

.skeleton-card {
  height: 180px;
  background-color: var(--bg-secondary);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.skeleton-line {
  height: 12px;
  border-radius: 4px;
}

.skeleton-line.title {
  width: 80%;
  height: 18px;
}

.skeleton-line.meta {
  width: 40%;
}

.skeleton-line.desc1 {
  width: 100%;
}

.skeleton-line.desc2 {
  width: 90%;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background-color: var(--bg-secondary);
  border: 1px solid var(--accent);
  color: var(--text-primary);
  padding: 12px 24px;
  border-radius: 30px;
  box-shadow: 0 10px 25px -5px rgba(139, 92, 246, 0.4);
  z-index: 200;
  font-size: 14px;
  font-weight: 500;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.25);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }

  /* Enlarge mobile sidebar items for readability & touch-targets */
  .sidebar .nav-item {
    font-size: 15px !important;
    padding: 12px 16px !important;
  }
  
  .sidebar .nav-item svg {
    width: 20px !important;
    height: 20px !important;
  }
  
  .sidebar .category-header {
    font-size: 14px !important;
    padding: 10px 14px !important;
  }
  
  .sidebar .category-arrow {
    width: 16px !important;
    height: 16px !important;
  }
  
  .sidebar .category-icon {
    width: 18px !important;
    height: 18px !important;
  }

  .sidebar .feed-item {
    font-size: 14px !important;
    padding: 10px 14px !important;
  }
  
  .sidebar .feed-favicon, .sidebar .feed-favicon-placeholder {
    width: 18px !important;
    height: 18px !important;
  }
  
  .menu-toggle {
    display: block;
  }
  
  .search-input {
    width: 140px;
  }
  
  .search-input:focus {
    width: 180px;
  }
  
  .reader-panel {
    width: 100%;
  }

  .reader-body {
    padding: 24px 20px 80px 20px;
  }
  
  .reader-footer {
    padding: 16px 20px;
  }

  /* Typography size upgrades for mobile readability */
  .card-title {
    font-size: calc(20px + var(--font-size-modifier)) !important;
    line-height: 1.4 !important;
  }

  .card-description {
    font-size: calc(16px + var(--font-size-modifier)) !important;
    line-height: 1.55 !important;
  }

  .reader-meta-bar {
    font-size: calc(11px + var(--font-size-modifier) * 0.5) !important;
  }

  .reader-title {
    font-size: calc(26px + var(--font-size-modifier)) !important;
    line-height: 1.35 !important;
  }

  .reader-content {
    font-size: calc(20px + var(--font-size-modifier)) !important;
    line-height: 1.8 !important;
  }

  .reader-content p {
    margin-bottom: 22px !important;
  }

  /* Mobile touch targets upgrades */
  .card-controls {
    gap: 16px !important;
  }
  .card-btn {
    padding: 10px !important; /* expanded touch target area */
  }
  .card-btn svg {
    width: 20px !important;
    height: 20px !important;
  }

  /* Collapsible reader header items on mobile */
  .reader-close-btn span {
    display: none;
  }
  .reader-actions .btn-text {
    display: none;
  }
  .reader-actions {
    gap: 8px;
  }
  .reader-header-title {
    padding: 0 8px;
  }
  .reader-header-title .feed-name {
    max-width: 100px;
  }
}

/* ==========================================================================
   Phase 3: Filter Bar & Article Thumbnail Styles
   ========================================================================== */

/* Filter Bar */
.filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  z-index: 4;
  flex-wrap: wrap;
  gap: 12px;
  transition: background-color var(--transition-speed);
}

.filter-group {
  display: flex;
  gap: 6px;
}

.filter-btn {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.filter-btn:hover {
  color: var(--text-primary);
  border-color: var(--glass-border);
}

.filter-btn.active {
  background: var(--accent-gradient);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 10px rgba(139, 92, 246, 0.25);
}

/* Card Thumbnails */
.card-thumbnail-container {
  width: 100%;
  height: 150px;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  background-color: var(--bg-primary);
  flex-shrink: 0;
  margin-bottom: 12px;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2);
}

.card-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: block;
}

.article-card:hover .card-thumbnail {
  transform: scale(1.05);
}

/* List view thumbnail override */
.list-view .card-thumbnail-container {
  width: 72px;
  height: 72px;
  margin-bottom: 0;
  margin-right: 16px;
}

@media (max-width: 768px) {
  .filter-bar {
    padding: 10px 16px;
    justify-content: center;
  }
}

/* Pull to Refresh Pulling Spinner styles */
.pull-to-refresh {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 0;
  overflow: hidden;
  background-color: var(--bg-primary);
  border-bottom: 1px solid transparent;
  transition: height 0.2s ease, border-color 0.2s ease;
  color: var(--text-secondary);
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  box-sizing: border-box;
}

.ptr-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.ptr-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
}

.pull-to-refresh.pulling {
  transition: none; /* Instant drag response */
}

.pull-to-refresh.loading .ptr-icon svg {
  animation: spin 1s linear infinite;
}

/* ==========================================================================
   Phase 5: Feed Reordering & Properties Modal Styles
   ========================================================================== */

/* Drag and Drop sorting on feeds */
.feed-list .feed-item {
  cursor: grab;
  user-select: none;
}

.feed-list .feed-item:active {
  cursor: grabbing;
}

.feed-list .feed-item.dragging {
  opacity: 0.4;
  background-color: rgba(139, 92, 246, 0.1);
  border: 1px dashed var(--accent);
}

.feed-list .feed-item.drag-over {
  background-color: rgba(139, 92, 246, 0.15);
  transform: scale(0.98);
}

/* Feed Properties Details inside modal */
.feed-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
}

.feed-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-size: 13px;
  gap: 12px;
}

.feed-detail-label {
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.feed-detail-value {
  color: var(--text-primary);
  text-align: right;
  word-break: break-all;
}

.feed-technical-toggle {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-muted);
  cursor: pointer;
}

.feed-technical-toggle input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--accent);
}

.btn-danger {
  background-color: #ef4444;
  color: #ffffff;
  border: none;
}

.btn-danger:hover {
  background-color: #dc2626;
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.25);
}

/* ==========================================================================
   Phase 4: Bilingual Translation Styles
   ========================================================================== */
.translation-control-bar {
  display: flex;
  gap: 8px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px;
  margin-bottom: 20px;
  align-items: center;
  flex-wrap: wrap;
}

.translation-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-left: 8px;
  font-weight: 700;
}

.translation-view-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
}

.translation-view-btn:hover {
  color: var(--text-primary);
  background-color: var(--border-color);
}

.translation-view-btn.active {
  color: #ffffff;
  background: var(--accent-gradient);
  box-shadow: 0 2px 6px rgba(139, 92, 246, 0.2);
}

/* Bilingual content wrapper styles */
.bilingual-wrapper {
  margin-bottom: 1.5em;
}

.translation-mode-original .text-original {
  display: inline;
}
.translation-mode-original .text-translation-inline {
  display: none !important;
}

.translation-mode-translated .text-original {
  display: none !important;
}
.translation-mode-translated .text-translation-inline {
  display: inline;
  font-style: normal;
  color: var(--text-primary);
  border-left: none;
  padding-left: 0;
  margin-top: 0;
}

/* Bilingual Inline: Original then Translation below */
.translation-mode-inline .text-original {
  display: block;
  margin-bottom: 6px;
}
.translation-mode-inline .text-translation-inline {
  display: block;
  font-size: 0.92em;
  color: var(--accent);
  font-style: italic;
  opacity: 0.9;
  margin-top: 4px;
  border-left: 2px solid var(--accent);
  padding-left: 10px;
  line-height: 1.6;
}

/* For bilingual headers, keep it inline but smaller */
h1.bilingual-wrapper .text-translation-inline,
h2.bilingual-wrapper .text-translation-inline,
h3.bilingual-wrapper .text-translation-inline,
h4.bilingual-wrapper .text-translation-inline {
  font-size: 0.75em;
  font-weight: 500;
  margin-top: 6px;
}

/* Side by side split layout (desktop grid) */
.translation-mode-split .bilingual-wrapper {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  width: 100%;
  align-items: start;
}

.translation-mode-split .text-original {
  display: block;
}

.translation-mode-split .text-translation-inline {
  display: block;
  font-style: normal;
  color: var(--text-secondary);
  border-left: none;
  padding-left: 0;
  margin-top: 0;
  line-height: 1.6;
}

/* On mobile, collapse split view into block flow similar to inline view */
@media (max-width: 768px) {
  .translation-mode-split .bilingual-wrapper {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
  }
  .translation-mode-split .text-translation-inline {
    margin-top: 6px;
    border-left: 2px solid var(--accent);
    padding-left: 10px;
    font-style: italic;
    color: var(--accent);
  }
}

/* --- Authentication Page Styling --- */
.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  padding: 40px 20px;
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
  transition: background 0.3s ease;
  overflow-y: auto;
}

[data-theme="dark"] .auth-container {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
}

@media (max-height: 850px) {
  .auth-container {
    align-items: flex-start;
  }
}

.auth-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 48px;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  animation: fadeInUp 0.5s ease;
}

.auth-seo-info {
  width: 100%;
  text-align: center;
  color: var(--text-primary);
}

.auth-seo-info h3 {
  font-family: var(--font-title);
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 12px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.seo-intro-text {
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 640px;
  margin: 0 auto 36px auto;
  line-height: 1.6;
}

.seo-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  width: 100%;
  text-align: left;
}

.seo-info-card {
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 16px;
  padding: 24px;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .seo-info-card {
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.25);
}

.seo-info-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 10px 30px -5px rgba(139, 92, 246, 0.15);
}

.seo-icon {
  font-size: 28px;
  margin-bottom: 16px;
}

.seo-info-card h4 {
  font-family: var(--font-title);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.seo-info-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

@media (max-width: 768px) {
  .seo-info-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .auth-wrapper {
    gap: 32px;
  }
  
  .auth-seo-info h3 {
    font-size: 20px;
  }
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  border-radius: 20px;
  padding: 32px 24px;
  transition: all 0.3s ease;
}

[data-theme="dark"] .auth-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo {
  width: 48px;
  height: 48px;
  background: var(--accent);
  color: white;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  margin: 0 auto 12px auto;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.auth-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.auth-header p {
  font-size: 13px;
  color: var(--text-muted);
}

.auth-panel form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-color);
}

.auth-divider::before {
  margin-right: .5em;
}

.auth-divider::after {
  margin-left: .5em;
}

.auth-switch {
  margin-top: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
}

.auth-switch a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.auth-switch a:hover {
  text-decoration: underline;
}

#googleBtnContainer iframe {
  margin: 0 auto !important;
}

/* --- Collapsible Folder Styles --- */
.category-folder {
  margin-bottom: 4px;
}

.category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
  user-select: none;
}

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

.category-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.category-arrow {
  width: 14px;
  height: 14px;
  transition: transform 0.2s ease;
  flex-shrink: 0;
  color: var(--text-muted);
}

.category-arrow.collapsed {
  transform: rotate(-90deg);
}

.category-icon {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.category-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-unread-badge {
  font-size: 10px;
  background: var(--accent);
  padding: 1px 6px;
}

.category-feeds {
  padding-left: 12px;
  margin-top: 2px;
  overflow: hidden;
}

.category-feeds.collapsed {
  display: none;
}

/* --- Push Notification Button bottom row adjustments --- */
#pushNotificationBtn.active {
  color: var(--accent) !important;
}

/* --- Article Reader Slide Animation --- */
.reader-body {
  overflow-x: hidden !important;
}

.reader-content-slide {
  width: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

/* Floating PWA Install Banner */
.pwa-install-banner {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(40px);
  width: 90%;
  max-width: 420px;
  background-color: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 16px 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
}

.pwa-install-banner.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.pwa-install-banner-content {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.pwa-install-banner-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.pwa-install-banner-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pwa-install-banner-text strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.pwa-install-banner-text span {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pwa-install-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pwa-install-banner-actions .btn {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 8px;
  height: 32px;
}

.pwa-install-banner-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}

.pwa-install-banner-close:hover {
  background-color: var(--bg-active);
  color: var(--text-primary);
}

.pwa-install-banner-close svg {
  width: 14px;
  height: 14px;
}

@media (max-width: 480px) {
  .pwa-install-banner {
    bottom: 16px;
    padding: 12px 16px;
    gap: 12px;
  }
  .pwa-install-banner-icon {
    font-size: 24px;
  }
  .pwa-install-banner-text strong {
    font-size: 13px;
  }
  .pwa-install-banner-text span {
    font-size: 11px;
  }
  
  .reader-header-title .feed-name {
    max-width: 70px;
  }
}

/* --- Activity Statistics Dashboard styles --- */
.stats-modal-content {
  max-width: 500px !important;
}

.stats-tabs {
  display: flex;
  background-color: var(--bg-primary);
  border-radius: 10px;
  padding: 4px;
  margin-top: 20px;
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
}

.stats-tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 0;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.stats-tab-btn:hover {
  color: var(--text-primary);
}

.stats-tab-btn.active {
  background-color: var(--bg-secondary);
  color: var(--accent);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-color: var(--glass-border);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 10px;
}

.stats-card {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s ease, box-shadow 0.25s ease;
}

.stats-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.08);
}

.stats-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stats-card-icon {
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stats-card-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.stats-card-value {
  font-family: var(--font-title);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

/* --- Discover Catalog Language Tabs --- */
.discover-lang-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.discover-lang-tabs.modal-tabs {
  margin-top: 12px;
}

.discover-lang-tab-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

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

.discover-lang-tab-btn.active {
  background-color: var(--bg-active);
  color: var(--accent);
  border-color: var(--glass-border);
}

.discover-lang-content {
  display: none;
}

.discover-lang-content.active {
  display: block;
}

/* --- Category Folder active and hover controls --- */
.category-header.active {
  background-color: var(--bg-active) !important;
  color: var(--accent) !important;
}

.category-header.active .category-arrow,
.category-header.active .category-icon,
.category-header.active .category-title {
  color: var(--accent) !important;
}

.category-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.category-actions {
  display: none;
  align-items: center;
  gap: 4px;
}

.category-header:hover .category-actions {
  display: flex;
}

.category-header:hover .category-unread-badge {
  display: none !important;
}

.category-actions button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.category-actions button:hover {
  color: var(--text-primary);
  background-color: var(--border-color);
}

.category-actions button svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
}

.category-actions button[disabled] {
  opacity: 0.3 !important;
  cursor: not-allowed !important;
}

/* Custom Checkbox Styling */
.checkbox-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  margin-bottom: 16px;
}

.custom-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  outline: none;
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  transition: all 0.2s ease;
  margin: 0;
}

.custom-checkbox:hover {
  border-color: var(--accent);
}

.custom-checkbox:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}

.custom-checkbox:checked::before {
  content: "";
  width: 10px;
  height: 10px;
  clip-path: polygon(14% 44%, 0 58%, 38% 95%, 100% 16%, 86% 2%, 38% 68%);
  background-color: white;
}

.checkbox-label {
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  transition: color 0.2s ease;
}

.checkbox-label:hover {
  color: var(--text-primary);
}

/* Selection Translate Menu - Bottom Viewport Positioned */
.selection-translate-menu {
  position: fixed;
  bottom: 80px; /* Clears bottom nav tabs and mobile system bars */
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  z-index: 10000;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--accent);
  border-radius: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  padding: 4px;
  display: flex;
  align-items: center;
  pointer-events: auto;
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.2), opacity 0.25s ease;
  will-change: transform, opacity;
  max-width: 90%;
}

.selection-translate-menu.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.selection-translate-btn {
  background: var(--accent-gradient);
  border: none;
  border-radius: 26px;
  color: #ffffff;
  padding: 8px 18px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
  transition: transform var(--transition-speed), filter var(--transition-speed);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.selection-translate-btn:hover {
  transform: scale(1.03);
  filter: brightness(1.05);
}

.selection-translate-btn:active {
  transform: scale(0.97);
}

.selection-translate-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex-shrink: 0;
}

.selection-text-preview {
  display: inline-block;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 23px; /* 10px larger than previous 13px */
  font-weight: 600;
}

.selection-translate-btn.translated {
  background: linear-gradient(135deg, #10b981, #3b82f6); /* Emerald-Blue gradient */
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.selection-translate-btn.loading {
  background: var(--text-muted);
  cursor: wait;
}

/* App Update Banner */
.app-update-banner {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  z-index: 11000;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--accent);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
  opacity: 0;
  pointer-events: auto;
}

.app-update-banner.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.update-banner-content {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
}

.update-banner-content svg {
  color: var(--accent);
  flex-shrink: 0;
  animation: spin 3s linear infinite paused;
}

.app-update-banner.visible .update-banner-content svg {
  animation-play-state: running;
}

.update-banner-btn {
  background: var(--accent-gradient);
  border: none;
  border-radius: 8px;
  color: #ffffff;
  padding: 6px 14px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
  transition: transform var(--transition-speed), filter var(--transition-speed);
}

.update-banner-btn:hover {
  transform: scale(1.04);
  filter: brightness(1.05);
}

.update-banner-btn:active {
  transform: scale(0.96);
}

/* --- Mark-as-read chooser popup --- */
.mark-read-chooser {
  position: fixed;
  z-index: 1300;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  padding: 4px;
  display: flex;
  flex-direction: column;
  min-width: 190px;
}

.mark-read-chooser .mrc-option {
  background: transparent;
  border: none;
  color: var(--text-primary);
  text-align: left;
  font-size: 13px;
  padding: 9px 12px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}

.mark-read-chooser .mrc-option:hover {
  background: var(--bg-secondary);
}

/* --- Floating full-text search panel --- */
.search-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  z-index: 1200;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.search-fab svg {
  width: 24px;
  height: 24px;
}

.search-fab:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
}

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

.search-panel {
  position: fixed;
  right: 24px;
  bottom: 92px;
  width: min(440px, calc(100vw - 32px));
  max-height: min(70vh, 640px);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1201;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.search-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.search-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.search-panel-icon {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-panel-input {
  flex-grow: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 15px;
  padding: 4px 0;
}

.search-panel-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  padding: 4px;
  border-radius: 6px;
  flex-shrink: 0;
}

.search-panel-close svg {
  width: 18px;
  height: 18px;
}

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

.search-panel-results {
  overflow-y: auto;
  padding: 8px;
  flex-grow: 1;
}

.search-panel-hint,
.search-panel-status {
  padding: 16px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}

.search-result {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  color: inherit;
}

.search-result:hover {
  background: var(--bg-secondary);
}

.search-result-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
  line-height: 1.35;
}

.search-result-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.search-result-tech-tag {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0 5px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.search-result-snippet {
  font-size: 12px;
  color: var(--text-secondary, var(--text-muted));
  line-height: 1.45;
}

.search-result-snippet mark {
  background: rgba(250, 204, 21, 0.35);
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}

@media (max-width: 768px) {
  .search-fab {
    right: 16px;
    bottom: 16px;
  }
  .search-panel {
    right: 16px;
    left: 16px;
    width: auto;
    bottom: 84px;
  }

  /* Larger, more readable search results on mobile */
  .search-panel-input {
    font-size: 16px; /* also prevents iOS zoom-on-focus */
  }
  .search-result-title {
    font-size: 16px;
  }
  .search-result-meta {
    font-size: 13px;
  }
  .search-result-snippet {
    font-size: 14px;
    line-height: 1.5;
  }
}




