/**
 * Article Page Styles
 * Invest Like The Best
 */

/* Reading Progress Bar */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, #c9a962, #d4bc7a);
  z-index: 9999;
  transition: width 50ms linear;
}

/* Table of Contents */
.toc-container {
  margin: 2rem 0;
  padding: 1.5rem;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px;
}

.toc-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0;
  background: none;
  border: none;
  color: #c9a962;
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
}

.toc-toggle-icon {
  width: 20px;
  height: 20px;
  transition: transform 0.3s ease;
}

.toc-toggle[aria-expanded="true"] .toc-toggle-icon {
  transform: rotate(180deg);
}

.toc-list {
  margin-top: 1rem;
  padding-left: 1.25rem;
  list-style: decimal;
  color: #737373;
}

.toc-list li {
  margin-bottom: 0.5rem;
}

.toc-link {
  color: #a3a3a3;
  text-decoration: none;
  transition: color 0.2s;
  padding: 0.25rem 0;
  display: inline-block;
}

.toc-link:hover {
  color: #c9a962;
}

/* TOC Active State (scroll highlighting) */
.toc-link.active {
  color: #c9a962;
  font-weight: 500;
}

.toc-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  width: 2px;
  height: 100%;
  background: #c9a962;
}

/* Share Buttons */
.share-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0;
}

.share-label {
  font-size: 0.75rem;
  color: #737373;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.share-buttons {
  display: flex;
  gap: 0.5rem;
}

.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  color: #a3a3a3;
  transition: all 0.2s;
}

.share-btn:hover {
  background: #c9a962;
  border-color: #c9a962;
  color: #0a0a0a;
}

.share-btn svg {
  width: 18px;
  height: 18px;
}

/* Font Size Controls */
.reading-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid #262626;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.font-size-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.font-size-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 6px;
  color: #a3a3a3;
  font-weight: 600;
  transition: all 0.2s;
  cursor: pointer;
}

.font-size-btn:hover {
  border-color: #c9a962;
  color: #c9a962;
}

.font-size-label {
  font-size: 0.75rem;
  color: #737373;
}

/* Remaining Reading Time */
.reading-time-remaining {
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  font-size: 0.75rem !important;
  color: #737373 !important;
}

.reading-time-remaining svg {
  width: 14px !important;
  height: 14px !important;
  min-width: 14px !important;
  min-height: 14px !important;
  max-width: 14px !important;
  max-height: 14px !important;
  flex-shrink: 0 !important;
  color: #c9a962 !important;
}

.reading-time-remaining span {
  font-size: 0.75rem !important;
  line-height: 1 !important;
}

.reading-time-remaining.almost-done {
  color: #22c55e !important;
}

.reading-time-remaining.almost-done svg {
  color: #22c55e !important;
}

/* Article Navigation */
.article-navigation {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #262626;
}

@media (max-width: 640px) {
  .article-navigation {
    grid-template-columns: 1fr;
  }
}

.nav-article {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.2s;
}

.nav-article:hover {
  border-color: #c9a962;
  transform: translateY(-2px);
}

.nav-prev {
  align-items: flex-start;
}

.nav-next {
  align-items: flex-end;
  text-align: right;
}

.nav-label {
  font-size: 0.75rem;
  color: #c9a962;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.nav-title {
  font-size: 0.95rem;
  color: #e5e5e5;
  line-height: 1.4;
}

/* Related Articles */
.related-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #262626;
}

.related-heading {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  color: white;
  margin-bottom: 1.5rem;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.related-card {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.2s;
}

.related-card:hover {
  border-color: #c9a962;
  transform: translateY(-2px);
}

.related-date {
  font-size: 0.75rem;
  color: #c9a962;
  margin-bottom: 0.5rem;
}

.related-title {
  font-size: 1rem;
  color: #e5e5e5;
  line-height: 1.4;
  margin-bottom: 0.5rem;
}

.related-time {
  font-size: 0.75rem;
  color: #737373;
}

/* Back to Top */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 48px;
  height: 48px;
  background: #c9a962;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0a0a0a;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  z-index: 50;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: #d4bc7a;
  transform: translateY(-2px);
}

.back-to-top svg {
  width: 20px;
  height: 20px;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 6rem;
  left: 50%;
  transform: translateX(-50%);
  background: #c9a962;
  color: #0a0a0a;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 500;
  z-index: 9999;
  animation: toast-in 0.3s ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 10px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* Font size classes */
.reader-content.size-small {
  font-size: 1rem;
}

.reader-content.size-medium {
  font-size: 1.125rem;
}

.reader-content.size-large {
  font-size: 1.25rem;
}

/* Disclaimer - dezenter Hinweis */
.disclaimer {
  margin-top: 3rem;
  padding: 1rem 1.25rem;
  background: #111111;
  border-left: 2px solid #333;
  border-radius: 0 8px 8px 0;
}

.disclaimer p {
  font-size: 0.75rem;
  line-height: 1.5;
  color: #525252;
  margin: 0;
  font-style: italic;
}

/* ========== NEW: Copy Quote Button ========== */
.quote-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid #333;
  border-radius: 6px;
  color: #a3a3a3;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s;
}

.reader-content p:hover .quote-copy-btn,
.reader-content blockquote:hover .quote-copy-btn {
  opacity: 1;
}

.quote-copy-btn:hover {
  background: #c9a962;
  border-color: #c9a962;
  color: #0a0a0a;
}

.quote-copy-btn svg {
  width: 14px;
  height: 14px;
}

/* Text selection for copy */
.reader-content ::selection {
  background: rgba(201, 169, 98, 0.3);
  color: white;
}

/* ========== NEW: Headings anchor links ========== */
.reader-content h2 {
  position: relative;
  scroll-margin-top: 100px;
}

.reader-content h2:hover .heading-anchor {
  opacity: 1;
}

.heading-anchor {
  position: absolute;
  left: -1.5rem;
  color: #525252;
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.heading-anchor:hover {
  color: #c9a962;
}

/* ========== NEW: Bookmark article button ========== */
.article-bookmark-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.375rem !important;
  padding: 0.375rem 0.75rem !important;
  background: #1a1a1a !important;
  border: 1px solid #333 !important;
  border-radius: 6px !important;
  color: #a3a3a3 !important;
  font-size: 0.75rem !important;
  cursor: pointer;
  transition: all 0.2s;
}

.article-bookmark-btn:hover {
  border-color: #c9a962 !important;
  color: #c9a962 !important;
}

.article-bookmark-btn.is-saved {
  background: rgba(201, 169, 98, 0.1) !important;
  border-color: #c9a962 !important;
  color: #c9a962 !important;
}

.article-bookmark-btn svg {
  width: 14px !important;
  height: 14px !important;
  min-width: 14px !important;
  min-height: 14px !important;
  max-width: 14px !important;
  max-height: 14px !important;
  flex-shrink: 0 !important;
}

.article-bookmark-btn span {
  font-size: 0.75rem !important;
  line-height: 1 !important;
}

.article-bookmark-btn.is-saved svg {
  fill: currentColor;
}

/* ========== Print Styles ========== */
@media print {
  /* Hide non-essential elements */
  nav,
  footer,
  .back-to-top,
  .reading-progress,
  .reading-controls,
  .share-container,
  .toc-container,
  .article-navigation,
  .related-section,
  .article-bookmark-btn,
  #mobile-menu {
    display: none !important;
  }

  /* Reset colors for print */
  body {
    background: white !important;
    color: black !important;
    font-size: 12pt;
    line-height: 1.6;
  }

  /* Article header */
  header {
    padding-top: 0 !important;
  }

  h1 {
    color: black !important;
    font-size: 24pt !important;
  }

  h2, h3 {
    color: black !important;
    page-break-after: avoid;
  }

  /* Content styling */
  .reader-content {
    max-width: 100% !important;
    padding: 0 !important;
  }

  .reader-content p {
    color: black !important;
    orphans: 3;
    widows: 3;
  }

  /* Links */
  a {
    color: black !important;
    text-decoration: underline;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 10pt;
    color: #666;
  }

  /* Disclaimer */
  .disclaimer {
    background: #f5f5f5 !important;
    border-color: #ccc !important;
  }

  .disclaimer p {
    color: #666 !important;
  }

  /* Page breaks */
  article {
    page-break-inside: avoid;
  }

  /* Print footer */
  @page {
    margin: 2cm;
  }

  body::after {
    content: "Quelle: investlikethebest.de";
    display: block;
    text-align: center;
    margin-top: 2rem;
    font-size: 10pt;
    color: #999;
  }
}

/* ========== NEW: Smooth scroll for anchor links ========== */
html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* ========== Focus styles for accessibility ========== */
a:focus-visible,
button:focus-visible {
  outline: 2px solid #c9a962;
  outline-offset: 2px;
}

/* ========== Reading mode enhancements ========== */
.reader-content {
  max-width: 680px;
  margin: 0 auto;
}

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

.reader-content h2 {
  margin-top: 2.5em;
  margin-bottom: 1em;
}

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

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

.reader-content strong {
  color: #e5e5e5;
}

.reader-content em {
  color: #a3a3a3;
}
