/* Apple-inspired design system for Chat Interface */
:root {
    --primary-color: #007AFF;
    --secondary-color: #5856D6;
    --success-color: #34C759;
    --warning-color: #FF9500;
    --error-color: #FF3B30;
    --background-color: #F2F2F7;
    --surface-color: #FFFFFF;
    --text-primary: #000000;
    --text-secondary: #8E8E93;
    --border-color: #C6C6C8;
    --shadow-light: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-heavy: 0 8px 24px rgba(0, 0, 0, 0.2);
    --border-radius: 12px;
    --border-radius-small: 8px;
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-xxl: 48px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Main App Container */
.app {
    height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr;
    background: var(--background-color);
}

/* Header */
.header {
    background: var(--surface-color);
    padding: var(--spacing-lg) var(--spacing-xl);
    box-shadow: var(--shadow-light);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success-color);
    animation: pulse 2s infinite;
}

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

.title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Layout */
.layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    height: 100%;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    background: var(--surface-color);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    position: relative;
    z-index: 1; /* Ensure sidebar appears above composer background */
}

.sidebar-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0; /* Prevent header from collapsing */
    min-height: 100px; /* Ensure header has visible height */
    background: var(--surface-color); /* Ensure visible background */
}

.sidebar-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

/* Model Selector */
.model-selector {
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-sm);
    background: var(--background-color);
    border-radius: var(--border-radius-small);
}

.model-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.model-select {
    width: 100%;
    padding: var(--spacing-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small);
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.model-select:hover {
    border-color: var(--primary-color);
}

.model-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.new-chat {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius-small);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.new-chat:hover {
    background: #0051D5;
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
}

.new-chat:active {
    transform: translateY(0);
    box-shadow: var(--shadow-light);
}

/* Chat List */
.chat-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: var(--spacing-sm);
}

.chat-item {
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    border-radius: var(--border-radius-small);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.chat-item.active {
    background: #E8F2FF;
    border: 1px solid var(--primary-color);
}

.chat-content {
    flex: 1;
    min-width: 0;
}

.chat-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.3;
}

.chat-sub {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: var(--spacing-xs);
}

.delete-chat-btn {
    padding: var(--spacing-xs);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--border-radius-small);
    transition: all 0.2s ease;
}

.delete-chat-btn:hover {
    background: var(--background-color);
    color: var(--error-color);
}

/* Chat Area */
.chat {
    display: grid;
    grid-template-rows: 1fr auto;
    background: var(--background-color);
    height: 100%;
    overflow: hidden;
}

.chat-header {
    display: none;
}

.chat-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.chat-header p {
    font-size: 15px;
    color: var(--text-secondary);
}

/* Messages Area */
.messages {
    grid-row: 1;
    min-height: 0;
    overflow-y: auto;
    padding: var(--spacing-xl);
    max-width: 900px;
    margin: 0 auto 0 0;
    width: 100%;
}

.message {
    margin-bottom: var(--spacing-lg);
    display: flex;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    justify-content: flex-start;
}

.message.assistant {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 900px;
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--border-radius);
    word-wrap: break-word;
}

.message.user .message-bubble {
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: var(--spacing-xs);
}

.message.assistant .message-bubble {
    background: var(--surface-color);
    color: var(--text-primary);
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: var(--spacing-xs);
}

.message-content {
    font-size: 16px;
    line-height: 1.5;
}

/* Message content formatting */
.message-content p {
    margin-bottom: var(--spacing-sm);
}

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

.message-content code {
    background: var(--background-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 14px;
}

.message-content pre {
    background: var(--text-primary);
    color: white;
    padding: var(--spacing-md);
    border-radius: var(--border-radius-small);
    overflow-x: auto;
    margin: var(--spacing-md) 0;
}

.message-content pre code {
    background: transparent;
    padding: 0;
    color: white;
}

/* Message metadata */
.message-meta {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--border-color);
}

.message-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.message-sources {
    display: flex;
    gap: var(--spacing-xs);
    flex-wrap: wrap;
}

.source-badge {
    font-size: 12px;
    padding: 2px 8px;
    background: var(--background-color);
    color: var(--text-secondary);
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

/* Composer */
.composer {
    grid-row: 2;
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    padding: var(--spacing-lg) var(--spacing-xl);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.input-container {
    display: flex;
    gap: var(--spacing-md);
    max-width: 900px;
}

#messageInput {
    flex: 1;
    padding: var(--spacing-md) var(--spacing-lg);
    border: 2px solid var(--border-color);
    border-radius: 24px;
    font-size: 16px;
    font-family: inherit;
    background: var(--background-color);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

#messageInput:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--surface-color);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

#messageInput::placeholder {
    color: var(--text-secondary);
}

#sendBtn {
    padding: var(--spacing-md);
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

#sendBtn:hover {
    background: #0051D5;
    transform: scale(1.1);
    box-shadow: var(--shadow-medium);
}

#sendBtn:active {
    transform: scale(0.95);
}

#sendBtn:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.5;
}

/* Loading states */
.typing-indicator {
    display: flex;
    gap: var(--spacing-xs);
    padding: var(--spacing-md);
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: var(--spacing-xxl);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: var(--spacing-lg);
}

.empty-state-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.empty-state-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        z-index: 1000;
        transition: left 0.3s ease;
    }

    .sidebar.open {
        left: 0;
    }

    .message-bubble {
        max-width: 85%;
    }
}

/* Mirror styles for addEnhancedMessage elements to fix initial rendering */
.bubble {
    max-width: 900px;
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--border-radius);
    word-wrap: break-word;
    background: var(--surface-color);
    color: var(--text-primary);
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: var(--spacing-xs);
}

.bubble .content {
    font-size: 16px;
    line-height: 1.5;
}

/* Mirror all the content formatting styles */
.bubble .content p {
    margin-bottom: 4px;  /* Reduced from 8px to 4px */
}

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

/* Reduce spacing for list items */
.bubble .content ul,
.bubble .content ol {
    margin: 4px 0;  /* Reduced from 6px */
    padding-left: 20px;
}

.bubble .content li {
    margin-bottom: 2px;  /* Reduced from 4px */
}

.bubble .content li:last-child {
    margin-bottom: 0;
}

/* Spacing between sections (icons) */
.bubble .content h2,
.bubble .content h3,
.bubble .content h4 {
    margin: 12px 0 6px 0;  /* Normal space before section, small after */
}

.bubble .content h2:first-child,
.bubble .content h3:first-child,
.bubble .content h4:first-child {
    margin-top: 0;
}

/* Detect emoji section headers (🔧 📊 💡) and add spacing before them */
.bubble .content p > strong:first-child {
    display: block;
    margin-top: 12px;
    margin-bottom: 6px;
}

.bubble .content code {
    background: var(--background-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 14px;
}

.bubble .content pre {
    background: var(--text-primary);
    color: white;
    padding: var(--spacing-md);
    border-radius: var(--border-radius-small);
    overflow-x: auto;
    margin-bottom: var(--spacing-sm);
}

.bubble .content pre code {
    background: transparent;
    padding: 0;
    color: white;
}

/* Responsive for bubble class */
@media (max-width: 768px) {
    .bubble {
        max-width: 85%;
    }

    /* Reset left alignment for mobile - center content */
    .messages {
        padding-left: var(--spacing-xl);
        margin: 0 auto;
    }

    .input-container {
        margin-left: var(--spacing-lg);
        margin-right: var(--spacing-lg);
    }
}

/* Toggle Stats Button */
.toggle-stats-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 8px 12px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-stats-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.1);
}

/* Stats Panel */
.stats-panel {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 350px;
    background: var(--surface-color);
    border-left: 1px solid var(--border-color);
    display: none; /* Hidden by default, show with .show-stats class */
    animation: slideInRight 0.3s ease;
    /* Flex container for header + scrollable content */
    flex-direction: column;
    z-index: 10;
    grid-row: 1 / -1; /* Span all rows, overlay the grid */
}

.chat.show-stats .stats-panel {
    display: flex;
}

/* Adjust messages area when stats panel is shown */
.chat.show-stats .messages {
    margin-right: 350px;
}

/* Stats Panel Header */
.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    background: var(--surface-color);
    flex-shrink: 0;
}

.stats-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.close-stats {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-stats:hover {
    color: var(--text-primary);
}

/* Stats Content */
.stats-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-lg);
}

.stat-section {
    margin-bottom: var(--spacing-xl);
}

.stat-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--border-color);
}

.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-sm);
}

.stat-item {
    background: var(--background-color);
    padding: var(--spacing-sm);
    border-radius: var(--border-radius-small);
}

.stat-label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-color);
}

.stat-value.small {
    font-size: 12px;
}

/* Chunks List */
.chunks-list {
    margin-top: var(--spacing-md);
}

.chunk-item {
    background: var(--background-color);
    padding: var(--spacing-sm);
    border-radius: var(--border-radius-small);
    margin-bottom: var(--spacing-sm);
    font-size: 11px;
    position: relative;
}

.selected-chunk {
    border-left: 3px solid #4CAF50;
    background: rgba(76, 175, 80, 0.05);
}

.unselected-chunk {
    opacity: 0.7;
    border-left: 3px solid #999;
}

.chunk-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #4CAF50;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
}

.chunk-badge-excluded {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #999;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
}

.chunk-score {
    color: var(--primary-color);
    font-weight: 600;
    margin-right: var(--spacing-sm);
}

.chunk-content {
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Equipment List */
.equipment-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.equipment-item {
    background: var(--background-color);
    padding: var(--spacing-sm);
    border-radius: var(--border-radius-small);
    font-size: 12px;
}

.equipment-name {
    color: var(--text-primary);
    font-weight: 500;
}

.equipment-rank {
    color: var(--text-secondary);
    font-size: 11px;
    margin-top: 2px;
}

/* Animation */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background-color);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Source tag styling */
.source-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    margin-bottom: 4px;
    border-radius: 6px;
    background: rgba(0, 122, 255, 0.08);
    border: 1px solid rgba(0, 122, 255, 0.2);
    font-size: 12px;
    font-weight: 500;
    color: #007aff;
}

.source-tag.source-warning {
    background: rgba(255, 59, 48, 0.08);
    border-color: rgba(255, 59, 48, 0.3);
    color: #ff3b30;
}

.source-icon {
    font-size: 14px;
    line-height: 1;
}

.source-text {
    line-height: 1;
}

/* Source bubbles (numbered indicators at bottom) */
.source-bubbles {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
    align-items: center;
}

.source-bubble {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1.5px solid;
}

.source-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Pinecone sources - blue */
.source-bubble.source-pinecone {
    background: rgba(0, 122, 255, 0.1);
    border-color: rgba(0, 122, 255, 0.4);
    color: #007aff;
}

.source-bubble.source-pinecone:hover {
    background: rgba(0, 122, 255, 0.2);
    border-color: #007aff;
}

/* System/DIP sources - green */
.source-bubble.source-system {
    background: rgba(52, 199, 89, 0.1);
    border-color: rgba(52, 199, 89, 0.4);
    color: #34c759;
}

.source-bubble.source-system:hover {
    background: rgba(52, 199, 89, 0.2);
    border-color: #34c759;
}

/* Perplexity sources - purple/web theme */
.source-bubble.source-perplexity {
    background: rgba(147, 51, 234, 0.1);
    border-color: rgba(147, 51, 234, 0.4);
    color: #9333ea;
}

.source-bubble.source-perplexity:hover {
    background: rgba(147, 51, 234, 0.2);
    border-color: #9333ea;
}

/* Perplexity links in modal */
.perplexity-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 16px 0;
}

.perplexity-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.2s ease;
}

.perplexity-link:hover {
    background-color: rgba(147, 51, 234, 0.05);
    border-color: #9333ea;
}

.perplexity-link .link-number {
    flex-shrink: 0;
    font-weight: 600;
    color: var(--text-secondary);
}

.perplexity-link .link-url {
    flex: 1;
    word-break: break-all;
    font-size: 13px;
}

.perplexity-link .link-icon {
    flex-shrink: 0;
    font-size: 16px;
}

.perplexity-note {
    margin-top: 16px;
    font-size: 12px;
    font-style: italic;
    color: var(--text-secondary);
}

/* Unknown sources - gray */
.source-bubble.source-unknown {
    background: rgba(142, 142, 147, 0.1);
    border-color: rgba(142, 142, 147, 0.4);
    color: #8e8e93;
}

.source-bubble.source-unknown:hover {
    background: rgba(142, 142, 147, 0.2);
    border-color: #8e8e93;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .source-tag {
        background: rgba(10, 132, 255, 0.15);
        border-color: rgba(10, 132, 255, 0.3);
        color: #0a84ff;
    }

    .source-tag.source-warning {
        background: rgba(255, 69, 58, 0.15);
        border-color: rgba(255, 69, 58, 0.3);
        color: #ff453a;
    }

    /* Source bubbles dark mode */
    .source-bubble.source-pinecone {
        background: rgba(10, 132, 255, 0.15);
        border-color: rgba(10, 132, 255, 0.4);
        color: #0a84ff;
    }

    .source-bubble.source-pinecone:hover {
        background: rgba(10, 132, 255, 0.25);
        border-color: #0a84ff;
    }

    .source-bubble.source-system {
        background: rgba(50, 215, 75, 0.15);
        border-color: rgba(50, 215, 75, 0.4);
        color: #32d74b;
    }

    .source-bubble.source-system:hover {
        background: rgba(50, 215, 75, 0.25);
        border-color: #32d74b;
    }

    .source-bubble.source-unknown {
        background: rgba(174, 174, 178, 0.15);
        border-color: rgba(174, 174, 178, 0.4);
        color: #aeaeb2;
    }

    .source-bubble.source-unknown:hover {
        background: rgba(174, 174, 178, 0.25);
        border-color: #aeaeb2;
    }
}

/* Source details modal */
.source-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.source-modal-content {
    background: var(--surface-color);
    border-radius: 12px;
    padding: 24px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    position: relative;
}

.source-modal-content h3 {
    margin: 0 0 16px 0;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
}

.source-modal-content p {
    margin: 8px 0;
    color: var(--text-primary);
    line-height: 1.5;
}

.source-modal-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.source-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 28px;
    font-weight: 300;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.source-modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
}

.source-content {
    margin-top: 16px;
}

.source-chunk {
    padding: 12px;
    background: var(--background-color);
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
}

.source-chunk:last-child {
    margin-bottom: 0;
}

/* Dark mode modal */
@media (prefers-color-scheme: dark) {
    .source-modal-close:hover {
        background: rgba(255, 255, 255, 0.1);
    }
}