/* Base styles */
.live-code-editor-container {
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    margin: 20px 0;
    background: #2d2d2d;
}

/* Editor tabs */
.editor-tabs {
    display: flex;
    background: #252526;
    border-bottom: 1px solid #1e1e1e;
}

.tab-button {
    padding: 10px 20px;
    background: none;
    border: none;
    color: #d4d4d4;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    outline: none;
}

.tab-button:hover {
    background: #2a2d2e;
    color: #ffffff;
}

.tab-button.active {
    color: #ffffff;
    background: #1e1e1e;
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: #007acc;
}

/* Editor content area */
.editor-content {
    position: relative;
    height: 400px;
}

.code-editor {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    height: 100%;
}

.code-editor.active {
    display: block;
}

.code-preview {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    background: white;
    overflow: auto;
}

.code-preview.active {
    display: block;
}

.code-preview iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

/* CodeMirror overrides */
.CodeMirror {
    height: 100% !important;
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    line-height: 1.5;
}

/* Responsive styles */
@media (max-width: 768px) {
    .live-code-editor-container {
        border-radius: 0;
    }
    
    .editor-tabs {
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .tab-button {
        padding: 10px 15px;
        font-size: 13px;
    }
    
    .editor-content {
        height: 300px;
    }
}

/* Theme-specific styles */
.live-code-editor-container.theme-default {
    --editor-bg: #2d2d2d;
    --editor-tabs-bg: #252526;
    --editor-tabs-active-bg: #1e1e1e;
    --editor-tabs-color: #d4d4d4;
    --editor-tabs-active-color: #ffffff;
    --editor-tabs-indicator: #007acc;
}

.live-code-editor-container.theme-dracula {
    --editor-bg: #282a36;
    --editor-tabs-bg: #191a21;
    --editor-tabs-active-bg: #282a36;
    --editor-tabs-color: #f8f8f2;
    --editor-tabs-active-color: #ff79c6;
    --editor-tabs-indicator: #ff79c6;
}

.live-code-editor-container.theme-material {
    --editor-bg: #263238;
    --editor-tabs-bg: #1e272c;
    --editor-tabs-active-bg: #263238;
    --editor-tabs-color: #b0bec5;
    --editor-tabs-active-color: #ffffff;
    --editor-tabs-indicator: #80cbc4;
}

.live-code-editor-container.theme-monokai {
    --editor-bg: #272822;
    --editor-tabs-bg: #1e1f1c;
    --editor-tabs-active-bg: #272822;
    --editor-tabs-color: #f8f8f2;
    --editor-tabs-active-color: #a6e22e;
    --editor-tabs-indicator: #a6e22e;
}

.live-code-editor-container.theme-solarized {
    --editor-bg: #002b36;
    --editor-tabs-bg: #073642;
    --editor-tabs-active-bg: #002b36;
    --editor-tabs-color: #93a1a1;
    --editor-tabs-active-color: #b58900;
    --editor-tabs-indicator: #b58900;
}

/* Apply theme variables */
.live-code-editor-container {
    background: var(--editor-bg);
}

.editor-tabs {
    background: var(--editor-tabs-bg);
}

.tab-button {
    color: var(--editor-tabs-color);
}

.tab-button:hover {
    color: var(--editor-tabs-active-color);
}

.tab-button.active {
    color: var(--editor-tabs-active-color);
    background: var(--editor-tabs-active-bg);
}

.tab-button.active::after {
    background: var(--editor-tabs-indicator);
}