/* CSS Variables for Theme */
:root {
    --bg-primary: #1e1e1e;
    --bg-secondary: #252526;
    --bg-tertiary: #2d2d30;
    --bg-hover: #2a2d2e;
    --bg-active: #094771;
    --border-color: #3e3e42;
    --text-primary: #cccccc;
    --text-secondary: #858585;
    --text-muted: #6a6a6a;
    --accent-color: #007acc;
    --accent-hover: #005a9e;
    --error-color: #f48771;
    --success-color: #89d185;
    --warning-color: #cca700;
    --font-mono: 'Consolas', 'Monaco', 'Courier New', monospace;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.loading-content {
    text-align: center;
}

.loading-spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* Source Map Visualization Styles */
/* Gutter markers for matched/unmatched lines - using glyph margin */
/* Use universal selector to catch any element with these classes */
.monaco-editor [class*="source-map-matched-gutter"] {
    background-color: rgba(137, 209, 133, 0.9) !important; /* success-color - green */
    width: 6px !important;
    min-width: 6px !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
}

.monaco-editor [class*="source-map-unmatched-gutter"] {
    background-color: rgba(244, 135, 113, 0.9) !important; /* error-color - red */
    width: 6px !important;
    min-width: 6px !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* More specific selectors */
.monaco-editor .monaco-glyph-margin .source-map-matched-gutter {
    background-color: rgba(137, 209, 133, 0.9) !important;
    width: 6px !important;
    min-width: 6px !important;
    margin: 0 !important;
    padding: 0 !important;
}

.monaco-editor .monaco-glyph-margin .source-map-unmatched-gutter {
    background-color: rgba(244, 135, 113, 0.9) !important;
    width: 6px !important;
    min-width: 6px !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Remove spacing from glyph margin cells to eliminate gaps */
.monaco-editor .monaco-glyph-margin .monaco-glyph-margin-glyphs .monaco-glyph-margin-glyph-cell {
    margin: 0 !important;
    padding: 0 !important;
    line-height: 0 !important;
}

.monaco-editor .monaco-glyph-margin .monaco-glyph-margin-glyphs {
    margin: 0 !important;
    padding: 0 !important;
}

.monaco-editor .source-map-match-highlight {
    background-color: rgba(255, 165, 0, 0.15) !important; /* Orange for match highlights - reduced opacity further */
    /* No left border - gutter markers handle the visual indicator */
}

.monaco-editor .source-map-variable-highlight {
    background-color: rgba(0, 122, 204, 0.2) !important; /* accent-color with transparency */
    border-bottom: 1px solid rgba(0, 122, 204, 0.4) !important;
}

.monaco-editor .source-map-hover-highlight {
    background-color: rgba(0, 122, 204, 0.25) !important;
    border-left: 3px solid var(--accent-color) !important;
}

.monaco-editor .source-map-clickable {
    cursor: pointer !important;
}

.monaco-editor .source-map-match-highlight {
    cursor: pointer !important;
}

.monaco-editor .source-map-clickable-key {
    background-color: rgba(0, 122, 204, 0.15) !important;
    border-bottom: 1px dashed rgba(0, 122, 204, 0.5) !important;
    cursor: pointer !important;
}

.monaco-editor .source-map-clickable-key:hover {
    background-color: rgba(0, 122, 204, 0.25) !important;
    border-bottom: 2px solid rgba(0, 122, 204, 0.7) !important;
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Menu Bar */
.menu-bar {
    display: flex;
    align-items: center;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 10px;
    height: 40px;
    flex-shrink: 0;
}

.menu-item {
    position: relative;
    margin-right: 10px;
}

.menu-button {
    background: none;
    border: none;
    color: var(--text-primary);
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.menu-button:hover {
    background-color: var(--bg-hover);
}

.menu-button:active {
    background-color: var(--bg-active);
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    min-width: 150px;
    z-index: 1000;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Support both hover and explicit display toggle */
.menu-item:hover .dropdown-menu {
    display: block;
}

/* When explicitly shown via JavaScript, override hover */
.dropdown-menu[style*="display: block"] {
    display: block !important;
}

.dropdown-menu a {
    display: block;
    padding: 8px 12px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 13px;
    transition: background-color 0.2s;
}

.dropdown-menu a:hover {
    background-color: var(--bg-hover);
}

.menu-spacer {
    flex: 1;
}

.action-button {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.2s;
}

.action-button:hover {
    background-color: var(--accent-hover);
}

.format-select {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 13px;
    cursor: pointer;
}

.checkbox-label {
    display: flex;
    align-items: center;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 6px;
    cursor: pointer;
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.pane-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    border-right: 1px solid var(--border-color);
    min-width: 0;
}

.pane-container:last-child {
    border-right: none;
}

.pane-header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 12px;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pane-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.pane-stats {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: normal;
    font-family: var(--font-mono);
    margin-left: 16px;
}

.word-wrap-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    margin-left: auto;
    margin-right: 16px;
}

.word-wrap-toggle input[type="checkbox"] {
    cursor: pointer;
    margin: 0;
}

.word-wrap-toggle span {
    white-space: nowrap;
}

.editor-container {
    flex: 1;
    overflow: hidden;
}

.output-container {
    flex: 1;
    overflow: hidden;
    background-color: var(--bg-primary);
    position: relative;
}

/* Table wrapper for table format display */
.table-wrapper {
    padding: 12px;
    overflow: auto;
    height: 100%;
}

/* For table format (when not using Monaco) */
.table-wrapper table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 13px;
}

.output-container .error {
    color: var(--error-color);
}

.output-container .success {
    color: var(--success-color);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
}

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

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background-color: var(--bg-hover);
}

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

.modal-editor {
    width: 100%;
    min-height: 300px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    padding: 12px;
    font-family: var(--font-mono);
    font-size: 13px;
    resize: vertical;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.button-primary {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.2s;
}

.button-primary:hover {
    background-color: var(--accent-hover);
}

.button-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.2s;
}

.button-secondary:hover {
    background-color: var(--bg-hover);
}

/* Input/Lookup Lists */
#inputs-list,
#lookups-list,
#workspaces-list,
#examples-list {
    margin-bottom: 16px;
}

.input-item,
.lookup-item,
.workspace-item,
.example-item {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    padding: 12px;
    margin-bottom: 10px;
}

.input-item-header,
.lookup-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.input-item-name,
.lookup-item-name {
    font-weight: 600;
    color: var(--text-primary);
}

.input-item-actions,
.lookup-item-actions {
    display: flex;
    gap: 8px;
}

.btn-small {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 3px;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-edit {
    background-color: var(--accent-color);
    color: white;
}

.btn-edit:hover {
    background-color: var(--accent-hover);
}

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

.btn-delete:hover {
    background-color: #d66b5a;
}

/* Notifications */
.notifications {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.notification {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 12px 16px;
    min-width: 300px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    animation: slideInFromBottom 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInFromBottom {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.notification.success {
    border-left: 4px solid var(--success-color);
}

.notification.error {
    border-left: 4px solid var(--error-color);
}

.notification.warning {
    border-left: 4px solid var(--warning-color);
}

.notification.info {
    border-left: 4px solid var(--accent-color);
}

.notification-message {
    color: var(--text-primary);
    font-size: 13px;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

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

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

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

/* Responsive Design */
@media (max-width: 1200px) {
    .main-content {
        flex-direction: column;
    }
    
    .pane-container {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        min-height: 200px;
    }
    
    .pane-container:last-child {
        border-bottom: none;
    }
}

/* Monaco Editor Overrides */
.monaco-editor {
    --vscode-editor-background: var(--bg-primary);
    --vscode-editor-foreground: var(--text-primary);
}

