/* ============================================================
   SwapxLearn – Playground Styles
   ============================================================ */

.playground-page {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: calc(100vh - var(--nav-height));
    overflow: hidden;
}

/* ── Editor Panel ───────────────────────────────────── */
.editor-panel {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    background: var(--bg-surface);
}

.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-base);
    flex-shrink: 0;
}

.editor-toolbar .editor-title {
    font-weight: 700;
    font-size: 0.9rem;
    margin-right: auto;
}

.lang-tabs {
    display: flex;
    gap: 4px;
}

.lang-tab {
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    transition: all var(--transition);
    font-family: 'Fira Code', monospace;
}

.lang-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.editor-area {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.code-editor {
    width: 100%;
    height: 100%;
    background: #0d1117;
    color: #c9d1d9;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.7;
    padding: 20px;
    border: none;
    outline: none;
    resize: none;
    tab-size: 2;
}

.editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-base);
    flex-shrink: 0;
}

.editor-status {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-family: 'Fira Code', monospace;
}

.editor-actions {
    display: flex;
    gap: 10px;
}

.btn-run {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    background: linear-gradient(135deg, var(--accent-green), #2adb00);
    color: #000;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    font-family: 'Inter', sans-serif;
    box-shadow: 0 0 15px rgba(57, 255, 20, 0.3);
}

.btn-run:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(57, 255, 20, 0.5);
}

.btn-reset {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: 'Inter', sans-serif;
}

.btn-reset:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

/* ── Preview Panel ──────────────────────────────────── */
.preview-panel {
    display: flex;
    flex-direction: column;
    background: #fff;
}

.preview-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid #ddd;
    background: #f8f8f8;
    flex-shrink: 0;
}

.preview-dots span {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 4px;
}

.preview-dots span:nth-child(1) {
    background: #ff5f57;
}

.preview-dots span:nth-child(2) {
    background: #ffbd2e;
}

.preview-dots span:nth-child(3) {
    background: #28ca41;
}

.preview-url {
    flex: 1;
    background: #e8e8e8;
    border-radius: var(--radius-sm);
    padding: 4px 12px;
    font-size: 0.78rem;
    font-family: 'Fira Code', monospace;
    color: #555;
}

.preview-iframe {
    flex: 1;
    border: none;
    width: 100%;
    background: #fff;
}

/* ── Exercise Sidebar ───────────────────────────────── */
.exercises-sidebar {
    display: none;
    position: fixed;
    right: 0;
    top: var(--nav-height);
    width: 280px;
    height: calc(100vh - var(--nav-height));
    background: var(--bg-surface);
    border-left: 1px solid var(--border);
    padding: 20px;
    overflow-y: auto;
    z-index: 100;
}

.exercises-sidebar.open {
    display: block;
}

.exercises-sidebar h3 {
    font-size: 1rem;
    margin-bottom: 16px;
}

.ex-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
    cursor: pointer;
    margin-bottom: 10px;
    transition: all var(--transition);
}

.ex-card:hover {
    border-color: var(--primary);
    background: rgba(79, 142, 247, 0.06);
}

.ex-card .ex-title {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.ex-card .ex-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

/* ── Playground top bar ─────────────────────────────── */
.playground-top {
    padding: 12px 5%;
    background: var(--bg-base);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.playground-top h2 {
    font-size: 1rem;
}

.playground-top p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 768px) {
    .playground-page {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
        height: auto;
        min-height: calc(100vh - var(--nav-height));
    }

    .editor-panel {
        min-height: 50vh;
    }

    .preview-panel {
        min-height: 40vh;
    }
}