/**
 * Content Renderers Styles
 * 
 * Styles for all content renderers (markdown, image, PDF, text, etc.)
 */

/* Common renderer styles */
.rendered-content {
  padding: 20px;
  background: #1e1e1e;
  color: #cccccc;
  overflow-y: auto;
  height: 100%;
}

/* Markdown Content */
.markdown-content {
  padding: 20px;
  line-height: 1.6;
  font-size: 14px;
  max-width: 900px;
  margin: 0 auto;
}

/* Mermaid Diagrams */
.mermaid-diagram {
  background: #1e1e1e;
  border: 1px solid #3e3e42;
  border-radius: 8px;
  padding: 20px;
  margin: 20px 0;
  overflow-x: auto;
  text-align: center;
}

.mermaid-diagram svg {
  max-width: 100%;
  height: auto;
}

.markdown-content h1 {
  font-size: 28px;
  font-weight: 600;
  margin: 24px 0 16px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid #3e3e42;
  color: #ffffff;
}

.markdown-content h2 {
  font-size: 24px;
  font-weight: 600;
  margin: 20px 0 12px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid #3e3e42;
  color: #ffffff;
}

.markdown-content h3 {
  font-size: 20px;
  font-weight: 600;
  margin: 16px 0 8px 0;
  color: #ffffff;
}

.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  font-size: 16px;
  font-weight: 600;
  margin: 12px 0 8px 0;
  color: #cccccc;
}

.markdown-content p {
  margin: 12px 0;
  color: #cccccc;
}

.markdown-content a {
  color: #007acc;
  text-decoration: none;
  transition: color 0.15s;
}

.markdown-content a:hover {
  color: #4fc3f7;
  text-decoration: underline;
}

/* MCard Handles */
.mcard-handle {
  color: #4fc3f7;
  text-decoration: none;
  padding: 2px 6px;
  background: #2d2d30;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  transition: all 0.15s;
  cursor: pointer;
}

.mcard-handle:hover {
  background: #007acc;
  color: white;
  text-decoration: none;
}

.markdown-content code {
  background: #2d2d30;
  color: #4fc3f7;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
}

.markdown-content pre {
  background: #2d2d30;
  border: 1px solid #3e3e42;
  border-radius: 6px;
  padding: 16px;
  overflow-x: auto;
  margin: 16px 0;
}

.markdown-content pre code {
  background: none;
  padding: 0;
  color: #cccccc;
}

.markdown-content blockquote {
  border-left: 4px solid #007acc;
  margin: 16px 0;
  padding: 8px 16px;
  background: #2d2d30;
  color: #cccccc;
}

.markdown-content ul,
.markdown-content ol {
  margin: 12px 0;
  padding-left: 24px;
}

.markdown-content li {
  margin: 6px 0;
}

.markdown-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 16px 0;
}

.markdown-content th,
.markdown-content td {
  border: 1px solid #3e3e42;
  padding: 8px 12px;
  text-align: left;
}

.markdown-content th {
  background: #2d2d30;
  font-weight: 600;
}

.markdown-content tr:nth-child(even) {
  background: #252526;
}

.markdown-content img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 16px 0;
}

.markdown-content hr {
  border: none;
  border-top: 1px solid #3e3e42;
  margin: 24px 0;
}

/* Image Content */
.image-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
}

.image-container {
  max-width: 100%;
  max-height: 70vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #252526;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}

.rendered-image {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 4px;
}

.image-info {
  text-align: center;
  color: #858585;
  font-size: 13px;
}

.image-filename {
  color: #cccccc;
  font-weight: 500;
}

/* Text Content */
.text-content {
  font-family: 'Courier New', monospace;
}

.text-header {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  background: #2d2d30;
  border-bottom: 1px solid #3e3e42;
  margin-bottom: 16px;
}

.text-filename {
  color: #cccccc;
  font-weight: 500;
}

.text-lines {
  color: #858585;
  font-size: 12px;
}

.text-body {
  background: #1e1e1e;
  color: #cccccc;
  padding: 16px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.5;
}

.text-body.preserve-whitespace {
  white-space: pre-wrap;
}

.text-line {
  display: flex;
}

.line-number {
  color: #858585;
  margin-right: 16px;
  min-width: 40px;
  text-align: right;
  user-select: none;
}

.line-content {
  flex: 1;
}

/* PDF Content */
.pdf-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.pdf-header {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  background: #2d2d30;
  border-bottom: 1px solid #3e3e42;
  flex-shrink: 0;
}

.pdf-filename {
  color: #cccccc;
  font-weight: 500;
}

.pdf-status {
  color: #858585;
  font-size: 12px;
}

.pdf-pages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #252526;
}

.pdf-page {
  margin-bottom: 20px;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  overflow: hidden;
}

.pdf-page-canvas {
  display: block;
  width: 100%;
  height: auto;
}

.pdf-page-label {
  padding: 8px;
  background: #f5f5f5;
  color: #333;
  font-size: 12px;
  text-align: center;
  border-top: 1px solid #ddd;
}

.pdf-placeholder,
.pdf-loading,
.pdf-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #858585;
  text-align: center;
}

.pdf-placeholder i,
.pdf-loading i {
  margin-bottom: 16px;
  opacity: 0.5;
}

.pdf-loading .spinning {
  animation: spin 1s linear infinite;
}

.pdf-error {
  color: #f48771;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Code Syntax Highlighting (from highlight.js) */
.hljs {
  display: block;
  overflow-x: auto;
  padding: 0.5em;
  background: #2d2d30;
  color: #cccccc;
}

.hljs-comment,
.hljs-quote {
  color: #6a9955;
  font-style: italic;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-type {
  color: #569cd6;
}

.hljs-string,
.hljs-title {
  color: #ce9178;
}

.hljs-number {
  color: #b5cea8;
}

.hljs-function,
.hljs-params {
  color: #dcdcaa;
}

.hljs-variable,
.hljs-template-variable {
  color: #9cdcfe;
}

.hljs-tag,
.hljs-name,
.hljs-attribute {
  color: #4ec9b0;
}

/* Scrollbar styling */
.rendered-content::-webkit-scrollbar,
.pdf-pages::-webkit-scrollbar,
.text-body::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.rendered-content::-webkit-scrollbar-track,
.pdf-pages::-webkit-scrollbar-track,
.text-body::-webkit-scrollbar-track {
  background: #1e1e1e;
}

.rendered-content::-webkit-scrollbar-thumb,
.pdf-pages::-webkit-scrollbar-thumb,
.text-body::-webkit-scrollbar-thumb {
  background: #3e3e42;
  border-radius: 5px;
}

.rendered-content::-webkit-scrollbar-thumb:hover,
.pdf-pages::-webkit-scrollbar-thumb:hover,
.text-body::-webkit-scrollbar-thumb:hover {
  background: #4e4e52;
}

/* CLM (Cubical Logic Model) Renderer Styles */
.clm-container {
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.clm-header {
  text-align: center;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 2px solid #3e3e42;
}

.clm-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 28px;
  font-weight: 600;
  color: #ffffff;
  margin: 0 0 8px 0;
}

.clm-subtitle {
  color: #888;
  font-size: 14px;
  margin: 0;
}

.clm-dimensions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.clm-dimension {
  background: #252526;
  border: 2px solid #3e3e42;
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.clm-dimension:hover {
  border-color: #4fc3f7;
  box-shadow: 0 4px 12px rgba(79, 195, 247, 0.2);
}

.clm-specification {
  border-top: 4px solid #4fc3f7;
}

.clm-implementation {
  border-top: 4px solid #ce9178;
}

.clm-verification {
  border-top: 4px solid #6a9955;
}

.clm-dimension-header {
  background: #2d2d30;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #3e3e42;
}

.clm-dimension-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: #1e1e1e;
  border-radius: 6px;
}

.clm-specification .clm-dimension-icon {
  color: #4fc3f7;
}

.clm-implementation .clm-dimension-icon {
  color: #ce9178;
}

.clm-verification .clm-dimension-icon {
  color: #6a9955;
}

.clm-dimension-header h3 {
  flex: 1;
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #ffffff;
}

.clm-dimension-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #888;
  background: #1e1e1e;
  padding: 4px 8px;
  border-radius: 4px;
}

.clm-dimension-content {
  padding: 16px;
  max-height: 400px;
  overflow-y: auto;
}

.clm-properties {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.clm-property {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.clm-property-key {
  font-size: 12px;
  font-weight: 600;
  color: #9cdcfe;
  text-transform: capitalize;
}

.clm-property-value {
  font-size: 13px;
  color: #cccccc;
  padding-left: 12px;
  border-left: 2px solid #3e3e42;
}

.clm-nested {
  padding-left: 16px;
  margin-top: 8px;
  border-left: 2px solid #3e3e42;
}

.clm-empty {
  color: #666;
  font-style: italic;
  font-size: 13px;
}

.clm-metadata {
  background: #252526;
  border: 1px solid #3e3e42;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 24px;
}

.clm-metadata h4 {
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
}

.clm-raw-toggle {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid #3e3e42;
}

.clm-toggle-btn {
  background: #2d2d30;
  border: 1px solid #3e3e42;
  color: #cccccc;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
  width: 100%;
  text-align: center;
}

.clm-toggle-btn:hover {
  background: #3e3e42;
  border-color: #4fc3f7;
  color: #4fc3f7;
}

.clm-raw-yaml {
  margin-top: 16px;
  background: #1e1e1e;
  border: 1px solid #3e3e42;
  border-radius: 6px;
  padding: 16px;
  overflow-x: auto;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.5;
}

.clm-raw-yaml code {
  color: #cccccc;
}

.clm-error {
  padding: 40px;
  text-align: center;
  color: #f48771;
  font-size: 14px;
}

/* Scrollbar for CLM dimension content */
.clm-dimension-content::-webkit-scrollbar {
  width: 6px;
}

.clm-dimension-content::-webkit-scrollbar-track {
  background: #1e1e1e;
}

.clm-dimension-content::-webkit-scrollbar-thumb {
  background: #3e3e42;
  border-radius: 3px;
}

.clm-dimension-content::-webkit-scrollbar-thumb:hover {
  background: #4e4e52;
}

/* CLM Execution Controls */
.clm-execution-controls {
  display: flex;
  gap: 12px;
  margin: 20px 0;
  padding: 16px;
  background: #1e1e1e;
  border-radius: 8px;
  border: 1px solid #3e3e42;
}

.clm-execute-btn,
.clm-test-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.clm-execute-btn {
  background: #4CAF50;
  color: white;
}

.clm-execute-btn:hover {
  background: #45a049;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
}

.clm-test-btn {
  background: #2196F3;
  color: white;
}

.clm-test-btn:hover {
  background: #0b7dda;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(33, 150, 243, 0.3);
}

/* CLM Execution Results */
.clm-execution-results {
  margin: 20px 0;
  padding: 20px;
  background: #1e1e1e;
  border-radius: 8px;
  border: 1px solid #3e3e42;
}

.clm-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #3e3e42;
}

.clm-results-header h4 {
  margin: 0;
  color: #e0e0e0;
  font-size: 16px;
}

.clm-close-btn {
  background: none;
  border: none;
  color: #888;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

.clm-close-btn:hover {
  background: #3e3e42;
  color: #fff;
}

.clm-exec-time {
  color: #888;
  font-size: 13px;
  margin-bottom: 12px;
}

.clm-console-logs {
  margin: 16px 0;
}

.clm-console-logs h5 {
  margin: 0 0 8px 0;
  color: #e0e0e0;
  font-size: 14px;
}

.clm-log {
  padding: 8px 12px;
  margin: 4px 0;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
}

.clm-log-log {
  background: #2a2d2e;
  color: #e0e0e0;
}

.clm-log-error {
  background: #3d1f1f;
  color: #ff6b6b;
}

.clm-log-warn {
  background: #3d3520;
  color: #ffa500;
}

.clm-return-value {
  margin: 16px 0;
}

.clm-return-value h5 {
  margin: 0 0 8px 0;
  color: #e0e0e0;
  font-size: 14px;
}

.clm-return-value pre {
  background: #2a2d2e;
  padding: 12px;
  border-radius: 4px;
  overflow-x: auto;
  color: #4CAF50;
}

.clm-error {
  margin: 16px 0;
  padding: 12px;
  background: #3d1f1f;
  border-left: 4px solid #ff6b6b;
  border-radius: 4px;
  color: #ff6b6b;
}

.clm-error h5 {
  margin: 0 0 8px 0;
  font-size: 14px;
}

.clm-error pre {
  margin: 0;
  color: #ff6b6b;
  font-size: 13px;
}

/* Test Results */
.clm-test-summary {
  display: flex;
  gap: 20px;
  padding: 12px;
  background: #2a2d2e;
  border-radius: 6px;
  margin-bottom: 16px;
}

.clm-test-passed {
  color: #4CAF50;
  font-weight: 600;
}

.clm-test-failed {
  color: #ff6b6b;
  font-weight: 600;
}

.clm-test-total {
  color: #888;
  margin-left: auto;
}

.clm-test-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.clm-test-case {
  padding: 12px;
  border-radius: 6px;
  border-left: 4px solid;
}

.clm-test-passed {
  background: #1f3d1f;
  border-color: #4CAF50;
}

.clm-test-failed {
  background: #3d1f1f;
  border-color: #ff6b6b;
}

.clm-test-header {
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 14px;
}

.clm-test-passed .clm-test-header {
  color: #4CAF50;
}

.clm-test-failed .clm-test-header {
  color: #ff6b6b;
}

.clm-test-detail {
  margin: 4px 0;
  font-size: 13px;
  color: #ccc;
  font-family: 'Courier New', monospace;
}

.clm-test-error {
  color: #ff6b6b;
  font-size: 13px;
  margin-top: 8px;
  font-family: 'Courier New', monospace;
}
