/* ==========================================
   STANDARD LAB STYLES (Copied from Logistic Regression)
   ========================================== */

/* 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:disabled {
    background-color: #ccc !important;
    color: white !important;
    cursor: not-allowed;
    box-shadow: none;
}

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

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


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

.output-success {
    color: #6686ec;
    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 */
body {
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
    background-color: #ffffff;
    color: #333;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    width: 98%;
    max-width: 1600px;
    height: 98vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.main-layout {
    display: flex;
    height: 100%;
    width: 100%;
    overflow: hidden;
    gap: 5px;
}

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

.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: #5FA8E4;
    /* Pastel Blue - default for unlocked */
    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 {
    transform: scale(1.02);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    border: 2px solid #fff;
    outline: 2px solid #333;
    /* Darker outline for active step */
    z-index: 5;
}

.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 */
    box-shadow: 0 4px 6px rgba(245, 124, 42, 0.3);
    color: #fff;
}

/* Content Area Styles */
.content-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 10px;
    padding-bottom: 50px;
    height: 100%;
    width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
}

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

/* 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;
    /* Light Blue */
    color: #1d3557;
    /* Darker text for contrast */
    padding: 12px 20px;
    font-size: 0.95rem;
    font-weight: 500;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    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;
    border-radius: 30px;
    border: 2px solid #545151;
    padding: 20px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05);
    position: relative;
    box-sizing: border-box;
    transition: background-color 0.5s ease;
    
    /* Dynamic Height Logic */
    min-height: 62vh;
    height: auto;
    width: 100%;
    overflow-y: visible;
    overflow-x: hidden;
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
}

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

.bottom-pane.completed-output {
    border-color: #78ad1c;
    background-color: #f1f8e9; /* Light green background when successfully completed */
}

.run-button.arrow-mode {
    background-color: #5FA8E4; /* Blue for 'Next' */
}

.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;
    }
}

/* ==========================================
   DECISION TREES SPECIFIC STYLES (Copied but likely unused in KNN, keeping for safety)
   ========================================== */

/* CLASSIFICATION SELECTOR (Landing) */
.classification-selector {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff; /* Clean white background */
    z-index: 2000;
    position: fixed;
    top: 0;
    left: 0;
}

.selector-container {
    text-align: center;
    max-width: 800px;
    padding: 3rem;
}

.selector-container h1 {
    font-size: 3rem;
    font-weight: 800;
    color: #000;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.selector-container p {
    font-size: 1.25rem;
    color: #666;
    margin-bottom: 4rem;
}

.selector-buttons {
    display: flex;
    gap: 2rem;
    justify-content: center;
}

.selector-btn {
    flex: 1;
    padding: 3rem 2rem;
    background: #ffffff;
    border: 2px solid #eee;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.selector-btn:hover {
    border-color: #ff6b6b;
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(255, 107, 107, 0.15);
}

.selector-btn h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 1rem;
}

.selector-btn p {
    font-size: 1rem;
    color: #888;
    margin: 0;
    margin-bottom: 0;
}

/* Training Section Wrapper (to match layout) */
.training-section {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Animation Entry Button Style (adapted to fit new theme) */
.animation-entry-btn {
    padding: 15px 30px;
    font-size: 1.25rem;
    background-color: #4cd964;
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    box-shadow: 0 10px 20px rgba(76, 217, 100, 0.3);
    transition: all 0.3s;
    font-family: 'Outfit', sans-serif;
    margin-top: 20px;
}
.animation-entry-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(76, 217, 100, 0.4);
}

/* ==========================================
   ANIMATION SECTION (Tree Viz)
   ========================================== */
.animation-section {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #fff;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
}

.app-header {
    padding: 15px 30px;
    border-bottom: 1px solid #eee;
    background: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
}

.header-left h1 { font-size: 1.5rem; font-weight: 700; }
.header-left p { color: #888; font-size: 0.9rem; }

.header-controls {
    background: #f8f9fa;
    padding: 8px 20px;
    border-radius: 12px;
    border: 1px solid #eee;
    display: flex;
    gap: 20px;
}

.control-section label {
    font-size: 0.7rem;
    font-weight: 700;
    color: #aaa;
    text-transform: uppercase;
    margin-bottom: 4px;
    display: block;
}

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

.button-group {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    font-size: 0; /* Remove inline-block spacing */
}
.depth-btn, .criterion-btn {
    padding: 6px 12px;
    border: none;
    border-right: 1px solid #ddd;
    background: white;
    cursor: pointer;
    color: #666;
    font-weight: 500;
    font-family: 'Outfit', sans-serif;
    font-size: 0.875rem; /* Restore font size */
}
.depth-btn:last-child, .criterion-btn:last-child { border-right: none; }
.depth-btn.active, .criterion-btn.active {
    background: #ff6b6b;
    color: white;
}

/* Samples */
.sample-btn {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: white;
    color: #666;
    font-weight: 600;
    cursor: pointer;
    margin-right: 5px;
    font-family: 'Outfit', sans-serif;
}
.sample-btn.active {
    background: #ff6b6b;
    color: white;
    border-color: #ff6b6b;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Feature Sidebar */
.feature-sidebar {
    width: 450px;
    border-right: 1px solid #eee;
    padding: 20px;
    background: #fff;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
}
.feature-sidebar h3 {
    margin-bottom: 20px;
    font-size: 1.1rem;
    color: #333;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.indicator {
    display: inline-block;
    width: 6px;
    height: 24px;
    background: #ff6b6b;
    border-radius: 4px;
    margin-right: 10px;
}

.features-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    overflow-y: auto;
    padding-right: 5px;
}

.feature-item {
    background: #f9f9f9;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid transparent;
}
.feature-item:hover { border-color: #ffcccc; }
.feature-label { 
    font-size: 0.7rem; 
    color: #888; 
    text-transform: uppercase; 
    font-weight: 600; 
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.feature-value { 
    font-size: 1rem; 
    color: #333; 
    font-weight: 700;
    word-wrap: break-word;
}

.animation-area {
    flex: 1;
    background: #fafafa;
    position: relative;
    overflow: hidden;
    cursor: grab;
}
.animation-area:active { cursor: grabbing; }

/* Tree Container */
#treeContainer {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    width: 100%;
    height: 100%;
    min-width: 1px; 
    min-height: 1px;
}

.connections-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 5000px;
    height: 5000px;
    pointer-events: none;
    z-index: 0;
    overflow: visible;
}

/* Tree Nodes */
.tree-node {
    position: absolute;
    z-index: 5;
    background: white;
    border: 3px solid #666;
    border-radius: 12px;
    padding: 15px;
    width: 220px;
    text-align: center;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    transform: translate(-50%, -50%);
    transition: all 0.5s;
}
.tree-node.visited {
    border-color: #ff6b6b;
    border-width: 5px;
    transform: translate(-50%, -50%) scale(1.1);
    z-index: 10;
}
.tree-node.active {
    box-shadow: 0 0 0 8px rgba(255, 107, 107, 0.2);
}
.node-label { font-weight: 700; color: #888; font-size: 0.8rem; text-transform: uppercase; }
.node-value { font-weight: 800; color: #333; font-size: 1.2rem; margin: 5px 0; }
.node-class { font-weight: 900; font-size: 1.2rem; color: #333; }
.node-class.correct { color: #4cd964; }

/* Connections */
.connection-line {
    stroke: #ddd;
    stroke-width: 4;
}
.connection-line.path {
    stroke: #ff6b6b;
    stroke-width: 8;
}

/* True Label Box */
.true-label-display {
    position: absolute;
    bottom: 30px;
    right: 30px;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border: 1px solid #eee;
}
.true-label-display h4 {
    margin: 0 0 4px 0;
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    font-weight: 600;
}
.label-value { 
    color: #ff6b6b; 
    font-size: 1.5rem; 
    font-weight: 800;
    margin: 0;
}

/* Utility */
.back-btn, .replay-btn {
    border: none;
    background: #eee;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    color: #374151;
    font-family: 'Outfit', sans-serif;
    display: flex;
    align-items: center;
    gap: 6px;
}

.back-btn:hover, .replay-btn:hover { 
    background: #e5e7eb; 
}

/* Override Step Button Styles for Special Buttons */
.download-btn {
    background-color: #F57C2A !important;
    color: white !important;
    border: none;
    padding: 10px 10px; /* Reduced from 20px */
    white-space: nowrap !important;
    border-radius: 8px;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 6px rgba(245, 124, 42, 0.3) !important;
    transition: transform 0.1s, background-color 0.2s;
    margin-top: 10px;
    margin-bottom: 20px;
    width: 100%;
}

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

.restart-btn {
    background-color: #1f2937 !important;
    color: #fff !important;
    margin-top: auto;
}

.restart-btn:hover {
    background-color: #111827 !important;
}