:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: "Charter", "Georgia", "Times New Roman", serif;
  
  /* Dark Theme (Default) */
  --bg-primary: #121417;
  --bg-secondary: #1a1d21;
  --bg-tertiary: #24282e;
  --bg-hover: #2d323a;
  --border-color: #2b3038;
  
  --text-main: #e6e8eb;
  --text-muted: #8b949e;
  --text-dim: #6e7681;
  
  --accent: #2f81f7;
  --accent-hover: #388bfd;
  --accent-glow: rgba(47, 129, 247, 0.15);
  
  --unread-dot: #1f6feb;
  --starred: #e3b341;
  
  --sidebar-width: 280px;
  --list-width: 380px;
  --header-height: 56px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #f6f8fa;
  --bg-tertiary: #eaeef2;
  --bg-hover: #e1e4e8;
  --border-color: #d0d7de;
  
  --text-main: #1f2328;
  --text-muted: #57606a;
  --text-dim: #8c959f;
  
  --accent: #0969da;
  --accent-hover: #0860ca;
  --accent-glow: rgba(9, 105, 218, 0.1);
  
  --unread-dot: #0969da;
  --starred: #d4a72c;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* APP LAYOUT */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ICONS & BUTTONS */
.icon {
  width: 20px;
  height: 20px;
}

.icon-sm {
  width: 16px;
  height: 16px;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

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

.icon-btn.highlight {
  background-color: var(--accent);
  color: #fff;
}

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

.icon-btn.active {
  color: var(--starred);
}

.btn-primary {
  background-color: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-primary:hover {
  background-color: var(--accent-hover);
}

.btn-secondary {
  background-color: var(--bg-tertiary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

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

.btn-action {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.btn-action.highlight {
  background: var(--accent-glow);
  color: var(--accent);
  border-color: var(--accent);
}

.badge {
  background-color: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 12px;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 600;
  margin-left: auto;
}

.badge.unread {
  background-color: var(--accent);
  color: #fff;
}

/* 1. LEFT SIDEBAR */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  user-select: none;
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.3px;
}

.logo-icon {
  font-size: 20px;
}

.header-actions {
  display: flex;
  gap: 4px;
}

.nav-section {
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

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

.nav-item.active {
  background-color: var(--accent-glow);
  color: var(--accent);
}

.sidebar-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 4px 12px;
}

.subscriptions-tree {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
}

.tree-header {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  padding: 4px 12px 8px 12px;
  display: flex;
  justify-content: space-between;
}

.folder-group {
  margin-bottom: 6px;
}

.folder-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.folder-header:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-main);
}

.folder-icon {
  transition: transform 0.15s ease;
  font-size: 12px;
}

.folder-icon.open {
  transform: rotate(90deg);
}

.folder-feeds {
  padding-left: 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 2px;
}

.feed-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

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

.feed-item.active {
  background-color: var(--accent-glow);
  color: var(--accent);
  font-weight: 600;
}

.feed-favicon {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  flex-shrink: 0;
}

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

.sidebar-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.footer-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

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

/* 2. CENTER PANE: ARTICLE LIST */
.article-list-pane {
  width: var(--list-width);
  min-width: var(--list-width);
  background-color: var(--bg-primary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
}

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

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

.view-title-container h2 {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.view-title-container .subtitle {
  font-size: 11px;
  color: var(--text-dim);
}

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

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

.search-icon {
  position: absolute;
  left: 8px;
  width: 14px;
  height: 14px;
  color: var(--text-dim);
}

.search-box input {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 5px 8px 5px 28px;
  font-size: 12px;
  width: 140px;
  transition: width 0.2s ease, border-color 0.2s ease;
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent);
  width: 180px;
}

.articles-stream {
  flex: 1;
  overflow-y: auto;
}

.article-card {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.15s ease;
  position: relative;
}

.article-card:hover {
  background-color: var(--bg-secondary);
}

.article-card.active {
  background-color: var(--accent-glow);
  border-left: 3px solid var(--accent);
}

.card-top {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.unread-dot {
  width: 7px;
  height: 7px;
  background-color: var(--unread-dot);
  border-radius: 50%;
  flex-shrink: 0;
}

.article-card.read .unread-dot {
  visibility: hidden;
}

.card-feed {
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.card-time {
  margin-left: auto;
  font-size: 11px;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-main);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card.read .card-title {
  font-weight: 400;
  color: var(--text-muted);
}

.card-excerpt {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.card-star-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px;
}

.card-star-btn.starred {
  color: var(--starred);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 24px;
  gap: 12px;
}

.empty-icon {
  font-size: 48px;
}

/* 3. RIGHT PANE: READING VIEW */
.reading-pane {
  flex: 1;
  background-color: var(--bg-primary);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

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

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.article-content-container {
  flex: 1;
  overflow-y: auto;
  padding: 36px 48px 80px 48px;
  max-width: 860px;
  margin: 0 auto;
  width: 100%;
}

.reading-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 60%;
  text-align: center;
  color: var(--text-dim);
  gap: 12px;
}

.placeholder-icon {
  font-size: 56px;
}

.article-header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.article-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

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

.readability-badge {
  background: var(--accent-glow);
  color: var(--accent);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 24px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.article-header h1 {
  font-family: var(--font-sans);
  font-size: 28px;
  font-weight: 800;
  line-height: 1.3;
  color: var(--text-main);
  letter-spacing: -0.4px;
}

.article-body {
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.75;
  color: var(--text-main);
}

.article-body p {
  margin-bottom: 20px;
}

.article-body h2, .article-body h3, .article-body h4 {
  font-family: var(--font-sans);
  margin: 32px 0 16px 0;
  color: var(--text-main);
}

.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  margin: 20px auto;
  display: block;
}

.article-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-body pre, .article-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background-color: var(--bg-secondary);
  border-radius: 4px;
  font-size: 14px;
}

.article-body code {
  padding: 2px 6px;
}

.article-body pre {
  padding: 16px;
  overflow-x: auto;
  margin-bottom: 20px;
}

.article-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 18px;
  margin: 20px 0;
  color: var(--text-muted);
  font-style: italic;
}

/* MODALS */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 480px;
  max-width: 90vw;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

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

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
}

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-hint {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.form-group input {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}

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

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.shortcuts-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

kbd {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  font-size: 13px;
  font-weight: 500;
  z-index: 2000;
  animation: slideUp 0.2s ease-out;
}

.mobile-only {
  display: none;
}

.full-width {
  width: 100%;
}

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

/* RESPONSIVE MEDIA QUERIES */
@media (max-width: 992px) {
  :root {
    --sidebar-width: 240px;
    --list-width: 320px;
  }
  .article-content-container {
    padding: 24px;
  }
}

@media (max-width: 768px) {
  .mobile-only {
    display: inline-flex;
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 500;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .article-list-pane {
    width: 100vw;
    min-width: 100vw;
  }
  .reading-pane {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 400;
    transform: translateX(100%);
    transition: transform 0.25s ease;
  }
  .reading-pane.open {
    transform: translateX(0);
  }
}

/* USER PROFILE SECTION (Sidebar) */
.user-profile-section {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background-color: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}

.user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-btn {
  color: var(--text-dim);
  padding: 6px;
}

.logout-btn:hover {
  color: #f85149;
}

/* GOOGLE SSO LOGIN OVERLAY */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at center, rgba(30, 36, 46, 0.95), rgba(18, 20, 23, 0.98));
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.login-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 400px;
  max-width: 90vw;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: slideUp 0.3s ease-out;
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.login-brand h2 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.login-logo {
  font-size: 28px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.login-sso-action {
  display: flex;
  justify-content: center;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background-color: #ffffff;
  color: #1f2328;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  width: 100%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-google:hover {
  background-color: #f6f8fa;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.google-icon {
  width: 20px;
  height: 20px;
}

.login-dev-notice {
  background-color: var(--bg-tertiary);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: left;
  display: flex;
  gap: 8px;
  line-height: 1.4;
}

.login-footnote {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

