/* preview-panel.css — File preview panel */

.preview-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-secondary);
  border-left: 1px solid var(--glass-border);
  overflow: hidden;
  transition: width var(--transition-normal);
}

.preview-panel.hidden {
  display: none;
}

/* Toolbar */
.preview-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur-sm));
}

.preview-toolbar-title {
  flex: 1;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Content area */
.preview-content {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.preview-content iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

.preview-content .preview-markdown {
  padding: var(--space-lg);
  overflow-y: auto;
  height: 100%;
  color: var(--text-primary);
  font-size: var(--font-size-base);
  line-height: var(--line-height-relaxed, 1.6);
}

.preview-content .preview-code {
  padding: var(--space-md);
  overflow: auto;
  height: 100%;
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  background: var(--bg-primary);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Split layout with chat */
.chat-with-preview {
  display: flex;
  flex-direction: row;
  height: 100%;
  overflow: hidden;
}

.chat-with-preview .chat-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.chat-with-preview .preview-panel {
  width: 55%;
  min-width: 400px;
  max-width: 70%;
}

/* Maximized state — takes full width, hides chat */
.chat-with-preview .preview-panel.maximized {
  width: 100%;
  max-width: 100%;
  min-width: 100%;
  border-left: none;
}

.chat-with-preview:has(.preview-panel.maximized) > .chat-main {
  display: none;
}

/* Preview toggle button */
.preview-toggle-btn.has-file {
  color: var(--accent-primary);
}

/* Mobile: full-screen overlay */
@media (max-width: 768px) {
  .chat-with-preview .preview-panel {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: 100%;
    z-index: var(--z-modal, 100);
    border-left: none;
  }
}
