/**
 * JPA Lecture — Frontend Styles
 *
 * Layout: Split panel (left: lesson/interview/video, right: tabbed IDE)
 * Theme:  Dark (GitHub Dark / VS Code inspired)
 * Matches DSA Problem Lab styling for visual consistency.
 */

/* ════════════════════════════════════════════════════════════════
   RESET & CONTAINER
   ════════════════════════════════════════════════════════════════ */

.jpa-lecture-container {
    font-family: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    color: #c9d1d9;
    background: #0d1117;
    overflow-x: hidden;
    border: none;
    margin: 0;
    line-height: 1.6;
    min-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    width: 100% !important;
    max-width: 100% !important;
}

.jpa-lecture-container *,
.jpa-lecture-container *::before,
.jpa-lecture-container *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ════════════════════════════════════════════════════════════════
   MAIN TAB NAVIGATION — Learn / Interview / Video
   ════════════════════════════════════════════════════════════════ */

.jpa-tabs {
    display: flex;
    align-items: center;
    background: #161b22;
    padding: 0 12px;
    gap: 4px;
    height: 42px;
    border-bottom: 1px solid #30363d;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 50;
}

.jpa-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px;
    height: 32px;
    background: none !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    -webkit-appearance: none;
    color: #8b949e;
    font-size: 13px;
    font-weight: 500;
    font-family: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    line-height: 1;
    border-radius: 6px;
}

.jpa-tab:hover,
.jpa-tab:focus,
.jpa-tab:active,
.jpa-tab:focus-visible {
    color: #e6edf3;
    background: rgba(255,255,255,0.06) !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.jpa-tab.active,
.jpa-tab.active:hover,
.jpa-tab.active:focus {
    color: #fff;
    background: #1f6feb !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    border-radius: 6px;
}

/* Active indicator underline — removed, using fill background instead */
.jpa-tab.active::after {
    display: none;
}

/* Remove pipe dividers — cleaner look */
.jpa-tab + .jpa-tab::before {
    display: none;
}

/* Tab icons */
.jpa-tab-icon {
    display: inline-flex;
    align-items: center;
    font-size: 13px;
    flex-shrink: 0;
    line-height: 1;
}

/* Badge on interview tab showing question count or ✓ */
.jpa-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 2px;
    border-radius: 9px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
}

.jpa-tab-badge-count {
    background: rgba(139, 148, 158, 0.3);
    color: #c9d1d9;
}

/* Badge inside active tab — white on translucent white */
.jpa-tab.active .jpa-tab-badge-count {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.jpa-tab-badge-done {
    background: rgba(46, 160, 67, 0.2);
    color: #2ea043;
}

.jpa-tab.active .jpa-tab-badge-done {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* ════════════════════════════════════════════════════════════════
   SPLIT PANEL — Left (lesson) + Divider + Right (IDE)
   ════════════════════════════════════════════════════════════════ */

.jpa-split {
    display: flex;
    flex: 1;
    height: calc(100vh - 120px);
    max-height: calc(100vh - 120px);
    overflow: hidden;
    position: relative;
    padding: 8px;
    gap: 8px;
    background: #0d1117;
}

/* ── Left panel: Lesson content (card style, matches right) ── */

.jpa-left {
    width: 40%;
    min-width: 25%;
    max-width: 75%;
    display: flex;
    flex-direction: column;
    background: #161b22;
    overflow: hidden;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.08);
    border-top: 1px solid rgba(255,255,255,0.12);
    box-shadow:
            0 1px 2px rgba(0,0,0,0.3),
            0 4px 12px rgba(0,0,0,0.25),
            0 12px 28px rgba(0,0,0,0.2);
}

.jpa-left-content {
    flex: 1;
    padding: 24px 28px 120px 28px;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.4);
}

.jpa-left-content::-webkit-scrollbar { width: 6px; }
.jpa-left-content::-webkit-scrollbar-track { background: #161b22; }
.jpa-left-content::-webkit-scrollbar-thumb { background: #30363d; border-radius: 3px; }
.jpa-left-content::-webkit-scrollbar-thumb:hover { background: #484f58; }

/* Override GitHub Markdown CSS background to match left panel card */
.jpa-left-content .markdown-body {
    background-color: #161b22 !important;
}

/* ── Draggable divider between panels ── */

.jpa-divider {
    width: 4px;
    background: transparent;
    cursor: col-resize;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
    margin: 0 -2px;
}

.jpa-divider:hover,
.jpa-divider.dragging {
    background: #58a6ff;
    border-radius: 2px;
}

/* ── Right panel: Tabbed IDE (LeetCode card style) ── */

.jpa-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #1e1e1e;
    min-width: 25%;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.08);
    border-top: 1px solid rgba(255,255,255,0.12);
    box-shadow:
            0 1px 2px rgba(0,0,0,0.3),
            0 4px 12px rgba(0,0,0,0.25),
            0 12px 28px rgba(0,0,0,0.2);
}

/* ════════════════════════════════════════════════════════════════
   LESSON CONTENT — Markdown rendered HTML
   Reuses DSA learn-content styling for visual consistency.
   ════════════════════════════════════════════════════════════════ */

.jpa-lesson h1,
.jpa-lesson h2,
.jpa-lesson h3,
.jpa-lesson h4 {
    margin-top: 24px;
    margin-bottom: 12px;
    font-family: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.3;
    color: #c3d0e5;
}

.jpa-lesson h1 { font-size: 22px; font-weight: 700; color: #569cd6; padding-bottom: 8px; border-bottom: 1px solid #30363d; }
.jpa-lesson h2 { font-size: 17px; font-weight: 600; padding-bottom: 6px; border-bottom: 1px solid #30363d; }
.jpa-lesson h3 { font-size: 17px; font-weight: 600; }
.jpa-lesson h4 { font-size: 17px; font-weight: 600; }

.jpa-lesson p {
    margin-bottom: 16px;
    color: #c9d1d9;
    font-family: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.jpa-lesson a {
    color: #58a6ff;
    text-decoration: none;
}

.jpa-lesson a:hover {
    text-decoration: underline;
}

.jpa-lesson strong {
    color: #e6edf3;
    font-weight: 600;
}

.jpa-lesson em {
    color: #c9d1d9;
    font-style: italic;
}

.jpa-lesson ul,
.jpa-lesson ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.jpa-lesson li {
    margin-bottom: 6px;
    font-family: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Inline code */
.jpa-lesson code {
    background: #161b22;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'SF Mono', 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    font-weight: 600;
    color: #79c0ff;
    border: 1px solid #30363d;
}

/* Reference code blocks (non-runnable) */
.jpa-lesson pre {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 16px;
    overflow-x: auto;
}

.jpa-lesson pre code {
    background: transparent;
    padding: 0;
    border: none;
    border-radius: 0;
    color: #c9d1d9;
    font-size: 13px;
    line-height: 1.5;
}

.jpa-lesson blockquote {
    border-left: 3px solid #58a6ff;
    padding: 8px 16px;
    margin: 0 0 16px 0;
    background: rgba(88, 166, 255, 0.05);
    color: #8b949e;
}

.jpa-lesson table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}

.jpa-lesson th,
.jpa-lesson td {
    border: 1px solid #30363d;
    padding: 8px 12px;
    text-align: left;
}

.jpa-lesson th {
    background: #161b22;
    font-weight: 600;
    color: #e6edf3;
}

.jpa-lesson hr {
    border: none;
    border-top: 1px solid #30363d;
    margin: 24px 0;
}

/* ════════════════════════════════════════════════════════════════
   RUNNABLE CODE BLOCKS — Hover overlay to load in editor
   ════════════════════════════════════════════════════════════════ */

.jpa-runnable-block {
    position: relative;
    margin-bottom: 16px;
    border-radius: 6px;
    overflow: hidden;
}

/* The code display inside the runnable block */
.jpa-runnable-block pre {
    margin-bottom: 0;
}

/* Hover overlay */
.jpa-runnable-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(13, 17, 23, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s ease;
    cursor: pointer;
    border-radius: 6px;
}

.jpa-runnable-block:hover .jpa-runnable-overlay {
    opacity: 1;
}

.jpa-runnable-overlay-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #2cbb5d;
    color: #fff;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    pointer-events: none;
}

/* Currently-loaded indicator */
.jpa-runnable-block.active {
    outline: 2px solid #58a6ff;
    outline-offset: -2px;
}

.jpa-runnable-block.active .jpa-runnable-overlay {
    display: none;
}

.jpa-runnable-block.active::after {
    content: '✓ Loaded in Editor';
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(88, 166, 255, 0.2);
    color: #58a6ff;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

/* ════════════════════════════════════════════════════════════════
   REFERENCE CODE BLOCKS — [code name="..."] styled, no overlay
   ════════════════════════════════════════════════════════════════ */

.jpa-code-block {
    position: relative;
    margin-bottom: 16px;
}

.jpa-code-block-name {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #21262d;
    color: #8b949e;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-family: 'SF Mono', 'Consolas', 'Courier New', monospace;
}

/* ════════════════════════════════════════════════════════════════
   RIGHT PANEL — File tabs (IDE)
   ════════════════════════════════════════════════════════════════ */

.jpa-file-tabs {
    display: flex;
    align-items: center;
    background: #262626;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    height: 40px;
    min-height: 40px;
    flex-shrink: 0;
    overflow-x: auto;
    gap: 0;
    padding: 0 8px;
    border-radius: 10px 10px 0 0;
}

.jpa-file-tabs::-webkit-scrollbar { height: 0; }

.jpa-file-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px;
    height: 32px;
    background: none !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    -webkit-appearance: none;
    color: #8b949e;
    font-size: 13px;
    font-weight: 500;
    font-family: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    border-radius: 6px;
    margin: 0 2px;
}

.jpa-file-tab:hover {
    color: #c9d1d9;
    background: rgba(255,255,255,0.06) !important;
}

.jpa-file-tab.active {
    color: #e6edf3;
    background: rgba(255,255,255,0.1) !important;
}

/* Active tab underline */
.jpa-file-tab.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 4px;
    right: 4px;
    height: 2px;
    background: #58a6ff;
    border-radius: 1px;
}

/* Lock icon for read-only tabs */
.jpa-lock-icon {
    width: 12px;
    height: 12px;
    opacity: 0.5;
    margin-right: 4px;
    flex-shrink: 0;
}

/* Reset button in file tab bar */
.jpa-reset-btn {
    margin-left: 4px;
    color: #8b949e !important;
    gap: 4px;
}

.jpa-reset-btn:hover,
.jpa-reset-btn:focus {
    color: #ffa198 !important;
}

.jpa-reset-icon {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

/* Status bar — Java Sandbox indicator */
.jpa-ide-status {
    display: flex;
    align-items: center;
    margin-left: auto;
    gap: 8px;
    padding: 0 14px;
    font-size: 12px;
    color: #8b949e;
    height: 36px;
}

.jpa-status-dot {
    width: 8px;
    height: 8px;
    background: #2ea043;
    border-radius: 50%;
    animation: jpaPulse 2s infinite;
}

@keyframes jpaPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ════════════════════════════════════════════════════════════════
   MONACO EDITOR WRAPPER
   ════════════════════════════════════════════════════════════════ */

.jpa-editor-wrapper {
    height: 400px;
    min-height: 150px;
    flex-shrink: 0;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.4);
}

/* ════════════════════════════════════════════════════════════════
   CONTROLS — Run button toolbar
   ════════════════════════════════════════════════════════════════ */

.jpa-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 8px 12px;
    background: #262626;
    border-top: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 -1px 4px rgba(0,0,0,0.15);
    flex-shrink: 0;
    justify-content: flex-end;
}

.jpa-controls .jpa-timer {
    margin-right: auto;
    font-family: 'SF Mono', 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    color: #8b949e;
}

/* Kill all hover/focus effects on control buttons */
.jpa-controls button {
    outline: none !important;
    box-shadow: none !important;
    transform: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

.jpa-controls button:hover,
.jpa-controls button:focus,
.jpa-controls button:active,
.jpa-controls button:focus-visible {
    outline: none !important;
    box-shadow: none !important;
    transform: none !important;
}

/* ════════════════════════════════════════════════════════════════
   TERMINAL — Output area with resize handle
   ════════════════════════════════════════════════════════════════ */

.jpa-terminal-resize-handle {
    height: 4px;
    background: #262626;
    border-top: 1px solid rgba(255,255,255,0.06);
    cursor: ns-resize;
    flex-shrink: 0;
    position: relative;
}

.jpa-terminal-resize-handle::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 2px;
    background: #484f58;
    border-radius: 1px;
}

.jpa-terminal-resize-handle:hover {
    background: #333;
}

.jpa-terminal-resize-handle:hover::after {
    background: #8b949e;
}

.jpa-terminal {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.jpa-terminal-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 12px;
    background: #262626;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    font-size: 13px;
    color: #8b949e;
    flex-shrink: 0;
}

.jpa-terminal-header span:first-child {
    font-weight: 600;
    color: #e6edf3;
    position: relative;
    padding-bottom: 6px;
}

.jpa-terminal-header span:first-child::after {
    content: '';
    position: absolute;
    bottom: -9px;
    left: 0;
    right: 0;
    height: 2px;
    background: #58a6ff;
    border-radius: 1px;
}

.jpa-terminal-output {
    flex: 1;
    padding: 12px 16px;
    font-family: 'SF Mono', 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #c9d1d9;
    overflow-y: auto;
    white-space: pre-wrap;
    background: #1e1e1e;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.4);
}

.jpa-terminal-output::-webkit-scrollbar { width: 6px; }
.jpa-terminal-output::-webkit-scrollbar-track { background: #1e1e1e; }
.jpa-terminal-output::-webkit-scrollbar-thumb { background: #444; border-radius: 3px; }

.jpa-terminal-prompt { color: #56d364; font-weight: 500; }
.jpa-terminal-error { color: #ffa198; }
.jpa-terminal-success { color: #7ee787; }
.jpa-terminal-compiling { color: #8b949e; font-style: italic; }

.jpa-terminal-spin {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #484f58;
    border-top-color: #58a6ff;
    border-radius: 50%;
    animation: jpaSpinRotate 0.8s linear infinite;
    vertical-align: middle;
}

@keyframes jpaSpinRotate {
    to { transform: rotate(360deg); }
}

/* ════════════════════════════════════════════════════════════════
   VIDEO TAB — Responsive player in left panel
   ════════════════════════════════════════════════════════════════ */

.jpa-video-wrapper {
    padding: 20px;
}

.jpa-video-title {
    font-size: 16px;
    font-weight: 600;
    color: #e6edf3;
    margin-bottom: 16px;
}

.jpa-video-player {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: #161b22;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #30363d;
}

.jpa-video-player iframe,
.jpa-video-player video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* ════════════════════════════════════════════════════════════════
   INTERVIEW TAB — Reuses DSA interview styling
   ════════════════════════════════════════════════════════════════ */

.jpa-interview-panel {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
}

.jpa-interview-panel::-webkit-scrollbar { width: 6px; }
.jpa-interview-panel::-webkit-scrollbar-track { background: #161b22; }
.jpa-interview-panel::-webkit-scrollbar-thumb { background: #30363d; border-radius: 3px; }

/* Progress bar */
.jpa-iq-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.jpa-iq-progress-bar {
    flex: 1;
    height: 4px;
    background: #21262d;
    border-radius: 2px;
    overflow: hidden;
}

.jpa-iq-progress-fill {
    height: 100%;
    background: #58a6ff;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.jpa-iq-progress-text {
    font-size: 13px;
    color: #8b949e;
    white-space: nowrap;
}

/* Question */
.jpa-iq-question {
    font-size: 16px;
    font-weight: 500;
    color: #e6edf3;
    margin-bottom: 20px;
    line-height: 1.5;
}

/* Answer options */
.jpa-iq-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.jpa-iq-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    color: #c9d1d9;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
    width: 100%;
    font-family: inherit;
}

.jpa-iq-option:hover {
    background: #1c2129;
    border-color: #58a6ff;
}

.jpa-iq-option.selected {
    border-color: #58a6ff;
    background: rgba(88, 166, 255, 0.08);
}

.jpa-iq-option.correct {
    border-color: #2ea043;
    background: rgba(46, 160, 67, 0.1);
    color: #7ee787;
}

.jpa-iq-option.incorrect {
    border-color: #f85149;
    background: rgba(248, 81, 73, 0.1);
    color: #ffa198;
}

.jpa-iq-option.disabled {
    cursor: default;
    opacity: 0.7;
}

.jpa-iq-option-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    background: #21262d;
    border: 1px solid #30363d;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

/* Explanation */
.jpa-iq-explanation {
    padding: 14px 16px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
    animation: jpaFadeIn 0.3s ease;
}

.jpa-iq-explanation-correct {
    background: rgba(46, 160, 67, 0.1);
    border: 1px solid rgba(46, 160, 67, 0.3);
    color: #7ee787;
}

.jpa-iq-explanation-incorrect {
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid rgba(248, 81, 73, 0.3);
    color: #ffa198;
}

/* Controls */
.jpa-iq-controls {
    display: flex;
    gap: 8px;
}

/* Complete screen */
.jpa-iq-complete {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

.jpa-iq-complete-icon { font-size: 48px; margin-bottom: 16px; }
.jpa-iq-complete-title { font-size: 20px; font-weight: 600; color: #e6edf3; margin-bottom: 8px; }
.jpa-iq-complete-subtitle { font-size: 14px; color: #8b949e; margin-bottom: 24px; }

/* ════════════════════════════════════════════════════════════════
   SHARED BUTTONS
   ════════════════════════════════════════════════════════════════ */

.jpa-btn {
    padding: 6px 16px;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1;
    white-space: nowrap;
    outline: none !important;
    box-shadow: none !important;
    -webkit-appearance: none !important;
    transition: background 0.15s ease;
}

.jpa-btn:hover,
.jpa-btn:focus,
.jpa-btn:active,
.jpa-btn:focus-visible {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

.jpa-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.jpa-btn-primary {
    background: #2cbb5d;
    color: #fff;
}

.jpa-btn-primary:hover,
.jpa-btn-primary:focus,
.jpa-btn-primary:active,
.jpa-btn-primary:focus-visible {
    background: #2cbb5d !important;
    color: #fff !important;
    opacity: 0.9;
}

.jpa-btn-secondary {
    background: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d !important;
}

.jpa-btn-secondary:hover,
.jpa-btn-secondary:focus,
.jpa-btn-secondary:active,
.jpa-btn-secondary:focus-visible {
    background: #292e36 !important;
    color: #e6edf3 !important;
    border: 1px solid #30363d !important;
}

.jpa-btn-blue {
    background: #1f6feb;
    color: #fff;
}

.jpa-btn-blue:hover,
.jpa-btn-blue:focus,
.jpa-btn-blue:active,
.jpa-btn-blue:focus-visible {
    background: #1f6feb !important;
    color: #fff !important;
    opacity: 0.9;
}

/* Play icon (SVG replaces emoji to avoid WordPress emoji conversion) */
.jpa-play-icon {
    width: 14px;
    height: 14px;
    vertical-align: middle;
    flex-shrink: 0;
}

.jpa-runnable-overlay-btn .jpa-play-icon {
    width: 16px;
    height: 16px;
}

/* Spinner */
.jpa-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: jpaSpin 0.6s linear infinite;
}

@keyframes jpaSpin {
    to { transform: rotate(360deg); }
}

@keyframes jpaFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ════════════════════════════════════════════════════════════════
   KEYBOARD SHORTCUTS BAR
   ════════════════════════════════════════════════════════════════ */

.jpa-keyboard-bar {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 8px 16px;
    background: #161b22;
    border-top: 1px solid #30363d;
    font-size: 11px;
    color: #484f58;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.jpa-keyboard-bar kbd {
    background: #21262d;
    border: 1px solid #30363d;
    border-radius: 3px;
    padding: 1px 6px;
    font-family: 'SF Mono', 'Consolas', 'Courier New', monospace;
    font-size: 10px;
    color: #8b949e;
}

/* ════════════════════════════════════════════════════════════════
   LAB PANEL — Steps, check button, test results
   ════════════════════════════════════════════════════════════════ */

.jpa-lab-panel {
    padding: 0;
}

.jpa-lab-intro {
    margin-bottom: 24px;
}

/* Step list */
.jpa-lab-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.jpa-lab-step {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #30363d;
    border-radius: 8px;
    overflow: hidden;
}

.jpa-lab-step-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid #30363d;
}

.jpa-lab-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #1f6feb;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.jpa-lab-step-title {
    font-size: 15px;
    font-weight: 600;
    color: #e6edf3;
}

.jpa-lab-step-content {
    padding: 16px;
}

.jpa-lab-step-content p {
    margin-bottom: 12px;
    color: #c9d1d9;
}

.jpa-lab-step-content p:last-child {
    margin-bottom: 0;
}

/* ════════════════════════════════════════════════════════════════
   EMPTY STATE
   ════════════════════════════════════════════════════════════════ */

.jpa-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #484f58;
    font-size: 14px;
    text-align: center;
    padding: 40px;
}

/* ════════════════════════════════════════════════════════════════
   INTERVIEW — Markdown-aware overrides
   Questions and explanations render through marked.js and use
   the jpa-lesson class for inline code, code blocks, bold, etc.
   ════════════════════════════════════════════════════════════════ */

/* Question — markdown rendered */
.jpa-iq-question.jpa-lesson {
    margin-bottom: 20px;
}

.jpa-iq-question.jpa-lesson p {
    font-size: 16px;
    font-weight: 500;
    color: #e6edf3;
    line-height: 1.5;
}

.jpa-iq-question.jpa-lesson p:last-child {
    margin-bottom: 0;
}

.jpa-iq-question.jpa-lesson pre {
    margin-top: 12px;
}

/* Multi-select hint */
.jpa-iq-multi-hint {
    font-size: 13px;
    color: #8b949e;
    font-style: italic;
    margin-bottom: 16px;
    margin-top: -12px;
}

/* Inline code inside answer options */
.jpa-iq-option code {
    background: rgba(0, 0, 0, 0.3);
    padding: 1px 6px;
    border-radius: 3px;
    font-family: 'SF Mono', 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    color: inherit;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Explanation body — markdown rendered */
.jpa-iq-explanation-body.jpa-lesson p {
    margin-bottom: 8px;
    color: inherit;
}

.jpa-iq-explanation-body.jpa-lesson p:last-child {
    margin-bottom: 0;
}

.jpa-iq-explanation-body.jpa-lesson code {
    color: inherit;
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.2);
}

.jpa-iq-explanation-body.jpa-lesson strong {
    color: inherit;
}
/* ═══════════════════════════════════════════════════════════════
   IDE DISABLED STATE (Interview Prep tab)
   ═══════════════════════════════════════════════════════════════ */

.jpa-ide-disabled {
    position: relative;
}

.jpa-ide-disabled .jpa-file-tabs,
.jpa-ide-disabled .jpa-editor-wrapper,
.jpa-ide-disabled .jpa-controls,
.jpa-ide-disabled .jpa-terminal,
.jpa-ide-disabled .jpa-terminal-resize-handle,
.jpa-ide-disabled .jpa-empty {
    filter: blur(3px);
    opacity: 0.3;
    pointer-events: none;
    user-select: none;
}

.jpa-ide-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 17, 23, 0.4);
    border-radius: 8px;
}

.jpa-ide-overlay-text {
    font-family: 'Work Sans', sans-serif;
    font-size: 15px;
    font-weight: 500;
    color: #8b949e;
    background: rgba(22, 27, 34, 0.9);
    padding: 12px 24px;
    border-radius: 8px;
    border: 1px solid #30363d;
    letter-spacing: 0.01em;
}

/* ════════════════════════════════════════════════════════════════
   MOBILE PANEL TOGGLE — Visible only on small screens.
   Switches between Lesson (left) and Code Editor (right).
   Injected by template JS; styled here for consistency.
   ════════════════════════════════════════════════════════════════ */

.jpa-mobile-toggle {
    display: none;
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE — Tablet (≤ 1024px)
   Slightly tighter spacing, narrower defaults.
   ════════════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
    .jpa-left-content {
        padding: 20px 20px 100px 20px;
    }

    .jpa-interview-panel {
        padding: 20px;
    }

    .jpa-lesson h1 { font-size: 20px; }
    .jpa-lesson h2 { font-size: 16px; }
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile (≤ 768px)
   Stack panels vertically. Show one at a time via toggle.
   ════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

    /* ── Mobile toggle bar ── */

    .jpa-mobile-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        gap: 4px;
        background: #161b22;
        padding: 6px 8px;
        border-bottom: 1px solid #30363d;
        flex-shrink: 0;
        position: sticky;
        top: 42px;
        z-index: 49;
    }

    .jpa-mobile-toggle-btn {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 8px 12px;
        background: none;
        border: 1px solid transparent;
        border-radius: 6px;
        color: #8b949e;
        font-family: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
        font-size: 13px;
        font-weight: 500;
        cursor: pointer;
        outline: none;
        -webkit-appearance: none;
        -webkit-tap-highlight-color: transparent;
        transition: background 0.15s, color 0.15s, border-color 0.15s;
    }

    .jpa-mobile-toggle-btn:hover,
    .jpa-mobile-toggle-btn:focus {
        outline: none;
        box-shadow: none;
    }

    .jpa-mobile-toggle-btn.active {
        background: #21262d;
        color: #e6edf3;
        border-color: #30363d;
    }

    .jpa-mobile-toggle-icon {
        font-size: 14px;
        line-height: 1;
        flex-shrink: 0;
    }

    /* ── Split layout becomes vertical, show one panel at a time ── */

    .jpa-split {
        flex-direction: column;
        height: auto !important;
        max-height: none !important;
        padding: 0;
        gap: 0;
    }

    .jpa-left {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        border-radius: 0;
        border: none;
        border-bottom: 1px solid #30363d;
        box-shadow: none;
        /* Default: visible when lesson panel is active */
        min-height: calc(100vh - 135px);
        max-height: calc(100vh - 135px);
        overflow-y: auto;
    }

    .jpa-left-content {
        padding: 16px 16px 100px 16px;
    }

    .jpa-right {
        width: 100% !important;
        min-width: 100% !important;
        border-radius: 0;
        border: none;
        box-shadow: none;
        min-height: calc(100vh - 135px);
        max-height: calc(100vh - 135px);
        overflow: hidden;
    }

    /* Panel visibility toggled by JS-added classes */
    .jpa-split.mobile-show-lesson .jpa-left {
        display: flex;
    }
    .jpa-split.mobile-show-lesson .jpa-right {
        display: none;
    }
    .jpa-split.mobile-show-ide .jpa-left {
        display: none;
    }
    .jpa-split.mobile-show-ide .jpa-right {
        display: flex;
    }

    /* ── Hide divider on mobile ── */

    .jpa-divider {
        display: none !important;
    }

    /* ── Hide keyboard shortcuts bar on mobile (touch devices) ── */

    .jpa-keyboard-bar {
        display: none !important;
    }

    /* ── Tabs: horizontal scroll if overflow ── */

    .jpa-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0 8px;
        gap: 2px;
    }

    .jpa-tabs::-webkit-scrollbar {
        display: none;
    }

    .jpa-tab {
        padding: 0 10px;
        font-size: 12px;
        height: 30px;
        flex-shrink: 0;
    }

    .jpa-tab-icon {
        font-size: 12px;
    }

    .jpa-tab-badge {
        min-width: 16px;
        height: 16px;
        font-size: 9px;
        padding: 0 4px;
    }

    /* ── Editor adjustments ── */

    .jpa-editor-wrapper {
        height: 250px !important;
        min-height: 150px !important;
    }

    .jpa-file-tabs {
        padding: 0 6px;
        height: 36px;
        min-height: 36px;
    }

    .jpa-file-tab {
        padding: 0 10px;
        height: 28px;
        font-size: 12px;
    }

    .jpa-ide-status {
        font-size: 11px;
        padding: 0 8px;
    }

    .jpa-controls {
        padding: 6px 10px;
    }

    /* ── Terminal ── */

    .jpa-terminal-output {
        padding: 10px 12px;
        font-size: 12px;
        min-height: 80px;
    }

    .jpa-terminal-header {
        padding: 6px 10px;
        font-size: 12px;
    }

    /* ── Lesson content ── */

    .jpa-lesson h1 { font-size: 18px; }
    .jpa-lesson h2 { font-size: 15px; }
    .jpa-lesson h3 { font-size: 14px; }
    .jpa-lesson h4 { font-size: 14px; }
    .jpa-lesson p { font-size: 14px; }
    .jpa-lesson li { font-size: 14px; }

    .jpa-lesson pre {
        padding: 12px;
        font-size: 12px;
    }

    .jpa-lesson pre code {
        font-size: 12px;
    }

    .jpa-lesson code {
        font-size: 12px;
        padding: 1px 5px;
    }

    .jpa-lesson table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .jpa-lesson th,
    .jpa-lesson td {
        padding: 6px 8px;
        font-size: 12px;
        white-space: nowrap;
    }

    .jpa-lesson blockquote {
        padding: 6px 12px;
        font-size: 13px;
    }

    /* ── Runnable blocks ── */

    .jpa-runnable-overlay {
        opacity: 1;
        background: rgba(13, 17, 23, 0.5);
    }

    .jpa-runnable-overlay-btn {
        font-size: 12px;
        padding: 8px 14px;
    }

    .jpa-runnable-block.active::after {
        font-size: 10px;
        padding: 2px 8px;
        top: 6px;
        right: 6px;
    }

    /* ── Code block name badge ── */

    .jpa-code-block-name {
        font-size: 10px;
        padding: 1px 6px;
        top: 6px;
        right: 6px;
    }

    /* ── Interview panel ── */

    .jpa-interview-panel {
        padding: 16px;
    }

    .jpa-iq-question.jpa-lesson p {
        font-size: 14px;
    }

    .jpa-iq-option {
        padding: 12px 14px;
        font-size: 13px;
        gap: 10px;
    }

    .jpa-iq-option-key {
        width: 22px;
        height: 22px;
        font-size: 11px;
    }

    .jpa-iq-explanation {
        padding: 12px 14px;
        font-size: 13px;
    }

    .jpa-iq-complete {
        padding: 32px 16px;
    }

    .jpa-iq-complete-title {
        font-size: 18px;
    }

    /* ── Lab panel ── */

    .jpa-lab-step-header {
        padding: 10px 14px;
        gap: 10px;
    }

    .jpa-lab-step-num {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }

    .jpa-lab-step-title {
        font-size: 14px;
    }

    .jpa-lab-step-content {
        padding: 12px 14px;
    }

    /* ── Video ── */

    .jpa-video-wrapper {
        padding: 16px;
    }

    .jpa-video-title {
        font-size: 15px;
        margin-bottom: 12px;
    }

    /* ── Buttons ── */

    .jpa-btn {
        padding: 8px 14px;
        font-size: 13px;
    }
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE — Small Mobile (≤ 480px)
   Even tighter for very small devices.
   ════════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {

    .jpa-left {
        min-height: calc(100vh - 130px);
        max-height: calc(100vh - 130px);
    }

    .jpa-right {
        min-height: calc(100vh - 130px);
        max-height: calc(100vh - 130px);
    }

    .jpa-left-content {
        padding: 12px 12px 80px 12px;
    }

    .jpa-editor-wrapper {
        height: 200px !important;
        min-height: 120px !important;
    }

    .jpa-lesson h1 { font-size: 16px; }

    .jpa-tab {
        padding: 0 8px;
        font-size: 11px;
    }

    .jpa-mobile-toggle-btn {
        padding: 6px 8px;
        font-size: 12px;
    }

    .jpa-interview-panel {
        padding: 12px;
    }

    .jpa-iq-option {
        padding: 10px 12px;
        font-size: 12px;
    }
}