@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');
@import url('selector.css');
@import url('highlight.css');

* {
  box-sizing: border-box;
}

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

/* Theme Selector Styles (Preserved) */
.theme-selector-container {
  width: 100%;
  max-width: 1400px;
  padding: 40px;
  text-align: center;
}

.theme-selector-title {
  font-size: 3rem;
  font-weight: 800;
  margin: 0 0 10px 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.theme-selector-subtitle {
  font-size: 1.2rem;
  color: #6b7280;
  margin-bottom: 50px;
}

.theme-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
  max-width: 1200px;
  margin: 0 auto;
}

.theme-card {
  background: white;
  border-radius: 20px;
  padding: 30px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 3px solid transparent;
}

.theme-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  border-color: #667eea;
}

.theme-preview {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  height: 80px;
}

.preview-bar {
  flex: 1;
  border-radius: 12px;
  transition: transform 0.3s ease;
}

.theme-card:hover .preview-bar {
  transform: scale(1.05);
}

.theme-name {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 10px 0;
  color: #1f2937;
}

.theme-description {
  font-size: 1rem;
  color: #6b7280;
  margin: 0;
  line-height: 1.5;
}

/* Back Button */
.back-to-themes-btn {
  position: fixed;
  top: 20px;
  left: 20px;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 20px;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 1000;
  font-size: 0.95rem;
  color: #4b5563;
}

.back-to-themes-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
  transform: translateX(-3px);
}

/* ==========================================
   STANDARD SIMULATION STYLES (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 {
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    display: flex;
    align-items: center;
    transition: transform 0.1s, background-color 0.2s;
}


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

/* ==========================================
   MULTI-BLOCK SEPARATORS
   ========================================== */
.code-block-separator {
    height: 2px;
    background: linear-gradient(to right, transparent, #555, transparent);
    margin: 20px 0;
}

.output-block-separator {
    height: 2px;
    background: linear-gradient(to right, transparent, #ddd, transparent);
    margin: 15px 0;
}

/* ==========================================
   DATAFRAME TABLE STYLING (df.head() output)
   ========================================== */
.dataframe-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    background: #f9f9f9;
    border: 1px solid #ddd;
}

.dataframe-table th,
.dataframe-table td {
    padding: 6px 10px;
    text-align: left;
    border: 1px solid #ddd;
    white-space: nowrap;
}

.dataframe-table th {
    background: #f0f0f0;
    font-weight: 600;
    color: #333;
}

.dataframe-table tbody tr:nth-child(even) {
    background: #f5f5f5;
}

.dataframe-table tbody tr:hover {
    background: #e8f4ff;
}

/* df.info() output styling */
.info-output {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    line-height: 1.3;
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    white-space: pre;
}

/* 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;
}

.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 {
    display: block;
}

.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: linear-gradient(135deg, #94cefb 0%, #7db9e8 100%);
    /* Swapped: 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 */
    height: auto;
    min-height: 62vh; /* Updated to match Logistic Regression */
    overflow: visible;
    
    /* Ensure Flex Column if Display is set to Flex by JS */
    display: flex;
    flex-direction: column;
}

/* 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;
    }
}


/* ==========================================
   DECISION TREES SPECIFIC STYLES
   ========================================== */

/* Animation Entry Button */
.animation-entry-btn {
  padding: 15px 30px;
  font-size: 1.25rem;
  background-color: #a855f7;
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 10px 20px rgba(168, 85, 247, 0.3);
  transition: all 0.3s;
  font-family: 'Outfit', sans-serif;
  margin-top: 20px;
}

.animation-entry-btn:hover {
  background-color: #9333ea;
  transform: translateY(-3px);
  box-shadow: 0 15px 30px rgba(168, 85, 247, 0.4);
}

/* CLASSIFICATION SELECTOR (Landing) */
.classification-selector {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  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: #6b7280;
  margin-bottom: 4rem;
}

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

.selector-btn {
  flex: 1;
  padding: 3rem 2rem;
  background: #ffffff;
  border: 2px solid #e5e7eb;
  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: #5FA8E4;
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(95, 168, 228, 0.15);
}

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

.selector-btn p {
  font-size: 1rem;
  color: #6b7280;
  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 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 #e5e7eb;
  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: #6b7280; 
  font-size: 0.9rem; 
}

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

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

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

.button-group {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  overflow: hidden;
  background: white;
  font-size: 0;
}

.depth-btn, .criterion-btn {
  padding: 6px 12px;
  border: none;
  border-right: 1px solid #d1d5db;
  background: white;
  cursor: pointer;
  color: #4b5563;
  font-weight: 500;
  font-family: 'Outfit', sans-serif;
  font-size: 0.875rem;
}

.depth-btn:last-child, .criterion-btn:last-child { 
  border-right: none; 
}

.depth-btn.active, .criterion-btn.active {
  background: #a855f7;
  color: white;
}

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

.sample-btn.active {
  background: #a855f7;
  color: white;
  border-color: #a855f7;
}

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

/* Feature Sidebar */
.feature-sidebar {
  width: 450px;
  border-right: 1px solid #e5e7eb;
  padding: 20px;
  background: #fff;
  overflow-y: hidden;
  display: flex;
  flex-direction: column;
}

.feature-sidebar h3 {
  margin-bottom: 20px;
  font-size: 1.1rem;
  color: #111827;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.indicator {
  display: inline-block;
  width: 6px;
  height: 24px;
  background: #a855f7;
  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: #f9fafb;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid transparent;
}

.feature-item:hover { 
  border-color: #bfdbfe; 
}

.feature-label { 
  font-size: 0.7rem; 
  color: #6b7280; 
  text-transform: uppercase; 
  font-weight: 600; 
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feature-value { 
  font-size: 1rem; 
  color: #111827; 
  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 #6b7280;
  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: #a855f7;
  border-width: 5px;
  transform: translate(-50%, -50%) scale(1.1);
  z-index: 10;
}

.tree-node.active {
  box-shadow: 0 0 0 8px rgba(168, 85, 247, 0.2);
}

.node-label { 
  font-weight: 700; 
  color: #6b7280; 
  font-size: 0.8rem; 
  text-transform: uppercase; 
}

.node-value { 
  font-weight: 800; 
  color: #111827; 
  font-size: 1.2rem; 
  margin: 5px 0; 
}

.node-class { 
  font-weight: 900; 
  font-size: 1.2rem; 
  color: #111827; 
}

.node-class.correct { 
  color: #22c55e; 
}

/* Connections */
.connection-line {
  stroke: #d1d5db;
  stroke-width: 4;
}

.connection-line.path {
  stroke: #a855f7;
  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 #e5e7eb;
}

.true-label-display h4 {
  margin: 0 0 4px 0;
  font-size: 0.75rem;
  color: #6b7280;
  text-transform: uppercase;
  font-weight: 600;
}

.label-value { 
  color: #a855f7; 
  font-size: 1.5rem; 
  font-weight: 800;
  margin: 0;
}

/* Utility */
.back-btn, .replay-btn {
  border: none;
  background: #f3f4f6;
  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; 
}

/* Responsive */
@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;
  }
}

/* Override Step Button Styles for Special Buttons */
.download-btn {
    border: none;
    padding: 10px 10px;
    white-space: nowrap !important;
    border-radius: 8px;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: none;
    transition: transform 0.1s, background-color 0.2s;
    margin-top: 10px;
    margin-bottom: 20px;
    width: 100%;
}

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

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