/* Output Pane Specifics */
.placeholder-text {
    color: #666;
    font-style: italic;
    text-align: center;
    margin-top: 50px;
}

.loading-spinner {
    color: #0077b6;
    font-weight: bold;
    text-align: center;
    margin-top: 20px;
}

/* Header Styles */
.exp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.exp-title {
    font-size: 2rem;
    font-weight: 800;
    margin: 0;
    color: #333;
}

.download-btn {
    background-color: #ef5350;
    /* Reddish like image */
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 6px rgba(239, 83, 80, 0.3);
    transition: transform 0.1s, background-color 0.2s;
}

.download-btn:hover {
    background-color: #e53935;
    transform: translateY(-1px);
}

.download-btn:active {
    transform: translateY(1px);
}


.output-text {
    margin-bottom: 5px;
    line-height: 1.4;
}

.output-success {
    color: #89a0ed;
    font-weight: bold;
    margin-top: 5px;
}

/* Scoped style for code box to keep variables/comments black */
.code-box .output-success {
    color: #333;
    font-weight: normal;
}

.output-header {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 10px;
    color: #000;
}

/* Syntax Highlighting (Simulated) */
.kw {
    color: #d63384;
    font-weight: bold;
}

/* Keywords like import, def */
.func {
    color: #0077b6;
}

/* Functions like print */

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    background: white;
    font-size: 0.8rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.data-table th,
.data-table td {
    padding: 8px 5px;
    border: 1px solid #dee2e6;
    text-align: center;
    vertical-align: middle;
    white-space: normal;
    overflow-wrap: break-word;
    /* Wraps at word boundaries */
    word-break: normal;
    /* Prevents mid-word breaking */
}

.data-table th {
    background-color: #f8f9fa;
    font-weight: 700;
}

.stats-table th {
    background-color: #e9ecef;
}

/* Interactive Plot Container */
.interactive-plot-container {
    background: white;
    padding: 15px;
    border-radius: 10px;
    margin-top: 10px;
}

.dropdown-label {
    font-weight: bold;
    margin-bottom: 5px;
    display: block;
}

select {
    padding: 5px;
    border-radius: 5px;
    border: 1px solid #ccc;
    font-family: inherit;
    margin-bottom: 15px;
    width: 180px;
}

/* Global Styles */
/* Global Styles */
.hidden {
    display: none !important;
}

.full-height {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

body {
    margin: 0;
    padding: 0;
    /* Reset global padding */
    font-family: 'Outfit', sans-serif;
    background-color: #ffffff;
    color: #333;
    min-height: 100vh;
    height: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
}

.container {
    width: 98%;
    max-width: 1600px;
    height: auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-layout {
    display: flex;
    height: auto;
    gap: 5px;
}

/* Sidebar Styles */
.sidebar {
    width: 250px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 10px 15px;
    margin-right: 5px;
}

.main-layout .sidebar {
    position: sticky;
    top: 7px;
    margin-top: 7px;
    /* Specific top gap for steps */
    align-self: flex-start;
}

.sidebar-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    position: relative;
    padding-left: 0;
    width: fit-content;
    /* Ensure it wraps the content for right alignment */
}

.sidebar-title {
    font-size: 1.8rem;
    font-weight: 800;
    margin: 0;
    padding-left: 30px;
    padding-right: 30px;
    /* Identical gaps for both triangles */
    text-transform: uppercase;
    position: relative;
    /* Anchor for pseudo-element */
}

/* Bottom-Right Corner Triangle */
.sidebar-header::after {
    content: '';
    position: absolute;
    bottom: 5px;
    right: 0;
    width: 0;
    height: 0;
    border-bottom: 22px solid #000;
    border-left: 22px solid transparent;
}

/* Decorative corner triangle for "STEPS" label */
.corner-triangle-top-left {
    position: absolute;
    top: 5px;
    left: 0;
    width: 0;
    height: 0;
    border-top: 22px solid #000;
    border-right: 22px solid transparent;
}

.steps-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.step-btn {
    appearance: none;
    border: none;
    background-color: #f57c2a;
    /* Orange - default for unlocked/not completed */
    color: white;
    padding: 14px 15px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    /* Align text left for list look */
    transition: transform 0.1s ease, background-color 0.2s;
    box-shadow: 0 4px 6px rgba(255, 107, 107, 0.2);
    position: relative;
}

.step-btn:hover {
    background-color: #ff6b6b;
    transform: translateY(-2px);
}

.step-btn.active {
    background-color: #5fa8e4;
    transform: scale(1.02);
    box-shadow: 0 6px 12px rgba(95, 168, 228, 0.3);
    border: 2px solid #fff;
    outline: 2px solid #333;
}

.step-btn.disabled {
    background-color: #e0e0e0;
    color: #a0a0a0;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.step-btn.completed {
    background-color: #A6CE63;
    box-shadow: 0 4px 6px rgba(166, 206, 99, 0.3);
}

.step-btn.in-progress {
    background-color: #f57c2a;
    /* Orange - for not completed yet */
    box-shadow: 0 4px 6px rgba(245, 124, 42, 0.3);
    color: #fff;
}

/* Content Area Styles */
.content-area {
    margin-top: 7px;
    /* Specific top gap for comment section */
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 10px;
    padding-bottom: 50px;
    height: auto;
    overflow-y: visible;
}

/* Removed hiding rule */

.pane {
    position: relative;
    width: 100%;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
}

/* Top Pane (Code) */
.top-pane {
    flex: 0 0 auto;
    /* Stop it from growing/shrinking unexpectedly */
}

.code-box-container {
    /* Fixed height for top pane to allow bottom pane to expand */
    position: relative;
    background-color: white;
    border: 2px solid #5994d3;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    height: 32vh;
    /* Fixed smaller height */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.code-header-bar {
    background-color: #94cefb;
    /* Swapped: Light Blue */
    color: #1d3557;
    /* Darker text for contrast */
    padding: 12px 20px;
    font-size: 0.95rem;
    font-weight: 500;
    border-bottom: 2px solid #5994d3;
    /* Matching container border */
    min-height: 45px;
    box-sizing: border-box;
    display: none;
    /* Hidden by default, shown when comment exists */
}

.code-box {
    width: 100%;
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    align-items: flex-start;
    padding: 20px;
    padding-right: 85px;
    box-sizing: border-box;
}

.code-box pre {
    margin: 0;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 1rem;
    color: #333;
    white-space: pre-wrap;
    width: 100%;
}

.run-button {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    background-color: #F57C2A;
    /* Orange-ish default */
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: white;
    box-shadow: 0 4px 10px rgba(247, 160, 114, 0.4);
    transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s;
    z-index: 10;
}

.run-button:hover {
    background-color: #f63c3c;
    transform: translateY(-50%) scale(1.1);
}

.run-button:active {
    transform: translateY(-50%) scale(0.95);
}

.run-button.completed {
    background-color: #A6CE63;
    /* Green */
}

/* Bottom Pane (Output) */
.bottom-pane {
    background-color: #f0f0f0;
    margin-top: 10px;
    /* Small buffer */
    /* Default Grey */
    border-radius: 30px;
    border: 2px solid #545151;
    padding: 20px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow-y: visible;
    overflow-x: auto;
    /* Allow X scrolling for wide tables locally */
    box-sizing: border-box;
    transition: background-color 0.5s ease;
    min-height: 62vh;
    height: auto;
    margin-bottom: 20px;
}

/* Active Output State */
.bottom-pane.active-output {
    background-color: #d6e1f0;
    border: 3px solid #78ad1c;
}

.output-content {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.95rem;
    color: #1d3557;
    /* white-space: pre-wrap; */
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .main-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 10px;
    }

    .steps-container {
        flex-direction: row;
    }

    .step-btn {
        min-width: 150px;
    }
}

/* Interactive Simulator Styles - User Provided */
.simulation-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    background-color: #0f111a;
    display: flex;
    flex-direction: column;
    font-family: 'Outfit', sans-serif;
    color: #ffffff;

    --bg-dark: #f0f7ff;
    /* Very light blue background */
    --bg-panel: #f8fbff;
    /* Soft light blue/white for panels */
    --sidebar-bg: #eff6ff;
    /* Light blue sidebar */
    --primary-color: #2563eb;
    /* High Contrast Blue */
    --secondary-color: #4f46e5;
    /* Indigo 600 */
    --accent-color: #db2777;
    /* Pink 600 */
    --text-main: #0f172a;
    /* Slate 900 - Sharp text */
    --text-muted: #475569;
    /* Slate 600 - Readable muted text */
    --border-color: #e2e8f0;
    /* Slate 200 - Clean borders */
    --font-main: 'Outfit', sans-serif;
}

.simulation-page * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.simulation-page .app-container {
    display: flex;
    height: 100%;
}

/* Sidebar */
.simulation-page .sidebar {
    width: 350px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    z-index: 10;
    overflow-y: auto;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.02);
}

.simulation-page .logo-area h1 {
    font-size: 1.6rem;
    font-weight: 700;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.simulation-page .logo-area p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Back Button Integration */
.back-to-exp-integrated {
    background: #1e293b;
    /* Solid dark for high contrast */
    border: none;
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    /* Full width in sidebar */
    margin-bottom: 5px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.back-to-exp-integrated:hover {
    background: #0f172a;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

/* Education Panel */
.simulation-page .education-panel {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 4px solid var(--accent-color);
    margin-top: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    min-height: 250px;
    /* Stabilize layout */
    display: flex;
    flex-direction: column;
}

.simulation-page .education-panel h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--accent-color);
}

.simulation-page .guide-text {
    flex: 1;
    overflow-y: auto;
    max-height: 200px;
}

.simulation-page .guide-text p {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 0.8rem;
    color: #334155;
    /* Slate 700 - Better readability */
    font-weight: 500;
}

.simulation-page .guide-text strong {
    color: #0f172a;
    /* Slate 900 - Sharp emphasis */
    font-weight: 700;
}

.simulation-page .guide-text ul {
    padding-left: 1.2rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

/* Controls */
.simulation-page .control-group label {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
    /* Slate 800 */
    margin-bottom: 0.8rem;
}

.simulation-page .control-group h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 5px;
}

.simulation-page .hint {
    font-size: 0.8rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    font-style: italic;
}

.simulation-page input[type="range"] {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 5px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.simulation-page input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Buttons */
.simulation-page .btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-family: var(--font-main);
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
}

.simulation-page .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #333 !important;
    color: #666;
}

.simulation-page .btn.primary {
    background: var(--primary-color);
    color: #000;
}

.simulation-page .btn.secondary {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.simulation-page .btn.secondary:hover:not(:disabled) {
    background: rgba(76, 201, 240, 0.1);
}

.simulation-page .btn.accent {
    background: var(--secondary-color);
    color: #fff;
}

.simulation-page .btn.accent:hover:not(:disabled) {
    box-shadow: 0 0 15px var(--secondary-color);
}

.simulation-page .btn.danger {
    background: rgba(255, 50, 50, 0.1);
    color: #ff5555;
    border: 1px solid #ff5555;
    margin-top: 10px;
}

.simulation-page .btn.danger:hover {
    background: #ff5555;
    color: #fff;
}

.simulation-page .button-row {
    display: flex;
    gap: 10px;
}

/* Workspace */
.simulation-page .workspace {
    flex: 1;
    position: relative;
    background: #f0f7ff;
    display: flex;
    flex-direction: column;
}

/* Tabs */
.simulation-page .tab-header {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 25px;
    background: #f1f5f9;
    padding: 6px;
    border-radius: 50px;
    border: 1px solid var(--border-color);
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.simulation-page .tab-btn {
    background: transparent;
    border: none;
    padding: 10px 28px;
    border-radius: 40px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.simulation-page .tab-btn:hover {
    color: var(--text-main);
}

.simulation-page .tab-btn.active {
    background: var(--primary-color);
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.simulation-page .control-btn {
    padding: 12px 16px;
    border-radius: 10px;
    border: 2px solid var(--primary-color);
    background: transparent;
    color: var(--primary-color);
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
}

.simulation-page .control-btn:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.simulation-page .control-btn.primary-btn {
    background: var(--primary-color);
    color: white;
}

/* Specific Button Colors */
#btnPrev,
#btnStep {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white !important;
}

#btnPrev:hover:not(:disabled),
#btnStep:hover:not(:disabled) {
    background-color: #4338ca;
    /* Darker Indigo */
    border-color: #4338ca;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

#btnAuto {
    background-color: #f59e0b;
    /* Amber/Orange */
    border-color: #f59e0b;
    color: white !important;
}

#btnAuto:hover:not(:disabled) {
    background-color: #d97706;
    /* Darker Orange */
    border-color: #d97706;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.simulation-page .control-btn:disabled {
    background-color: #f1f5f9 !important;
    border-color: #e2e8f0 !important;
    color: #94a3b8 !important;
    cursor: not-allowed;
    box-shadow: none !important;
}

.simulation-page .chart-container {
    position: relative;
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    padding: 20px;
    min-height: 0;
}

.simulation-page .chart-title {
    text-align: center;
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 10px;
    font-weight: 400;
    letter-spacing: 1px;
    flex-shrink: 0;
}

.simulation-page canvas {
    flex: 1;
    width: 100%;
    min-height: 300px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    cursor: crosshair;
}

/* Tooltip */
.simulation-page .tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    pointer-events: none;
    z-index: 100;
    white-space: nowrap;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.simulation-page .tooltip.hidden {
    display: none;
}

/* Status */
.simulation-page .status-panel {
    margin-top: auto;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.simulation-page .metrics {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.simulation-page .metric .value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.simulation-page .legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 5px;
}

.simulation-page .legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.simulation-page .legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.simulation-page .toggle-switch {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 12px;
    margin-bottom: 20px;
    width: 100%;
}

.simulation-page .toggle-switch input {
    display: none;
}

.simulation-page .toggle-switch .slider {
    position: relative;
    display: block;
    width: 44px;
    height: 22px;
    background-color: #cbd5e1;
    /* Slate 300 */
    border-radius: 20px;
    transition: all 0.3s ease;
    flex-shrink: 0;
    /* Prevent shrinking */
}

.simulation-page .toggle-switch .slider:before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: #ffffff;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.simulation-page .toggle-switch input:checked+.slider {
    background-color: var(--primary-color);
}

.simulation-page .toggle-switch input:checked+.slider:before {
    transform: translateX(20px);
    background-color: #fff;
}

.simulation-page .toggle-switch .label-text {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Enter Animation Button - Output Pane */
.btn-enter-animation {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background-color: #1a2a3a;
    color: #ffffff !important;
    padding: 16px 32px;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(26, 42, 58, 0.3);
    margin: 20px auto;
}

.btn-enter-animation:hover {
    background-color: #2c3e50;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(26, 42, 58, 0.4);
}

.btn-enter-animation svg {
    width: 20px;
    height: 20px;
}

.experiment-completed-banner {
    text-align: center;
    padding: 30px;
    background-color: #eef2f7;
    border-radius: 15px;
    margin-top: 20px;
}

.experiment-completed-banner h2 {
    color: #429d93;
    font-size: 2.2rem;
    font-family: 'Courier New', Courier, monospace;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.experiment-completed-banner p {
    color: #64748b;
    font-size: 1.1rem;
    margin-bottom: 25px;
}

.clap-emoji {
    display: inline-block;
    font-size: 3rem;
    animation: clapShake 0.6s ease-in-out infinite;
}

.clap-emoji:nth-child(2) {
    animation-delay: 0.15s;
}

.clap-emoji:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes clapShake {
    0%, 100% { transform: rotate(0deg); }
    15% { transform: rotate(15deg); }
    30% { transform: rotate(-10deg); }
    45% { transform: rotate(10deg); }
    60% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}