/**
 * Blog-Post Styles für die KI-Entwickler Website
 * Styles für Blog-Posts, Inhaltsverzeichnis und Sharing-Buttons
 */

/* Header-Bereich des Blogposts */
.post-header {
  padding: 60px 0;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  margin-bottom: 30px;
}

.post-header .post-title {
  color: white;
  margin-bottom: 20px;
}

.post-header .post-meta {
  color: rgba(255, 255, 255, 0.8);
}

.post-header .category-tag {
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
}

.post-header .post-summary {
  margin-top: 20px;
  font-size: 1.2rem;
  max-width: 800px;
}

/* Blog-Inhalt */
.post-content {
  font-size: 1.1rem;
  line-height: 1.7;
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
  margin-bottom: var(--spacing-xxl);
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
  scroll-margin-top: 20px;
}

.post-content h2 {
  font-size: 1.8rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.post-content h3 {
  font-size: 1.4rem;
}

.post-content h4 {
  font-size: 1.2rem;
}

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

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--border-radius-md);
  margin: 1.5em 0;
}

.post-content pre {
  margin: 1.5em 0;
  padding: 1.25em;
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: var(--border-radius-md);
  overflow-x: auto;
}

.post-content code {
  font-family: var(--font-family-mono);
  font-size: 0.9em;
  padding: 0.2em 0.4em;
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: 3px;
}

.post-content pre code {
  padding: 0;
  background-color: transparent;
}

.post-content blockquote {
  margin: 1.5em 0;
  padding: 0.5em 1em 0.5em 1.5em;
  border-left: 4px solid var(--primary-color);
  background-color: rgba(0, 0, 0, 0.03);
  font-style: italic;
  color: var(--text-muted);
}

.post-content ul,
.post-content ol {
  margin: 1em 0 1.5em 1.5em;
}

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

.post-content a {
  color: var(--primary-color);
  text-decoration: none;
  border-bottom: 1px dotted var(--primary-color);
}

.post-content a:hover {
  border-bottom: 1px solid var(--primary-color);
  text-decoration: none;
}

/* Inhaltsverzeichnis */
.table-of-contents {
  position: sticky;
  top: 20px;
  margin-bottom: var(--spacing-lg);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  z-index: 5;
  /* Reduzierter z-index, um Konflikte zu vermeiden */
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-list li {
  margin-bottom: 0.5em;
  font-size: 0.95rem;
}

.toc-list li.h3 {
  padding-left: 1.5em;
  font-size: 0.9rem;
}

.toc-list li.h4 {
  padding-left: 3em;
  font-size: 0.85rem;
}

.toc-list a {
  display: block;
  padding: 0.35em 0.5em;
  color: var(--text-color);
  text-decoration: none;
  border-radius: var(--border-radius-sm);
  transition: all 0.2s ease;
  border-left: 2px solid transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toc-list a:hover,
.toc-list a.active {
  background-color: rgba(0, 0, 0, 0.05);
  color: var(--primary-color);
  padding-left: 0.75em;
  border-left: 2px solid var(--primary-color);
}

/* Autor-Bereich */
.author-section {
  display: flex;
  align-items: center;
  margin: 3em 0;
  padding: 1.5em;
  background-color: var(--card-color);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-sm);
}

.author-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  margin-right: 1.5em;
  flex-shrink: 0;
}

.author-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.author-info h3 {
  margin-top: 0;
  margin-bottom: 0.5em;
}

.author-info p {
  margin-bottom: 1em;
}

.author-social {
  display: flex;
  gap: 10px;
}

.author-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--primary-color);
  color: white;
  transition: opacity 0.2s;
}

.author-social a:hover {
  opacity: 0.8;
}

.author-social a svg {
  width: 18px;
  height: 18px;
}

/* Kommentarbereich */
.comments-section {
  margin-top: 3em;
}

/* Sidebar-Widgets */
.sidebar-widget {
  margin-bottom: 1.5em;
  position: relative;
  /* Stellt sicher, dass Widget-Inhalte nicht vom Inhaltsverzeichnis überdeckt werden */
}

.sidebar-widget h3 {
  margin-top: 0;
  margin-bottom: 1em;
  font-size: 1.2rem;
}

/* Ähnliche Artikel */
.related-post {
  margin-bottom: 1em;
}

.related-post h4 {
  margin-top: 0;
  margin-bottom: 0.25em;
  font-size: 1rem;
}

.related-post-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Share-Buttons */
.share-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
}

.share-button {
  display: inline-flex;
  align-items: center;
  padding: 0.5em 1em;
  border-radius: var(--border-radius-sm);
  color: white;
  text-decoration: none;
  font-size: 0.9rem;
  transition: opacity 0.2s;
  flex: 1 0 calc(50% - 0.5em);
  max-width: 150px;
}

.share-button:hover {
  opacity: 0.9;
  text-decoration: none;
  color: white;
}

.share-button svg {
  width: 16px;
  height: 16px;
  margin-right: 8px;
}

.share-button.twitter {
  background-color: #1DA1F2;
}

.share-button.linkedin {
  background-color: #0077B5;
}

.share-button.email {
  background-color: #555;
}

/* Newsletter-Formular */
.newsletter-form {
  margin-top: 1em;
}

.newsletter-form .form-control {
  margin-bottom: 0.5em;
}

/* Mobile TOC und Share-Buttons */
.mobile-toc,
.mobile-share-buttons {
  display: none;
}

/* Responsive Anpassungen */
@media (max-width: 991px) {
  .author-section {
    flex-direction: column;
    text-align: center;
  }

  .author-avatar {
    margin-right: 0;
    margin-bottom: 1em;
  }

  .author-social {
    justify-content: center;
  }

  /* Desktop TOC in Mobile ausblenden */
  .col-lg-4 .table-of-contents {
    display: none;
  }

  /* Mobile TOC anzeigen */
  .mobile-toc {
    display: block;
    margin-bottom: 1.5em;
  }

  .mobile-toc .table-of-contents {
    position: relative;
    top: 0;
    max-height: none;
    margin-bottom: 0;
    overflow: visible;
  }

  /* Mobile Teilen-Buttons anzeigen */
  .mobile-share-buttons {
    display: block;
    margin: 2em 0;
  }

  /* Inhaltsverzeichnis mobile Anpassungen */
  .toc-list a {
    white-space: normal;
    /* Erlaubt Textumbruch auf Mobilgeräten */
  }

  /* Verbesserte Seitenleiste für mobile Geräte */
  .sidebar-widget {
    z-index: 1;
    /* Stellt sicher, dass Widgets über anderen Elementen angezeigt werden */
  }

  /* Klappbare Inhaltsverzeichnisse */
  .table-of-contents.collapsible h3 {
    position: relative;
    cursor: pointer;
    padding-right: 30px;
    margin-bottom: 0.5em;
  }

  .table-of-contents.collapsible h3::after {
    content: "▼";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8em;
    transition: transform 0.3s ease;
  }

  .table-of-contents.collapsed h3::after {
    content: "▶";
  }

  .table-of-contents.collapsed #mobile-toc-content,
  .table-of-contents.collapsed .toc-list {
    display: none;
  }
}

@media (max-width: 767px) {
  .post-header {
    padding: 40px 0;
  }

  .post-header .post-title {
    font-size: 1.8rem;
  }

  .post-content {
    font-size: 1rem;
  }

  .post-content h2 {
    font-size: 1.5rem;
  }

  .post-content h3 {
    font-size: 1.3rem;
  }

  .share-button {
    font-size: 0.85rem;
    padding: 0.4em 0.8em;
  }

  /* Verbesserte mobile Ansicht für Inhaltsverzeichnis */
  .toc-list li {
    margin-bottom: 0.4em;
  }

  .toc-list li.h3,
  .toc-list li.h4 {
    padding-left: 1em;
    /* Reduzierter Einzug für mobile Ansicht */
  }
}