/* Problem Mode Layout */
.problem-layout {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 1.5rem;
    height: calc(100vh - 100px);
    /* Adjust for navbar */
    overflow: hidden;
}

/* Left Panel */
.problem-desc {
    background: var(--bg-panel);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1.5rem;
    overflow-y: auto;
    color: var(--text-main);
}

.problem-desc h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.difficulty-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.difficulty-badge.easy {
    background: rgba(0, 255, 157, 0.15);
    color: var(--success);
}

.difficulty-badge.medium {
    background: rgba(255, 189, 46, 0.15);
    color: #ffbd2e;
}

.difficulty-badge.hard {
    background: rgba(255, 77, 77, 0.15);
    color: var(--error);
}

.markdown-content h2 {
    font-size: 1.4rem;
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
    color: var(--text-main);
}

.markdown-content h3 {
    font-size: 1.1rem;
    margin-top: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.markdown-content p {
    margin-bottom: 1rem;
    line-height: 1.6;
    color: var(--text-muted);
}

body.dark-theme .markdown-content p {
    color: #ccc;
}

.markdown-content code {
    background: rgba(120, 120, 120, 0.1);
    color: var(--accent);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: var(--code-font);
    font-size: 0.9em;
}

body.dark-theme .markdown-content code {
    color: var(--primary);
}

.markdown-content pre {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-main);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1rem;
}

body.dark-theme .markdown-content pre {
    background: rgba(0, 0, 0, 0.3);
}

.markdown-content pre code {
    background: transparent;
    padding: 0;
}

/* Right Panel */
.work-area {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
    /* Flexbox overflow fix */
}

.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.tab-btn {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-family: var(--body-font);
    transition: all 0.2s;
}

body.light-theme .tab-btn {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.tab-btn.active {
    background: var(--bg-panel);
    border-bottom: none;
    /* Blend with panel */
    color: var(--primary);
    font-weight: 600;
}

body.light-theme .tab-btn.active {
    background: #ffffff;
}

.tab-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
}

.problem-typing-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    /* Manually duplicated styles from .typing-container */
    margin: 0;
    max-width: none;
    border-radius: 0 12px 12px 12px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    position: relative;
    text-align: left;
    background: var(--bg-panel);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.problem-code-window {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    background: rgba(10, 10, 15, 0.8);
    font-family: var(--code-font);
    font-size: 1rem;
    border-radius: 0 0 12px 12px;
}

@media (max-width: 900px) {
    .problem-layout {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }

    .problem-desc {
        max-height: 400px;
    }

    .work-area {
        height: 600px;
    }
}