/**
 * Markdown Content Styling
 * Styles for rendered Markdown content with proper formatting
 */

.markdown-content {
  font-size: 1rem;
  line-height: 1.7;
  color: #e0e0e0;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Paragraphs */
.markdown-content p {
  margin: 0 0 1em 0;
  line-height: 1.7;
}

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

/* Headings */
.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  margin: 1.5em 0 0.75em 0;
  font-weight: 700;
  line-height: 1.3;
  color: #fff;
}

.markdown-content h1:first-child,
.markdown-content h2:first-child,
.markdown-content h3:first-child,
.markdown-content h4:first-child,
.markdown-content h5:first-child,
.markdown-content h6:first-child {
  margin-top: 0;
}

.markdown-content h1 { font-size: 2em; }
.markdown-content h2 { font-size: 1.75em; }
.markdown-content h3 { font-size: 1.5em; }
.markdown-content h4 { font-size: 1.25em; }
.markdown-content h5 { font-size: 1.1em; }
.markdown-content h6 { font-size: 1em; }

/* Text formatting */
.markdown-content strong,
.markdown-content b {
  font-weight: 700;
  color: #fff;
}

.markdown-content em,
.markdown-content i {
  font-style: italic;
  color: #f0f0f0;
}

.markdown-content u {
  text-decoration: underline;
}

.markdown-content s,
.markdown-content del {
  text-decoration: line-through;
  opacity: 0.7;
}

/* Links */
.markdown-content a {
  color: #00d4ff;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.3s ease;
}

.markdown-content a:hover {
  color: #00ffcc;
  border-bottom-color: #00ffcc;
}

/* Lists */
.markdown-content ul,
.markdown-content ol {
  margin: 0.5em 0 1em 0;
  padding-left: 2em;
  line-height: 1.7;
}

.markdown-content ul {
  list-style-type: disc;
}

.markdown-content ol {
  list-style-type: decimal;
}

.markdown-content li {
  margin: 0.25em 0;
}

.markdown-content li > ul,
.markdown-content li > ol {
  margin-top: 0.25em;
  margin-bottom: 0.25em;
}

/* Nested lists */
.markdown-content ul ul {
  list-style-type: circle;
}

.markdown-content ul ul ul {
  list-style-type: square;
}

/* Blockquotes */
.markdown-content blockquote {
  margin: 1em 0;
  padding: 0.75em 1.25em;
  border-left: 4px solid #00d4ff;
  background: rgba(0, 212, 255, 0.1);
  font-style: italic;
  color: #d0d0d0;
}

.markdown-content blockquote p {
  margin: 0;
}

.markdown-content blockquote p:not(:last-child) {
  margin-bottom: 0.5em;
}

/* Code */
.markdown-content code {
  padding: 0.2em 0.4em;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9em;
  color: #00ffcc;
}

.markdown-content pre {
  margin: 1em 0;
  padding: 1em;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  border-left: 4px solid #00d4ff;
  overflow-x: auto;
  line-height: 1.5;
}

.markdown-content pre code {
  padding: 0;
  background: none;
  border-radius: 0;
  font-size: 0.875em;
  color: #e0e0e0;
  display: block;
}

/* Horizontal Rule */
.markdown-content hr {
  margin: 2em 0;
  border: none;
  border-top: 2px solid rgba(255, 255, 255, 0.2);
}

/* Images */
.markdown-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1em 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Tables */
.markdown-content table {
  width: 100%;
  margin: 1em 0;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 8px;
}

.markdown-content table th,
.markdown-content table td {
  padding: 0.75em 1em;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.markdown-content table th {
  background: rgba(0, 212, 255, 0.2);
  font-weight: 700;
  color: #fff;
}

.markdown-content table tr:last-child td {
  border-bottom: none;
}

.markdown-content table tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .markdown-content {
    font-size: 0.95rem;
  }

  .markdown-content h1 { font-size: 1.75em; }
  .markdown-content h2 { font-size: 1.5em; }
  .markdown-content h3 { font-size: 1.25em; }
  .markdown-content h4 { font-size: 1.1em; }
  
  .markdown-content ul,
  .markdown-content ol {
    padding-left: 1.5em;
  }

  .markdown-content pre {
    padding: 0.75em;
    font-size: 0.85em;
  }

  .markdown-content table {
    font-size: 0.9em;
  }

  .markdown-content table th,
  .markdown-content table td {
    padding: 0.5em 0.75em;
  }
}

/* Dark theme enhancements */
.markdown-content {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.markdown-content strong,
.markdown-content b {
  text-shadow: 0 1px 3px rgba(0, 212, 255, 0.3);
}

/* Compact mode for cards (optional) */
.remix-card .markdown-content {
  font-size: 0.9rem;
  max-height: 4.5em;
  overflow: hidden;
  position: relative;
}

.remix-card .markdown-content::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 100%;
  height: 1.5em;
  background: linear-gradient(to bottom, transparent, rgba(26, 26, 46, 0.95));
}

/* Full view in detail pages */
.detail-page .markdown-content,
.detail-modal .markdown-content {
  max-height: none;
}

.detail-page .markdown-content::after,
.detail-modal .markdown-content::after {
  display: none;
}
