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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0d1117;
    color: #c9d1d9;
    height: 100vh;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.header {
    background: linear-gradient(135deg, #1f2937, #374151);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #6366f1;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

.header h1 {
    font-size: 1.8em;
    background: linear-gradient(45deg, #6366f1, #8b5cf6, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: bold;
}

.ai-controls {
    display: flex;
    gap: 10px;
}

.ai-btn {
    background: transparent;
    border: 1px solid #00d4ff;
    color: #00d4ff;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.ai-btn:hover {
    background: #00a8cc;
    color: #1a1e2e;
    transform: translateY(-2px);
}

.editor-container {
    display: flex;
    flex: 1;
    background: #21262d;
}

.editor-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0d1117;
    z-index: 1;
    min-width: 0;
}

.splitter {
    width: 9px;
    background: #21262d;
    cursor: col-resize;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 100;
    flex-shrink: 0;
    user-select: none;
}

.splitter::before {
    content: '';
    width: 2px;
    height: 60px;
    background: #30363d;
    border-radius: 2px;
    transition: all 0.2s ease;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.splitter:hover {
    background: #30363d;
}

.splitter:hover::before {
    background: #6366f1;
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.3);
}

.splitter.dragging {
    background: #30363d;
}

.splitter.dragging::before {
    background: #6366f1;
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.5);
}

.tabs {
    display: flex;
    background: #21262d;
    border-bottom: 1px solid #30363d;
}

.tab {
    background: #21262d;
    border: none;
    color: #8b949e;
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
    font-weight: 500;
}

.tab:hover {
    background: #30363d;
    color: #c9d1d9;
}

.tab.active {
    background: #0d1117;
    color: #6366f1;
    border-bottom-color: #6366f1;
}

.editor-content {
    flex: 1;
    position: relative;
    overflow-y: auto;
    min-height: 0;
}

.code-editor {
    width: 100%;
    height: 100%;
    border: none;
    background: #0d1117;
    color: #c9d1d9;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.5;
    padding: 20px;
    resize: none;
    outline: none;
}

.code-editor.hidden {
    display: none;
}

.CodeMirror {
    height: auto !important;
    min-height: 200px !important;
    background: #0d1117 !important;
    color: #c9d1d9 !important;
    font-family: 'Fira Code', 'Consolas', monospace !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    z-index: 1 !important;
}

.CodeMirror-scroll {
    height: auto !important;
    min-height: 200px !important;
}

/* Custom Monokai theme with Dracula background */
.cm-s-monokai.CodeMirror {
    background: #21222c !important;
    color: #f8f8f2 !important;
}

.cm-s-monokai .CodeMirror-gutters {
    background: #44475a !important;
    border-right: 1px solid #6272a4 !important;
}

.cm-s-monokai .CodeMirror-guttermarker {
    color: white !important;
}

.cm-s-monokai .CodeMirror-guttermarker-subtle {
    color: #d0d0d0 !important;
}

.cm-s-monokai .CodeMirror-linenumber {
    color: white !important;
}

.cm-s-monokai .CodeMirror-cursor {
    border-left: 1px solid #f8f8f0 !important;
}

.cm-s-monokai span.cm-comment {
    color: #75715e !important;
}

.cm-s-monokai span.cm-atom {
    color: #ae81ff !important;
}

.cm-s-monokai span.cm-number {
    color: #ae81ff !important;
}

.cm-s-monokai span.cm-comment.cm-attribute {
    color: #97b757 !important;
}

.cm-s-monokai span.cm-comment.cm-def {
    color: #bc9262 !important;
}

.cm-s-monokai span.cm-comment.cm-tag {
    color: #bc6283 !important;
}

.cm-s-monokai span.cm-comment.cm-type {
    color: #5998a6 !important;
}

.cm-s-monokai span.cm-property, .cm-s-monokai span.cm-attribute {
    color: #a6e22e !important;
}

.cm-s-monokai span.cm-keyword {
    color: #f92672 !important;
}

.cm-s-monokai span.cm-builtin {
    color: #66d9ef !important;
}

.cm-s-monokai span.cm-string {
    color: #e6db74 !important;
}

.cm-s-monokai span.cm-variable {
    color: #f8f8f2 !important;
}

.cm-s-monokai span.cm-variable-2 {
    color: #9effff !important;
}

.cm-s-monokai span.cm-variable-3, .cm-s-monokai span.cm-type {
    color: #66d9ef !important;
}

.cm-s-monokai span.cm-def {
    color: #fd971f !important;
}

.cm-s-monokai span.cm-bracket {
    color: #f8f8f2 !important;
}

.cm-s-monokai span.cm-tag {
    color: #f92672 !important;
}

.cm-s-monokai span.cm-header {
    color: #ae81ff !important;
}

.cm-s-monokai span.cm-link {
    color: #ae81ff !important;
}

.cm-s-monokai span.cm-error {
    background: #f92672 !important;
    color: #f8f8f0 !important;
}

.cm-s-monokai .CodeMirror-activeline-background {
    background: #44475a !important;
}

.cm-s-monokai .CodeMirror-matchingbracket {
    text-decoration: underline !important;
    color: white !important;
}

.CodeMirror-gutters {
    background: #161b22 !important;
    border-right: 1px solid #30363d !important;
}

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

.ai-input-panel {
    background: #161b22;
    border-top: 1px solid #30363d;
    padding: 15px;
    display: flex;
    gap: 10px;
}

#aiPrompt {
    flex: 1;
    background: #21262d;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #c9d1d9;
    padding: 10px;
    font-family: inherit;
    font-size: 14px;
    resize: none;
    outline: none;
    min-height: 40px;
}

#aiPrompt:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.submit-btn {
    background: transparent;
    border: 1px solid #00ff88;
    color: #00ff88;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.submit-btn:hover {
    background: #00cc6a;
    color: #1a1e2e;
    transform: translateY(-1px);
}

.preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0d1117;
    z-index: 1;
    min-width: 0;
}

.preview-header {
    background: #161b22;
    padding: 12px 20px;
    border-bottom: 1px solid #30363d;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.preview-header h3 {
    color: #c9d1d9;
    font-size: 1.1em;
}

.refresh-btn {
    background: #21262d;
    border: 1px solid #30363d;
    color: #c9d1d9;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.refresh-btn:hover {
    background: #30363d;
    border-color: #6366f1;
}

#preview {
    flex: 1;
    border: none;
    background: white;
}

.ai-response-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    width: 80%;
    max-width: 800px;
    max-height: 70%;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.ai-response-panel.hidden {
    display: none;
}

.ai-response-header {
    background: #21262d;
    padding: 15px 20px;
    border-bottom: 1px solid #30363d;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.ai-response-header h3 {
    color: #c9d1d9;
}

.close-btn {
    background: none;
    border: none;
    color: #8b949e;
    font-size: 1.2em;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #30363d;
    color: #c9d1d9;
}

#aiResponseContent {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
    background: #0d1117;
    color: #c9d1d9;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    min-height: 200px;
    max-height: 400px;
}

.ai-actions {
    background: #161b22;
    padding: 15px 20px;
    border-top: 1px solid #30363d;
    border-radius: 0 0 8px 8px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-shrink: 0;
}

.apply-btn, .insert-btn {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.apply-btn:hover, .insert-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.insert-btn {
    background: linear-gradient(135deg, #059669, #047857);
}

.insert-btn:hover {
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.settings-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    width: 80%;
    max-width: 500px;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.settings-panel.hidden {
    display: none;
}

.settings-header {
    background: #21262d;
    padding: 15px 20px;
    border-bottom: 1px solid #30363d;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    cursor: move;
    user-select: none;
}

.settings-header h3 {
    color: #c9d1d9;
}

.settings-content {
    padding: 20px;
    background: #0d1117;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-group label {
    color: #c9d1d9;
    font-weight: 500;
    font-size: 14px;
}

.setting-group input,
.setting-group select {
    background: #21262d;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #c9d1d9;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s ease;
}

.setting-group input:focus,
.setting-group select:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.setting-group small {
    color: #8b949e;
    font-size: 12px;
}

.settings-actions {
    background: #161b22;
    padding: 15px 20px;
    border-top: 1px solid #30363d;
    border-radius: 0 0 8px 8px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-shrink: 0;
}

.save-btn {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.save-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.clear-btn {
    background: #21262d;
    border: 1px solid #30363d;
    color: #c9d1d9;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.clear-btn:hover {
    background: #30363d;
    border-color: #6366f1;
}

@media (max-width: 768px) {
    .editor-container {
        flex-direction: column;
    }
    
    .splitter {
        width: 100%;
        height: 6px;
        cursor: row-resize;
    }
    
    .splitter::before {
        width: 40px;
        height: 2px;
    }
    
    .ai-controls {
        flex-wrap: wrap;
    }
    
    .ai-btn {
        font-size: 0.8em;
        padding: 6px 12px;
    }
    
    .ai-response-panel,
    .settings-panel {
        width: 95%;
        max-height: 80%;
    }
}
    border-radius: 8px;
    width: 80%;
    max-width: 800px;
    max-height: 70%;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.ai-response-panel.hidden {
    display: none;
}

.ai-response-header {
    background: #21262d;
    padding: 15px 20px;
    border-bottom: 1px solid #30363d;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-response-header h3 {
    color: #c9d1d9;
}

.close-btn {
    background: none;
    border: none;
    color: #8b949e;
    font-size: 1.2em;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #30363d;
    color: #c9d1d9;
}

#aiResponseContent {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
    background: #0d1117;
    color: #c9d1d9;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.ai-actions {
    background: #161b22;
    padding: 15px 20px;
    border-top: 1px solid #30363d;
    border-radius: 0 0 8px 8px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.apply-btn, .insert-btn {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.apply-btn:hover, .insert-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.insert-btn {
    background: linear-gradient(135deg, #059669, #047857);
}

.insert-btn:hover {
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

@media (max-width: 768px) {
    .editor-container {
        flex-direction: column;
    }
    
    .ai-controls {
        flex-wrap: wrap;
    }
    
    .ai-btn {
        font-size: 0.8em;
        padding: 6px 12px;
    }
    
    .ai-response-panel {
        width: 95%;
        max-height: 80%;
    }
}