.prompt-optimize-dialog {
  .next-dialog {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
  }

  .next-dialog-body {
    padding: 16px 20px;
    max-height: calc(90vh - 120px);
    overflow-y: auto !important;
    overflow-x: hidden;
    flex: 1;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;

    &::-webkit-scrollbar {
      width: 8px;
    }

    &::-webkit-scrollbar-track {
      background: #f1f1f1;
      border-radius: 4px;
    }

    &::-webkit-scrollbar-thumb {
      background: #c1c1c1;
      border-radius: 4px;

      &:hover {
        background: #a8a8a8;
      }
    }
  }

  .optimize-content {
    display: flex;
    flex-direction: column;
    height: 100%;

    .goal-section {
      margin-bottom: 16px;
      padding: 12px 16px;
      background: #fafafa;
      border-radius: 8px;
      border: 1px solid #e8e8e8;

      .next-form {
        display: flex;
        align-items: flex-start;
        gap: 12px;
      }

      .next-form-item {
        margin-bottom: 0;

        &:first-child {
          flex: 1;
        }
      }

      .next-form-item-label {
        font-weight: 500;
      }

      .next-input {
        width: 100% !important;
        min-width: 600px;
      }
    }

    .error-section {
      margin-bottom: 16px;

      .error-message {
        padding: 12px 16px;
        background: #fff2f0;
        border: 1px solid #ffccc7;
        border-radius: 4px;
        color: #ff4d4f;
        display: flex;
        align-items: center;
      }
    }

    .comparison-container {
      display: flex;
      gap: 16px;
      flex: 1;
      min-height: 400px;

      .comparison-panel {
        flex: 1;
        display: flex;
        flex-direction: column;
        border: 1px solid #e8e8e8;
        border-radius: 8px;
        overflow: hidden;
        background: #fff;

        .panel-header {
          padding: 10px 16px;
          background: #fafafa;
          border-bottom: 1px solid #e8e8e8;
          font-weight: 600;
          font-size: 14px;
          color: #333;
          display: flex;
          align-items: center;

          .panel-title {
            display: flex;
            align-items: center;
          }
        }

        .panel-content {
          flex: 1;
          overflow-y: auto;
          padding: 12px;
          font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
          font-size: 13px;
          line-height: 1.6;

          .prompt-text {
            margin: 0;
            white-space: pre-wrap;
            word-break: break-word;
            color: #333;
          }

          .empty-hint {
            color: #999;
            text-align: center;
            padding: 60px 20px;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
          }

          .diff-content {
            .diff-line {
              padding: 2px 8px;
              margin: 0 -12px;
              min-height: 22px;
              white-space: pre-wrap;
              word-break: break-word;

              &.diff-removed {
                background: #ffeef0;
                color: #9d1f28;
                text-decoration: line-through;
                text-decoration-color: rgba(157, 31, 40, 0.4);
              }

              &.diff-added {
                background: #e6ffec;
                color: #22863a;
              }
            }
          }
        }

        &.left-panel {
          .panel-header {
            background: #f5f5f5;
          }
        }

        &.right-panel {
          .panel-header {
            background: #f0f9ff;
            border-color: #91d5ff;
          }

          &.streaming {
            border-color: #91d5ff;
          }
        }
      }
    }

    .diff-legend {
      display: flex;
      justify-content: center;
      gap: 24px;
      margin-top: 12px;
      padding: 8px 0;

      .legend-item {
        display: flex;
        align-items: center;
        font-size: 12px;
        color: #666;

        .legend-color {
          width: 16px;
          height: 16px;
          border-radius: 3px;
          margin-right: 6px;

          &.removed {
            background: #ffeef0;
            border: 1px solid #ffc7ce;
          }

          &.added {
            background: #e6ffec;
            border: 1px solid #b7eb8f;
          }
        }
      }
    }
  }
}
