/* Reader view */
.reader { 
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px; 
  padding: 0.75rem; 
  text-align: left; 
  overflow: hidden; 
  max-width: 900px;
  margin: 0 auto;
  padding-bottom: 2rem; /* Add space for progress indicator */
}

/* Video container - responsive wrapper following react-player docs */
.reader-video { 
  position: relative;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16/9;
  margin: 0 0 1rem 0; /* align with reader padding, no bleed */
  background: rgb(0 0 0); /* black */
  overflow: hidden;
}
.reader.empty { color: var(--color-text-secondary); }
.loading-spinner { display: flex; align-items: center; gap: 0.5rem; color: var(--color-text-secondary); }
.loading-spinner svg { font-size: 1.2rem; }
.reader-header { margin-bottom: 2rem; position: relative; }
.reader-title { margin: 0 0 0.75rem 0; font-family: var(--reading-font); font-size: 2.5rem; font-weight: 700; line-height: 1.2; }
.reader-summary { color: var(--color-text); font-size: 1.2rem; line-height: 1.6; margin: 0 0 1rem 0; font-family: var(--reading-font); }
.reader-meta { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.publish-date { display: flex; align-items: center; gap: 0.4rem; font-size: 0.813rem; color: var(--color-text-muted); opacity: 0.85; }
.publish-date svg { font-size: 0.75rem; opacity: 0.6; }
.publish-date-topright { position: absolute; top: 1rem; right: 1rem; font-size: 0.813rem; color: var(--color-text); padding: 0.4rem 0.75rem; z-index: 10; }
.reading-time { display: flex; align-items: center; gap: 0.5rem; padding: 0.375rem 0.75rem; background: var(--color-bg-elevated); border: 1px solid var(--color-border); border-radius: 6px; font-size: 0.875rem; color: var(--color-text-secondary); }
.reading-time svg { font-size: 0.875rem; }
.highlight-indicator { display: flex; align-items: center; gap: 0.5rem; padding: 0.375rem 0.75rem; background: rgba(99, 102, 241, 0.1); border: 1px solid rgba(99, 102, 241, 0.3); border-radius: 6px; font-size: 0.875rem; color: var(--color-text); }
.highlight-indicator svg { font-size: 0.875rem; }
.reader-html { color: var(--color-text); line-height: 1.6; word-wrap: break-word; overflow-wrap: break-word; word-break: break-word; font-family: var(--reading-font); font-size: var(--reading-font-size); }
.reader-markdown { color: var(--color-text); line-height: 1.7; font-family: var(--reading-font); font-size: var(--reading-font-size); }
/* Ensure font inheritance */
.reader .reader-html *, .reader .reader-markdown * { font-family: inherit !important; }
/* Apply paragraph alignment from settings */
.reader .reader-html p,
.reader .reader-markdown p,
.reader .reader-html div,
.reader .reader-markdown div,
.reader .reader-html li,
.reader .reader-markdown li,
.reader .reader-html blockquote,
.reader .reader-markdown blockquote { text-align: var(--paragraph-alignment, justify); }
/* Override centered content with user preference */
.reader center, .reader [align="center"] { text-align: var(--paragraph-alignment, justify) !important; }
/* Keep headings left-aligned */
.reader .reader-html h1, .reader .reader-html h2, .reader .reader-html h3, .reader .reader-html h4, .reader .reader-html h5, .reader .reader-html h6,
.reader .reader-markdown h1, .reader .reader-markdown h2, .reader .reader-markdown h3, .reader .reader-markdown h4, .reader .reader-markdown h5, .reader .reader-markdown h6 { text-align: left !important; }
/* Tame images from external content */
.reader .reader-html img, .reader .reader-markdown img { 
  max-width: var(--image-max-width, 100%); 
  max-height: 70vh; 
  height: auto; 
  width: auto; 
  display: block; 
  margin: 0.75rem auto; 
  border-radius: 6px; 
}
/* Headlines with Tailwind typography */
.reader-markdown h1, .reader-html h1 { 
  font-size: 2.25rem; /* text-4xl */
  font-weight: 700; 
  line-height: 1.2; 
  margin-top: 2rem; 
  margin-bottom: 1rem; 
  color: var(--color-text);
}
.reader-markdown h2, .reader-html h2 { 
  font-size: 1.875rem; /* text-3xl */
  font-weight: 600; 
  line-height: 1.3; 
  margin-top: 1.75rem; 
  margin-bottom: 0.875rem; 
  color: var(--color-text);
}
.reader-markdown h3, .reader-html h3 { 
  font-size: 1.5rem; /* text-2xl */
  font-weight: 600; 
  line-height: 1.4; 
  margin-top: 1.5rem; 
  margin-bottom: 0.75rem; 
  color: var(--color-text);
}
.reader-markdown h4, .reader-html h4 { 
  font-size: 1.25rem; /* text-xl */
  font-weight: 600; 
  line-height: 1.4; 
  margin-top: 1.25rem; 
  margin-bottom: 0.625rem; 
  color: var(--color-text);
}
.reader-markdown h5, .reader-html h5 { 
  font-size: 1.125rem; /* text-lg */
  font-weight: 600; 
  line-height: 1.4; 
  margin-top: 1rem; 
  margin-bottom: 0.5rem; 
  color: var(--color-text);
}
.reader-markdown h6, .reader-html h6 { 
  font-size: 1rem; /* text-base */
  font-weight: 600; 
  line-height: 1.4; 
  margin-top: 1rem; 
  margin-bottom: 0.5rem; 
  color: var(--color-text);
}
.reader-markdown p { margin: 0.5rem 0; }
.reader-html p, .reader-html div, .reader-html span, .reader-html li, .reader-html td, .reader-html th { font-size: 1em !important; }
/* Lists */
.reader-markdown ul, .reader-html ul {
  list-style-type: disc;
  margin: 1rem 0;
  padding-left: 2rem;
}
.reader-markdown ol, .reader-html ol {
  list-style-type: decimal;
  margin: 1rem 0;
  padding-left: 2rem;
}
.reader-markdown li, .reader-html li {
  margin: 0.375rem 0;
  line-height: 1.6;
  color: var(--color-text);
}
.reader-markdown ul ul, .reader-markdown ol ul, .reader-html ul ul, .reader-html ol ul {
  list-style-type: circle;
  margin: 0.25rem 0;
}
.reader-markdown ul ol, .reader-markdown ol ol, .reader-html ul ol, .reader-html ol ol {
  list-style-type: lower-alpha;
  margin: 0.25rem 0;
}
.reader-markdown li p, .reader-html li p {
  margin: 0.25rem 0;
}
.reader-markdown blockquote, .reader-html blockquote { 
  margin: 1.5rem 0; 
  padding: 1rem 0 1rem 2rem;
  font-style: italic;
}
.reader-markdown blockquote p, .reader-html blockquote p { margin: 0.5rem 0; }
.reader-markdown blockquote p:first-child, .reader-html blockquote p:first-child { margin-top: 0; }
.reader-markdown blockquote p:last-child, .reader-html blockquote p:last-child { margin-bottom: 0; }
/* Horizontal rule - subtle divider */
.reader-markdown hr, .reader-html hr {
  border: none;
  border-top: 1px solid var(--color-border);
  opacity: 0.69;
  margin: 2.5rem 0;
}
.reader-markdown a { color: var(--color-primary); text-decoration: none; }
.reader-markdown a:hover { text-decoration: underline; }
.reader-markdown code { background: var(--color-bg-subtle); border: 1px solid var(--color-border); border-radius: 4px; padding: 0.15rem 0.4rem; font-size: 0.9em; font-family: 'Monaco', 'Menlo', 'Consolas', 'Courier New', monospace; }
.reader-markdown pre { background: var(--color-bg-subtle); border: 1px solid var(--color-border); border-radius: 8px; padding: 1rem; overflow-x: auto; margin: 1rem 0; line-height: 1.5; font-family: 'Monaco', 'Menlo', 'Consolas', 'Courier New', monospace; }
.reader-markdown pre code { background: transparent; border: none; padding: 0; font-size: 0.9em; display: block; }
/* Prism.js enhancements */
.reader-markdown pre[class*="language-"] { background: var(--color-bg-subtle); border: 1px solid var(--color-border); }
.reader-markdown code[class*="language-"] { background: transparent; text-shadow: none; }
.reader-html pre { background: var(--color-bg-subtle); border: 1px solid var(--color-border); border-radius: 8px; padding: 1rem; overflow-x: auto; margin: 1rem 0; font-family: 'Monaco', 'Menlo', 'Consolas', 'Courier New', monospace; }
.reader-html code { background: var(--color-bg-subtle); border: 1px solid var(--color-border); border-radius: 4px; padding: 0.15rem 0.4rem; font-size: 0.9em; font-family: 'Monaco', 'Menlo', 'Consolas', 'Courier New', monospace; }
.reader-html pre code { background: transparent; border: none; padding: 0; display: block; }
/* Mobile: prevent code blocks from causing horizontal overflow */
@media (max-width: 768px) {
  .reader-markdown pre, .reader-html pre {
    max-width: 100%;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  
  .reader-markdown code, .reader-html code {
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  
  /* Also handle tables and other wide elements */
  .reader-markdown table, .reader-html table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
  }
  
  .reader-markdown img, .reader-html img {
    max-width: 100%;
    height: auto;
  }
}

/* Desktop: increase horizontal padding for text content */
@media (min-width: 769px) {
  .reader-header,
  .reader-summary-below-image,
  .reader-html, 
  .reader-markdown,
  .article-menu-container,
  .mark-as-read-container {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}
/* Article menu */
.article-menu-container { display: flex; justify-content: flex-end; padding: 1.5rem 0 0.5rem; margin-top: 2rem; }
.article-menu-wrapper { position: relative; }
.article-menu-btn { background: none; border: none; color: var(--color-text-secondary); cursor: pointer; padding: 0.5rem 0.75rem; font-size: 0.875rem; display: flex; align-items: center; gap: 0.5rem; transition: all 0.2s ease; border-radius: 6px; }
.article-menu-btn:hover { color: var(--color-primary); background: rgba(99, 102, 241, 0.1); }
.article-menu { position: absolute; right: 0; top: calc(100% + 4px); background: var(--color-bg-elevated); border: 1px solid var(--color-border-subtle); border-radius: 6px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); z-index: 1000; min-width: 180px; overflow: hidden; }
.article-menu.open-upward { top: auto; bottom: calc(100% + 4px); }
.article-menu-item { width: 100%; background: none; border: none; color: var(--color-text); padding: 0.75rem 1rem; font-size: 0.875rem; display: flex; align-items: center; gap: 0.75rem; cursor: pointer; transition: all 0.15s ease; text-align: left; white-space: nowrap; }
.article-menu-item:hover { background: rgba(99, 102, 241, 0.15); color: var(--color-text); }
.article-menu-item svg { font-size: 0.875rem; flex-shrink: 0; }

/* Mark as Read button */
.mark-as-read-container { display: flex; justify-content: center; align-items: center; padding: 2rem 1rem; margin-top: 1rem; }
.mark-as-read-btn { display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem 1.5rem; background: var(--color-bg-elevated); color: var(--color-text); border: 1px solid var(--color-border-subtle); border-radius: 8px; font-size: 1rem; font-weight: 500; cursor: pointer; transition: all 0.2s ease; min-width: 160px; justify-content: center; }
.mark-as-read-btn:hover:not(:disabled) { background: var(--color-border); border-color: var(--color-text-muted); transform: translateY(-1px); }
.mark-as-read-btn:active:not(:disabled) { transform: translateY(0); }
.mark-as-read-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.mark-as-read-btn svg { font-size: 1.1rem; }
@media (max-width: 768px) {
  .reader {
    max-width: 100%;
    width: 100%;
    margin: 0;
    padding: 0.5rem;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  .mark-as-read-container { padding: 1.5rem 1rem; }
  .mark-as-read-btn { width: 100%; max-width: 300px; }
}

/* Hero image in reader/card views */
.article-hero-image { width: 100%; height: 200px; background-size: cover; background-position: center; background-repeat: no-repeat; cursor: pointer; transition: all 0.2s ease; border-radius: 8px 8px 0 0; position: relative; }
.article-hero-image:hover { opacity: 0.9; }
.article-hero-image::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 60%, rgba(0,0,0,0.4) 100%); pointer-events: none; border-radius: 8px 8px 0 0; }
.reader-hero-image { width: calc(100% + 1.5rem); margin: -0.75rem -0.75rem 2rem -0.75rem; border-radius: 0; overflow: hidden; position: relative; min-height: 300px; background: linear-gradient(135deg, var(--color-bg-elevated) 0%, var(--color-bg-subtle) 25%, var(--color-bg-elevated) 50%, var(--color-bg-subtle) 75%, var(--color-bg-elevated) 100%); }
.reader-hero-image img { width: 100%; height: auto; max-height: 500px; object-fit: cover; display: block; }
.reader-hero-placeholder { width: 100%; height: 300px; display: flex; align-items: center; justify-content: center; font-size: 4rem; color: var(--color-border-subtle); opacity: 0.3; }
.reader-header-overlay { position: absolute; bottom: 0; left: 0; right: 0; padding: 2rem 2rem 1.5rem; background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.6) 60%, rgba(0, 0, 0, 0) 100%); }
.reader-header-overlay .reader-title { color: #fff; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); margin-bottom: 0.75rem; font-size: 2.5rem; font-weight: 700; line-height: 1.2; }
.reader-header-overlay .reader-summary { color: rgba(255, 255, 255, 0.9); font-size: 1.2rem; line-height: 1.6; margin: 0 0 1rem 0; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); font-family: var(--reading-font); }
.reader-header-overlay .reader-meta { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.reader-header-overlay .publish-date { color: rgba(255, 255, 255, 0.65); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); opacity: 1; }
.reader-header-overlay .publish-date svg { opacity: 0.7; }
.reader-header-overlay .reading-time, .reader-header-overlay .highlight-indicator { background: rgba(255, 255, 255, 0.15); backdrop-filter: blur(8px); border: 1px solid rgba(255, 255, 255, 0.25); color: #fff; }
.reader-header-overlay .highlight-indicator { background: rgba(100, 108, 255, 0.25); border: 1px solid rgba(100, 108, 255, 0.4); }
.reader-summary-below-image { display: none; }
@media (max-width: 768px) {
  .reader-header-overlay .reader-summary.hide-on-mobile { display: none; }
  .reader-summary-below-image { display: block; padding: 0 0 1.5rem 0; margin-top: -1rem; }
  .reader-summary-below-image .reader-summary { color: var(--color-text-secondary); font-size: 1rem; line-height: 1.6; margin: 0; }
  .reader-hero-image { min-height: 280px; max-height: 400px; height: 50vh; }
  .reader-hero-image img { height: 100%; width: 100%; object-fit: cover; object-position: center; }
  .reader-header-overlay { padding: 1.5rem 1rem 1rem; }
  .reader-header-overlay .reader-title { font-size: 2rem; line-height: 1.3; }
}

/* Reading Progress Indicator - now using Tailwind utilities in component */

