/* 
 * Recursion Debugger Styles
 * Step-by-step visualization for learning recursion
 */

/* Main container */
.debugger-container {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Header */
.debugger-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.debugger-header h2 {
    margin: 0;
    color: #2c3e50;
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.step-info {
    font-size: 16px;
    color: #6c757d;
    background: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.step-info span {
    font-weight: bold;
    color: #3498db;
}

.dark-mode-btn {
    padding: 8px 16px;
    border: 2px solid #6c757d;
    background: transparent;
    color: #6c757d;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.dark-mode-btn:hover {
    background: #6c757d;
    color: white;
}

/* Controls */
.debugger-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: #fff;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.debugger-controls button {
    padding: 10px 18px;
    font-size: 14px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: #3498db;
    color: white;
    transition: all 0.2s ease;
    font-weight: 500;
}

.debugger-controls button:hover:not(:disabled) {
    background: #2980b9;
    transform: translateY(-1px);
}

.debugger-controls button:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
}

.debugger-controls button:active:not(:disabled) {
    transform: translateY(0);
}

#step-slider {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    background: #e9ecef;
    border-radius: 3px;
    outline: none;
}

#step-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3498db;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.4);
}

#speed-slider {
    width: 100px;
}

.debugger-controls label {
    font-size: 13px;
    color: #6c757d;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Main layout */
.debugger-code-section {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
    margin-bottom: 20px;
}

.state-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 280px;
    max-width: 500px;
    resize: horizontal;
    overflow: auto;
}

.tree-section {
    margin-bottom: 20px;
}

/* Code Panel */
.code-panel {
    background: #1e1e1e;
    border-radius: 10px;
    overflow: hidden;
    min-height: 200px;
    resize: vertical;
}

.code-panel h3 {
    margin: 0;
    padding: 12px 16px;
    background: #2d2d2d;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
}

/* Resize handle styling */
#code-display::-webkit-resizer,
#call-stack::-webkit-resizer,
#variables-display::-webkit-resizer,
.code-panel::-webkit-resizer,
.state-panel::-webkit-resizer {
    background: linear-gradient(135deg, transparent 50%, #667eea 50%, #667eea 60%, transparent 60%, transparent 70%, #667eea 70%, #667eea 80%, transparent 80%);
    border-radius: 0 0 10px 0;
}

#code-display {
    margin: 0;
    padding: 15px 0;
    min-height: 150px;
    max-height: 600px;
    overflow-y: auto;
    font-family: 'Inconsolata', 'Fira Code', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
}

.code-line {
    display: flex;
    padding: 2px 0;
    transition: background 0.2s ease;
}

.line-number {
    width: 50px;
    padding: 0 15px;
    text-align: right;
    color: #6c6c6c;
    background: #252526;
    user-select: none;
    flex-shrink: 0;
}

.line-content {
    padding: 0 15px;
    color: #abb2bf;
    white-space: pre;
}

/* Syntax highlighting - One Dark inspired */
.syn-keyword {
    color: #c678dd;
    font-weight: 600;
}

.syn-builtin {
    color: #61afef;
}

.syn-function {
    color: #61afef;
    font-weight: 600;
}

.syn-number {
    color: #d19a66;
}

.syn-string {
    color: #98c379;
}

.syn-comment {
    color: #5c6370;
    font-style: italic;
}

.syn-operator {
    color: #56b6c2;
}

.syn-self {
    color: #e06c75;
    font-style: italic;
}

/* Line highlighting */
.code-line.current-line {
    background: rgba(255, 255, 0, 0.15);
    border-left: 3px solid #f1c40f;
}

.code-line.current-line .line-number {
    background: rgba(255, 255, 0, 0.2);
    color: #f1c40f;
}

.code-line.call-line {
    background: rgba(52, 152, 219, 0.2);
    border-left: 3px solid #3498db;
}

.code-line.call-line .line-number {
    background: rgba(52, 152, 219, 0.25);
    color: #3498db;
}

.code-line.return-line {
    background: rgba(46, 204, 113, 0.2);
    border-left: 3px solid #2ecc71;
}

.code-line.return-line .line-number {
    background: rgba(46, 204, 113, 0.25);
    color: #2ecc71;
}

.code-line.backtrack-line {
    background: rgba(231, 76, 60, 0.25);
    border-left: 3px solid #e74c3c;
    animation: backtrackFlash 0.3s ease;
}

.code-line.backtrack-line .line-number {
    background: rgba(231, 76, 60, 0.3);
    color: #e74c3c;
}

@keyframes backtrackFlash {
    0% { background: rgba(231, 76, 60, 0.5); }
    100% { background: rgba(231, 76, 60, 0.25); }
}

.call-stack-section,
.variables-section,
.stdout-section {
    flex: 1 1 auto;
    background: #fff;
    border-radius: 10px;
    overflow: visible;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    min-height: fit-content;
}

.call-stack-section h3,
.variables-section h3 {
    margin: 0;
    padding: 12px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
}

.variables-section h3 {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stdout-section h3 {
    margin: 0;
    padding: 12px 16px;
    background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
}

/* Stdout Display */
#stdout-display {
    padding: 10px;
    min-height: 60px;
    max-height: 300px;
    overflow-y: auto;
    resize: vertical;
}

.stdout-content {
    margin: 0;
    font-family: 'Inconsolata', monospace;
    font-size: 13px;
    color: #2d3436;
    white-space: pre-wrap;
    word-break: break-word;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 6px;
}

.stdout-new {
    margin-top: 8px;
    padding: 6px 10px;
    background: rgba(0, 184, 148, 0.15);
    border-left: 3px solid #00b894;
    border-radius: 4px;
    font-family: 'Inconsolata', monospace;
    font-size: 12px;
    color: #00b894;
}

.no-output {
    text-align: center;
    color: #95a5a6;
    padding: 20px;
    font-style: italic;
}

/* Call Stack */
#call-stack {
    padding: 10px;
    min-height: 80px;
    max-height: 400px;
    overflow-y: auto;
    resize: vertical;
}

.stack-frames {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stack-frame {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: #f8f9fa;
    border-radius: 8px;
    font-family: 'Inconsolata', monospace;
    font-size: 13px;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.stack-frame.current-frame {
    background: linear-gradient(135deg, #667eea22 0%, #764ba222 100%);
    border-color: #667eea;
}

.frame-depth {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #667eea;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    margin-right: 10px;
}

.current-frame .frame-depth {
    background: #764ba2;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.frame-call {
    color: #2c3e50;
}

.empty-stack {
    text-align: center;
    color: #95a5a6;
    padding: 20px;
    font-style: italic;
}

/* Variables */
#variables-display {
    padding: 10px;
    min-height: 80px;
    max-height: 400px;
    overflow-y: auto;
    resize: vertical;
}

.vars-table {
    width: 100%;
    border-collapse: collapse;
}

.vars-table th {
    text-align: left;
    padding: 8px 12px;
    background: #f8f9fa;
    color: #6c757d;
    font-size: 12px;
    text-transform: uppercase;
    border-bottom: 2px solid #e9ecef;
}

.vars-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f3f4;
    transition: background 0.3s ease;
}

.var-name {
    font-family: 'Inconsolata', monospace;
    font-weight: 600;
    color: #e74c3c;
}

.var-value {
    font-family: 'Inconsolata', monospace;
    color: #27ae60;
}

.vars-table tr.new-var td {
    background: rgba(46, 204, 113, 0.15);
    animation: fadeIn 0.3s ease;
}

.vars-table tr.changed-var td {
    background: rgba(241, 196, 15, 0.2);
    animation: highlight 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes highlight {
    0% { background: rgba(241, 196, 15, 0.5); }
    100% { background: rgba(241, 196, 15, 0.2); }
}

.no-vars {
    text-align: center;
    color: #95a5a6;
    padding: 20px;
    font-style: italic;
}

/* Explanation Panel */
.explanation-panel {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.explanation-panel h3 {
    margin: 0;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f5af19 0%, #f12711 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
}

#explanation-text {
    padding: 15px;
}

.explanation-main {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #2c3e50;
    line-height: 1.5;
}

.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.badge.recursive {
    background: #3498db22;
    color: #2980b9;
    border: 1px solid #3498db55;
}

.badge.base-case {
    background: #2ecc7122;
    color: #27ae60;
    border: 1px solid #2ecc7155;
}

.badge.return {
    background: #9b59b622;
    color: #8e44ad;
    border: 1px solid #9b59b655;
}

.badge.backtrack {
    background: #e74c3c22;
    color: #c0392b;
    border: 1px solid #e74c3c55;
    animation: backtrackPulse 0.5s ease;
}

@keyframes backtrackPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); background: #e74c3c44; }
    100% { transform: scale(1); }
}

.tip {
    background: #f8f9fa;
    border-left: 4px solid #f1c40f;
    padding: 12px 15px;
    margin-top: 10px;
    border-radius: 0 8px 8px 0;
    font-size: 14px;
    color: #5a6268;
    line-height: 1.5;
}

.tip strong {
    color: #2c3e50;
}

.global-vars {
    background: #e8f4fd;
    border-left: 4px solid #3498db;
    padding: 10px 15px;
    margin-top: 10px;
    border-radius: 0 8px 8px 0;
    font-size: 14px;
    font-family: 'Inconsolata', monospace;
}

/* Call Tree */
.tree-panel {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.tree-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: #fff;
}

.tree-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
}

.tree-hint {
    font-size: 12px;
    font-weight: 400;
    opacity: 0.85;
    margin-left: 10px;
}

.tree-fullscreen-btn {
    margin-left: auto;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 6px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.tree-fullscreen-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.tree-panel h3 {
    margin: 0;
    padding: 12px 16px;
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

#call-tree {
    padding: 25px;
    min-height: 200px;
    max-height: 800px;
    overflow: auto;
    background: #fafbfc;
    resize: vertical;
}

/* Tree panel resize handle */
#call-tree::-webkit-resizer {
    background: linear-gradient(135deg, transparent 50%, #11998e 50%, #11998e 60%, transparent 60%, transparent 70%, #11998e 70%, #11998e 80%, transparent 80%);
    border-radius: 0 0 10px 0;
}

.dark-mode #call-tree::-webkit-resizer {
    background: linear-gradient(135deg, transparent 50%, #4caf50 50%, #4caf50 60%, transparent 60%, transparent 70%, #4caf50 70%, #4caf50 80%, transparent 80%);
}

/* Tree Fullscreen Mode */
.tree-section.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background: white;
    display: flex;
    flex-direction: column;
}

.tree-section.fullscreen .tree-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-radius: 0;
}

.tree-section.fullscreen #call-tree {
    flex: 1;
    max-height: none;
    min-height: auto;
}

.dark-mode .tree-section.fullscreen {
    background: #1e2127;
}

/* Tree Structure */
.tree-root {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
}

.tree-node-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.tree-node-box {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 16px;
    background: #fff;
    border: 3px solid #e0e0e0;
    border-radius: 10px;
    font-family: 'Inconsolata', monospace;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 3px 8px rgba(0,0,0,0.08);
    margin: 8px;
    min-width: 80px;
    text-align: center;
}

.tree-node-box:hover {
    border-color: #3498db;
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.25);
    transform: translateY(-2px);
}

.tree-node-box.active {
    background: linear-gradient(135deg, #667eea22 0%, #764ba222 100%);
    border-color: #667eea;
    border-width: 3px;
    animation: nodeGlow 1.5s ease-in-out infinite;
}

.tree-node-box.current {
    background: linear-gradient(135deg, #f5af1933 0%, #f1271133 100%);
    border-color: #f5af19;
    border-width: 3px;
    box-shadow: 0 0 20px rgba(245, 175, 25, 0.5);
    transform: scale(1.08);
}

.tree-node-box.completed {
    background: linear-gradient(135deg, #2ecc7122 0%, #27ae6022 100%);
    border-color: #2ecc71;
}

@keyframes nodeGlow {
    0%, 100% { box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3); }
    50% { box-shadow: 0 5px 20px rgba(102, 126, 234, 0.5); }
}

.tree-func-name {
    font-weight: 700;
    color: #9b59b6;
    font-size: 15px;
}

.tree-args {
    color: #555;
    font-size: 13px;
}

.tree-return {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 2px dashed #ccc;
    color: #27ae60;
    font-weight: 700;
    font-size: 14px;
}

/* Children container with connecting lines */
.tree-children {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    position: relative;
    padding-top: 25px;
    gap: 15px;
}

/* Vertical line from parent to children connector */
.tree-children::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 3px;
    height: 25px;
    background: linear-gradient(to bottom, #3498db, #9b59b6);
    border-radius: 2px;
}

/* Horizontal line connecting siblings */
.tree-children > .tree-node-container {
    position: relative;
}

.tree-children > .tree-node-container::before {
    content: '';
    position: absolute;
    top: -25px;
    left: 50%;
    width: 3px;
    height: 25px;
    background: linear-gradient(to bottom, #9b59b6, #3498db);
    border-radius: 2px;
}

/* Connecting line styles for multiple children */
.tree-children > .tree-node-container:not(:only-child)::after {
    content: '';
    position: absolute;
    top: -25px;
    height: 3px;
    background: linear-gradient(to right, #3498db, #9b59b6);
    border-radius: 2px;
}

.tree-children > .tree-node-container:first-child:not(:only-child)::after {
    left: 50%;
    right: -50%;
}

.tree-children > .tree-node-container:last-child:not(:only-child)::after {
    right: 50%;
    left: -50%;
}

.tree-children > .tree-node-container:not(:first-child):not(:last-child)::after {
    left: -50%;
    right: -50%;
}

.no-calls {
    text-align: center;
    color: #95a5a6;
    padding: 40px;
    font-style: italic;
    font-size: 16px;
}

/* Responsive */
@media (max-width: 1200px) {
    .debugger-code-section {
        grid-template-columns: 1fr;
    }
    
    .state-panel {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .state-panel > div {
        flex: 1;
        min-width: 280px;
    }
}

@media (max-width: 768px) {
    .debugger-controls {
        flex-wrap: wrap;
    }
    
    .state-panel {
        flex-direction: column;
    }
    
    .state-panel > div {
        min-width: auto;
    }
    
    .debugger-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .header-right {
        flex-direction: column;
        width: 100%;
    }
}

/* Scrollbar styling */
#code-display::-webkit-scrollbar,
#call-stack::-webkit-scrollbar,
#variables-display::-webkit-scrollbar,
#call-tree::-webkit-scrollbar {
    width: 8px;
}

#code-display::-webkit-scrollbar-track,
#call-stack::-webkit-scrollbar-track,
#variables-display::-webkit-scrollbar-track,
#call-tree::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#code-display::-webkit-scrollbar-thumb,
#call-stack::-webkit-scrollbar-thumb,
#variables-display::-webkit-scrollbar-thumb,
#call-tree::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

#code-display::-webkit-scrollbar-thumb:hover,
#call-stack::-webkit-scrollbar-thumb:hover,
#variables-display::-webkit-scrollbar-thumb:hover,
#call-tree::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Dark scrollbar for code panel */
#code-display::-webkit-scrollbar-track {
    background: #2d2d2d;
}

#code-display::-webkit-scrollbar-thumb {
    background: #555;
}

#code-display::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* ==================== DARK MODE ==================== */

body.dark-mode {
    background: #1a1a2e !important;
}

.debugger-container.dark-mode {
    background: #16213e;
    color: #e4e4e4;
}

.dark-mode .debugger-header {
    border-bottom-color: #2a3f5f;
}

.dark-mode .debugger-header h2 {
    color: #e4e4e4;
}

.dark-mode .step-info {
    background: #1a1a2e;
    color: #a0a0a0;
}

.dark-mode .step-info span {
    color: #61afef;
}

.dark-mode .dark-mode-btn {
    border-color: #61afef;
    color: #61afef;
}

.dark-mode .dark-mode-btn:hover {
    background: #61afef;
    color: #1a1a2e;
}

/* Dark mode controls */
.dark-mode .debugger-controls {
    background: #1a1a2e;
}

.dark-mode .debugger-controls button {
    background: #2a3f5f;
}

.dark-mode .debugger-controls button:hover:not(:disabled) {
    background: #3a5f8f;
}

.dark-mode .debugger-controls button:disabled {
    background: #2a2a3e;
    color: #555;
}

.dark-mode .debugger-controls label {
    color: #a0a0a0;
}

.dark-mode #step-slider {
    background: #2a3f5f;
}

.dark-mode #step-slider::-webkit-slider-thumb {
    background: #61afef;
}

/* Dark mode code panel */
.dark-mode .code-panel {
    background: #282c34;
}

.dark-mode .code-panel h3 {
    background: #21252b;
}

.dark-mode .line-number {
    background: #21252b;
    color: #4b5263;
}

.dark-mode .line-content {
    color: #abb2bf;
}

/* Dark mode sections */
.dark-mode .call-stack-section,
.dark-mode .variables-section,
.dark-mode .stdout-section,
.dark-mode .explanation-panel,
.dark-mode .tree-panel {
    background: #1a1a2e;
}

/* Dark mode resize handles */
.dark-mode #code-display::-webkit-resizer,
.dark-mode #call-stack::-webkit-resizer,
.dark-mode #variables-display::-webkit-resizer,
.dark-mode .code-panel::-webkit-resizer,
.dark-mode .state-panel::-webkit-resizer {
    background: linear-gradient(135deg, transparent 50%, #61afef 50%, #61afef 60%, transparent 60%, transparent 70%, #61afef 70%, #61afef 80%, transparent 80%);
}

.dark-mode .call-stack-section h3 {
    background: linear-gradient(135deg, #4a00e0 0%, #8e2de2 100%);
}

.dark-mode .variables-section h3 {
    background: linear-gradient(135deg, #e91e63 0%, #ff5722 100%);
}

.dark-mode .stdout-section h3 {
    background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
}

.dark-mode .stdout-section {
    background: #1a1a2e;
}

.dark-mode .stdout-content {
    background: #21252b;
    color: #98c379;
}

.dark-mode .stdout-new {
    background: rgba(0, 184, 148, 0.2);
    color: #00cec9;
}

.dark-mode .no-output {
    color: #5c6370;
}

.dark-mode .explanation-panel h3 {
    background: linear-gradient(135deg, #ff9800 0%, #f44336 100%);
}

.dark-mode .tree-panel h3 {
    background: linear-gradient(135deg, #00bcd4 0%, #4caf50 100%);
}

.dark-mode .tree-header {
    background: linear-gradient(135deg, #00bcd4 0%, #4caf50 100%);
}

.dark-mode .tree-fullscreen-btn {
    background: rgba(0,0,0,0.2);
}

.dark-mode .tree-fullscreen-btn:hover {
    background: rgba(0,0,0,0.3);
}

/* Dark mode call stack */
.dark-mode .stack-frame {
    background: #2c3e50;
    color: #ecf0f1;
}

.dark-mode .stack-frame.current-frame {
    background: #3a5a8a;
    border-color: #61afef;
}

.dark-mode .frame-depth {
    background: #61afef;
    color: #1e1e1e;
}

.dark-mode .frame-call {
    color: #f1f1f1;
    font-weight: 500;
}

.dark-mode .empty-stack,
.dark-mode .no-vars,
.dark-mode .no-calls {
    color: #7f8c8d;
}

/* Dark mode variables */
.dark-mode .vars-table th {
    background: #21252b;
    color: #5c6370;
    border-bottom-color: #2a3f5f;
}

.dark-mode .vars-table td {
    border-bottom-color: #2a3f5f;
}

.dark-mode .var-name {
    color: #e06c75;
}

.dark-mode .var-value {
    color: #98c379;
}

.dark-mode .vars-table tr.new-var td {
    background: rgba(152, 195, 121, 0.15);
}

.dark-mode .vars-table tr.changed-var td {
    background: rgba(229, 192, 123, 0.2);
}

/* Dark mode explanation */
.dark-mode .explanation-main {
    color: #e4e4e4;
}

.dark-mode .tip {
    background: #21252b;
    border-left-color: #e5c07b;
    color: #abb2bf;
}

.dark-mode .tip strong {
    color: #e5c07b;
}

.dark-mode .global-vars {
    background: #21252b;
    border-left-color: #61afef;
    color: #abb2bf;
}

.dark-mode .badge.recursive {
    background: rgba(97, 175, 239, 0.2);
    color: #61afef;
    border-color: rgba(97, 175, 239, 0.4);
}

.dark-mode .badge.base-case {
    background: rgba(152, 195, 121, 0.2);
    color: #98c379;
    border-color: rgba(152, 195, 121, 0.4);
}

.dark-mode .badge.return {
    background: rgba(198, 120, 221, 0.2);
    color: #c678dd;
    border-color: rgba(198, 120, 221, 0.4);
}

.dark-mode .badge.backtrack {
    background: rgba(224, 108, 117, 0.2);
    color: #e06c75;
    border-color: rgba(224, 108, 117, 0.4);
}

/* Dark mode tree */
.dark-mode #call-tree {
    background: #21252b;
}

.dark-mode .tree-node-box {
    background: #2c3e50;
    border-color: #3a5f8f;
    border-width: 3px;
    color: #abb2bf;
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
}

.dark-mode .tree-node-box:hover {
    border-color: #61afef;
    box-shadow: 0 5px 15px rgba(97, 175, 239, 0.3);
}

.dark-mode .tree-node-box.active {
    background: rgba(142, 45, 226, 0.25);
    border-color: #8e2de2;
    border-width: 3px;
}

.dark-mode .tree-node-box.current {
    background: rgba(229, 192, 123, 0.25);
    border-color: #e5c07b;
    border-width: 3px;
    box-shadow: 0 0 25px rgba(229, 192, 123, 0.5);
}

.dark-mode .tree-node-box.completed {
    background: rgba(152, 195, 121, 0.2);
    border-color: #98c379;
}

.dark-mode .tree-func-name {
    color: #c678dd;
    font-size: 15px;
}

.dark-mode .tree-args {
    color: #abb2bf;
}

.dark-mode .tree-return {
    color: #98c379;
    border-top-color: #4a6f9f;
    border-top-width: 2px;
    font-size: 14px;
}

.dark-mode .tree-children::before,
.dark-mode .tree-children > .tree-node-container::before {
    background: linear-gradient(to bottom, #61afef, #c678dd);
}

.dark-mode .tree-children > .tree-node-container::after {
    background: linear-gradient(to right, #61afef, #c678dd);
}

.dark-mode .no-calls {
    color: #5c6370;
}

/* Dark mode line highlighting */
.dark-mode .code-line.current-line {
    background: rgba(229, 192, 123, 0.15);
    border-left-color: #e5c07b;
}

.dark-mode .code-line.current-line .line-number {
    background: rgba(229, 192, 123, 0.2);
    color: #e5c07b;
}

.dark-mode .code-line.call-line {
    background: rgba(97, 175, 239, 0.15);
    border-left-color: #61afef;
}

.dark-mode .code-line.call-line .line-number {
    background: rgba(97, 175, 239, 0.2);
    color: #61afef;
}

.dark-mode .code-line.return-line {
    background: rgba(152, 195, 121, 0.15);
    border-left-color: #98c379;
}

.dark-mode .code-line.return-line .line-number {
    background: rgba(152, 195, 121, 0.2);
    color: #98c379;
}

.dark-mode .code-line.backtrack-line {
    background: rgba(224, 108, 117, 0.2);
    border-left-color: #e06c75;
}

.dark-mode .code-line.backtrack-line .line-number {
    background: rgba(224, 108, 117, 0.25);
    color: #e06c75;
}
