/**
 * ============================================
 * MyInvest24 - Sticky Article TOC System
 * Version: 1.1.0
 * 
 * Dieses System bietet:
 * - Desktop: Sticky TOC links
 * - Mobile: Ausklappbares Dropdown oben
 * - Aktiver Abschnitt wird gehighlighted
 * - Smooth-Scroll zu Abschnitten
 * - Hero-Section Styling (H1 weiß!)
 * - CTA-Section Design
 * - Related Articles Cards
 * ============================================
 */

/* ================================================================
   RATGEBER HERO SECTION FIXES
   ================================================================ */

/* KRITISCH: H1 in Hero-Sections MUSS weiß sein! */
.article-hero h1,
.ratgeber-hero h1,
section[class*="hero"] h1,
.page-hero h1 {
  color: #FFFFFF !important;
}

/* Hero Lead Text */
.article-hero__lead,
.article-hero p,
.page-hero__lead {
  color: #94A3B8 !important;
}

/* Breadcrumb Links */
.article-hero__breadcrumb a {
  color: #22D3EE;
  text-decoration: none;
  transition: color 0.2s ease;
}

.article-hero__breadcrumb a:hover {
  color: #67E8F9;
}

.article-hero__breadcrumb span {
  color: #64748B;
}

/* Kategorie Badge */
.article-hero__category {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(14, 165, 233, 0.15);
  border: 1px solid rgba(14, 165, 233, 0.3);
  color: #0EA5E9;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 20px;
}

/* Meta Infos */
.article-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  color: #64748B;
  font-size: 14px;
}

.article-hero__meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.article-hero__meta-item svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}

/* ================================================================
   CTA SECTION - VERBESSERT
   ================================================================ */

.cta-section {
  padding: 48px 24px;
  margin: 48px 0;
  background: linear-gradient(135deg, #0EA5E9 0%, #0284C7 100%);
  border-radius: 20px;
  text-align: center;
}

.cta-section__title {
  color: #FFFFFF !important;
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 16px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.cta-section__text {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 28px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.cta-section__btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: white;
  color: #0284C7;
  padding: 16px 32px;
  border-radius: 10px;
  font-weight: 600;
  text-decoration: none;
  font-size: 1rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cta-section__btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.cta-section__btn svg {
  width: 20px;
  height: 20px;
}

/* Trust Signal unter CTA */
.cta-section__trust {
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  margin-top: 20px;
}

/* ================================================================
   ARTIKEL LAYOUT MIT STICKY TOC
   ================================================================ */

/* Container für das zweispaltige Layout */
.article-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}

@media (min-width: 1024px) {
  .article-layout {
    grid-template-columns: 260px 1fr;
    gap: 48px;
    padding: 48px 24px;
  }
}

@media (min-width: 1200px) {
  .article-layout {
    grid-template-columns: 280px 1fr;
    gap: 64px;
  }
}

/* ----------------------------------------------------------------
   DESKTOP TOC (Linke Sidebar)
   ---------------------------------------------------------------- */
.article-toc {
  display: none;
}

@media (min-width: 1024px) {
  .article-toc {
    display: block;
    position: relative;
  }
}

.toc-sticky {
  position: sticky;
  top: 100px; /* Unterhalb des Headers */
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  padding-right: 8px;
  
  /* Scrollbar Styling */
  scrollbar-width: thin;
  scrollbar-color: #CBD5E1 transparent;
}

.toc-sticky::-webkit-scrollbar {
  width: 4px;
}

.toc-sticky::-webkit-scrollbar-track {
  background: transparent;
}

.toc-sticky::-webkit-scrollbar-thumb {
  background-color: #CBD5E1;
  border-radius: 4px;
}

.toc-sticky::-webkit-scrollbar-thumb:hover {
  background-color: #94A3B8;
}

/* TOC Titel */
.toc-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #64748B;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toc-title svg {
  width: 14px;
  height: 14px;
  stroke: #64748B;
}

/* TOC Navigation */
.toc-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* TOC Links */
.toc-link {
  display: block;
  padding: 10px 14px;
  font-size: 13px;
  color: #64748B;
  text-decoration: none;
  border-left: 2px solid transparent;
  border-radius: 0 8px 8px 0;
  transition: all 0.2s ease;
  line-height: 1.4;
  font-weight: 500;
}

.toc-link:hover {
  color: #0EA5E9;
  background: #F8FAFC;
  border-left-color: #E2E8F0;
}

/* Aktiver Link */
.toc-link.active {
  color: #0EA5E9;
  background: linear-gradient(135deg, #EFF6FF 0%, #F0F9FF 100%);
  border-left-color: #0EA5E9;
  font-weight: 600;
}

/* Sub-Links (verschachtelte TOC-Einträge) */
.toc-link--sub {
  padding-left: 28px;
  font-size: 12px;
}

/* Progress Indicator (optional) */
.toc-progress {
  height: 3px;
  background: #E2E8F0;
  border-radius: 3px;
  margin-bottom: 16px;
  overflow: hidden;
}

.toc-progress__bar {
  height: 100%;
  background: linear-gradient(90deg, #0EA5E9, #22D3EE);
  width: 0%;
  transition: width 0.1s ease;
  border-radius: 3px;
}

/* CTA im TOC */
.toc-cta {
  margin-top: 24px;
  padding: 20px;
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
  border-radius: 16px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.toc-cta::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #0EA5E9, #22D3EE);
}

.toc-cta p {
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  margin-bottom: 14px;
  line-height: 1.5;
}

.toc-cta .btn-small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(135deg, #0EA5E9 0%, #0284C7 100%);
  color: white;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  width: 100%;
}

.toc-cta .btn-small:hover {
  background: linear-gradient(135deg, #38BDF8 0%, #0EA5E9 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.toc-cta .btn-small svg {
  width: 14px;
  height: 14px;
}

/* ----------------------------------------------------------------
   MOBILE TOC (Sticky oben, ausklappbar)
   ---------------------------------------------------------------- */
.mobile-toc {
  display: block;
  position: sticky;
  top: 72px; /* Unterhalb Header */
  z-index: 100;
  background: white;
  border-bottom: 1px solid #E2E8F0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  margin: 0 -24px;
  padding: 0 24px;
}

@media (min-width: 1024px) {
  .mobile-toc {
    display: none;
  }
}

/* Toggle Button */
.mobile-toc-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 0;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #1E293B;
  transition: color 0.2s ease;
}

.mobile-toc-toggle:hover {
  color: #0EA5E9;
}

.mobile-toc-toggle span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-toc-toggle svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}

.mobile-toc-toggle .chevron {
  width: 20px;
  height: 20px;
  transition: transform 0.3s ease;
  color: #64748B;
}

.mobile-toc.open .mobile-toc-toggle .chevron {
  transform: rotate(180deg);
}

/* Mobile TOC Navigation */
.mobile-toc-nav {
  display: none;
  padding: 0 0 16px;
  max-height: 50vh;
  overflow-y: auto;
}

.mobile-toc.open .mobile-toc-nav {
  display: block;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.mobile-toc-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: #475569;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: 10px;
  transition: all 0.2s ease;
  margin-bottom: 4px;
}

.mobile-toc-nav a:last-child {
  margin-bottom: 0;
}

.mobile-toc-nav a:hover {
  background: #F8FAFC;
  color: #0EA5E9;
}

.mobile-toc-nav a.active {
  background: linear-gradient(135deg, #EFF6FF 0%, #F0F9FF 100%);
  color: #0EA5E9;
  font-weight: 600;
}

.mobile-toc-nav a::before {
  content: attr(data-number);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: #E2E8F0;
  color: #64748B;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.mobile-toc-nav a.active::before {
  background: #0EA5E9;
  color: white;
}

/* ----------------------------------------------------------------
   ARTIKEL CONTENT
   ---------------------------------------------------------------- */
.article-content {
  max-width: 800px;
  min-width: 0; /* Prevent overflow in grid */
}

/* Sections mit Scroll-Margin für Sticky Header + TOC */
.article-content section {
  scroll-margin-top: 140px;
  margin-bottom: 48px;
}

.article-content section:last-child {
  margin-bottom: 0;
}

/* Überschriften */
.article-content h2 {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 1.75rem;
  color: #0F172A;
  margin-bottom: 20px;
  padding-top: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #E2E8F0;
  line-height: 1.3;
}

.article-content h2:first-of-type {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}

@media (min-width: 768px) {
  .article-content h2 {
    font-size: 2rem;
  }
}

.article-content h3 {
  font-size: 1.25rem;
  color: #0F172A;
  margin: 28px 0 14px;
  font-weight: 700;
}

@media (min-width: 768px) {
  .article-content h3 {
    font-size: 1.4rem;
  }
}

.article-content h4 {
  font-size: 1.1rem;
  color: #334155;
  margin: 20px 0 10px;
  font-weight: 600;
}

/* Absätze */
.article-content p {
  color: #475569;
  margin-bottom: 18px;
  line-height: 1.8;
}

.article-content p:last-child {
  margin-bottom: 0;
}

/* Rich-Content (Listen/Tabellen/Code/Zitate) ist zentral in css/global.css definiert */

/* Links im Content */
.article-content a {
  color: #0EA5E9;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s ease;
}

.article-content a:hover {
  color: #0284C7;
}

/* Strong Text */
.article-content strong {
  color: #0F172A;
  font-weight: 600;
}

/* ----------------------------------------------------------------
   RELATED ARTICLES SECTION - VERBESSERT
   ---------------------------------------------------------------- */
.related-articles {
  margin-top: 48px;
  padding: 48px 24px;
  background: #FAFBFC;
  border-top: 1px solid #E2E8F0;
  border-radius: 0;
  margin-left: -24px;
  margin-right: -24px;
}

@media (min-width: 1024px) {
  .related-articles {
    margin-left: 0;
    margin-right: 0;
    border-radius: 20px;
    padding: 48px;
  }
}

.related-articles h2 {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: #0F172A;
  margin-bottom: 32px;
  padding-bottom: 0;
  border-bottom: none;
}

.related-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 640px) {
  .related-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .related-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.related-card {
  display: flex;
  flex-direction: column;
  padding: 24px;
  background: white;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.related-card:hover {
  border-color: #0EA5E9;
  box-shadow: 0 4px 16px rgba(14, 165, 233, 0.12);
  transform: translateY(-2px);
}

.related-category {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #0EA5E9;
  margin-bottom: 12px;
}

.related-card h3 {
  font-size: 1.1rem;
  color: #0F172A;
  margin-bottom: 8px;
  line-height: 1.4;
  font-weight: 600;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.related-card p {
  font-size: 14px;
  color: #64748B;
  line-height: 1.5;
  flex-grow: 1;
  margin-bottom: 16px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.related-arrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #0EA5E9;
  font-size: 14px;
  font-weight: 500;
  transition: transform 0.2s ease;
}

.related-arrow svg {
  width: 16px;
  height: 16px;
}

.related-card:hover .related-arrow {
  transform: translateX(4px);
}

.related-more {
  text-align: center;
  margin-top: 32px;
}

.related-more a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #0EA5E9;
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  transition: color 0.2s ease;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.related-more a:hover {
  color: #0284C7;
}

.related-more a svg {
  width: 18px;
  height: 18px;
}

