.expression-evaluator {
  .expression-code-container {
    display: flex;
    align-items: center;
    width: 100%;
  }

  .expression-code {
    flex: 1;
    font-family: monospace;
    font-size: 0.85rem;
    white-space: pre;
    overflow-x: auto;
    width: calc(100% - 40px);
    border-radius: 0;
    background-color: transparent;
    // Disable ligatures to prevent the fi in filter from having malformed kerning.
    font-feature-settings: 'liga' 0;
  }

  .run-expression-btn {
    background-color: #632ca6;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    min-width: 32px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    padding: 0 6px;
    margin-left: 0.5rem;

    &:hover {
      background-color: #7847a6;
    }
  }

  .expression-result-container {
    height: 1.5em; // Fixed height to prevent layout shifts
    visibility: visible;
    margin: 0;
    margin-top: -2px; // Remove space between expression and result
    width: auto;
    max-width: calc(100% - 40px);

    .expression-result {
      font-family: monospace;
      font-size: 0.85rem; // Same size as code
      background-color: transparent;
      white-space: pre;
      overflow-x: auto;
      display: block;
      border-radius: 0;

      &.repl-result {
        color: #28a745;
      }

      &.repl-error {
        color: #dc3545;
      }
    }
  }
}


// Expression Simulator Container Styles
.expression-simulator-container {
  margin: 2rem 0;
  font-family: sans-serif;

  .instrumentation-indicator {
    padding: 0.5rem 0;
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    background-color: #f8f9fa;
    border: 1px dashed #ccc;
    border-radius: 4px;
    padding: 0.75rem;
    text-align: center;
  }
}

// Expression Simulator Component Styles
.expression-simulator {
  font-family: monospace;
  font-size: 0.85rem;
  border: 1px solid #d8e5f2;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  font-feature-settings: 'liga' 0;
  background-color: #edf5fd;

  // Indentation styles for Python code
  .indent-1 {
    display: inline-block;
    width: 4ch; // 4 character width for first level indentation
  }

  .indent-2 {
    display: inline-block;
    width: 8ch; // 8 character width for second level indentation
  }

  // Non-interactive elements styling
  .non-interactive {
    cursor: default !important;
    opacity: 0.85;
    pointer-events: none;
    position: relative;

    &::after {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background-color: rgba(240, 240, 240, 0.1);
      z-index: 1;
    }

    &.simulate-button {
      background-color: #8a5fc0;
    }
  }

  // Simulation results styles
  .simulation-results {
    background-color: #f8f9fa;
    border-top: 1px solid #d8e5f2;
    max-height: 200px;
    overflow-y: auto;
    padding: 0.5rem 1rem;
    font-family: monospace;
    font-size: 0.85rem;

    .simulation-log-entry {
      margin: 0.5rem 0;
      padding: 0.5rem;
      border-radius: 4px;
      background-color: #f0f8ff;
      border-left: 3px solid #28a745;

      .log-message {
        color: #28a745;
      }

      .log-error {
        color: #dc3545;
      }

      &.no-logs-entry {
        background-color: #fff5f5;
        border-left: 3px solid #dc3545;
        text-align: center;
        font-weight: bold;
      }
    }

    // Empty state
    &:empty {
      display: none;
    }
  }

  .simulator-code-editor {
    background-color: #ffffff;
    padding: 0;
    position: relative;
    display: flex;
    flex-direction: column;
  }

  .code-line-container {
    display: flex;
    align-items: center;
    width: 100%;
    height: 1.6rem;

    &.highlighted-line {
      background-color: rgba(99, 44, 166, 0.1);
    }
  }

  .line-number {
    display: inline-block;
    width: 40px;
    color: #999;
    text-align: right;
    padding-right: 0.5rem;
    user-select: none;
    flex-shrink: 0;
  }

  .code-line {
    display: inline-block;
    white-space: pre;
    padding-left: 0.5rem;
    flex-grow: 1;
  }

  .instrumentation-controls {
    background-color: #edf5fd;
    padding: 1rem;
    border-bottom: 1px solid #d8e5f2;
  }

  .emit-container, .template-container, .condition-container {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
  }

  .emit-label, .template-label, .condition-label {
    background-color: #e0e9f4;
    padding: 0.5rem;
    border-radius: 4px;
    margin-right: 0.5rem;
    color: #666;
    font-size: 0.85rem;
    min-width: 120px;
    text-align: center;
    font-family: sans-serif;
  }

  .dropdown-container {
    position: relative;
  }

  .dropdown-button {
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 80px;
    font-family: sans-serif;
  }

  .dropdown-arrow {
    margin-left: 0.5rem;
    font-size: 0.7rem;
  }

  .template-input, .condition-input {
    flex: 1;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 0.5rem;
    font-family: sans-serif;
    font-size: 0.9rem;
    background-color: white;
  }

  .clear-button {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 1rem;
    margin-right: 0.25rem;
    padding: 0 0.25rem;
  }

  .capture-variables-button {
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 0.5rem;
    margin-left: 0.5rem;
    cursor: pointer;
    white-space: nowrap;
    font-family: sans-serif;
    font-size: 0.9rem;
  }

  .simulation-controls {
    display: flex;
    align-items: center;
    padding: 1rem;
    background-color: #ffffff;
    border-top: 1px solid #d8e5f2;
  }

  .simulate-button {
    background-color: #632ca6;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    font-weight: bold;
    font-family: sans-serif;
    font-size: 0.9rem;
    text-transform: uppercase;

    &:hover {
      background-color: #7847a6;
    }
  }

  .curl-example {
    margin-left: 1.5rem;
    color: #666;
    font-style: italic;
    font-family: sans-serif;
  }

  // Syntax highlighting
  .keyword {
    color: #a71d5d;
  }

  .class-name {
    color: #0086b3;
  }

  .property {
    color: #795da3;
  }

  .string {
    color: #183691;
  }

  .decorator {
    color: #795da3;
  }

  .function-name {
    color: #0086b3;
  }

  .parameter {
    color: #333;
  }

  .variable {
    color: #333;
  }

  .number {
    color: #0086b3;
  }
}

// Autocomplete container styles (reused from existing REPL)
.expression-simulator .autocomplete-container {
  position: absolute;
  top: 100%;
  left: 150px;
  right: 150px;
  max-height: 200px;
  overflow-y: auto;
  background-color: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  display: none;
  margin-top: 2px;

  &.visible {
    display: block;
  }

  .autocomplete-item {
    padding: 0.5rem;
    cursor: pointer;
    font-family: monospace;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;

    &:hover, &.selected {
      background-color: #f0f0f0;
    }

    .item-name {
      font-weight: bold;
      margin-right: 0.5rem;
      flex-shrink: 0;
    }

    .item-type {
      font-size: 0.75rem;
      color: #632ca6;
      background-color: #f8f5fd;
      padding: 0.1rem 0.3rem;
      border-radius: 2px;
      margin-right: 0.5rem;
      flex-shrink: 0;

      &[data-type="function"] {
        color: #632ca6;
        background-color: #f8f5fd;
      }

      &[data-type="variable"] {
        color: #0275d8;
        background-color: #e6f3ff;
      }

      &[data-type="special"] {
        color: #d9534f;
        background-color: #ffeeee;
      }

      &[data-type="property"] {
        color: #5cb85c;
        background-color: #efffef;
      }

      &[data-type="index"] {
        color: #f0ad4e;
        background-color: #fff9e6;
      }
    }

    .item-description {
      font-size: 0.75rem;
      color: #666;
      margin-left: auto;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 75%;
      flex-shrink: 1;
    }
  }

  .no-suggestions {
    padding: 0.5rem;
    color: #666;
    font-style: italic;
  }
}

.condition-container {
  display: flex;
  align-items: center;
  margin-bottom: 0.75rem;
  position: relative;
}

// Expression Examples Container Styles
.expression-examples-container {
  margin-bottom: 1rem;
  font-family: sans-serif;

  .examples-header {
    font-size: 0.95rem;
    // font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
  }

  .examples-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .example-button {
    background-color: #f0f0f0;
    border: 1px solid #d8e5f2;
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    font-family: monospace;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;

    &:hover {
      background-color: #e0e9f4;
      border-color: #632ca6;
    }
  }
}
