/* Python Runner Styles */

/* Python Runner + Tutorial Layout */
.python-layout {
    display: grid;
    grid-template-columns: minmax(250px, 15%) minmax(600px, 45%) 1fr;
    gap: 0;
    margin: 0 auto;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    height: calc(100vh - 120px);
    max-height: calc(100vh - 120px);
}

body.dark .python-layout {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* Tutorial Sidebar */
.tutorial-sidebar {
    background: var(--bg-alt);
    border-right: 1px solid var(--border);
    overflow-y: auto;
}

.tutorial-header {
    padding: 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.tutorial-header h2 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--text);
}

.tutorial-list {
    padding: 10px;
}

.tutorial-item {
    padding: 12px 16px;
    margin-bottom: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: block;
    color: var(--text);
}

.tutorial-item:hover {
    background: var(--bg-alt);
    border-color: #667eea;
}

.tutorial-item.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.tutorial-item-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.tutorial-item-desc {
    font-size: 12px;
    opacity: 0.8;
}

.tutorial-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    margin-top: 4px;
}

.tutorial-badge.beginner { background: #4ade80; color: white; }
.tutorial-badge.intermediate { background: #fbbf24; color: #1f2937; }
.tutorial-badge.advanced { background: #ef4444; color: white; }

/* Tutorial Content */
.tutorial-content {
    padding: 20px;
    overflow-y: auto;
    background: var(--bg);
    border-right: 1px solid var(--border);
}

.tutorial-content h1 {
    font-size: 22px;
    margin-bottom: 15px;
    color: var(--text);
}

.tutorial-content h2 {
    font-size: 18px;
    margin-top: 20px;
    margin-bottom: 12px;
    color: var(--text);
}

.tutorial-content h3 {
    font-size: 16px;
    margin-top: 15px;
    margin-bottom: 8px;
    color: var(--text);
}

.tutorial-content p {
    margin-bottom: 12px;
    line-height: 1.6;
    color: var(--text-muted);
    font-size: 14px;
}

.tutorial-content ul, .tutorial-content ol {
    margin-left: 20px;
    margin-bottom: 12px;
    color: var(--text-muted);
    font-size: 14px;
}

.tutorial-content li {
    margin-bottom: 6px;
    line-height: 1.5;
}

.tutorial-content code {
    background: var(--bg-alt);
    padding: 2px 5px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #d63384;
}

body.dark .tutorial-content code {
    color: #f48fb1;
}

.tutorial-content pre {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 15px;
    overflow-x: auto;
    position: relative;
}

.tutorial-content pre code {
    background: none;
    padding: 0;
    color: var(--text);
    display: block;
    line-height: 1.5;
}

.code-block-wrapper {
    position: relative;
    margin-bottom: 15px;
}

.export-code-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #667eea;
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    opacity: 0.9;
    transition: opacity 0.2s;
    z-index: 10;
}

.export-code-btn:hover {
    opacity: 1;
}

.tutorial-content strong {
    font-weight: 600;
    color: var(--text);
}

.tutorial-content blockquote {
    border-left: 3px solid #667eea;
    padding-left: 15px;
    margin: 15px 0;
    color: var(--text-muted);
    font-style: italic;
}

/* Code Editor Panel */
.code-panel {
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

.code-header {
    padding: 15px 20px;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.code-header h2 {
    font-size: 16px;
    color: var(--text);
    margin: 0;
}

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

.code-actions button {
    padding: 6px 12px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.code-actions button:hover {
    background: var(--bg-alt);
    border-color: #667eea;
}

.code-actions button.primary {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.code-actions button.primary:hover {
    background: #5568d3;
}

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

#code-editor {
    flex: 1;
    padding: 15px;
    border: none;
    background: var(--bg);
    color: var(--text);
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    outline: none;
}

#output {
    flex: 1;
    padding: 15px;
    background: #1e1e1e;
    color: #d4d4d4;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    overflow-y: auto;
    white-space: pre-wrap;
    border-top: 1px solid var(--border);
}

body.dark #output {
    background: #0d1117;
    color: #c9d1d9;
}

#output .error {
    color: #ff6b6b;
}

#output .success {
    color: #51cf66;
}

/* Responsive design */
@media (max-width: 1200px) {
    .python-layout {
        grid-template-columns: 1fr;
    }

    .tutorial-sidebar,
    .code-panel {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
}
