/* Markdown Rendering Styles for Terminal Output */

/* Code Blocks */
.code-block-wrapper {
    margin: 1rem 0;
    border-radius: 8px;
    overflow: hidden;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.code-language {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.copy-code-btn {
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 0.25rem;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.copy-code-btn:hover {
    color: #cbd5e1;
    transform: scale(1.1);
}

.code-block {
    margin: 0;
    padding: 1rem;
    overflow-x: auto;
    font-family: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    color: #e2e8f0;
    background: transparent;
}

.code-block code {
    background: transparent;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
}

/* Syntax Highlighting Base */
.code-block.language-javascript,
.code-block.language-typescript,
.code-block.language-jsx,
.code-block.language-tsx {
    color: #7dd3fc;
}

.code-block.language-python {
    color: #fbbf24;
}

.code-block.language-bash,
.code-block.language-shell {
    color: #86efac;
}

.code-block.language-html,
.code-block.language-xml {
    color: #fca5a5;
}

.code-block.language-css,
.code-block.language-scss {
    color: #c084fc;
}

.code-block.language-json {
    color: #fdba74;
}

.code-block.language-yaml,
.code-block.language-yml {
    color: #a5f3fc;
}

/* Inline Code */
.inline-code {
    background: rgba(139, 92, 246, 0.1);
    color: #a78bfa;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875em;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

/* Headers */
.markdown-header {
    margin: 1rem 0 0.5rem 0;
    font-weight: 600;
    line-height: 1.3;
    color: #f1f5f9;
}

h1.markdown-header {
    font-size: 1.875rem;
    border-bottom: 2px solid rgba(139, 92, 246, 0.3);
    padding-bottom: 0.5rem;
}

h2.markdown-header {
    font-size: 1.5rem;
    border-bottom: 1px solid rgba(139, 92, 246, 0.2);
    padding-bottom: 0.25rem;
}

h3.markdown-header {
    font-size: 1.25rem;
    color: #e2e8f0;
}

h4.markdown-header {
    font-size: 1.125rem;
    color: #cbd5e1;
}

h5.markdown-header {
    font-size: 1rem;
    color: #94a3b8;
}

h6.markdown-header {
    font-size: 0.875rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Lists */
.markdown-list {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
    color: #e2e8f0;
}

.markdown-list li {
    margin: 0.25rem 0;
    line-height: 1.6;
}

.markdown-list ul,
.markdown-list ol {
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
}

/* Blockquotes */
.markdown-blockquote {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    border-left: 4px solid #8b5cf6;
    background: rgba(139, 92, 246, 0.05);
    color: #cbd5e1;
    font-style: italic;
}

.markdown-blockquote p {
    margin: 0;
}

/* Tables */
.markdown-table {
    width: 100%;
    margin: 1rem 0;
    border-collapse: collapse;
    overflow-x: auto;
    display: block;
}

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

.markdown-table th {
    background: rgba(139, 92, 246, 0.1);
    color: #f1f5f9;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.markdown-table td {
    background: rgba(0, 0, 0, 0.2);
    color: #e2e8f0;
}

.markdown-table tr:hover td {
    background: rgba(139, 92, 246, 0.05);
}

/* Links */
.markdown-link {
    color: #60a5fa;
    text-decoration: none;
    border-bottom: 1px dotted #60a5fa;
    transition: all 0.2s;
}

.markdown-link:hover {
    color: #93c5fd;
    border-bottom-style: solid;
}

.markdown-link:visited {
    color: #a78bfa;
}

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

/* Horizontal Rules */
.markdown-hr {
    margin: 1.5rem 0;
    border: none;
    height: 1px;
    background: linear-gradient(
        to right,
        transparent,
        rgba(139, 92, 246, 0.5),
        transparent
    );
}

/* Strong and Emphasis */
strong {
    color: #f8fafc;
    font-weight: 600;
}

em {
    color: #f1f5f9;
    font-style: italic;
}

/* Task Lists */
.markdown-list input[type="checkbox"] {
    margin-right: 0.5rem;
    transform: scale(1.2);
    accent-color: #8b5cf6;
}

/* Nested Code in Lists */
.markdown-list .inline-code {
    font-size: 0.875rem;
}

/* Scrollbar Styling for Code Blocks */
.code-block::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

.code-block::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.code-block::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.5);
    border-radius: 4px;
}

.code-block::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.7);
}

/* Animation for copying */
@keyframes copySuccess {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.copy-success {
    animation: copySuccess 0.3s ease;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .code-block {
        font-size: 0.75rem;
    }
    
    .markdown-table {
        font-size: 0.875rem;
    }
    
    h1.markdown-header {
        font-size: 1.5rem;
    }
    
    h2.markdown-header {
        font-size: 1.25rem;
    }
}

/* Dark mode specific adjustments */
@media (prefers-color-scheme: dark) {
    .code-block-wrapper {
        background: #0f172a;
    }
    
    .inline-code {
        background: rgba(139, 92, 246, 0.15);
    }
}

/* Print styles */
@media print {
    .copy-code-btn {
        display: none;
    }
    
    .code-block-wrapper {
        break-inside: avoid;
    }
    
    .markdown-table {
        break-inside: avoid;
    }
}