/* ==========================================================================
   FeedFlow - Premium Dark Theme
   ========================================================================== */

:root {
  /* Colors */
  --bg-primary: #0c0c14;
  --bg-secondary: #14141f;
  --bg-tertiary: #1c1c2e;
  --bg-elevated: #24243d;
  --bg-hover: #2e2e4a;
  
  /* Text */
  --text-primary: #eeeef0;
  --text-secondary: #9898b0;
  --text-tertiary: #686880;
  
  /* Accents */
  --accent-primary: #7c5cfc;
  --accent-secondary: #5c8afc;
  --accent-gradient: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  
  /* Status Colors */
  --color-success: #4ade80;
  --color-warning: #fbbf24;
  --color-danger: #f87171;
  
  /* Borders */
  --border-color: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  
  /* Glassmorphism */
  --glass-bg: rgba(20, 20, 35, 0.85);
  
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-lg: 17px;
  --text-xl: 20px;
  --text-2xl: 24px;
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Spacing and Layout */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --sidebar-width: 280px;
  --topbar-height: calc(56px + var(--safe-top));
}

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */

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

html {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: -webkit-fill-available;
  overflow: hidden; /* App-like feel, scroll inside containers */
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

ul, ol {
  list-style: none;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

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

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

/* ==========================================================================
   Typography Utilities
   ========================================================================== */

.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); font-weight: 600; }
.text-2xl { font-size: var(--text-2xl); font-weight: 700; }

.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-accent {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ==========================================================================
   Layout Components
   ========================================================================== */

.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  position: relative;
  overflow: hidden;
}

/* Overlay for mobile sidebar */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

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

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-color);
  z-index: 100;
  transform: translateX(-100%);
  transition: transform var(--transition-normal);
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  padding-left: var(--safe-left);
}

.sidebar.open {
  transform: translateX(0);
}

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

/* Top Bar */
.top-bar {
  position: sticky;
  top: 0;
  height: var(--topbar-height);
  padding-top: var(--safe-top);
  padding-right: var(--safe-right);
  padding-left: max(16px, var(--safe-left));
  padding-right: max(16px, var(--safe-right));
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 50;
}

.top-bar-title {
  font-size: var(--text-lg);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  margin: 0 16px;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Common Buttons */
.icon-btn {
  width: 44px; /* Touch target minimum */
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-primary);
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.icon-btn:hover {
  background-color: var(--bg-hover);
}

.icon-btn:active {
  background-color: var(--bg-elevated);
  transform: scale(0.96);
}

/* ==========================================================================
   Sidebar Content
   ========================================================================== */

.sidebar-header {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
}

.app-logo svg {
  width: 28px;
  height: 28px;
  color: var(--accent-primary);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.nav-section {
  margin-bottom: 24px;
}

.nav-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  margin-bottom: 8px;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  border-left: 3px solid transparent;
  margin-bottom: 2px;
}

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

.nav-item.active {
  background-color: var(--bg-elevated);
  color: var(--text-primary);
  border-left-color: var(--accent-primary);
}

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: var(--text-base);
}

.nav-badge {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  min-width: 24px;
  text-align: center;
}

.nav-item.active .nav-badge {
  background-color: var(--accent-primary);
  color: #fff;
}

.folder-feeds {
  padding-left: 12px;
  overflow: hidden;
  transition: max-height var(--transition-normal);
}

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

.feed-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

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

.feed-item img {
  width: 16px;
  height: 16px;
  border-radius: 2px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
}

.sidebar-btn {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: var(--bg-elevated);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: 500;
  transition: background-color var(--transition-fast);
}

.sidebar-btn:hover {
  background-color: var(--bg-hover);
}

/* ==========================================================================
   Articles Container & Views
   ========================================================================== */

.articles-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: calc(16px + var(--safe-bottom));
  padding-left: max(16px, var(--safe-left));
  padding-right: max(16px, var(--safe-right));
}

.articles-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 1200px;
  margin: 0 auto;
}

/* Common Article Card Styles */
.article-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
  cursor: pointer;
  position: relative;
}

.article-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.article-card:active {
  transform: scale(0.98);
}

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

/* View: Magazine (Default) */
.view-magazine .article-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  padding: 16px;
}

.view-magazine .article-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.view-magazine .article-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.view-magazine .article-snippet {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.view-magazine .article-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: auto;
  padding-top: 8px;
  flex-wrap: wrap;
}

/* Language & Translation Badges */
.lang-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  background-color: rgba(124, 92, 252, 0.15);
  color: var(--accent-primary);
  border: 1px solid rgba(124, 92, 252, 0.3);
  text-transform: uppercase;
}

.translated-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  background-color: rgba(74, 222, 128, 0.12);
  color: var(--color-success);
  border: 1px solid rgba(74, 222, 128, 0.25);
}

.lang-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 600;
  background: var(--bg-elevated);
  color: var(--accent-secondary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.lang-toggle-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent-primary);
}

.view-magazine .article-thumbnail {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  object-fit: cover;
  background-color: var(--bg-tertiary);
}

/* View: List */
.view-list .articles-list {
  gap: 0;
}
.view-list .article-card {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 12px;
  border: none;
  border-bottom: 1px solid var(--border-color);
  border-radius: 0;
  background-color: transparent;
}
.view-list .article-card:hover {
  background-color: var(--bg-hover);
  transform: none;
  box-shadow: none;
}
.view-list .article-favicon {
  width: 16px;
  height: 16px;
  border-radius: 2px;
}
.view-list .article-title {
  font-size: var(--text-base);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.view-list .article-date {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  white-space: nowrap;
}
.view-list .article-thumbnail,
.view-list .article-snippet {
  display: none;
}

/* View: Title Only */
.view-title .articles-list {
  gap: 0;
}
.view-title .article-card {
  padding: 12px 16px;
  border: none;
  border-bottom: 1px solid var(--border-color);
  border-radius: 0;
  background-color: transparent;
}
.view-title .article-card:hover {
  background-color: var(--bg-hover);
  transform: none;
  box-shadow: none;
}
.view-title .article-title {
  font-size: var(--text-base);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.view-title .article-thumbnail,
.view-title .article-snippet,
.view-title .article-meta,
.view-title .article-favicon {
  display: none;
}

/* View: Cards */
.view-cards .articles-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
@media (min-width: 640px) {
  .view-cards .articles-list {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}
.view-cards .article-card {
  display: flex;
  flex-direction: column;
}
.view-cards .article-thumbnail-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 Aspect Ratio */
  background-color: var(--bg-tertiary);
}
.view-cards .article-thumbnail {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.view-cards .article-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}
.view-cards .article-title {
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1.4;
  margin: 0;
}
.view-cards .article-snippet {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.view-cards .article-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: auto;
}

/* ==========================================================================
   Article Reader
   ========================================================================== */

.article-reader {
  position: fixed;
  inset: 0;
  background-color: var(--bg-primary);
  z-index: 200;
  transform: translateX(100%);
  transition: transform var(--transition-normal);
  display: flex;
  flex-direction: column;
}

.article-reader.open {
  transform: translateX(0);
}

.reader-header {
  position: sticky;
  top: 0;
  height: var(--topbar-height);
  padding-top: var(--safe-top);
  padding-right: max(16px, var(--safe-right));
  padding-left: max(16px, var(--safe-left));
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
}

.reader-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 16px;
  padding-bottom: calc(80px + var(--safe-bottom));
  padding-left: max(16px, var(--safe-left));
  padding-right: max(16px, var(--safe-right));
  max-width: 100%;
}

.reader-content > * {
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

.reader-meta {
  margin-bottom: 32px;
}

.reader-meta .title {
  font-size: var(--text-2xl);
  line-height: 1.3;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.reader-meta .details {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.reader-meta .source {
  font-weight: 600;
  color: var(--accent-secondary);
}

/* Reader Body Typography */
.reader-body {
  font-size: 17px; /* Good reading size */
  line-height: 1.7;
  color: var(--text-primary);
}

.reader-body p {
  margin-bottom: 1.5em;
}

.reader-body h1, 
.reader-body h2, 
.reader-body h3, 
.reader-body h4, 
.reader-body h5, 
.reader-body h6 {
  margin-top: 2em;
  margin-bottom: 0.75em;
  line-height: 1.3;
  font-weight: 600;
  color: #fff;
}

.reader-body h1 { font-size: 1.75em; }
.reader-body h2 { font-size: 1.5em; }
.reader-body h3 { font-size: 1.25em; }

.reader-body img,
.reader-body figure {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  margin: 2em 0;
}

.reader-body figcaption {
  font-size: 0.85em;
  color: var(--text-tertiary);
  text-align: center;
  margin-top: 0.5em;
}

.reader-body blockquote {
  border-left: 4px solid var(--accent-primary);
  margin: 1.5em 0;
  padding: 0.5em 0 0.5em 1.5em;
  font-style: italic;
  color: var(--text-secondary);
  background-color: var(--bg-secondary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.reader-body a {
  color: var(--accent-secondary);
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: text-decoration-color var(--transition-fast);
}

.reader-body a:hover {
  text-decoration-color: var(--accent-secondary);
}

.reader-body ul, 
.reader-body ol {
  margin-bottom: 1.5em;
  padding-left: 1.5em;
}

.reader-body li {
  margin-bottom: 0.5em;
}

.reader-body pre {
  background-color: var(--bg-tertiary);
  padding: 1em;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin-bottom: 1.5em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
}

.reader-body code {
  background-color: var(--bg-tertiary);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
}

.reader-body pre code {
  background-color: transparent;
  padding: 0;
}

.reader-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5em;
}

.reader-body th, 
.reader-body td {
  border: 1px solid var(--border-color);
  padding: 0.75em;
  text-align: left;
}

.reader-body th {
  background-color: var(--bg-secondary);
  font-weight: 600;
}

/* ==========================================================================
   Modals
   ========================================================================== */

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 16px;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 48px rgba(0,0,0,0.4);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-sm .modal-content {
  max-width: 320px;
}

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

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

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-tertiary);
  transition: all var(--transition-fast);
}

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

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

/* ==========================================================================
   Forms & Buttons
   ========================================================================== */

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

.input-group label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

input[type="text"],
input[type="url"],
input[type="email"],
input[type="password"],
select,
textarea {
  width: 100%;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-family: inherit;
  font-size: var(--text-base);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.user-account-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.user-account-badge .user-id-text {
  font-family: ui-monospace, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-tertiary);
}

.input-with-btn {
  display: flex;
  gap: 8px;
}

.input-with-btn input {
  flex: 1;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px; /* Touch target minimum */
  padding: 0 20px;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: var(--text-base);
  transition: all var(--transition-fast);
  cursor: pointer;
  white-space: nowrap;
}

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

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  border: none;
  box-shadow: 0 4px 12px rgba(124, 92, 252, 0.3);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.1);
  box-shadow: 0 6px 16px rgba(124, 92, 252, 0.4);
}

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

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

.btn-danger {
  background-color: rgba(248, 113, 113, 0.1);
  color: var(--color-danger);
  border: 1px solid rgba(248, 113, 113, 0.2);
}

.btn-danger:hover:not(:disabled) {
  background-color: rgba(248, 113, 113, 0.2);
}

.btn-line {
  background-color: #06C755;
  color: #ffffff;
  font-weight: 600;
  border: none;
}

.btn-line:hover:not(:disabled) {
  background-color: #05b34c;
  box-shadow: 0 0 12px rgba(6, 199, 85, 0.4);
}

.line-auth-card {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 16px;
}

/* ==========================================================================
   Feed Discovery
   ========================================================================== */

.discovery-results {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.discovery-item {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

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

.discovery-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.discovery-url {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed-preview {
  margin-top: 24px;
  border-top: 1px solid var(--border-color);
  padding-top: 24px;
}

.feed-preview-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.feed-preview-item {
  font-size: var(--text-sm);
  color: var(--text-primary);
  margin-bottom: 8px;
  padding-left: 12px;
  border-left: 2px solid var(--border-hover);
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: calc(24px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast {
  background-color: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

.toast-success { border-color: rgba(74, 222, 128, 0.3); }
.toast-error { border-color: rgba(248, 113, 113, 0.3); }
.toast-warning { border-color: rgba(251, 191, 36, 0.3); }
.toast-info { border-color: rgba(92, 138, 252, 0.3); }

.toast:not(.show) {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   Loading, Skeleton & Empty States
   ========================================================================== */

.state-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
  height: 100%;
}

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

.state-message h2,
.state-message h3 {
  font-size: var(--text-lg);
  color: var(--text-primary);
  margin-bottom: 8px;
}

.state-message p {
  font-size: var(--text-sm);
  max-width: 300px;
}

/* Spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.spinner.lg {
  width: 48px;
  height: 48px;
  border-width: 4px;
}

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-elevated) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

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

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

.skeleton-text.short {
  width: 60%;
}

.skeleton-image {
  height: 80px;
  width: 80px;
  border-radius: var(--radius-md);
}

/* ==========================================================================
   Dropdowns
   ========================================================================== */

.dropdown-container {
  position: relative;
}

.dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background-color: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px;
  min-width: 200px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
  z-index: 200;
  animation: fadeIn 0.2s ease-out;
}

.dropdown.hidden {
  display: none;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  transition: all var(--transition-fast);
}

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

.dropdown-item.active {
  background-color: rgba(124, 92, 252, 0.1);
  color: var(--accent-primary);
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes slideInLeft {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

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

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

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

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

/* Utilities */
.hidden {
  display: none !important;
}

/* Reader Source Label */
.reader-source {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}

/* Reader Footer */
.reader-footer {
  padding-top: 32px;
  border-top: 1px solid var(--border-color);
  margin-top: 32px;
}

.reader-open-link {
  width: 100%;
}

/* Spinning animation for refresh button */
.spinning svg {
  animation: spin 1s linear infinite;
}

/* Small button variant */
.btn-sm {
  min-height: 40px;
  padding: 0 16px;
  font-size: var(--text-sm);
}

/* Small spinner */
.spinner-sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
  margin: 8px auto;
}

.feed-preview-samples {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.feed-preview-samples-title {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.feed-preview-sample-item {
  font-size: var(--text-xs);
  color: var(--text-primary);
  margin-bottom: 6px;
  padding: 6px 10px;
  background-color: var(--bg-secondary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.4;
}

.feed-preview-sample-item .orig-title {
  color: var(--text-tertiary);
  font-size: 11px;
}

.feed-preview-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.feed-preview-favicon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-elevated);
}

.feed-preview-title {
  font-weight: 600;
  font-size: var(--text-base);
  margin: 0 0 4px;
}

.feed-preview-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0;
}

.feed-preview-stats {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.feed-preview-stats span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Discovery label */
.discovery-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: 4px;
}

/* Discovery item (button style from JS) */
.discovery-item {
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.discovery-item:hover {
  border-color: var(--accent-primary);
}

.discovery-item-title {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text-primary);
  display: block;
}

.discovery-item-url {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  display: block;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Error text */
.error-text {
  color: var(--color-danger);
  font-size: var(--text-sm);
}

/* Icon button size variants */
.icon-btn-sm {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
}

.icon-btn-xs {
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.nav-item:hover .icon-btn-xs {
  opacity: 1;
}

/* Feed favicon in sidebar */
.feed-favicon {
  width: 16px;
  height: 16px;
  border-radius: 2px;
}

/* Folder feeds collapsible */
.folder-feeds.collapsed {
  display: none;
}

.folder-toggle {
  transition: transform var(--transition-fast);
}

.folder-toggle.rotated {
  transform: rotate(-90deg);
}

/* ==========================================================================
   Media Queries (Desktop Enhancements)
   ========================================================================== */

@media (min-width: 768px) {
  /* Desktop Layout */
  .sidebar {
    position: relative;
    transform: none; /* Always visible */
    border-right: 1px solid var(--border-color);
  }
  
  .overlay {
    display: none !important; /* No overlay on desktop */
  }
  
  .sidebar-btn-mobile {
    display: none; /* Hide hamburger menu */
  }
  
  /* Article Reader slides in differently or appears as modal/split pane */
  .article-reader {
    /* For a split pane approach if desired later, but keeping as slide-over per spec */
    max-width: 800px;
    right: 0;
    left: auto;
    border-left: 1px solid var(--border-color);
    box-shadow: -12px 0 32px rgba(0,0,0,0.3);
  }
  
  /* Hover effects enhanced for non-touch devices */
  .article-card:hover {
    transform: translateY(-4px);
  }
}

/* Safe area insets for notches */
@supports (padding-top: env(safe-area-inset-top)) {
  .safe-area-top {
    padding-top: env(safe-area-inset-top);
  }
  .safe-area-bottom {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

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

.feed-preview-carousel::-webkit-scrollbar {
  display: none;
}
.feed-preview-carousel {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
