
.previewContainer {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--color-background)!important;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

/* Ensure all child elements have white background */
.previewContainer * {
  background-color: var(--color-background) !important;
}

/* Loading State */
.loadingContainer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  color: var(--color-text);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--color-primary);
  border-top: 4px solid var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Error State */
.errorContainer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  color: var(--color-error);
  text-align: center;
}

.errorIcon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.retryButton {
  background: var(--color-primary);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.2s ease;
}

.retryButton:hover {
  background: var(--color-primary-hover);
}

/* Image Preview */
.previewImage {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Iframe Preview (for PDFs, text files, etc.) */
.previewIframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 4px;
  background: var(--color-background) !important;
  color: var(--color-text) !important;
}

/* Force iframe content to have white background */
.previewIframe::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--color-background) !important;
  z-index: -1;
}

/* Unsupported File Type */
.unsupportedContainer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  color: var(--color-text);
  text-align: center;
}

.unsupportedIcon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.6;
}

.fileName {
  font-weight: 500;
  font-size: 1.1rem;
  color: var(--color-text);
  margin: 0.5rem 0;
}

/* Responsive Design */
@media (max-width: 768px) {
  .previewContainer {
    padding: 1rem;
  }
  
  .loadingContainer,
  .errorContainer,
  .unsupportedContainer {
    padding: 1rem;
  }
  
  .previewImage {
    max-height: 70vh;
  }
  
  .previewIframe {
    height: 70vh;
  }
}


/* JSON Container */
.jsonContainer {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--color-background) !important;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* JSON Header */
.jsonHeader {
  background: var(--color-background) !important;
  border-bottom: 1px solid #e9ecef;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.jsonHeaderRight {
  display: flex;
  align-items: center;
  gap: 12px;
}

.jsonTitle {
  font-weight: 600;
  color: #495057;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.jsonSize {
  color: var(--color-text);
  font-size: 12px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}



/* Table Layout - Row-wise rendering */
.jsonTable {
  flex: 1;
  overflow: hidden;
  background: var(--color-background) !important;
  display: flex;
  flex-direction: column;
}

/* Collapsible functionality */
.collapseButton {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  margin-left: 8px;
  font-size: 12px;
  color: var(--color-gray);
  border-radius: 3px;
  transition: all 0.2s;
  font-weight: bold;
  min-width: 20px;
  text-align: center;
}

.collapseButton:hover {
  background-color: var(--color-gray-hover);
  color: #333;
}

.collapseButton:active {
  transform: scale(0.95);
}

.valueContainer {
  display: flex;
  flex-direction: column;
  width: auto;
  overflow: visible !important;
  min-width: 20rem;
}

.jsonValuePreview {
  color: #666;
  font-style: italic;
  background: var(--color-background);
  padding: 4px 8px;
  border-radius: 4px;
  border-left: 3px solid var(--color-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: block;
  font-size: 12px;
}

.jsonValue {
  word-wrap: break-word;
  white-space: pre-wrap;
  max-width: 100%;
  display: block;
  position: relative;
  z-index: 10;
  min-height: 18px;
}

.collapsedRow {
  background-color: #f8f9fa;
  opacity: 0.8;
}

.collapsedRow .jsonTableKey {
  border-left: 2px solid var(--color-secondary);
}

.notCollapsedRow {
  background-color: #f8f9fa;
  border-left: 2px solid var(--color-background);
}

.collapsedRow:hover {
  opacity: 1;
}

.jsonTableBody {
  flex: 1;
  overflow-y: auto;
  background: var(--color-background) !important;
}

.jsonTableRow {
  display: flex;
  border-bottom: 1px solid var(--color-primary);
  transition: background-color 0.2s ease;
}

.jsonTableRow:hover {
  background: var(--color-background);
}

.jsonTableKey {
  flex: 0 0 200px;
  padding: 12px 16px;
  border-right: 1px solid var(--color-primary);
  border-left: 2px solid var(--color-background);
  background: var(--color-background);
  display: flex;
  align-items: flex-start;
  box-sizing: border-box;
  word-wrap: break-word;
  white-space: pre-wrap;
  width: 100%;
}

.jsonTableValue {
  flex: 1;
  padding: 12px 16px;
  background: var(--color-background) !important;
  display: flex;
  align-items: flex-start;
  box-sizing: border-box;
}

.jsonKey {
  font-family: 'Fira Code', 'Monaco', 'Cascadia Code', 'Roboto Mono', 'Courier New', monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  word-break: break-all;
  background: transparent;
  line-height: 1.4;
  width: 100%;
  
  word-wrap: break-word;
  white-space: -wrap;
}

.jsonValue {
  font-family: 'Fira Code', 'Monaco', 'Cascadia Code', 'Roboto Mono', 'Courier New', monospace;
  font-size: 13px;
  color: var(--color-text);
  word-break: break-word;
  white-space: pre-wrap;
  background: transparent;
  line-height: 1.4;
  width: 100%;
  position: relative;
  z-index: 10;
  min-height: 18px;
}

/* Type-specific styling */
.jsonValueString {
    color: var(--color-text);
    font-weight: 600;
    font-family: 'Fira Code', 'Monaco', 'Cascadia Code', 'Roboto Mono', 'Courier New', monospace;
    font-size: 13px;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.jsonValueNumber {
  color: var(--color-text);
  font-weight: 600;
  white-space: nowrap !important;
  word-break: keep-all !important;
  overflow: visible !important;
}

.jsonValueBoolean {
  color: var(--color-text);
  font-weight: 600;
  white-space: nowrap !important;
  word-break: keep-all !important;
  overflow: visible !important;
}

.jsonValueNull {
  color: var(--color-text);
  font-style: italic;
}

.jsonValueUndefined {
  color: var(--color-text);
  font-style: italic;
}

.jsonValueArray {
  color: #fd7e14;
  font-weight: 600;
}

.jsonValueObject {
  color: #6f42c1;
  font-weight: 600;
}

.jsonValueTimestamp {
  color: var(--color-text);
  font-weight: 600;
  font-family: 'Fira Code', 'Monaco', 'Cascadia Code', 'Roboto Mono', 'Courier New', monospace;
}

/* Dark mode support for JSON table layout */
[data-theme="dark"] .jsonTableHeader {
  background: #2d3748;
  border-bottom-color: #4a5568;
  color: #e2e8f0;
}

[data-theme="dark"] .jsonTableKeyHeader {
  background: #2d3748;
  border-right-color: #4a5568;
}

[data-theme="dark"] .jsonTableValueHeader {
  background: #2d3748;
}

[data-theme="dark"] .jsonTableBody {
  background: #1a202c !important;
}

[data-theme="dark"] .jsonTableRow {
  border-bottom-color: #2d3748;
}

[data-theme="dark"] .jsonTableRow:hover {
  background: #2d3748;
}

[data-theme="dark"] .jsonTableKey {
  background: #2d3748;
  border-right-color: #4a5568;
}

[data-theme="dark"] .jsonTableValue {
  background: #1a202c !important;
}

[data-theme="dark"] .jsonKey {
  color: #e2e8f0;
}

[data-theme="dark"] .jsonValue {
  color: #e2e8f0;
}

[data-theme="dark"] .jsonValueString {
  color: #63b3ed;
}

[data-theme="dark"] .jsonValueNumber {
  color: #68d391;
}

[data-theme="dark"] .jsonValueBoolean {
  color: #fc8181;
}

[data-theme="dark"] .jsonValueNull,
[data-theme="dark"] .jsonValueUndefined {
  color: #a0aec0;
}

[data-theme="dark"] .jsonValueArray {
  color: #f6ad55;
}

[data-theme="dark"] .jsonValueObject {
  color: #b794f6;
}

[data-theme="dark"] .jsonValueTimestamp {
  color: #4fd1c7;
}

/* Dark mode for collapsible functionality */
[data-theme="dark"] .collapseButton {
  color: #a0aec0;
}

[data-theme="dark"] .collapseButton:hover {
  background-color: #4a5568;
}

[data-theme="dark"] .jsonValuePreview {
  color: #a0aec0;
  background: #2d3748;
  border-left-color: #4a5568;
}

[data-theme="dark"] .collapsedRow {
  background-color: #2d3748;
}

[data-theme="dark"] .collapsedRow .jsonTableKey {
  border-left-color: #63b3ed;
}

[data-theme="dark"] .collapsedRow:hover {
  background-color: #4a5568;
}

/* Nested Table Styles */
.nestedTable {
  margin-top: 8px;
  border-radius: 4px;
  background: #f8f9fa;
  overflow: visible !important;
  width: auto;
  min-width: 20rem;
}




.nestedTableKeyHeader {
  flex: 0 0 150px;
  padding: 8px 12px;
  border-right: 1px solid #dee2e6;
  background: #e9ecef;
}

.nestedTableValueHeader {
  flex: 1;
  padding: 8px 12px;
  background: #e9ecef;
}

.nestedTableBody {
  background: var(--color-background) !important;
}

.nestedTableRow {
  display: flex;
  transition: background-color 0.2s ease;
  overflow: visible !important;
  min-height: 30px;
}

.nestedTableRow:hover {
  background: var(--color-background);
}

.nestedTableRow:last-child {
  border-bottom: none;
}

.nestedTableKey {
  flex: 0 0 150px;
  padding: 8px 12px;
  background: var(--color-background);
  display: flex;
  align-items: flex-start;
  box-sizing: border-box;
}

.nestedTableValue {
  flex: 1;
  padding: 8px 12px;
  background: var(--color-background) !important;
  display: flex;
  align-items: flex-start;
  box-sizing: border-box;
  position: relative;
  z-index: 1;
  white-space: nowrap !important;
  word-break: keep-all !important;
  overflow: visible !important;
  min-width: 20rem;
  width: auto;
}

.nestedValueSummary {
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--color-text);
}

/* Array items display */
.arrayItems {
  display: flex;
  flex-wrap: wrap;
  gap: 0px;
  margin-left: -0.4rem;
}

/* Array items when no key is shown (should span full width) */
.arrayItemsFullWidth {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
  margin-left: -183px;
  padding-left: 16px;
  width: calc(100% + 183px);
}

.arrayItem {
  display: flex;
  align-items: center;
  padding: 2px 6px;
  background: #f8f9fa;
  border-radius: 3px;
  font-size: 12px;
}

.arrayValue {
  color: var(--color-text);
  font-weight: 400;
}

.arrayPreview {
  color: var(--color-light-gray);
  font-size: 12px;
  font-style: italic;
  padding: 4px 8px;
  background: var(--color-background);
  border-radius: 3px;
  border: 1px solid green;
}

/* JSON Syntax Highlighting */
.jsonCode {
  color: #212529;
  background: white !important;
}

/* Key highlighting */
.jsonCode {
  background: linear-gradient(90deg, 
    transparent 0%, 
    transparent 100%
  );
}

/* Add some basic syntax highlighting using CSS */
.jsonCode::before {
  content: '';
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  background: 
    /* Strings - green */
    linear-gradient(90deg, transparent 0%, transparent 100%),
    /* Numbers - blue */
    linear-gradient(90deg, transparent 0%, transparent 100%),
    /* Booleans - purple */
    linear-gradient(90deg, transparent 0%, transparent 100%),
    /* Null - gray */
    linear-gradient(90deg, transparent 0%, transparent 100%);
}

/* Scrollbar styling */
.jsonPreview::-webkit-scrollbar {
  width: 8px;
  height: 8px;
  background: var(--color-background) !important;
}

.jsonPreview::-webkit-scrollbar-track {
  background: var(--color-background) !important;
  border-radius: 4px;
}

.jsonPreview::-webkit-scrollbar-thumb {
  background: #c1c1c1 !important;
  border-radius: 4px;
}

.jsonPreview::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8 !important;
}

/* JSON Structure Indicators */
.jsonPreview {
  position: relative;
  background: var(--color-background) !important;
}

/* Add line numbers */
.jsonPreview::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 40px;
  height: 100%;
  background: var(--color-background) !important;
  border-right: 1px solid #e9ecef;
  z-index: 1;
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
  .previewIframe {
    background: white !important;
    color: black !important;
  }
  
  /* Only apply dark background for non-HTML content */
  .previewIframe[data-mime-type*="application/pdf"] {
    background: #1a1a1a !important;
  }
  
  /* Keep JSON files with light background for readability */
  .previewIframe[data-mime-type*="application/json"] {
    background: var(--color-background) !important;
    color: black !important;
  }
  
  .jsonPreview {
    background: var(--color-background) !important;
    color: black !important;
  }
  
  /* Dark mode for JSON container */
  .jsonContainer {
    background: #1e1e1e;
    color: #d4d4d4;
  }
  
  .jsonHeader {
    background: #2d2d30;
    border-bottom-color: #3e3e42;
  }
  
  .jsonTitle {
    color: #cccccc;
  }
  
  .jsonSize {
    color: #969696;
  }
  
  .jsonPreview {
    background: #1e1e1e !important;
    color: #d4d4d4 !important;
  }
  
  .jsonPreview::before {
    background: #2d2d30;
    border-right-color: #3e3e42;
  }
  
  .jsonPreview::-webkit-scrollbar-track {
    background: #2d2d30;
  }
  
  .jsonPreview::-webkit-scrollbar-thumb {
    background: #555;
  }
  
  .jsonPreview::-webkit-scrollbar-thumb:hover {
    background: #777;
  }
}

/* Text Container Styles */
.textContainer {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--color-background);
  border-radius: 8px;
  overflow: hidden;
}

.textHeader {
  padding: 1rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-background);
}

.textTitle {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.5rem;
  display: block;
}

.warningMessage {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--color-background);
  border: 1px solid var(--color-secondary);
  border-radius: 6px;
  margin-top: 0.5rem;
  width: 100%;
  text-align: center;
  justify-content: center;
}

.warningIcon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--color-secondary);
  flex-shrink: 0;
  margin-top: 0.1rem;
  text-align: center;
  justify-content: center;
}

.warningText {
  color: var(--color-text);
  font-size: 0.9rem;
  line-height: 1.4;
  font-weight: 500;
}

.textPreview {
  flex: 1;
  padding: 1rem;
  margin: 0;
  background: var(--color-background);
  overflow: auto;
  font-family: 'Fira Code', 'Monaco', 'Cascadia Code', 'Roboto Mono', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.4;
  color: var(--color-text);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.textCode {
  background: transparent;
  color: var(--color-text);
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  white-space: inherit;
  word-wrap: inherit;
}

.contentPreviewPopup {
  /* Popup-specific styles if needed */
}

