@tailwind base;
@tailwind components;
@tailwind utilities;

/* MoreCompute Notebook Styles - Marimo inspired */


@font-face {
  font-family: 'Fira';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/Fira.ttf') format('truetype');
}

@font-face {
  font-family: 'Tiempos';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/Tiempos.woff2') format('woff2');
}

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

:root {
    --mc-background: #E9E7E3;

    /* Font Family Custom Properties */
    --font-sans: 'CustomFont', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'VeraMono', 'CustomMono', 'Fira Code', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace;
    --font-display: 'DisplayFont', 'Inter', system-ui, sans-serif;
    --mc-cell-background: #F4EEE7;
    --mc-text-color: #575042;
    --mc-markdown-color: #372E25;
    --mc-markdown-heading-color: #624204;
    --mc-markdown-paragraph-color: #575042;
    --mc-line-number-color: #9ca3af;
    --text-secondary: #6b7280;
}

@media (prefers-color-scheme: light) {
    :root {
        --mc-cell-background: #F4EEE7;
    }
}

@media (prefers-color-scheme: dark) {
    :root {
        --mc-cell-background: #0B1118;
    }
}

body {
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--mc-background);
    color: var(--mc-text-color);
    line-height: 1.6;
    overflow-x: hidden;
}

#app {
    min-height: 100vh;
    padding: 0;
    display: flex;
}

/* Kernel Status Banner */
.kernel-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: linear-gradient(180deg, #ef4444 0%, #dc2626 50%, #ffffff 100%);
    padding: 12px 20px;
    border-bottom: 1px solid #fca5a5;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.kernel-message {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.kernel-status-text {
    font-weight: 600;
    font-size: 14px;
    color: #ffffff;
    margin-bottom: 2px;
}

.kernel-subtitle {
    font-size: 12px;
    color: #fecaca;
}

/* Kernel Status Bar */
.kernel-status-bar {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
}

.kernel-status-indicator {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 8px 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(8px);
    font-size: 12px;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
    transition: background-color 0.3s ease;
}

.status-dot.connecting {
    background-color: #fbbf24;
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background-color: #10b981;
}

.status-dot.disconnected {
    background-color: #ef4444;
}

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

.status-text {
    color: #6b7280;
}

/* Notebook Wrapper */
.notebook-wrapper {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 20px;
}

.notebook {
    position: relative;
}

/* Empty State */
.empty-state {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

/* Add Cell Lines */
.add-cell-line {
    position: relative;
    height: 0;
    width: 100%;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 10;
    pointer-events: none; /* Don't block interactions by default */
}

.add-cell-line:hover {
    opacity: 1;
    pointer-events: auto; /* Re-enable interactions on hover */
}

.add-cell-line::before {
    content: "";
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 20px;
    background: transparent;
    pointer-events: auto; /* Allow hover detection */
}

/* Extra padding for top cell hover area */
.add-line-above::before {
    height: 40px;
    top: -14px;
    left: 50px;
    right: 50px;
}

/* Extended hover area for add-line-below to capture hover below cells */
.add-line-below::before {
    content: "";
    position: absolute;
    top: -8px;
    left: 0;
    right: 0;
    height: 16px; /* Smaller hover area to avoid blocking cell clicks */
    background: transparent;
    pointer-events: auto; /* Allow hover detection */
}

.add-cell-line::after {
    content: "";
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 1px;
    background: #DBC7A8;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.add-cell-line:hover::after {
    opacity: 1;
}

.add-cell-button {
    position: absolute;
    top: -27px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: auto;
    z-index: 100;
}

.add-cell-line:hover .add-cell-button {
    opacity: 1;
}

.add-cell-button img {
    width: 14px;
    height: 14px;
    filter: brightness(0) invert(1);
}

.cell-type-menu {
    display: flex;
    flex-direction: row;
    gap: 16px;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    z-index: 20;
}

.add-cell-line:hover .cell-type-menu {
    opacity: 1;
    pointer-events: auto;
}

/* Create hover area that includes both button and menu */
.add-cell-button::after {
    content: "";
    position: absolute;
    top: 0;
    left: -20px;
    right: -20px;
    bottom: -40px;
    z-index: 19;
}

.cell-type-option {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid #DBC7A8;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    color: #575042;
    font-family: 'Fira';
    letter-spacing: -0.02em;
}

.cell-type-option:hover {
    background: #E9E7E3;
    cursor: pointer;
}

/* Cell Wrapper */
.cell-wrapper {
    position: relative;
    margin: 0;
}

.cell-status-indicator {
    position: absolute;
    top: 14px;
    left: -48px;
    width: auto; /* allow room for timer */
    height: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 0 2px;
}

.cell-status-indicator .status-placeholder {
    width: 14px;
    height: 14px;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: monospace;
    font-size: 12px;
    color: inherit;
    margin-top: -1px;
}

.status-bracket {
    opacity: 0.3;
}

.cell-status-indicator .status-timer {
    margin-left: 0;
    font-size: 9px;
    color: #6b7280;
    min-width: auto;
    text-align: center;
    line-height: 1;
    white-space: nowrap;
}

/* Main Cell */
.cell {
    position: relative;
    margin: 20px 0;
    padding: 0;
    background: var(--mc-cell-background);
    border: 2px solid #DBC7A8;
    border-radius: 0.5px;
    transition: all 0.2s ease;
    overflow: hidden;
}

.cell:hover {
    box-shadow: 2px 4px 0 #E2DACC;
}

.cell.active {
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px #3b82f6;
}

/* Markdown display mode - no borders or background */
.cell.markdown-display-mode {
    border: none !important;
    background: transparent !important;
    margin: 0;
    padding: 0;
    box-shadow: none;
}

.cell.markdown-display-mode:hover {
    box-shadow: none;
}

.cell.markdown-display-mode .cell-content {
    border: none !important;
    background: transparent !important;
    padding: 0;
    margin: 0;
}

/* Override markdown hover background for display mode */
.cell.markdown-display-mode .markdown-rendered:hover {
    background: transparent !important;
}

/* Ensure markdown renderer has no background and reduced padding in display mode */
.cell.markdown-display-mode .markdown-rendered {
    background: transparent !important;
    padding: 2px 4px !important;
}

/* Cell Hover Controls */
.cell-hover-controls {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 15;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.cell:hover .cell-hover-controls {
    opacity: 1;
}

.cell-actions-right {
    display: flex;
    gap: 4px;
    align-items: center;
}

.cell-button {
    /* Styling is handled by inline styles in CellButton component */
}

.cell-actions-right {
    display: flex;
    gap: 4px;
    align-items: center;
}

/* Legacy cell-action styles removed - now handled by CellButton component */

/* Simple spin animation for loader icon */
.mc-spin {
    animation: mc-spin 0.9s linear infinite;
}

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

/* Cell Content */
.cell-content {
    position: relative;
    background: var(--mc-cell-background);
}

.cell-input {
    padding: 0;
}

.cell-editor-container {
    position: relative;
}

.cell-editor {
    width: 100%;
    border: none;
    outline: none;
    resize: none;
    font-family: 'Fira', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    padding: 16px 20px;
    background: transparent;
    color: var(--mc-text-color);
    min-height: 100px;
}

.cell-editor:focus {
    outline: none;
}

/* Markdown editor styling - uses Fira font for better readability */
.markdown-editor-container {
    /* Inherits from cell-editor-container */
}

.markdown-editor {
    font-family: 'Fira', 'CustomFont', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    /* Keep other properties from .cell-editor */
}

/* Code editor styling - keeps monospace font */
.code-editor-container {
    /* Inherits from cell-editor-container */
}

.code-editor {
    /* Inherits monospace font from .cell-editor */
}

/* CodeMirror Styling */
.CodeMirror {
    height: auto;
    font-family: 'Fira', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    border: none;
    background: transparent;
    color: var(--mc-text-color);
}

.CodeMirror-focused {
    outline: none;
}

.CodeMirror-scroll {
    /* Content-based sizing - start small and grow with content */
    min-height: 32px; /* Single line minimum */
    padding: 8px 16px;
    transition: min-height 0.2s ease;
    background: var(--mc-cell-background);
}

/* Auto-sizing based on content */
.CodeMirror {
    /* Let CodeMirror size itself based on content */
    height: auto !important;
    min-height: 32px;
}

.CodeMirror-sizer {
    min-height: auto !important;
}

/* Smart sizing classes applied dynamically */
.cell.cell-empty .CodeMirror-scroll {
    min-height: 32px; /* Very compact for empty cells */
}

.cell.cell-single-line .CodeMirror-scroll {
    min-height: 40px; /* Slightly more space for single line */
}

.cell.cell-focused .CodeMirror-scroll {
    min-height: 48px; /* More space when focused for editing */
}

.CodeMirror-cursor {
    border-left: 2px solid #3b82f6;
}

.CodeMirror-selected {
    background: #dbeafe;
}

.CodeMirror-line {
    padding: 0;
}

.CodeMirror-placeholder {
    color: #9ca3af !important;
    font-style: italic;
}

/* Line numbers styling */
.CodeMirror-linenumbers {
    background: var(--mc-cell-background);
    border-right: 1px solid #e5e7eb;
    padding-right: 8px;
    min-width: 30px;
}

.CodeMirror-linenumber {
    color: var(--mc-line-number-color);
    font-size: 11px;
    text-align: right;
    padding: 0 5px 0 0;
    min-width: 20px;
}

.CodeMirror-gutters {
    background: var(--mc-cell-background);
    border-right: 1px solid #e5e7eb;
}

/* Markdown Rendered Content - Auto-sizing */
.markdown-rendered {
    padding: 8px 16px;
    line-height: 1.7;
    color: var(--mc-markdown-color);
    cursor: pointer;
    min-height: auto; /* Let content determine height */
}

/* Smart sizing for markdown content */
.cell.cell-empty .markdown-rendered,
.cell.cell-empty .text-cell-output {
    min-height: 24px; /* Very compact for empty markdown */
    padding: 4px 12px;
}

.cell.cell-single-line .markdown-rendered,
.cell.cell-single-line .text-cell-output {
    min-height: 32px; /* Single line markdown */
    padding: 6px 14px;
}

.markdown-rendered:hover {
    background: rgba(59, 130, 246, 0.02);
}

.markdown-rendered h1, .markdown-rendered h2, .markdown-rendered h3,
.markdown-rendered h4, .markdown-rendered h5, .markdown-rendered h6 {
    margin: 0px 0 0px 0;
    font-weight: 600;
    color: var(--mc-markdown-heading-color);
    font-family: 'Tiempos', serif;
}

.markdown-rendered h1 {
    font-size: 1.5em;
}
.markdown-rendered h2 {
    font-size: 1.3em;
}
.markdown-rendered h3 {
    font-size: 1.1em;
}

.markdown-rendered p {
    margin: 8px 0;
    font-family: 'Fira', monospace;
    letter-spacing: -0.02em;
    color: var(--mc-markdown-paragraph-color);
}

.markdown-rendered ul,
.markdown-rendered ol {
    margin: 8px 0;
    padding-left: 20px;
}

.markdown-rendered li {
    margin: 4px 0;
    font-family: 'Fira', sans-serif;
    color: var(--mc-markdown-paragraph-color);
}

.markdown-rendered code {
    background: #f3f4f6;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Fira', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 0.9em;
}

.markdown-rendered pre {
    background: #f9fafb;
    padding: 12px;
    border-radius: 6px;
    margin: 12px 0;
    overflow-x: auto;
}

.markdown-rendered pre code {
    background: none;
    padding: 0;
    font-family: 'Fira', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
}

.markdown-rendered blockquote {
    border-left: 3px solid #d1d5db;
    padding-left: 12px;
    margin: 12px 0;
    color: var(--mc-markdown-paragraph-color);
    font-style: italic;
    font-family: 'Fira', sans-serif;
}

.markdown-rendered a {
    color: var(--mc-markdown-paragraph-color);
    text-decoration: none;
    font-family: 'Fira', sans-serif;
}

.markdown-rendered a:hover {
    text-decoration: underline;
}

.markdown-rendered .empty-markdown {
    color: #9ca3af;
    font-style: italic;
}

/* Execution Indicator */
.execution-indicator {
    position: absolute;
    top: 16px;
    left: -40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 11px;
    color: #6b7280;
    width: 30px;
}

.execution-count {
    font-family: 'Fira', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 10px;
    color: #9ca3af;
}

.execution-time {
    font-size: 9px;
    color: #d1d5db;
    margin-top: 2px;
}

/* Execution Status Icon */
.execution-status {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 16;
    opacity: 0;
    animation: fadeInStatus 0.3s ease forwards;
}

@keyframes fadeInStatus {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.status-icon {
    width: 16px;
    height: 16px;
    display: block;
}

/* Cell Output */
.cell-output {
    border-top: 1px solid #f3f4f6;
    background: #fafafa;
}

.output-content {
    padding: 16px 20px;
}

.output-stream {
    background: #f9fafb;
    padding: 12px 16px;
    margin: 8px 0;
    border-radius: 6px;
    font-family: 'Fira', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 13px;
    white-space: pre-wrap;
    word-wrap: break-word;
    border-left: 3px solid #e5e7eb;
}

.output-stream.stdout {
    color: #374151;
    border-left-color: #6b7280;
}

.output-stream.stderr {
    color: #dc2626;
    background: #fef2f2;
    border-left-color: #ef4444;
}

.output-result {
    background: var(--mc-cell-background);
    padding: 12px 16px;
    margin: 8px 0;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    font-family: 'Fira', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 13px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.output-error {
    background: #fef2f2;
    color: #dc2626;
    padding: 12px 16px;
    margin: 8px 0;
    border-radius: 6px;
    border: 1px solid #fecaca;
    font-family: 'Fira', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 13px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Executing State */
.cell.executing {
    border-color: #fbbf24;
    background: linear-gradient(90deg, #fffbeb 0%, #ffffff 100%);
}

.cell.executing .execution-count {
    color: #f59e0b;
}

.cell.executing .execution-count::after {
    content: " •";
    animation: blink 1s infinite;
}

@keyframes blink {
    0%,
    50% {
        opacity: 1;
    }
    51%,
    100% {
        opacity: 0.3;
    }
}

/* Drag and Drop */
.sortable-ghost {
    opacity: 0.4;
}

.sortable-drag {
    transform: rotate(5deg);
    z-index: 1000;
}

/* Responsive */
@media (max-width: 768px) {
    .notebook-wrapper {
        padding: 20px 10px;
        max-width: 100%;
    }

    .execution-indicator {
        display: none;
    }

    .cell-hover-controls {
        position: relative;
        top: auto;
        right: auto;
        opacity: 1;
        padding: 8px 12px;
        background: #f9fafb;
        border-bottom: 1px solid #e5e7eb;
        justify-content: flex-end;
    }
}

/* Sidebar Styles */
.sidebar {
    width: 60px;
    background: #f8fafc;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    padding: 16px 0;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 50;
}

.sidebar-item {
    position: relative;
    width: 48px;
    height: 48px;
    margin: 4px auto;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-item:hover {
    background: #e2e8f0;
}

.sidebar-item.active {
    background: #3b82f6;
}

.sidebar-item.active .sidebar-icon {
    filter: brightness(0) invert(1);
}

.sidebar-icon {
    width: 20px;
    height: 20px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.sidebar-item:hover .sidebar-icon {
    opacity: 1;
}

.sidebar-tooltip {
    position: absolute;
    left: 60px;
    top: 50%;
    transform: translateY(-50%);
    background: #1f2937;
    color: white;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
}

.sidebar-item:hover .sidebar-tooltip {
    opacity: 1;
    visibility: visible;
}

.sidebar-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: #4b5563;
}

.sidebar-icon-image {
    width: 18px;
    height: 18px;
}

/* Main content adjustment */
.main-content {
    flex: 1;
    margin-left: 60px;
}

/* Popup Overlay */
.popup-overlay {
    position: fixed;
    left: 60px;
    top: 0;
    width: min(480px, calc(100vw - 60px));
    height: 100vh;
    background: var(--mc-background);
    border-right: 1px solid #e2e8f0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 40;
    display: flex;
    flex-direction: column;
}

/* Popup Content */
.popup-content {
    flex: 1;
    padding: 24px;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Allow children to scroll within fixed-height overlay */
}

.popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.popup-title {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.popup-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.popup-close:hover {
    background: #f3f4f6;
    color: #374151;
}

/* File Browser Styles */
.file-tree {
    font-size: 14px;
}

.file-browser {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    background: var(--mc-background);
}

.file-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 10px 0; /* even spacing above and below */
}

.file-toolbar-btn {
    background: var(--mc-cell-background);
    color: var(--mc-text-color);
    border: 1px solid #e5e7eb;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        color 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Icon-only variant (bordered, compact) */
.file-toolbar-btn.icon {
    border: 1px solid #e5e7eb;
    background: var(--mc-cell-background);
    padding: 6px;
}

.file-toolbar-btn.icon:hover {
    background: #f3f4f6;
}

.file-toolbar-btn:hover:not(:disabled) {
    background: #e5e7eb;
}

.file-toolbar-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.file-path-header {
    padding: 8px 0;
    margin-bottom: 12px;
    font-size: 12px;
    color: #6b7280;
    border-bottom: 1px solid #e5e7eb;
}

.file-path-label {
    font-weight: 600;
    color: #4b5563;
}

.popup-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0; /* Critical for inner scroll areas in flex layouts */
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border: 1px solid transparent;
}

.file-item.directory .file-icon {
    filter: hue-rotate(200deg);
}

.file-item:hover {
    background: #f3f4f6;
    border-color: #e5e7eb;
}

.file-icon {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    color: #4b5563;
}

.file-meta {
    display: flex;
    flex-direction: column;
}

.file-name {
    font-weight: 500;
    color: var(--mc-text-color);
}

.file-details {
    font-size: 11px;
    color: #6b7280;
}

.file-preview {
    display: flex;
    flex-direction: column;
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.file-preview-header {
    padding: 12px 16px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.file-preview-body {
    padding: 16px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    background: var(--mc-background);
    color: var(--mc-markdown-color);
    border-radius: 0 0 8px 8px;
}

.file-preview-loading {
    color: #94a3b8;
    font-size: 13px;
}

.file-preview-content {
    font-family: 'Fira', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 13px;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--mc-markdown-color);
}

.file-tree.empty {
    color: #6b7280;
    font-style: italic;
    padding: 8px;
}

/* Python Environment Styles */
.python-env-list {
    max-height: 300px;
    overflow-y: auto;
}

.env-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    margin: 8px 0;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.env-item:hover {
    border-color: #3b82f6;
    background: #f8fafc;
}

.env-item.active {
    border-color: #3b82f6;
    background: #eff6ff;
}

.env-info {
    display: flex;
    flex-direction: column;
}

.env-name {
    font-weight: 500;
    color: #1f2937;
}

.env-path {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

.env-version {
    font-size: 12px;
    color: #3b82f6;
    font-weight: 500;
}

.settings-editor {
    width: 100%;
    height: 400px;
    font-family: 'Fira', 'SF Mono', Monaco, monospace;
    font-size: 13px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 12px;
    resize: vertical;
    background: #f9fafb;
}

.settings-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

/* Metrics Popup Styles */
.metrics-container {
    font-size: 14px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.metric-panel {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: var(--mc-cell-background);
}

.metric-panel-header {
    padding: 8px 12px;
    border-bottom: 1px solid #e5e7eb;
}

.metric-panel-title {
    font-size: 12px;
    color: #6b7280;
    font-weight: 600;
}

.metric-panel-body {
    padding: 10px 12px;
}

.metric-big-value .value {
    font-size: 20px;
    font-weight: 700;
    color: var(--mc-text-color);
}

.metric-big-value .subtitle {
    font-size: 12px;
    color: #6b7280;
}

.mini-chart {
    margin-top: 6px;
}

.metrics-footer {
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #6b7280;
}

.metrics-placeholder {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

.metrics-placeholder h3 {
    font-size: 24px;
    margin-bottom: 16px;
    color: #1f2937;
}

.metrics-placeholder p {
    margin-bottom: 24px;
    font-size: 16px;
}

.coming-soon {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 24px;
    margin: 20px 0;
}

.coming-soon ul {
    list-style: none;
    padding: 0;
    margin: 16px 0;
}

.coming-soon li {
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    font-size: 14px;
    color: #374151;
}

.coming-soon li:last-child {
    border-bottom: none;
}

.coming-soon p:last-child {
    margin-top: 20px;
    font-style: italic;
    color: #9ca3af;
    font-size: 14px;
}

/* Packages Popup Styles */
.packages-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
}

.packages-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.packages-search {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    background: var(--mc-cell-background);
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px 10px;
}

.packages-search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 14px;
    color: var(--mc-text-color);
}

.packages-search-icon {
    color: #6b7280;
}

.packages-subtext {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #6b7280;
}

.packages-table {
    display: flex;
    flex-direction: column;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: var(--mc-cell-background);
}

.packages-table-header {
    display: grid;
    grid-template-columns: 1fr 140px;
    gap: 8px;
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.packages-list {
    overflow-y: auto;
    max-height: calc(100vh - 260px);
}

.package-row {
    display: grid;
    grid-template-columns: 1fr 140px;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #f3f4f6;
}

.package-row:last-child {
    border-bottom: none;
}

.package-name {
    color: var(--mc-text-color);
}

.package-version {
    color: #374151;
}

.file-tree-container {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.file-tree {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

@font-face {
  font-family: 'VeraMono';
  src: url('/fonts/VeraMono.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
