/* GraphTalker Web UI */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
    background-color: #f5f5f5;
    color: #333;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Top Header Bar */
.top-header {
    padding: 12px 20px;
    background-color: #fff;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.top-header h1 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #2c3e50;
}

/* Tab Bar */
.tab-bar {
    display: flex;
    gap: 0;
    background-color: #fff;
    border-bottom: 1px solid #ddd;
    padding: 0 20px;
    flex-shrink: 0;
}

.tab-btn {
    padding: 10px 24px;
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    background: none;
    color: #666;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.2s, border-color 0.2s;
}

.tab-btn:hover {
    color: #2196f3;
}

.tab-btn.active {
    color: #2196f3;
    border-bottom-color: #2196f3;
}

/* Tab Content */
.tab-content {
    display: none;
    flex: 1;
    overflow: hidden;
}

.tab-content.active {
    display: block;
}

.container {
    display: flex;
    height: 100%;
    gap: 1px;
    background-color: #ddd;
}

/* Left Panel - Chat style */
.left-panel {
    flex: 1 1 50%;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    min-width: 300px;
    overflow: hidden;
}

/* Right Panel - Iterations */
.right-panel {
    flex: 1 1 50%;
    display: flex;
    flex-direction: column;
    background-color: #1e1e1e;
    color: #d4d4d4;
    min-width: 300px;
    overflow: hidden;
}

/* Panel Headers (inside left/right panels) */
.panel-header {
    padding: 12px 20px;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}

.panel-header h2 {
    font-size: 1.1rem;
    font-weight: 500;
    color: #9cdcfe;
}

/* Query List Header */
.query-list-header {
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.search-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
}

.search-input:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}

/* Query List */
.query-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.query-card {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.query-card:hover {
    border-color: #2196f3;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.1);
}

.query-card.selected {
    border-color: #2196f3;
    background-color: #e3f2fd;
}

.query-card-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.query-card-description {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.4;
}

.query-card-meta {
    font-size: 0.75rem;
    color: #999;
    margin-top: 8px;
}

/* Query Details Panel */
.query-details-panel {
    background-color: #fff;
    color: #333;
}

.query-details-panel .panel-header {
    border-bottom: 1px solid #eee;
}

.query-details-panel .panel-header h2 {
    color: #2c3e50;
}

.query-details {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.query-detail-section {
    margin-bottom: 20px;
}

.query-detail-section h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #666;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* URI Row with Copy Button */
.uri-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 8px 12px;
}

.uri-text {
    flex: 1;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-size: 0.8rem;
    color: #333;
    word-break: break-all;
    background: none;
    padding: 0;
}

.copy-btn {
    flex-shrink: 0;
    padding: 6px;
    background-color: #e9ecef;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    color: #495057;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.copy-btn:hover {
    background-color: #dee2e6;
    border-color: #ced4da;
    color: #212529;
}

.copy-btn.copied {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #28a745;
}

.copy-btn svg {
    display: block;
}

/* Delete Button */
.delete-btn {
    flex-shrink: 0;
    padding: 6px;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    cursor: pointer;
    color: #721c24;
    transition: background-color 0.2s, border-color 0.2s;
}

.delete-btn:hover {
    background-color: #f1b0b7;
    border-color: #e4969e;
    color: #491217;
}

.delete-btn svg {
    display: block;
}

.query-detail-section pre {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 12px;
    overflow-x: auto;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
}

/* Query Description (Markdown) */
.query-description-section {
    border-top: 1px solid #e9ecef;
    padding-top: 20px;
    margin-top: 24px;
}

.query-description-content {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #444;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji';
}

.query-description-content h1,
.query-description-content h2,
.query-description-content h3,
.query-description-content h4 {
    margin-top: 1em;
    margin-bottom: 0.5em;
    color: #333;
}

.query-description-content h1 { font-size: 1.3rem; }
.query-description-content h2 { font-size: 1.15rem; }
.query-description-content h3 { font-size: 1rem; }

.query-description-content p {
    margin-bottom: 0.8em;
}

.query-description-content ul,
.query-description-content ol {
    margin-left: 1.5em;
    margin-bottom: 0.8em;
}

.query-description-content li {
    margin-bottom: 0.3em;
}

.query-description-content code {
    background-color: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-size: 0.85em;
}

.query-description-content pre {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 12px;
    overflow-x: auto;
    margin: 1em 0;
}

.query-description-content pre code {
    background: none;
    padding: 0;
}

/* Visualization Grid */
.viz-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.viz-card {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.viz-card:hover {
    border-color: #2196f3;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.15);
}

.viz-card-type {
    font-size: 0.75rem;
    font-weight: 600;
    color: #2196f3;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.viz-card-description {
    font-size: 0.85rem;
    color: #333;
    line-height: 1.4;
}

.viz-card-summary {
    font-size: 0.75rem;
    color: #666;
    margin-top: 8px;
    font-style: italic;
    max-height: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* Modal Overlay */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background-color: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* Visualization Summary Section */
.viz-summary-section {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 20px;
    line-height: 1.7;
}

.viz-summary-content {
    font-size: 0.95rem;
    color: #333;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji';
}

.viz-summary-content h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 16px 0 8px 0;
}

.viz-summary-content h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #495057;
    margin: 12px 0 6px 0;
}

.viz-summary-content strong {
    color: #2c3e50;
}

/* Markdown tables in summary */
.viz-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 0.85rem;
}

.viz-table th,
.viz-table td {
    border: 1px solid #dee2e6;
    padding: 8px 12px;
    text-align: left;
}

.viz-table th {
    background-color: #e9ecef;
    font-weight: 600;
    color: #495057;
}

.viz-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.viz-table tr:hover {
    background-color: #e9ecef;
}

/* Wider modal for visualizations */
.viz-modal-content {
    max-width: 900px;
}

.viz-info {
    background-color: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 0.85rem;
}

.viz-config {
    margin-bottom: 16px;
}

.viz-config h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #666;
    margin-bottom: 8px;
}

.viz-config pre {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 12px;
    overflow-x: auto;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-size: 0.8rem;
    max-height: 300px;
}

.viz-render {
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 20px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

.viz-render-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.viz-render-container canvas {
    max-width: 100%;
    height: auto;
}

/* Multi-chart dashboard layout */
.viz-render-container.multi-chart {
    max-width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
}

/* Table container - wider and scrollable */
.viz-render-container.table-container {
    max-width: 100%;
    overflow-x: auto;
}

/* Network graph container */
.viz-render-container.network-graph-container {
    max-width: 100%;
    padding: 10px;
}

.network-graph-svg {
    width: 100%;
    height: 500px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background-color: #fafafa;
}

.network-graph-svg svg {
    width: 100%;
    height: 100%;
}

/* Network graph node and edge styles */
.network-graph-svg .nodes circle {
    transition: r 0.2s ease;
}

.network-graph-svg .nodes circle:hover {
    r: 20;
    filter: brightness(1.1);
}

.network-graph-svg .labels text {
    font-family: var(--font-mono);
    fill: #333;
    pointer-events: none;
}

.network-graph-svg .edge-labels text {
    font-family: var(--font-mono);
    pointer-events: none;
}

.network-graph-svg .legend text {
    font-family: var(--font-mono);
    fill: #333;
}

.chart-wrapper {
    flex: 1 1 300px;
    min-width: 280px;
    max-width: 500px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 16px;
}

.chart-wrapper canvas {
    width: 100% !important;
    height: 250px !important;
}

.chart-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    margin: 0 0 12px 0;
    text-align: center;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-separator {
    color: #ccc;
    font-size: 0.9rem;
}

.header-link {
    color: #666;
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s;
}

.header-link:hover {
    color: #333;
}

/* Context Bar */
.context-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
}

.context-label {
    color: #666;
}

.context-meter {
    width: 80px;
    height: 6px;
    background-color: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}

.context-fill {
    height: 100%;
    background-color: #4caf50;
    width: 0%;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.context-fill.warning {
    background-color: #ff9800;
}

.context-fill.danger {
    background-color: #f44336;
}

.context-pct {
    font-weight: 500;
    min-width: 35px;
    font-size: 0.8rem;
}

/* Repository Selector */
.repo-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.repo-label {
    color: #666;
    font-weight: 500;
}

.repo-selector select {
    padding: 6px 12px;
    font-size: 0.85rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: #fff;
    color: #333;
    cursor: pointer;
    min-width: 150px;
    max-width: 250px;
}

.repo-selector select:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}

.repo-selector select:hover {
    border-color: #bbb;
}

.repo-selector select:disabled {
    background-color: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

/* Status indicator */
.status {
    font-size: 0.8rem;
    color: #888;
}

.status.running {
    color: #4caf50;
}

.status.running::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #4caf50;
    border-radius: 50%;
    margin-right: 6px;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Chat Area - Scrollable middle section */
.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.welcome-message {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    color: #666;
    line-height: 1.6;
}

.welcome-message .hint {
    margin-top: 12px;
    font-style: italic;
    color: #888;
}

/* Chat Messages */
.chat-message {
    max-width: 100%;
}

.chat-message.user {
    align-self: flex-end;
}

.chat-message.assistant {
    align-self: flex-start;
}

.message-label {
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 4px;
    font-weight: 500;
}

.user .message-label {
    text-align: right;
}

.message-content {
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.6;
}

.user .message-content {
    background-color: #2196f3;
    color: white;
    border-bottom-right-radius: 4px;
}

.assistant .message-content {
    background-color: #f0f0f0;
    color: #333;
    border-bottom-left-radius: 4px;
}

/* Markdown in assistant messages */
.assistant .message-content pre {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 12px;
    overflow-x: auto;
    margin: 12px 0;
    font-family: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 0.85rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Handle images in assistant messages - prevent broken/missing images from creating large empty spaces */
.assistant .message-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 8px 0;
}

.assistant .message-content img:not([src]),
.assistant .message-content img[src=""] {
    display: none;
}

/* Handle iframes and embedded content */
.assistant .message-content iframe {
    max-width: 100%;
    border: 1px solid #ddd;
    border-radius: 6px;
}

/* Hide empty code/pre blocks that may result from markdown parsing */
.assistant .message-content pre:empty,
.assistant .message-content code:empty {
    display: none;
}

/* Make tables in assistant messages responsive */
.assistant .message-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 0.85rem;
    display: block;
    overflow-x: auto;
}

.assistant .message-content th,
.assistant .message-content td {
    border: 1px solid #ddd;
    padding: 8px 12px;
    text-align: left;
    min-width: 100px;
}

.assistant .message-content th {
    background-color: #f0f0f0;
    font-weight: 600;
}

/* Force single-column layout for content that might have side-by-side elements */
.assistant .message-content {
    display: block;
    overflow-x: auto;
}

.assistant .message-content > * {
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Override any inline flex/grid layouts to stack vertically */
.assistant .message-content div,
.assistant .message-content section,
.assistant .message-content article {
    display: block !important;
    float: none !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* Reset any multi-column layouts */
.assistant .message-content * {
    column-count: unset !important;
    columns: unset !important;
}

/* Handle any inline content that might cause horizontal overflow */
.assistant .message-content img,
.assistant .message-content canvas,
.assistant .message-content svg {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 8px auto;
}

.assistant .message-content code {
    font-family: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 0.85rem;
}

/* ASCII art blocks - when not in pre/code, marked may wrap in p tags */
.assistant .message-content .ascii-art,
.assistant .message-content pre code {
    font-family: 'JetBrains Mono', monospace !important;
    white-space: pre;
    line-height: 1.2;
}

.assistant .message-content p code {
    background-color: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid #ddd;
}

.assistant .message-content p {
    margin: 8px 0;
}

.assistant .message-content p:first-child {
    margin-top: 0;
}

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

/* Lists in assistant messages need left padding for bullets/numbers */
.assistant .message-content ul,
.assistant .message-content ol {
    margin: 8px 0;
    padding-left: 28px;
}

.assistant .message-content li {
    margin: 4px 0;
}

/* Nested lists */
.assistant .message-content ul ul,
.assistant .message-content ol ol,
.assistant .message-content ul ol,
.assistant .message-content ol ul {
    margin: 4px 0;
    padding-left: 24px;
}

/* Error Message */
.chat-message.error .message-content {
    background-color: #ffebee;
    border: 1px solid #ef9a9a;
    color: #c62828;
}

/* Input Area - Fixed at bottom */
.input-area {
    padding: 16px 20px;
    border-top: 1px solid #eee;
    background-color: #fff;
    flex-shrink: 0;
}

.input-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.input-row textarea {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    resize: none;
    min-height: 44px;
    max-height: 120px;
}

.input-row textarea:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.input-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    padding: 0 4px;
}

/* Buttons */
button {
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#send-btn {
    background-color: #2196f3;
    color: white;
    min-width: 80px;
}

#send-btn:hover {
    background-color: #1976d2;
}

#send-btn:disabled {
    background-color: #bbb;
    cursor: not-allowed;
}

/* Stop button - red, shown during query execution */
.stop-btn {
    background-color: #f44336;
    color: white;
    min-width: 80px;
}

.stop-btn:hover {
    background-color: #d32f2f;
}

button.secondary {
    background-color: #e0e0e0;
    color: #333;
}

button.secondary:hover {
    background-color: #d0d0d0;
}

button.small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #666;
    cursor: pointer;
}

.checkbox-label input {
    cursor: pointer;
}

.iterations-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #666;
    margin-left: 16px;
}

.iterations-label input[type="number"] {
    width: 60px;
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
    text-align: center;
}

.iterations-label input[type="number"]:focus {
    outline: none;
    border-color: #2196f3;
}

/* Iterations Panel */
.iterations-content {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.8rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.placeholder {
    color: #666;
    font-style: italic;
    font-family: inherit;
}

/* Iteration blocks */
.iteration-block {
    margin-bottom: 16px;
    border-left: 3px solid #4ec9b0;
    padding-left: 12px;
}

.iteration-header {
    color: #4ec9b0;
    font-weight: bold;
    margin-bottom: 8px;
}

.tool-call {
    color: #dcdcaa;
}

.tool-input {
    color: #9cdcfe;
}

.tool-result {
    color: #d4d4d4;
    max-height: 300px;
    overflow-y: auto;
    background-color: #252526;
    padding: 8px;
    border-radius: 4px;
    margin: 4px 0;
}

.stop-reason {
    color: #c586c0;
}

.final-answer-marker {
    color: #4caf50;
    font-weight: bold;
    margin-top: 16px;
    padding-top: 8px;
    border-top: 1px solid #444;
}

/* Hidden class */
.hidden {
    display: none !important;
}

/* Scrollbar styling */
.chat-area::-webkit-scrollbar,
.iterations-content::-webkit-scrollbar {
    width: 8px;
}

.chat-area::-webkit-scrollbar-track {
    background: #f0f0f0;
}

.chat-area::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.chat-area::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

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

.iterations-content::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

.iterations-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive */
@media (max-width: 900px) {
    .container {
        flex-direction: column;
    }

    .left-panel,
    .right-panel {
        max-width: 100%;
        min-width: 100%;
        height: 50vh;
    }
}

/* ==================== Session Storage Styles ==================== */

/* Session Preview in Details Panel */
.session-preview {
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 16px;
    background-color: #fff;
}

.session-message {
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    word-wrap: break-word;
}

.session-message:last-child {
    margin-bottom: 0;
}

.session-message.user {
    background-color: #e3f2fd;
    margin-left: 20%;
}

.session-message.assistant {
    background-color: #f5f5f5;
    margin-right: 10%;
}

.session-message .message-label {
    font-weight: 600;
    font-size: 0.85em;
    margin-bottom: 8px;
}

.session-message.user .message-label {
    color: #1976d2;
}

.session-message.assistant .message-label {
    color: #388e3c;
}

.session-message .message-content {
    line-height: 1.6;
}

/* Markdown content in session preview */
.session-message .message-content h1,
.session-message .message-content h2,
.session-message .message-content h3 {
    margin-top: 16px;
    margin-bottom: 8px;
}

.session-message .message-content h1:first-child,
.session-message .message-content h2:first-child,
.session-message .message-content h3:first-child {
    margin-top: 0;
}

.session-message .message-content ul,
.session-message .message-content ol {
    margin: 8px 0;
    padding-left: 24px;
}

.session-message .message-content pre {
    background-color: #1e1e1e;
    color: #d4d4d4;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 12px 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9em;
}

.session-message .message-content code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9em;
}

.session-message .message-content p {
    margin: 8px 0;
}

.session-message .message-content p:first-child {
    margin-top: 0;
}

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

/* Session Action Buttons */
.session-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.session-actions button {
    flex: 1;
    padding: 10px 16px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.session-actions button.primary {
    background: #4caf50;
    color: white;
    border: none;
}

.session-actions button.primary:hover {
    background: #43a047;
}

.session-actions button.danger {
    background: #fff;
    color: #dc3545;
    border: 1px solid #dc3545;
}

.session-actions button.danger:hover {
    background: #dc3545;
    color: white;
}

/* ==================== Collapsible Visualization Code Widget ==================== */

details.viz-code-collapsed {
    margin: 12px 0;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #f8f9fa;
    overflow: hidden;
}

details.viz-code-collapsed summary {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.9em;
    color: #666;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

details.viz-code-collapsed summary::-webkit-details-marker {
    display: none;
}

details.viz-code-collapsed summary::before {
    content: '▶';
    font-size: 0.7em;
    transition: transform 0.2s ease;
}

details.viz-code-collapsed[open] summary::before {
    transform: rotate(90deg);
}

details.viz-code-collapsed summary:hover {
    background: #f0f0f0;
}

details.viz-code-collapsed[open] summary {
    border-bottom: 1px solid #e0e0e0;
}

details.viz-code-collapsed pre {
    margin: 0;
    border-radius: 0;
    max-height: 400px;
    overflow: auto;
}

details.viz-code-collapsed pre code {
    font-size: 0.85em;
}
