/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: #1a1a1a;
    color: #e5e7eb;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    padding-bottom: 50px; /* Make room for status bar */
}

.container {
    width: 100%;
    height: calc(100vh - 50px); /* Account for fixed status bar */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.header {
    background: #2d2d2d;
    border-bottom: 1px solid #404040;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    height: 60px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.header-left h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #f3f4f6;
    margin: 0;
}

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

/* Buttons */
.btn {
    padding: 8px 16px;
    border: 1px solid #525252;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #404040;
    color: #e5e7eb;
}

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

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

.btn-secondary {
    background: #404040;
    color: #d1d5db;
    border-color: #525252;
}

.btn-secondary:hover {
    background: #525252;
    border-color: #6b7280;
}

/* Format select and other controls */
.format-select {
    padding: 8px 12px;
    border: 1px solid #525252;
    border-radius: 6px;
    background: #404040;
    color: #e5e7eb;
    font-size: 0.875rem;
    cursor: pointer;
}


.auto-process-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: #d1d5db;
    cursor: pointer;
    user-select: none;
}

.auto-process-toggle input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #3b82f6;
    cursor: pointer;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Documentation link styling */
#docsBtn {
    background: #059669;
    color: white;
    text-decoration: none;
    border: 1px solid #059669;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-block;
    text-align: center;
    min-width: 80px;
}

#docsBtn:hover {
    background: #047857;
    border-color: #047857;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

/* Main content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.pane-container {
    display: flex;
    flex: 1;
    height: calc(100vh - 100px); /* Account for header and status bar */
    overflow: hidden;
}

.pane {
    background: #262626;
    border-right: 1px solid #404040;
    display: flex;
    flex-direction: column;
    min-width: 200px;
    overflow: hidden;
    flex: 0 0 33.33%; /* Don't grow, don't shrink, fixed width */
    width: 33.33%; /* Equal initial width for all panes */
}

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

.data-pane {
    flex: 1;
}

.template-pane {
    flex: 1;
}

.result-pane {
    flex: 1;
}

/* Resize handles */
.resize-handle {
    width: 6px;
    background: #404040;
    cursor: col-resize;
    transition: background-color 0.2s ease;
    position: relative;
    flex-shrink: 0;
    z-index: 10;
    border-left: 1px solid #525252;
    border-right: 1px solid #525252;
}

.resize-handle:hover {
    background: #525252;
}

.resize-handle:active {
    background: #6b7280;
}

.resize-handle.dragging {
    background: #6b7280;
    box-shadow: 0 0 10px rgba(107, 114, 128, 0.5);
}

.editor-panel {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.panel-header {
    padding: 12px 16px;
    background: #333333;
    border-bottom: 1px solid #404040;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-width: 0;
    overflow: hidden;
    position: relative;
    width: 100%;
    box-sizing: border-box;
    z-index: 100;
}

.panel-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #d1d5db;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 8px;
}

.word-wrap-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #9ca3af;
    cursor: pointer;
    user-select: none;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
    flex-shrink: 0;
    white-space: nowrap;
}

.word-wrap-toggle:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #d1d5db;
}

.word-wrap-toggle input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #3b82f6;
    cursor: pointer;
    margin: 0;
}

.word-wrap-toggle span {
    font-weight: 500;
}

.editor-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
    min-width: 0;
}

/* Ensure template pane header stays visible and above Monaco overlays */
.template-pane .panel-header {
    position: relative !important;
    z-index: 1000 !important;
    background: #333333 !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Ensure Monaco suggestions/widgets don't cover the header */
.template-pane .monaco-editor .monaco-hover,
.template-pane .monaco-editor .suggest-widget,
.template-pane .monaco-editor .context-view {
    z-index: 999 !important;
}

/* Prevent Monaco from covering the header */
.template-pane .editor-wrapper {
    position: relative;
    z-index: 1;
    overflow: hidden;
}

.editor-wrapper textarea {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: none;
    background: #262626;
    padding: 16px;
    color: #e5e7eb;
    overflow-y: auto;
}

.editor-wrapper textarea::placeholder {
    color: #6b7280;
}

/* CodeMirror overrides */
.CodeMirror {
    height: 100%;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.5;
    border: none;
    background: #262626 !important;
    color: #e5e7eb !important;
}

.CodeMirror-scroll {
    overflow-y: auto !important;
    overflow-x: auto !important;
}

.CodeMirror-focused .CodeMirror-selected {
    background: rgba(59, 130, 246, 0.25);
}

.CodeMirror-gutters {
    background: #333333 !important;
    border-right: 1px solid #404040 !important;
}

.CodeMirror-linenumber {
    color: #6b7280 !important;
}

.CodeMirror-cursor {
    border-left: 1px solid #e5e7eb !important;
}

/* CodeMirror folding styles for dark theme */
.CodeMirror-foldgutter {
    width: 12px;
    background: #333333 !important;
}

.CodeMirror-foldgutter-open,
.CodeMirror-foldgutter-folded {
    cursor: pointer;
    color: #9ca3af !important;
    display: inline-block;
    text-align: center;
    width: 12px;
    height: 1.2em;
    line-height: 1.2em;
}

.CodeMirror-foldgutter-open:after {
    content: "▼";
    font-size: 10px;
}

.CodeMirror-foldgutter-folded:after {
    content: "▶";
    font-size: 10px;
}

.CodeMirror-foldgutter-open:hover,
.CodeMirror-foldgutter-folded:hover {
    color: #f3f4f6 !important;
}

.CodeMirror-foldmarker {
    background: #525252;
    border: 1px solid #6b7280;
    color: #d1d5db;
    cursor: pointer;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 11px;
    padding: 0 3px;
    border-radius: 3px;
    display: inline-block;
}

.CodeMirror-foldmarker:hover {
    background: #6b7280;
    border-color: #9ca3af;
}

/* Ensure fold gutter is visible and clickable */
.CodeMirror-gutters {
    background: #333333 !important;
    border-right: 1px solid #404040 !important;
}

.CodeMirror-foldgutter .CodeMirror-guttermarker-subtle {
    color: #9ca3af;
}

.result-wrapper {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#resultOutput {
    width: 100%;
    height: 100%;
    flex: 1;
    background: #262626;
    color: #e5e7eb;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.5;
    overflow: auto;
    border: none;
    margin: 0;
}

/* Additional result editor styles */
#resultOutput .CodeMirror {
    height: 100%;
    background: #262626 !important;
    color: #e5e7eb !important;
}

#resultOutput .CodeMirror-scroll {
    padding: 16px;
}

/* Status bar */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #2d2d2d;
    border-top: 1px solid #404040;
    padding: 8px 20px;
    font-size: 0.8rem;
    color: #9ca3af;
    flex-shrink: 0;
    height: 40px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    background: white;
    padding: 40px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.loading-content p {
    margin: 10px 0;
    color: #2d3748;
}

.loading-detail {
    font-size: 0.9rem;
    color: #666;
}

/* Success/Error states */
.success {
    border-left: 4px solid #48bb78;
    background-color: rgba(72, 187, 120, 0.1);
}

.error {
    border-left: 4px solid #f56565;
    background-color: rgba(245, 101, 101, 0.1);
}

/* Responsive design */
@media (max-width: 1024px) {
    .pane-container {
        flex-direction: column;
        height: auto;
    }
    
    .pane {
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
        height: 300px;
        flex: none;
    }
    
    .pane:last-child {
        border-bottom: none;
    }
    
    .resize-handle {
        display: none;
    }
    
    .header-controls {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        height: auto;
        padding: 12px;
        gap: 12px;
    }
    
    .header-left h1 {
        font-size: 1.25rem;
    }
    
    .header-controls {
        justify-content: center;
    }
    
    .status-bar {
        flex-direction: column;
        gap: 4px;
        text-align: center;
        height: auto;
        padding: 8px;
    }
    
    .pane-container {
        height: calc(100vh - 140px);
    }
}

/* Table view for results */
.result-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.result-table th,
.result-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.result-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #2d3748;
}

.result-table tr:hover {
    background: #f8fafc;
}

/* Syntax highlighting hints */
.ttp-keyword {
    color: #d73a49;
    font-weight: bold;
}

.ttp-variable {
    color: #6f42c1;
}

.ttp-comment {
    color: #6a737d;
    font-style: italic;
}

/* Hide loading overlay initially */
.loading-overlay.hidden {
    display: none;
}

/* Error marker styling for Monaco Editor */
.monaco-error-line {
    background-color: rgba(255, 68, 68, 0.1) !important;
    border-left: 3px solid #ff4444 !important;
}

.monaco-error-glyph {
    background-color: #ff4444 !important;
    color: white !important;
    border-radius: 50% !important;
    width: 16px !important;
    height: 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 10px !important;
    font-weight: bold !important;
}

/* TTP syntax highlighting styles */
.mtk1 { color: #d4d4d4; } /* Default text */
.mtk2 { color: #ce9178; } /* String */
.mtk3 { color: #b5cea8; } /* Comment */
.mtk4 { color: #569cd6; } /* Keyword */
.mtk5 { color: #4ec9b0; } /* Number */
.mtk6 { color: #dcdcaa; } /* Function */
.mtk7 { color: #9cdcfe; } /* Variable */
.mtk8 { color: #f44747; } /* Error */

/* TTP-specific token colors */
.mtk9 { color: #ff6b6b; } /* TTP template tags */
.mtk10 { color: #4ec9b0; } /* TTP group tags */
.mtk11 { color: #ffd93d; } /* TTP macro tags */
.mtk12 { color: #6bcf7f; } /* TTP doc tags */
.mtk13 { color: #ff9f43; } /* TTP variables {{ }} */
.mtk14 { color: #a8e6cf; } /* TTP functions */
.mtk15 { color: #ff8a80; } /* Python keywords in TTP */
.mtk16 { color: #b39ddb; } /* TTP comments {# #} */

/* Compact header layout */
.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

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

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

/* Dropdown styling */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    background: #4a5568;
    border: 1px solid #718096;
    color: #e2e8f0;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 80px;
    justify-content: center;
}

.dropdown-toggle:hover {
    background: #5a6578;
    border-color: #4299e1;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.dropdown-toggle::after {
    content: '▼';
    font-size: 10px;
    transition: transform 0.2s;
}

.dropdown.open .dropdown-toggle::after {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #2d3748;
    border: 1px solid #4a5568;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    min-width: 160px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    margin-top: 4px;
}

.dropdown.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    color: #e2e8f0;
    text-decoration: none;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 13px;
    text-align: left;
    transition: background-color 0.2s;
    border-bottom: 1px solid #4a5568;
}

.dropdown-item:last-child {
    border-bottom: none;
    border-radius: 0 0 6px 6px;
}

.dropdown-item:first-child {
    border-radius: 6px 6px 0 0;
}

.dropdown-item:hover {
    background: #4a5568;
    color: #ffffff;
}

.dropdown-item:active {
    background: #5a6578;
}

/* Icon button styling */
.btn-icon {
    padding: 8px;
    min-width: auto;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

/* Compact auto-process toggle */
.auto-process-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #cbd5e0;
    cursor: pointer;
}

.auto-process-toggle input[type="checkbox"] {
    margin: 0;
}

.auto-process-toggle span {
    font-weight: 500;
}

/* Notification system */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    min-width: 300px;
    max-width: 500px;
    background: #2d3748;
    border: 1px solid #4a5568;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
}

.notification-content {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 12px;
}

.notification-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.notification-message {
    flex: 1;
    color: #e2e8f0;
    font-size: 14px;
    line-height: 1.4;
}

.notification-close {
    background: none;
    border: none;
    color: #a0aec0;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.notification-close:hover {
    background-color: #4a5568;
    color: #e2e8f0;
}

.notification-success {
    border-left: 4px solid #48bb78;
}

.notification-error {
    border-left: 4px solid #f56565;
}

.notification-warning {
    border-left: 4px solid #ed8936;
}

.notification-info {
    border-left: 4px solid #4299e1;
}

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

/* Modal system */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: #2d3748;
    border: 1px solid #4a5568;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    min-width: 400px;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #4a5568;
    background: #1a202c;
}

.modal-header h3 {
    margin: 0;
    color: #e2e8f0;
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: #a0aec0;
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.modal-close:hover {
    background-color: #4a5568;
    color: #e2e8f0;
}

.modal-body {
    padding: 24px;
}

.modal-body p {
    margin: 0 0 16px 0;
    color: #cbd5e0;
    font-size: 14px;
}

.modal-body input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    background: #1a202c;
    border: 1px solid #4a5568;
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 14px;
    margin-bottom: 20px;
    transition: border-color 0.2s;
}

.modal-body input[type="text"]:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.workspace-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.workspace-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #1a202c;
    border: 1px solid #4a5568;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.workspace-item:hover {
    background: #2d3748;
    border-color: #4299e1;
}

.workspace-item.selected {
    background: #2b6cb0;
    border-color: #4299e1;
}

.workspace-item:last-child {
    margin-bottom: 0;
}

.workspace-name {
    flex: 1;
    color: #e2e8f0;
    font-size: 14px;
    font-weight: 500;
}

.workspace-date {
    color: #a0aec0;
    font-size: 12px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-actions .btn {
    min-width: 80px;
}

/* Danger button styling */
.btn-danger {
    background: #e53e3e;
    border-color: #e53e3e;
    color: white;
}

.btn-danger:hover {
    background: #c53030;
    border-color: #c53030;
}

.btn-danger:disabled {
    background: #4a5568;
    border-color: #4a5568;
    color: #a0aec0;
    cursor: not-allowed;
}

/* Large modal for inputs */
.large-modal {
    min-width: 600px;
    max-width: 800px;
}

/* Inputs configuration styling */
.inputs-container {
    margin: 20px 0;
}

.inputs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #4a5568;
}

.inputs-header h4 {
    margin: 0;
    color: #e2e8f0;
    font-size: 16px;
    font-weight: 600;
}

.inputs-list {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.input-item {
    background: #1a202c;
    border: 1px solid #4a5568;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    transition: all 0.2s;
}

.input-item:hover {
    border-color: #4299e1;
    background: #2d3748;
}

.input-item:last-child {
    margin-bottom: 0;
}

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

.input-item-name {
    font-weight: 600;
    color: #e2e8f0;
    font-size: 14px;
}

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

.input-item-actions .btn {
    padding: 4px 8px;
    font-size: 12px;
    min-width: auto;
}

.input-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.input-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.input-field label {
    font-size: 12px;
    color: #a0aec0;
    font-weight: 500;
}

.input-field input,
.input-field select {
    padding: 8px 12px;
    background: #2d3748;
    border: 1px solid #4a5568;
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 13px;
    transition: border-color 0.2s;
}

.input-field input:focus,
.input-field select:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.1);
}

.input-field.full-width {
    grid-column: 1 / -1;
}

.input-field textarea {
    padding: 8px 12px;
    background: #2d3748;
    border: 1px solid #4a5568;
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 13px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.2s;
}

.input-field textarea:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.1);
}

.input-field-help {
    font-size: 11px;
    color: #718096;
    margin-top: 2px;
}

/* Empty state */
.inputs-empty {
    text-align: center;
    padding: 40px 20px;
    color: #a0aec0;
}

.inputs-empty h5 {
    margin: 0 0 8px 0;
    color: #cbd5e0;
    font-size: 14px;
}

.inputs-empty p {
    margin: 0;
    font-size: 12px;
}

/* Packages configuration styling */
.packages-container {
    margin: 20px 0;
}

.packages-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #4a5568;
}

.packages-header h4 {
    margin: 0;
    color: #e2e8f0;
    font-size: 16px;
    font-weight: 600;
}

.packages-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.package-item {
    background: #1a202c;
    border: 1px solid #4a5568;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    transition: all 0.2s;
}

.package-item:hover {
    border-color: #4299e1;
    background: #2d3748;
}

.package-item:last-child {
    margin-bottom: 0;
}

.package-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.package-item-name {
    font-weight: 600;
    color: #e2e8f0;
    font-size: 14px;
}

.package-item-actions {
    display: flex;
    gap: 8px;
}

.package-item-actions .btn {
    padding: 4px 8px;
    font-size: 12px;
    min-width: auto;
}

.package-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.package-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.package-field label {
    font-size: 12px;
    color: #a0aec0;
    font-weight: 500;
}

.package-field input,
.package-field select {
    padding: 8px 12px;
    background: #2d3748;
    border: 1px solid #4a5568;
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 13px;
    transition: border-color 0.2s;
}

.package-field input:focus,
.package-field select:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.1);
}

.package-field.full-width {
    grid-column: 1 / -1;
}

.package-field-help {
    font-size: 11px;
    color: #718096;
    margin-top: 2px;
}

.packages-info {
    background: #1a202c;
    border: 1px solid #4a5568;
    border-radius: 8px;
    padding: 16px;
    margin-top: 20px;
}

.packages-info h5 {
    margin: 0 0 12px 0;
    color: #e2e8f0;
    font-size: 14px;
    font-weight: 600;
}

.packages-info ul {
    margin: 0;
    padding-left: 20px;
    color: #a0aec0;
}

.packages-info li {
    margin-bottom: 8px;
    font-size: 13px;
}

.packages-info code {
    background: #2d3748;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    color: #68d391;
}

.packages-requirements,
.packages-sources,
.packages-examples {
    margin-bottom: 16px;
}

.packages-requirements h6 {
    color: #f56565;
    margin: 0 0 8px 0;
    font-size: 13px;
    font-weight: 600;
}

.packages-sources h6 {
    color: #4299e1;
    margin: 0 0 8px 0;
    font-size: 13px;
    font-weight: 600;
}

.packages-examples h6 {
    color: #68d391;
    margin: 0 0 8px 0;
    font-size: 13px;
    font-weight: 600;
}

.packages-requirements ul,
.packages-sources ul,
.packages-examples ul {
    margin: 0;
    padding-left: 20px;
    color: #a0aec0;
}

.packages-requirements li,
.packages-sources li,
.packages-examples li {
    margin-bottom: 6px;
    font-size: 12px;
}

.packages-requirements li strong {
    color: #e2e8f0;
}

.packages-sources li strong {
    color: #e2e8f0;
}

.packages-examples li {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 11px;
}

/* Package validation messages */
.package-validation-message {
    font-size: 11px;
    margin-top: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.package-validation-message.error {
    background: rgba(245, 101, 101, 0.1);
    color: #f56565;
    border: 1px solid rgba(245, 101, 101, 0.3);
}

.package-validation-message.success {
    background: rgba(104, 211, 145, 0.1);
    color: #68d391;
    border: 1px solid rgba(104, 211, 145, 0.3);
}

/* Empty state for packages */
.packages-empty {
    text-align: center;
    padding: 40px 20px;
    color: #a0aec0;
}

.packages-empty h5 {
    margin: 0 0 8px 0;
    color: #cbd5e0;
    font-size: 14px;
}

.packages-empty p {
    margin: 0;
    font-size: 12px;
}

/* Package status section */
.packages-status {
    background: #1a202c;
    border: 1px solid #4a5568;
    border-radius: 8px;
    padding: 16px;
    margin: 20px 0;
}

.packages-status-info h6 {
    margin: 0 0 8px 0;
    color: #4299e1;
    font-size: 14px;
    font-weight: 600;
}

.packages-status-info p {
    margin: 0 0 12px 0;
    color: #a0aec0;
    font-size: 13px;
    line-height: 1.4;
}

.packages-status-info strong {
    color: #e2e8f0;
}

.packages-status-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.packages-status-steps .step {
    color: #cbd5e0;
    font-size: 12px;
    padding: 4px 8px;
    background: #2d3748;
    border-radius: 4px;
    border-left: 3px solid #4299e1;
}

/* Status Bar */
.status-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #2d3748;
    color: #e2e8f0;
    padding: 8px 16px;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #4a5568;
    z-index: 9999;
}

.status-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-right span {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
}

/* Package status styling */
.package-item.package-pending {
    border-left: 3px solid #a0aec0;
}

.package-item.package-installing {
    border-left: 3px solid #4299e1;
    background: rgba(66, 153, 225, 0.05);
}

.package-item.package-success {
    border-left: 3px solid #68d391;
    background: rgba(104, 211, 145, 0.05);
}

.package-item.package-error {
    border-left: 3px solid #f56565;
    background: rgba(245, 101, 101, 0.05);
}

.package-item-header .package-item-name {
    display: flex;
    align-items: center;
    gap: 8px;
}

.loading-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.package-error {
    background: rgba(245, 101, 101, 0.1);
    color: #f56565;
    padding: 8px 12px;
    border-radius: 4px;
    margin-top: 8px;
    font-size: 12px;
    border: 1px solid rgba(245, 101, 101, 0.3);
}

.package-success {
    background: rgba(104, 211, 145, 0.1);
    color: #68d391;
    padding: 8px 12px;
    border-radius: 4px;
    margin-top: 8px;
    font-size: 12px;
    border: 1px solid rgba(104, 211, 145, 0.3);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* Template pane error indicator */
.template-pane.has-error {
    border: 2px solid #ff4444;
    background-color: rgba(255, 68, 68, 0.05);
}

.template-pane.has-error .pane-header {
    background-color: rgba(255, 68, 68, 0.1);
    color: #ff6666;
}

/* Line-specific error markers */
.cm-error-line {
    background-color: rgba(255, 68, 68, 0.1) !important;
    border-left: 3px solid #ff4444 !important;
    padding-left: 5px !important;
}

.cm-error-line-number {
    background-color: rgba(255, 68, 68, 0.2) !important;
    color: #ff4444 !important;
    font-weight: bold !important;
}

.cm-error-icon {
    color: #ff4444;
    font-weight: bold;
    margin-left: 3px;
    font-size: 12px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #2d2d2d;
    margin: 5% auto;
    padding: 0;
    border: 1px solid #404040;
    border-radius: 8px;
    width: 80%;
    max-width: 800px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #404040;
    background-color: #3d3d3d;
    border-radius: 8px 8px 0 0;
}

.modal-header h2 {
    margin: 0;
    color: #e5e7eb;
    font-size: 1.5rem;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover,
.close:focus {
    color: #e5e7eb;
    text-decoration: none;
}

.modal-body {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.vars-format-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.vars-format-selector label {
    color: #e5e7eb;
    font-weight: 500;
}

.vars-editor-container {
    flex: 1;
    min-height: 300px;
    border: 1px solid #404040;
    border-radius: 4px;
    overflow: hidden;
}

.vars-editor {
    height: 100%;
    min-height: 300px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #404040;
}

/* Functions Modal Styles */
.functions-modal-content {
    max-width: 1000px;
    width: 90%;
    max-height: 85vh;
}

.functions-container {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 15px;
    max-height: 60vh;
}

.function-item {
    border: 1px solid #404040;
    border-radius: 6px;
    margin-bottom: 15px;
    background: #333333;
    overflow: hidden;
}

.function-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #3d3d3d;
    cursor: pointer;
    border-bottom: 1px solid #404040;
    transition: background-color 0.2s ease;
}

.function-header:hover {
    background: #454545;
}

.function-header.collapsed + .function-body {
    display: none;
}

.function-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #e5e7eb;
    font-weight: 500;
}

.function-collapse-icon {
    font-size: 12px;
    color: #9ca3af;
    transition: transform 0.2s ease;
}

.function-header.collapsed .function-collapse-icon {
    transform: rotate(-90deg);
}

.function-controls {
    display: flex;
    gap: 8px;
}

.function-remove-btn {
    padding: 4px 8px;
    font-size: 12px;
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.function-remove-btn:hover {
    background: #b91c1c;
}

.function-body {
    padding: 16px;
    background: #2d2d2d;
}

.function-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.function-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.function-form-group.full-width {
    grid-column: 1 / -1;
}

.function-form-group label {
    color: #e5e7eb;
    font-size: 0.875rem;
    font-weight: 500;
}

.function-form-group input,
.function-form-group select {
    padding: 8px 12px;
    border: 1px solid #525252;
    border-radius: 4px;
    background: #404040;
    color: #e5e7eb;
    font-size: 0.875rem;
}

.function-form-group input:focus,
.function-form-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px #3b82f6;
}

.function-checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.function-checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
}

.function-code-editor {
    border: 1px solid #404040;
    border-radius: 4px;
    overflow: hidden;
    min-height: 200px;
    background: #262626;
}

.add-function-btn {
    width: 100%;
    margin-bottom: 15px;
    padding: 12px;
    background: #404040;
    border: 2px dashed #525252;
    color: #9ca3af;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-function-btn:hover {
    background: #525252;
    border-color: #6b7280;
    color: #e5e7eb;
}

/* Function validation styles */
.function-form-group.error input,
.function-form-group.error select {
    border-color: #dc2626;
    box-shadow: 0 0 0 1px #dc2626;
}

.function-error-message {
    color: #fca5a5;
    font-size: 0.75rem;
    margin-top: 4px;
}

/* Lookups Modal Styles */
.lookups-modal-content {
    max-width: 1000px;
    width: 90%;
    max-height: 85vh;
}

.lookups-container {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 15px;
    max-height: 60vh;
}

.lookup-item {
    border: 1px solid #404040;
    border-radius: 6px;
    margin-bottom: 15px;
    background: #333333;
    overflow: hidden;
}

.lookup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #3d3d3d;
    cursor: pointer;
    border-bottom: 1px solid #404040;
    transition: background-color 0.2s ease;
}

.lookup-header:hover {
    background: #454545;
}

.lookup-header.collapsed + .lookup-body {
    display: none;
}

.lookup-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #e5e7eb;
    font-weight: 500;
}

.lookup-collapse-icon {
    font-size: 12px;
    color: #9ca3af;
    transition: transform 0.2s ease;
}

.lookup-header.collapsed .lookup-collapse-icon {
    transform: rotate(-90deg);
}

.lookup-controls {
    display: flex;
    gap: 8px;
}

.lookup-remove-btn {
    padding: 4px 8px;
    font-size: 12px;
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.lookup-remove-btn:hover {
    background: #b91c1c;
}

.lookup-body {
    padding: 16px;
    background: #2d2d2d;
}

.lookup-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.lookup-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lookup-form-group.full-width {
    grid-column: 1 / -1;
}

.lookup-form-group label {
    color: #e5e7eb;
    font-size: 0.875rem;
    font-weight: 500;
}

.lookup-form-group input,
.lookup-form-group select {
    padding: 8px 12px;
    border: 1px solid #525252;
    border-radius: 4px;
    background: #404040;
    color: #e5e7eb;
    font-size: 0.875rem;
}

.lookup-form-group input:focus,
.lookup-form-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px #3b82f6;
}

.lookup-data-editor {
    border: 1px solid #404040;
    border-radius: 4px;
    overflow: hidden;
    min-height: 200px;
    background: #262626;
}

.add-lookup-btn {
    width: 100%;
    margin-bottom: 15px;
    padding: 12px;
    background: #404040;
    border: 2px dashed #525252;
    color: #9ca3af;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-lookup-btn:hover {
    background: #525252;
    border-color: #6b7280;
    color: #e5e7eb;
}

/* Lookup validation styles */
.lookup-form-group.error input,
.lookup-form-group.error select {
    border-color: #dc2626;
    box-shadow: 0 0 0 1px #dc2626;
}

.lookup-error-message {
    color: #fca5a5;
    font-size: 0.75rem;
    margin-top: 4px;
}
