/* Add to Notion - Light Theme (matching SMR Renderer & Endo Chatbot) */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'JetBrains Mono', 'SF Mono', Monaco, 'Courier New', monospace;
    background: #f5f5f5;
    color: #1a1a1a;
    min-height: 100vh;
    padding: 10px 20px 20px 20px;
    line-height: 1.6;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
}

header {
    margin-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 12px;
}

header h1 {
    font-size: 28px;
    font-weight: 600;
    color: #795548;
    margin-bottom: 4px;
}

header p {
    font-size: 14px;
    color: #666666;
}

/* Step Sections */
.step-section {
    background: #ffffff;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    padding: 20px 24px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Drop section - narrower initially */
.drop-section {
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.step-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #9181c4;
    color: white;
    border-radius: 50%;
    font-weight: 600;
    font-size: 14px;
}

.step-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #795548;
}

/* Drop Zone */
.drop-zone {
    position: relative;
    border: 2px dashed #d0d0d0;
    border-radius: 6px;
    padding: 32px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fafafa;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: #9181c4;
    background: #ffffff;
}

.drop-icon {
    margin-bottom: 12px;
    color: #9181c4;
}

.drop-icon svg {
    display: block;
}

.drop-title {
    font-size: 16px;
    color: #1a1a1a;
    margin-bottom: 4px;
    font-weight: 500;
}

.drop-hint {
    font-size: 13px;
    color: #666666;
}

.upload-divider {
    margin: 20px 0;
    position: relative;
    color: #999999;
}

.upload-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e0e0e0;
    z-index: 1;
}

.upload-divider span {
    background: #fafafa;
    padding: 0 12px;
    position: relative;
    z-index: 2;
    font-size: 13px;
}

.file-upload-btn {
    display: inline-block;
    padding: 10px 20px;
    background: #9181c4;
    color: white;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-family: inherit;
}

.file-upload-btn:hover {
    background: #7b6fa0;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(145, 129, 196, 0.3);
}


/* Two Column Layout */
.working-area {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    margin-top: 16px;
    align-items: stretch;
}

.content-section,
.analysis-section {
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: calc(100vh - 200px);
}

.analysis-section {
    position: sticky;
    top: 20px;
    height: calc(100vh - 200px);
    min-height: 0;
    max-height: calc(100vh - 200px);
    display: flex;
    flex-direction: column;
}

.analysis-title {
    font-size: 18px;
    font-weight: 600;
    color: #795548;
    margin-bottom: 16px;
    padding: 0;
    flex-shrink: 0;
}

/* Content Preview */
.content-preview {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #fafafa;
    border-bottom: 1px solid #e0e0e0;
}

.preview-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-name {
    font-size: 14px;
    color: #795548;
    font-weight: 500;
}

.toolbar-toggle-btn {
    background: transparent;
    border: 1px solid #d0d0d0;
    color: #666666;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toolbar-toggle-btn:hover {
    border-color: #9181c4;
    color: #9181c4;
    background: rgba(145, 129, 196, 0.08);
}

.toolbar-toggle-btn.active {
    border-color: #9181c4;
    color: #9181c4;
    background: rgba(145, 129, 196, 0.08);
}

.btn-icon {
    padding: 6px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.markdown-editor {
    width: 100%;
    flex: 1;
    padding: 16px;
    border: none;
    background: #ffffff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    line-height: 1.7;
    overflow-y: auto;
    outline: none;
    color: #1a1a1a;
    min-height: 0;
}

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

/* Styling for content inside the editor */
.markdown-editor h1,
.markdown-editor h2,
.markdown-editor h3 {
    margin-top: 16px;
    margin-bottom: 8px;
    color: #1a1a1a;
    font-weight: 600;
}

.markdown-editor h1 { font-size: 20px; }
.markdown-editor h2 { font-size: 17px; }
.markdown-editor h3 { font-size: 15px; }

.markdown-editor p {
    margin-bottom: 12px;
}

.markdown-editor ul,
.markdown-editor ol {
    margin-left: 20px;
    margin-bottom: 12px;
}

.markdown-editor code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    border: 1px solid #e0e0e0;
}

.markdown-editor pre {
    background: #1a1a1a;
    color: #f5f5f5;
    padding: 12px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 12px 0;
}

.markdown-editor pre code {
    background: none;
    padding: 0;
    color: inherit;
    border: none;
}

.markdown-editor blockquote {
    margin: 12px 0;
    padding: 8px 16px;
    border-left: 3px solid #9181c4;
    background: #fafafa;
    color: #666666;
}

.markdown-editor hr {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 16px 0;
}

.markdown-editor a {
    color: #9181c4;
    text-decoration: underline;
}

.markdown-preview h1,
.markdown-preview h2,
.markdown-preview h3 {
    margin-top: 16px;
    margin-bottom: 8px;
    color: #1a1a1a;
    font-weight: 600;
}

.markdown-preview h1 { font-size: 20px; }
.markdown-preview h2 { font-size: 17px; }
.markdown-preview h3 { font-size: 15px; }

.markdown-preview p {
    margin-bottom: 12px;
}

.markdown-preview ul,
.markdown-preview ol {
    margin-left: 20px;
    margin-bottom: 12px;
}

.markdown-preview code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    border: 1px solid #e0e0e0;
}

.markdown-preview pre {
    background: #1a1a1a;
    color: #f5f5f5;
    padding: 12px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 12px 0;
}

.markdown-preview pre code {
    background: none;
    padding: 0;
    color: inherit;
    border: none;
}

.markdown-preview blockquote {
    margin: 12px 0;
    padding: 8px 16px;
    border-left: 3px solid #9181c4;
    background: #fafafa;
    color: #666666;
}

.markdown-preview hr {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 16px 0;
}

.markdown-preview a {
    color: #9181c4;
    text-decoration: underline;
}

.content-meta {
    display: flex;
    gap: 24px;
    padding: 10px 16px;
    background: #fafafa;
    border-top: 1px solid #e0e0e0;
    font-size: 12px;
    color: #666666;
}

/* Editor Toolbar */
.editor-toolbar-container {
    background: #fafafa;
}

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 16px;
    background: #ffffff;
    border-top: 1px solid #e0e0e0;
}

.toolbar-btn {
    padding: 6px 8px;
    background: #ffffff;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666666;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    min-width: 32px;
    height: 32px;
}

.toolbar-btn:hover {
    background: #f5f5f5;
    border-color: #9181c4;
    color: #9181c4;
}

.toolbar-btn:active {
    background: #e5e5e5;
    transform: translateY(1px);
}

/* Active state when formatting is applied */
.toolbar-btn.active {
    background: #9181c4;
    border-color: #9181c4;
    color: white;
}

.toolbar-btn.active:hover {
    background: #7b6fa0;
    border-color: #7b6fa0;
    color: white;
}

.toolbar-btn svg {
    width: 16px;
    height: 16px;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: #e0e0e0;
    margin: 4px 4px;
}

/* Buttons */
.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: #9181c4;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #7b6fa0;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(145, 129, 196, 0.3);
}

.btn-secondary {
    background: #ffffff;
    color: #666666;
    border: 1px solid #d0d0d0;
}

.btn-secondary:hover:not(:disabled) {
    border-color: #9181c4;
    color: #9181c4;
    background: rgba(145, 129, 196, 0.08);
}

.btn-sm {
    padding: 6px 10px;
    font-size: 12px;
}

.btn-large {
    padding: 12px 24px;
    font-size: 15px;
}

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

/* Loading Panel */
.loading-panel {
    text-align: center;
    padding: 32px;
    background: #fafafa;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    max-height: 100%;
    overflow-y: auto;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e0e0e0;
    border-top: 3px solid #9181c4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

.loading-hint {
    font-size: 13px;
    color: #999999;
    margin-top: 8px;
}

.suggestion-text {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 16px;
    color: #1a1a1a;
}

/* File Tree */
.file-tree-container {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: #fafafa;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    padding: 16px;
    overflow: hidden;
}

.file-tree {
    background: #1a1a1a;
    color: #d0d0d0;
    padding: 16px;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.6;
    overflow-y: auto;
    overflow-x: auto;
    flex: 1;
    min-height: 0;
    font-family: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
}

.tree-root {
    color: #f5f5f5;
    font-weight: 600;
    margin-bottom: 8px;
}

.tree-line {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 4px;
    border-radius: 4px;
}

.tree-line:hover {
    background: rgba(255, 255, 255, 0.05);
}

.tree-line.selected {
    background: transparent !important;
    color: #fff0b8;
    font-weight: 400;
}

.tree-prefix {
    white-space: pre;
    color: #6c6c6c;
}

.tree-toggle {
    background: transparent;
    border: none;
    color: #9bb0ff;
    font-size: 12px;
    padding: 0 2px;
    cursor: pointer;
    margin-left: auto;
}

.tree-toggle[disabled] {
    opacity: 0.35;
    cursor: default;
}

.tree-label {
    color: #d0d0d0;
}

.tree-label.database {
    color: #5f7fd9;
}

.tree-line.selected .tree-label.database {
    color: #fff0b8;
    font-weight: 400;
}

.tree-line.selected .tree-label {
    font-weight: 400;
}

.tree-tag {
    color: #8aa6ff;
    font-size: 11px;
    margin-left: 6px;
    opacity: 0.8;
}

.file-tree .highlight {
    color: #9181c4;
    font-weight: 600;
}

.file-tree .folder {
    color: #74b9ff;
}

.file-tree .new-file {
    color: #00b894;
    background: rgba(0, 184, 148, 0.15);
    padding: 2px 6px;
    border-radius: 3px;
}

.file-tree .database {
    color: #74b9ff;
}

/* Page Details */
.page-details {
    background: #fafafa;
    border-radius: 6px;
    padding: 16px;
    border: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.detail-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.detail-row:last-child {
    margin-bottom: 0;
}

.detail-row label {
    font-weight: 500;
    color: #666666;
    min-width: 50px;
    font-size: 13px;
}

.page-title-input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.page-title-input:focus {
    outline: none;
    border-color: #9181c4;
    box-shadow: 0 0 0 3px rgba(145, 129, 196, 0.15);
}

.suggestion-actions {
    display: flex;
    gap: 12px;
    padding: 16px 0 0 0;
    flex-shrink: 0;
}

/* Result Panel */
.result-panel {
    text-align: center;
    padding: 32px;
}

.success-icon {
    margin-bottom: 12px;
    color: #00b894;
}

.success-icon svg {
    display: block;
    margin: 0 auto;
}

.result-panel h3 {
    font-size: 18px;
    color: #00b894;
    margin-bottom: 8px;
}

.result-panel p {
    color: #666666;
    margin-bottom: 24px;
    font-size: 14px;
}

.result-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Toast Messages */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 20px;
    border-radius: 4px;
    font-weight: 500;
    font-size: 13px;
    z-index: 2000;
    animation: slideDown 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast-success {
    background: #00b894;
    color: white;
}

.toast-error {
    background: #d63031;
    color: white;
}

.toast-info {
    background: #0984e3;
    color: white;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Scrollbar styling */
.markdown-editor::-webkit-scrollbar,
.markdown-preview::-webkit-scrollbar,
.file-tree::-webkit-scrollbar {
    width: 6px;
}

.markdown-editor::-webkit-scrollbar-track,
.markdown-preview::-webkit-scrollbar-track,
.file-tree::-webkit-scrollbar-track {
    background: #f5f5f5;
}

.markdown-editor::-webkit-scrollbar-thumb,
.markdown-preview::-webkit-scrollbar-thumb,
.file-tree::-webkit-scrollbar-thumb {
    background: #d0d0d0;
    border-radius: 3px;
}

.markdown-editor::-webkit-scrollbar-thumb:hover,
.markdown-preview::-webkit-scrollbar-thumb:hover,
.file-tree::-webkit-scrollbar-thumb:hover {
    background: #999999;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    .step-section {
        padding: 16px;
    }

    .drop-zone {
        padding: 24px 16px;
    }

    /* Stack columns vertically on mobile */
    .working-area {
        grid-template-columns: 1fr;
    }

    .suggestion-actions,
    .result-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .preview-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .preview-actions {
        flex-direction: column;
        width: 100%;
        align-items: stretch;
    }
}

/* Empty state styling */
.empty-state {
    text-align: center;
    padding: 24px;
    color: #999999;
}

.empty-state p {
    margin-bottom: 12px;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(4px);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    padding: 32px;
}

.loading-text {
    font-size: 16px;
    font-weight: 600;
    color: #795548;
    margin-bottom: 20px;
}

/* Progress Bar */
.progress-bar-container {
    width: 100%;
    max-width: 600px;
    position: relative;
    z-index: 5;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #9181c4, #7b6fa0);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-percentage {
    font-size: 13px;
    font-weight: 600;
    color: #9181c4;
    text-align: center;
    margin: 0 0 12px 0;
}

/* Terminal Output */
.terminal-output {
    background: #ffffff;
    color: #000000;
    font-family: 'SF Mono', 'Courier New', monospace;
    font-size: 12px;
    padding: 20px;
    border-radius: 4px;
    text-align: left;
    min-height: 120px;
    max-height: 150px;
    overflow-y: auto;
    line-height: 1.8;
    white-space: pre;
    border: 1px solid #d0d0d0;
    margin-top: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.terminal-output::-webkit-scrollbar {
    width: 6px;
}

.terminal-output::-webkit-scrollbar-track {
    background: #f5f5f5;
}

.terminal-output::-webkit-scrollbar-thumb {
    background: #d0d0d0;
    border-radius: 3px;
}

.terminal-output::-webkit-scrollbar-thumb:hover {
    background: #999999;
}

/* Stage Progress Bars */
.stage-progress {
    margin: 0;
    padding: 0;
    font-family: 'SF Mono', 'Courier New', monospace;
    line-height: 1.4;
    color: #000000;
    font-size: 12px;
}

.stage-name {
    color: #000000;
    font-weight: 400;
    display: inline;
    min-width: 180px;
}

.stage-bar {
    color: #000000;
    font-size: 12px;
    letter-spacing: 0px;
    margin: 0 8px;
    font-weight: normal;
}

.stage-percentage {
    color: #000000;
    font-weight: 400;
    display: inline;
}

.stage-count {
    color: #666666;
    margin-left: 8px;
    font-size: 12px;
}

/* Pulsing animation for active stages without percentage updates */
.stage-pulsing {
    animation: stagePulse 2s ease-in-out infinite;
}

@keyframes stagePulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}
