/* LaTeX and PDF styles */
.latex-block, .latex-display {
  margin: 1.5rem 0;
  padding: 1rem;
  background: rgba(255,255,255,0.02);
  border-radius: 8px;
  overflow-x: auto;
  text-align: center;
}

.latex-error {
  color: #ff6b6b;
  background: rgba(255,107,107,0.1);
  padding: 0.5rem;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.9rem;
  margin: 0.5rem 0;
}

.pdf-embed {
  margin: 2rem 0;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255,255,255,0.02);
}

.pdf-embed iframe {
  display: block;
  width: 100%;
  height: 600px;
  border: none;
}

.image-embed {
  margin: 2rem 0;
  text-align: center;
  border-radius: 12px;
  overflow: hidden;
}

.image-embed .article-image {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  transition: transform 0.3s ease;
}

.image-embed .article-image:hover {
  transform: scale(1.02);
}

.youtube-embed, .vimeo-embed {
  margin: 2rem 0;
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
  border-radius: 12px;
  background: rgba(255,255,255,0.02);
}

.youtube-embed iframe, .vimeo-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 12px;
}

.video-embed {
  margin: 2rem 0;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255,255,255,0.02);
}

.video-embed video {
  width: 100%;
  height: auto;
  border-radius: 12px;
}

.iframe-embed {
  margin: 2rem 0;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255,255,255,0.02);
}

.iframe-embed iframe {
  display: block;
  width: 100%;
  border: none;
  border-radius: 12px;
}

.iframe-internal {
  border-color: #fd7e14;
}

.iframe-internal iframe {
  border: 1px solid rgba(253, 126, 20, 0.3);
}

.iframe-error {
  color: #ff6b6b;
  background: rgba(255,107,107,0.1);
  padding: 1rem;
  border-radius: 8px;
  font-family: monospace;
  font-size: 0.9rem;
  margin: 1.5rem 0;
  text-align: center;
  border: 1px solid rgba(255,107,107,0.3);
}

/* Inline markdown link styling */
.markdown-external-link {
  color: var(--accent-color, #7b16ff);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent-color, #7b16ff);
  transition: all 0.3s ease;
  font-weight: 500;
}

.markdown-external-link:hover {
  color: var(--text-primary, #fff);
  border-bottom-style: solid;
  text-decoration: none;
}

.markdown-external-link::after {
  content: " 🔗";
  font-size: 0.8em;
  opacity: 0.7;
  margin-left: 0.25em;
}

.markdown-download-link {
  color: #28a745;
  text-decoration: none;
  border-bottom: 1px dotted #28a745;
  transition: all 0.3s ease;
  font-weight: 500;
}

.markdown-download-link:hover {
  color: var(--text-primary, #fff);
  border-bottom-style: solid;
  text-decoration: none;
}

.markdown-download-link::after {
  content: " ⬇️";
  font-size: 0.8em;
  opacity: 0.7;
  margin-left: 0.25em;
}

.markdown-internal-link {
  color: #fd7e14;
  text-decoration: none;
  border-bottom: 1px dotted #fd7e14;
  transition: all 0.3s ease;
  font-weight: 500;
}

.markdown-internal-link:hover {
  color: var(--text-primary, #fff);
  border-bottom-style: solid;
  text-decoration: none;
}

.markdown-internal-link::after {
  content: " 📁";
  font-size: 0.8em;
  opacity: 0.7;
  margin-left: 0.25em;
}

.link-error {
  color: #ff6b6b;
  background: rgba(255,107,107,0.1);
  padding: 1rem;
  border-radius: 8px;
  font-family: monospace;
  font-size: 0.9rem;
  margin: 1.5rem 0;
  text-align: center;
  border: 1px solid rgba(255,107,107,0.3);
}

@media (max-width: 768px) {
  .pdf-embed iframe {
    height: 400px;
  }
  
  .latex-block, .latex-display {
    font-size: 0.9rem;
    padding: 0.8rem;
  }
  
  .youtube-embed, .vimeo-embed {
    padding-bottom: 56.25%; /* Mantieni aspect ratio su mobile */
  }
  
  .video-embed video {
    max-height: 300px;
  }
  
  .image-embed .article-image {
    border-radius: 8px;
  }
  
  .iframe-embed iframe {
    min-height: 300px;
    border-radius: 8px;
  }
}